Skip to content

Commit

Permalink
feat: #86 Fix object shadow culling
Browse files Browse the repository at this point in the history
  • Loading branch information
ducphamhong committed Aug 23, 2020
1 parent 482b718 commit 129c049
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,10 @@ namespace Skylicht

m_frustumBox[i].addInternalPoint(camPos);

// Fix: object shadow culling above camera
core::vector3df highCameraPos = frustum.Center - m_lightDirection * radius * 2.0f;
m_frustumBox[i].addInternalPoint(highCameraPos);

// Add the near offset to the Z value of the cascade extents to make sure the orthographic frustum captures the entire frustum split (else it will exhibit cut-off issues).
core::matrix4 ortho;
ortho.buildProjectionMatrixOrthoLH(max.X - min.X, max.Y - min.Y, -m_nearOffset, m_nearOffset + cascadeExtents.Z);
Expand Down

0 comments on commit 129c049

Please sign in to comment.