2022-03-15 18:04:21 +00:00
|
|
|
|
|
|
|
#ifndef RAIN_OCCLUSION_GLSL
|
|
|
|
#define RAIN_OCCLUSION_GLSL
|
|
|
|
|
|
|
|
// Use with sampler2DShadow
|
|
|
|
layout(set = 1, binding = 4)
|
|
|
|
uniform texture2D t_directed_occlusion_maps;
|
|
|
|
layout(set = 1, binding = 5)
|
|
|
|
uniform samplerShadow s_directed_occlusion_maps;
|
|
|
|
|
|
|
|
layout (std140, set = 0, binding = 14)
|
|
|
|
uniform u_rain_occlusion {
|
2022-06-04 01:25:17 +00:00
|
|
|
mat4 rain_occlusion_matrices;
|
|
|
|
mat4 rain_occlusion_texture_mat;
|
2022-07-02 10:00:02 +00:00
|
|
|
mat4 rain_dir_mat;
|
2022-05-30 21:02:22 +00:00
|
|
|
float integrated_rain_vel;
|
2022-06-11 20:57:07 +00:00
|
|
|
float rain_density;
|
|
|
|
vec2 occlusion_dummy; // Fix alignment.
|
2022-03-15 18:04:21 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
float rain_occlusion_at(in vec3 fragPos)
|
|
|
|
{
|
2022-07-10 15:56:45 +00:00
|
|
|
vec4 rain_pos = rain_occlusion_texture_mat * vec4(fragPos, 1.0);
|
2022-03-15 18:04:21 +00:00
|
|
|
|
|
|
|
float visibility = textureProj(sampler2DShadow(t_directed_occlusion_maps, s_directed_occlusion_maps), rain_pos);
|
|
|
|
|
|
|
|
return visibility;
|
|
|
|
}
|
2022-03-16 12:04:02 +00:00
|
|
|
#endif
|