Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // fragPos is in clip space, lightPos is (2,2,2), and pointDepthMap is a samplerCubemap
- float pointShadowCalculation (vec3 fragPos, vec3 lightPos) {
- vec3 fragToLight = fragPos - lightPos;
- float closestDepth = texture(pointDepthMap, fragToLight).r;
- closestDepth *= farPlane;
- float currentDepth = length(fragToLight);
- float bias = 0.05;
- float shadow = currentDepth - bias > closestDepth ? 1.0 : 0.0;
- return shadow;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement