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.

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.
            return true;
        }
    }

This is a nice and simple ground plane, it's going to get very complicated shortly, and then we will use it as our "water" function.