Mastering GLSL in TouchDesigner, Lesson 3: Shader Macros, Color Spaces, and Bit Depth in GLSL

In this lesson of Mastering GLSL in TouchDesigner, we explore key concepts that will deepen your shader programming skills. You’ll learn about macros (#define), how to include external GLSL code, and the impact of bit depth on image precision. We’ll also break down color spaces (RGB vs. HSV) and show how to work with color palettes inside shaders. This lesson includes practical examples, like defining a color palette with a uniform array, using mix() for smooth color transitions, and implementing RGB-to-HSV conversions.

Find me online:
Project Files/Patreon: https://www.patreon.com/water__shed
Portfolio: https://www.lakeheckaman.com
IG: https://instagram.com/lake_heckaman

Resources:
– Some color space GLSL functions https://github.com/tobspr/GLSL-Color-Spaces/blob/master/ColorSpaces.inc.glsl
– Procedural color palette functions from IQ https://iquilezles.org/articles/palettes/

00:00 – Start
00:03 – Intro – Lesson 3 – Color
01:35 – Color Spaces
03:53 – Color Space in TouchDesigner
08:20 – RGB2HSB in TouchDesigner
11:30 – Debugging GLSL in TouchDesigner
14:09 – Gradient mixing with vectors
15:57 – Color Palette from CHOPs
20:40 – GLSL Color Wheel in TouchDesigner
26:25 – Exercises

About The Author