Lately I was playing with raymarching and 3d-fractals. I came up with the method to optimize raymarching and implemented it in Urho. I also added volumetric light scattering for point and spot lights. Taking from this demo: blog.mmacklin.com/2010/05/29/in-scattering-demo/ and using some ugly hackery to make it work with finite attenuation lights (it uses inverse square fore light attenuation ).
Looks freaking amazing man. Reminds me of those ShaderToy fractal demos.
Any chance to get the C++ source code or is it all done in shader code?
Edit: Found the code in Angelscript.
Thank you all for feedback. So it actually works . Forgot to ask, I really want to know what hardware you have and what performance you are getting?
My go to source.
With this project I’ve made my first baby steps in C++. Whole raymarching thing is purely glsl and renderpath.xml. But I had to disable Z-culling for light volumes, to make them work with raymarching result. Also I passed couple additional shader parameters for light scattering of spotlights. That’s like 5-6 lines changed.
No, I just placed him there . I haven’t tried collisions yet, but I will. Mesh is not an option, I have to calculate SDF for collisions either on GPU or CPU, both ways seems terrible. CPU will require to write code twice, keep it same, and may still give different results (in theory). GPU has problems with bringing information back to CPU to update objects.
Do you think you could make a pull request in Urho3D master branch for adding this volumetric effect support to point and spot lights ? That would be awesome.
I never did a pull requests, might use an assistance, and my coding style is a bit savage.
Also, it works easily only with deferred lighting, other modes will need an additional light volumes pass, witch is not cool.
Plus, this light scattering should somehow interact with fog, and trying to resolve this will rise many complicated questions.
Everything has to be sphere approximated. Character controller uses 2 spheres. Submarine uses 3. It’s calculated with pixel shader. I use small 16bit textures to pass data to and from GPU. Position and radius is sent to GPU, distance and normal(estimated with given radius) are sent back. It is not very accurate, but with signed distance you can do soft collisions