added head check to rain blocker

This commit is contained in:
Turánszki János
2023-11-09 08:58:14 +01:00
parent 46d85ac496
commit 842db2d75a
2 changed files with 22 additions and 1 deletions
+21
View File
@@ -121,11 +121,23 @@ inline bool furthest_cascade_volumetrics(inout ShaderEntity light, inout uint fu
return false;
}
static const float rain_blocker_head_size = 1;
static const float rain_blocker_head_size_sq = rain_blocker_head_size * rain_blocker_head_size;
// Checks whether position is below or above rain blocker
// true: below
// false: above
inline bool rain_blocker_check(in float3 P)
{
// Before checking blocker shadow map, check "head" blocker:
if(P.y < GetCamera().position.y + rain_blocker_head_size)
{
float2 diff = GetCamera().position.xz - P.xz;
float distsq = dot(diff, diff);
if(distsq < rain_blocker_head_size_sq)
return true;
}
[branch]
if (GetFrame().texture_shadowatlas_index < 0 || !any(GetFrame().rain_blocker_mad))
return false;
@@ -150,6 +162,15 @@ inline bool rain_blocker_check(in float3 P)
// Same as above but using previous frame's values
inline bool rain_blocker_check_prev(in float3 P)
{
// Before checking blocker shadow map, check "head" blocker:
if(P.y < GetCamera().position.y + rain_blocker_head_size)
{
float2 diff = GetCamera().position.xz - P.xz;
float distsq = dot(diff, diff);
if(distsq < rain_blocker_head_size_sq)
return true;
}
[branch]
if (GetFrame().texture_shadowatlas_index < 0 || !any(GetFrame().rain_blocker_mad_prev))
return false;
+1 -1
View File
@@ -9,7 +9,7 @@ namespace wi::version
// minor features, major updates, breaking compatibility changes
const int minor = 71;
// minor bug fixes, alterations, refactors, updates
const int revision = 342;
const int revision = 343;
const std::string version_string = std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(revision);