Palette Shader

Опубликовано: 18 Июль 2026
на канале: Tw1ddle
187
0

A colourful city demonstrating a WebGL palette swapping shader. Here I show off some of the palettes and settings.

Play with it in your browser: http://samcodes.co.uk/webgl/palette-s...
Get the code: https://github.com/Tw1ddle/webgl-pale...
I'm on Twitter:   / sam_twidale  

How it works: regular phong shading is done on the model of the city. The luminance of the fragments are then used to index into a palette texture to pick the final colours. A directional light hovers over the scene to create the nice variations in the colours.

I used three.js and TypeScript to make this. The code is free and open source.