โ† All examples

godot shaders

Hair with Kajiya-Kay shifted highlights

Hair shading for meshes and cards with strands along UV v: two Kajiya-Kay specular lobes shifted along the strand, a white primary and a tinted secondary, broken up per strand by noise, over a root to tip colour.

Recorded render of Hair with Kajiya-Kay shifted highlights

What this component contains

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

How it works

Shader type
spatial
Render modes
cull_disabled
Parameters
root_color (vec4 = 0.12, 0.06, 0.03, 1), tip_color (vec4 = 0.45, 0.25, 0.12, 1), secondary_tint (vec4 = 0.85, 0.55, 0.3, 1), primary_shift (float = 0.1), secondary_shift (float = -0.15), primary_exponent (float = 160), secondary_exponent (float = 40), strand_noise (float = 0.4) and 2 more
Use it on
Hair geometry whose UV v runs along the strands, with tangents.
Result
A brown sphere with a bright, ragged highlight band across its strands and a warmer second band.
Renderers
compatibility: compiled and rendered, forward plus: not verified, mobile: not verified
Placement
res://baltor/godot_shaders/hair_strand_highlight/

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

No transparency, depth sorting or self-shadowing of strands: pair it with alpha-tested cards for strand silhouettes. Strand direction comes from UV layout; badly unwrapped hair gives broken bands.