Comment by tehsauce
9 years ago
That is not 20 lines, that's 300+! Here is terrain rendered in 30 lines, with no textures either. https://www.shadertoy.com/view/lslBz7
9 years ago
That is not 20 lines, that's 300+! Here is terrain rendered in 30 lines, with no textures either. https://www.shadertoy.com/view/lslBz7
Author here
The main algorithm fits easily in 20 lines. However, the JavaScript code is optimized and contains also the initializing routines and input device logic.
It is also a little bit unfair to compare this with shadertoy. He doesn't have to include the render algorithm but relies on a GPU. The Voxel Space engine just draws vertical lines and doesn't need a GPU.
Shadertoy shaders _do_ include the render algorithm. That shader is completely ray-traced, so the only real input that is used for that shader is the x, y coordinates and time. It's not using any of the GPU's polygon rasterization. It's stateless and is generating the terrain while it ray-traces it.
Firstly - this is really nice. I don't want to derogate the work itself in any way (and I don't think the gp did either) - I'm just really quite curious about what exactly the post title is referring to.
If I extract the code and delete what I can see might be extraneous setup boilerplate (event handling, camera navigation, init function, image download helper utility, various config object initialisations), it still comes in at around 150-200 lines. The render function alone is 38 lines, not including the external dependencies of that function (DrawVerticalLine, screen, camera).
Again, not a criticism of the work, just querying the title.
Shadertoys' authors never fail to amaze me.
To be fair that seems to originally be a piece of the 4k demo elevated.
Next challenge, code golfing, to render a golf course :D