File under:
Javascript Ray Marcher v0.1
The start of the raytracer. It just draws a flat featureless plain, with no objects, no lights, and no shadows. We have to start somewhere.
To do this, it creates a ray for each pixel in the picture and walks them into the landscape, a tiny step forwards each time. When it hits the terrain, it is coloured brown, otherwise it gets the skysphere colour(blue).
Because there isn't any code for the lens of the camera, all the rays are parallel. I sank the camera halfway into the ground to make the ground appear in the picture.
Our ground function is currently
if( p.y < f( p.x, p.z ) )
//We've sunk into the ground.
{
//resT = t - 0.5f*delt;
return true;
}
}
Nice and simple, it's going to get very complicated shortly, before turning into our "water" function.