Special Category Shaders

 

Diffuse Lighting Models

Specular Lighing Models

  • Phong
  • Blinn-Phong
  • Cook-Torrance
  • GGX (Trowbridge-Reitz)
  • Ward Anisotropic
  • Fresnel (Schlick)

Phong Specular Lighting – Core Formula

The Phong model adds specular highlights based on the angle between the view direction and the reflected light vector. It's simple, intuitive, and good for shiny plastic or cartoon-style effects.

Core Formula:

float spec = pow(max(dot(reflect(-lightDir, normal), viewDir), 0.0), shininess);

 

Prompt:

shiny plastic toy, float spec = pow(max(dot(reflect(-lightDir, normal), viewDir), 0.0), shininess); --chaos 5 --ar 3:4 --raw --stylize 150

 

Fresnel (Schlick)

Edge-glow reflections (glass, water, chrome), used with all models

Core Formula:

F = F0 + (1 - F0) * pow(1 - dot(viewDir, halfVec), 5.0);  

 

Prompt:

edge-glow reflection on wine glass, F = F0 + (1 - F0) * pow(1 - dot(viewDir, halfVec), 5.0); --chaos 5 --ar 3:4 --raw --stylize 150 --draft

 

 

Glossy Reflections

 

Glossy reflections simulate rough surfaces that blur reflections (e.g. brushed metal, frosted glass). Unlike perfect mirror-like reflections, glossy reflections scatter reflected rays slightly.

Core Formula:

vec3 reflDir = reflect(incident, normal);

 

 

Core Formula:

 

 

Fresnel Effect

The Fresnel effect simulates how surfaces become more reflective at glancing angles—a subtle but powerful trick to make reflective materials like water, glass, or polished surfaces look more realistic.

In shader art (especially raymarching), we use Fresnel to blend between diffuse and reflection based on the viewing angle.

Fresnel Term (Core Formula)

float fresnel = pow(1.0 - dot(viewDir, normal), 5.0);