Shader Learn

13 Capstone

Capstone: rewrite the opening planet

The vertex shader raises terrain with noise; the fragment shader colours it with banded light. Every line can be edited.

01
28
-3.143.14

Runs once per vertexDrag numbers, or edit the code

JS sidematerial.uniforms.uTime.value = 0.00 material.uniforms.uHeight.value = 0.35 material.uniforms.uBands.value = 3 material.uniforms.uSun.value.set(0.83, 0.5, 0.56)

The opening planet is yours now: the vertex raises terrain with fbm, the fragment colours it with banded light and a rim.

Try it

  • Vertex code: raise uHeight for taller mountains
  • Fragment code: change the water, sand, grass and snow colours
  • Add a little shimmer to the water using uTime
  • Change the rim exponent from 3.0 to 1.5