3 struct ShadowParameters
13 ShadowParameters shadows[max_lights];
14 mat4 shd_world_matrix[max_lights];
17 uniform sampler2DShadow shadow_map;
19 layout(constant_id=auto) const bool use_shadow_map = false;
21 #pragma MSP stage(fragment)
22 virtual float get_shadow_factor(int index, vec4 world_pos)
26 int type = shadows[index].type;
29 shadow_coord = (shd_world_matrix[shadows[index].matrix_index]*world_pos).xyz;
33 if(shadow_coord.x<0 || shadow_coord.x>1 || shadow_coord.y<0 || shadow_coord.y>1)
36 vec4 region = shadows[index].region;
37 float shadow_sample = texture(shadow_map, shadow_coord*vec3(region.zw, 1.0)+vec3(region.xy, 0.0));
38 return mix(1.0, shadow_sample, shadows[index].darkness);