Created
January 14, 2017 12:31
-
-
Save wezu/837fccced9d632b4308e4a590f6eb029 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //shadows | |
| vec4 world_pos = p3d_ViewProjectionMatrixInverse * vec4( uv.xy * 2.0 - vec2(1.0), depth, 1.0); | |
| world_pos.xyz /= world_pos.w; | |
| world_pos.xyz-=light_pos.xyz; | |
| vec4 shadow_uv=trans_render_to_shadowcaster*world_pos; | |
| float ldist = max(abs(shadow_uv.x), max(abs(shadow_uv.y), abs(shadow_uv.z))); | |
| ldist = ((light_radius+light_view_pos.w)/(light_radius-light_view_pos.w))+((-2.0*light_radius*light_view_pos.w)/(ldist * (light_radius-light_view_pos.w))); | |
| float shadow= float(texture(shadowcaster.shadowMap, shadow_uv.xyz).r >= ldist * 0.5 + 0.5); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment