Shader Story

October 21, 2025 · View on GitHub

Lighting Models : Fresnel

The Fresnel Lighting describes how the amount of reflected light on a surface depends on the viewing angle. When looking directly at a surface (normal incidence), reflection is minimal. But when viewing at a grazing angle, reflection increases dramatically.

This technique is widely used for:

  • Rim lighting in stylized or toon shading
  • Reflective materials like glass, water, or polished metal
  • Highlighting silhouettes and enhancing form readability

Visual demo

Shader Story: Lighting Models - Fresnel


// Pseudo-code (Complete per-vertex and per-pixel implementations, with detailed comments, are available in the related Patreon post)
// Link: https://www.patreon.com/posts/shader-story-141138764

// Determine how much the surface faces the camera
NdotV = dot(normal, viewDir)

// Fresnel factor increases at grazing angles
fresnelFactor = pow((1 - saturate(NdotV)), contrast)
fresnelFactor *= intensity

// Scale the chosen color by the Fresnel intensity
return color * fresnelFactor


Complete per-vertex and per-pixel implementations, with detailed comments, are available on Patreon.


Basic idea

The Fresnel effect enhances how light interacts with surfaces viewed at glancing angles. Instead of relying only on direct lighting, it emphasizes the edges of objects, making them appear to “glow” or reflect more light as they turn away from the viewer.

Technically, this is achieved by comparing the surface normal with the view direction (dot(N, V)).

When the surface faces directly toward the camera, the Fresnel factor is small. As the viewing angle becomes shallower (the surface turns away), the factor increases, brightening the rim of the object.

Equation

d = (1 - N·V) ^ p × i × Tint

Where:

  • N·V - dot product between the surface normal and view direction
  • p - Fresnel power, controls how sharp the rim appears
  • i - intensity, scales the overall brightness of the effect
  • Tint - per-material color parameter, tints the Fresnel glow

Dot • Power


❤️ Support Shader Story

If this article helped you, consider supporting the project on Patreon - you'll get access to the related source files, reference cheat-sheets, and other exclusive resources:

DecompiledArt on Patreon

Your support helps keep this library open, growing, and free for everyone.