Elin Gammelli

Generalist Programmer and Technical Artist

Raymarching

Raymarching in OpenGL and Unity

Simple Raymarching done in OpenGL and Unity, with normal calculations and shadowing from a single directional light. To avoid the issue of reaching the maximum number of allowed steps without finding a collision, I added some simple optimization for the ray to adjust it's step size based on how close it was from reaching it's maximum number of steps. That optimization solved the issue of unresolved pixels. Some "optimization" for the raymarching steps, to be more aggressive as it approaches the maximum allowed number of steps. Shadows were implemented in the most trivial way. After a ray has hit a surface, it will then traverse towards the single directional light and record it's closest approach. The closest approach is then smooth stepped to create a smooth border for the shadow. This has the negative effect of making the shadow encroach on the lit area, while realistically it should be the opposite.

Read more and view the code on Github