โ† All examples

godot shaders

Lighting through an artist colour ramp

Map the light term through a gradient texture so an artist controls the whole shading curve and its colours: warm lights, coloured shadows, sharp or soft transitions, plus a ramp-driven specular and rim.

Recorded render of Lighting through an artist colour ramp

What this component contains

  • ATTRIBUTION.md
  • LICENSE
  • README.md
  • component.json
  • demo.tscn
  • inspect_shader.py
  • material.tres
  • preview.png
  • ramp_texture_lighting.gdshader
  • test_package.py
  • verification/native.json

How it works

Shader type
spatial
Parameters
light_ramp (sampler2D), albedo (vec4 = 1, 1, 1, 1), ramp_offset (float = 0), specular_size (float = 0.12), specular_strength (float = 0.6), rim_amount (float = 0.3), rim_width (float = 0.25)
Use it on
A ramp texture; edit the bundled GradientTexture1D or assign any horizontal gradient image.
Result
Shapes shaded from purple shadows through an orange edge to warm white light.
Renderers
compatibility: compiled and rendered, forward plus: not verified, mobile: not verified
Placement
res://baltor/godot_shaders/ramp_texture_lighting/

Recorded checks

godot 4.7.2.stable.official.ed1daf0bf

  • contract_static
  • engine_run
  • engine_log_clean
  • shader_in_scene
  • capture_written
  • render_not_uniform
  • shader_changes_pixels

Limits to consider

Each light samples the ramp separately and adds, so several lights brighten past the ramp. Ambient light does not use the ramp. A ramp with sharp steps aliases at grazing angles.