Question: Modify Program 8.2 to replace the hardcoded values 0.001 in the lookup() function, with the more accurate values of 1.0/shadowbufferwidth and 1.0/shadowbufferheight. Observe to what
Modify Program 8.2 to replace the hardcoded values 0.001 in the lookup() function, with the more accurate values of 1.0/shadowbufferwidth and 1.0/shadowbufferheight. Observe to what degree this change makes a difference (or not) for various window sizes.
Program 8.2


Fragment Shader #version 430 // all variable declarations are unchanged // Returns the shadow depth value for a texel at distance (x,y) from shadow_coord. Recall that // shadow_coord is the location in the shadow map corresponding to the current pixel being rendered. float lookup (float ox, float oy) { float t = texture Proj(shadow Tex, shadow_coord + vec4(ox * 0.001 * shadow_coord.w, oy * 0.001 * shadow_coord.w, -0.01, 0.0)); // the third parameter (-0.01) is an offset to counteract shadow acne return t;
Step by Step Solution
3.33 Rating (147 Votes )
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
