Command Palette

Search for a command to run...

Hectal
Phase 12: Shaders with GLSL
3D Web · Exercise 5 of 5 Previous
Advanced

Tint a paint with onBeforeCompile

The ball uses a white MeshPhysicalMaterial. With onBeforeCompile, multiply the final colour by vec3(1.0, 0.45, 0.2) just before #include <dithering_fragment>, and give the material its own customProgramCacheKey. Keep the lighting.

What Check tests

  1. The centre of the ball is orange, not white
  2. The ball is still lit: its lit side is brighter than its shaded side
  3. A cache key is set

Stuck? One hint at a time

The solution unlocks after your first Check. Try first: that is where the learning happens.

Runs in your browser. Your code is saved here.

Your page

Press Run to see the page.

Console

Nothing logged yet.