GetAssetPack

Diffuse Lighting

Type
Shaders & VFX
Creator
bricksphd

A shader program that renders an object with simple diffuse lighting. This shader program builds on our previous shader, https://shaderfrog.com/app/view/3151. To get this shader, we reintroduce the external color variable. We also add a directionToLight variable, which points to the light source. To calculate the diffuse lighting on this object, we calculate the dot product of the normal of the surface and the direction to the light. This gives the cosine of the angle between the surface the light source, effectively giving us the amount of the light the reaches the surface. We call this diffuse lighting. Although this lighting is simple to calculate, it has several problems. First, it does not calculate shadows. Second, it does not calculate ambient lighting or diffuse bleeding. Third, it assumes the light source is infinitely far away (which is not a bad assumption for lighting from the sun, but fails under must other cases). Clearly, this is a biased form of rendering. Created for Computer Graphics 4620, a course offered at the University of Nebraska at Omaha. @bricksphd

Available on

Search by image

Upload a reference to find previews with similar colors, contrast, and detail.

Diffuse Lighting

No preview
bricksphd · ShaderFrog
Shaders & VFX
License not indexed
  • i Check the terms on the original listing.
Show full terms

A shader program that renders an object with simple diffuse lighting. This shader program builds on our previous shader, https://shaderfrog.com/app/view/3151. To get this shader, we reintroduce the external color variable. We also add a directionToLight variable, which points to the light source. To calculate the diffuse lighting on this object, we calculate the dot product of the normal of the surface and the direction to the light. This gives the cosine of the angle between the surface the light source, effectively giving us the amount of the light the reaches the surface. We call this diffuse lighting. Although this lighting is simple to calculate, it has several problems. First, it does not calculate shadows. Second, it does not calculate ambient lighting or diffuse bleeding. Third, it assumes the light source is infinitely far away (which is not a bad assumption for lighting from the sun, but fails under must other cases). Clearly, this is a biased form of rendering. Created for Computer Graphics 4620, a course offered at the University of Nebraska at Omaha. @bricksphd

View original listing

Tags

glslthree.js