Skip to content

Commit

Permalink
added head check to rain blocker
Browse files Browse the repository at this point in the history
  • Loading branch information
turanszkij committed Nov 9, 2023
1 parent 46d85ac commit 842db2d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
21 changes: 21 additions & 0 deletions WickedEngine/shaders/shadowHF.hlsli
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion WickedEngine/wiVersion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 842db2d

Please sign in to comment.