354 points · by edejong · 9y ago · 104 comments
All the calculations are done on a per-pixel basis, there are no polygons or other objects created. The city is a 3d scalar field with effectively an isosurface plotted.
The city is made infinite with a simple modulo operation in X-Y on the field.
Interesting to note in this technique there is no additional computational load associated with more visible objects, and there can be as many objects as pixels.
The Infinitown posted here was (pretty much) buttery smooth though, and relatively fast loading time (especially the second time with cache), and I bet the codebase is a lot easier on the eyes, though it's likely nowhere near as efficient as writing it all in the shader obviously.
Is the world just waiting for a no-dependency cross browser MMO/shooter/whatever 3D game to take the world by storm? Why worry about Steam when people can just go to a website, if the experience is good enough and the game is simple enough? I must not know enough about the industry/how hard it is to make a good game + how hard it is to make a truly good browser-only game.
Infinitown is just a set of objects repeated in different orientations/combinations. The shader-city is awesome though. Very clever :)
- the game monetization problem's always around (and always going to be around) -- is there a reason one wouldn't pay for a game in their browser but would pay for one on steam?
- Some of the greatest games of all time made do with so much less -- Isn't the resource problem just a matter of effort/ingenuity? Also isn't that problem bound to go away as time goes on? (though of course the "modern game" target will also move)
- I must not understand enough of why/how the demos are so different. Isn't shader city doing the exact same thing but insted drawing the visible pixels in space (and from a different viewpoint) rather than rendering the higher level polygons? I thought the key innovation/hard bit was the fact that it was inside a single shader.
I have been working on a browser based game for TOO long now, and garbage collection is a constant problem. Plus things just run a LOT slower than a native c++ client.
Also, if you're facing a problem with garbage collection, have you tried the emscripten/wasm approach? Using some garbage collected language and compiling it down to javascript? Or maybe even one that is functional to make garbage collection simpler?
Could that be an issue with the new rendering engine? I'm on Waterfox 55.2.2, 64-bit, and it worked well for me.
Is there a term for this type of shader? Am I correct in assuming that this approach is primarily for demos, or is there a benefit to this approach for gaming or visualization?
[1] http://www.iquilezles.org/www/material/nvscene2008/rwwtt.pdf
Sadly they never seem to open source anything? It'd be nice to see how such polished stuff is organized
Our first web game, http://browserquest.mozilla.org, was actually open source: https://github.com/mozilla/Browserquest
There are more details on: http://www.cs.cornell.edu/courses/cs4620/2017sp/
There is some car detection code but it's far from perfect and collisions happen from time to time.
Edit: Oh, this did the trick: https://askubuntu.com/questions/299345/how-to-enable-webgl-i...
The examples for this lib are also pretty cool:
The prettiest so far is https://fenwick.pizza/rentaduck
(1) - After doing this: https://askubuntu.com/a/299346/81166
Browser related? Here's my browser info for reference:
Build identifier: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0
Yes, it did look like a bug to me because I didn't expect clouds to act like that in what I took to be a simulation of the real world.
To be fair, I did have a lot of tabs open in chrome already. Like about 30.
Edit - 47 to be exact.
I notice that the vehicles start and stop, whats the logic?
Is it doing collison testing?
Anyone seen any instances where it fails and vehicles collide?
https://support.mozilla.org/en-US/kb/refresh-firefox-reset-a...
(note this will wipe out some settings)
Now, after a refresh it worked. But then again a refresh: grey screen. Refreshing with the screen open: It keeps working. But refreshing and then switching tabs quickly, and switching back: grey screen. (however very difficult to reproduce)
Logs only show this: unreachable code after return statement [Learn More]
Seems so.
But the rest of it is Three.JS. Thus were the assets created in Unity and someone copied the shader code to ensure that they render the same in ThreeJS as in Unity? I am a little confused.