3 struct ShadowParameters
13 ShadowParameters shadows[max_lights];
16 uniform sampler2DShadow shadow_map;
18 layout(constant_id=auto) const bool use_shadow_map = false;
20 #pragma MSP stage(fragment)
21 virtual float get_shadow_factor(int index, vec4 world_pos)
25 if(shadows[index].enabled==0)
28 vec3 shadow_coord = (shadows[index].shd_world_matrix*world_pos).xyz;
29 if(shadow_coord.x<0 || shadow_coord.x>1 || shadow_coord.y<0 || shadow_coord.y>1)
32 vec4 region = shadows[index].region;
33 float shadow_sample = texture(shadow_map, shadow_coord*vec3(region.zw, 1.0)+vec3(region.xy, 0.0));
34 return mix(1.0, shadow_sample, shadows[index].darkness);