Raymarching Tutorial: Getting Started With Signed Distance Fields in GLSL
If you have written a fragment shader that colours a 2D plane, raymarching is the next step: the same single shader renders solid 3D objects with lighting, because the shape is defined by arithmetic rather than triangles. Here is a complete, working shader built up one piece at a time, plus the three constants that decide whether it looks right or melts.