Javascript Ray Marcher v0.4
◆
This version's features are spheres and a preview mode. I now have a sphere floating in mid-air, over the ground. This required modifying most of the routines to check multiple objects.
The sphere function is rather easy - I just check to see if the ray satisfies the equation x^2+y^2+z^2 < 1. If it does, I decide we've hit a surface and stop. The shading function works exactly the same as for terrain.
I also changed the display to add a striped preview mode, which made testing much faster.
Some images taken while building this stage:
Lighting vector wrong by 180 degrees (shadow and light are swapped)
Lighting vector correct
All working now