What is RGB - Built-in functions - Shader Learning

Built-in functions

What is RGB

Task

Make the screen turn yellow!


Try changing the first three numbers ( $R$, $G$, $B$ ) to 1.0 or 0.0


Hint: you need $\text{red} + \text{green}$, but no $\text{blue}$

Theory

Most computer graphics images are defined in terms of RGB color space, where each pixel is a mix of three primary light sources:

  • 🔴 Red
  • 🟢 Green
  • 🔵 Blue

These lights mix additively, meaning:

  • you start with black ( $R=G=B=0$ );
  • you add light to create color;
  • full intensity of all three ( $R=G=B=1$ ) gives white.

Mixing Examples

Mix RGB Values Resulting Color
Red (1.0, 0.0, 0.0) Pure red light
Green (0.0, 1.0, 0.0) Pure green light
Bue (0.0, 0.0, 1.0) Pure blue light
Red + Green (1.0, 1.0, 0.0) Warm yellow tone
Green + Blue (0.0, 1.0, 1.0) Cool aqua tone
Blue + Red (1.0, 0.0, 1.0) Vivid pink-purple
Red + Green + Blue (1.0, 1.0, 1.0) White light
All zero (0.0, 0.0, 0.0) Black (no light emitted)

Each channel can be dimmed from:

  • 0.0 - fully off
  • 1.0 - fully on

This allows for continuous blending:

  • (0.5, 0.5, 0.0) - muted yellow (olive)
  • (0.2, 0.6, 0.8) - soft teal
  • (0.9, 0.3, 0.4) - warm rose

This flexibility lets us create millions of colors on an RGB monitor.