Generate terrain by using FBM noise as a heightmap. The raymarcher steps along the ray and checks if p.y < fbm(p.xz) to detect the ground. Use smaller steps near the surface for precision. Compute the normal from the FBM gradient for lighting, and add fog for depth. Coloring by height and slope creates grass, rock, and snow zones.
Key Concepts
heightmap raymarching
terrain normal from gradient
height-based coloring
terrain fog
Try this shader live in the Shader Sandbox editor with real-time preview.