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
This shader has no tags.
No comments
Add a comment