GetAssetPack

World Space Lighting

Type
Shaders & VFX
Creator
bricksphd

A shader program that renders an object with local lights (as opposed to lights that are infinitely far away). This shader program builds on our previous shader, https://shaderfrog.com/app/view/3153. In this shader, we change our light from being defined as a direction to a position in world space. To calculate the direction from a point to this light, we need to track our position in world space for each fragment as well. Then in our fragment shader, we calculate the direction to the light by subtracting the world position from the light position. It is very important to normalize this result. If you take out the normalize() call, the strength of the light will be multiplied by the distance to the light. 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.

World Space 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 local lights (as opposed to lights that are infinitely far away). This shader program builds on our previous shader, https://shaderfrog.com/app/view/3153. In this shader, we change our light from being defined as a direction to a position in world space. To calculate the direction from a point to this light, we need to track our position in world space for each fragment as well. Then in our fragment shader, we calculate the direction to the light by subtracting the world position from the light position. It is very important to normalize this result. If you take out the normalize() call, the strength of the light will be multiplied by the distance to the light. Created for Computer Graphics 4620, a course offered at the University of Nebraska at Omaha. @bricksphd

View original listing

Tags

glslthree.js