Skip to content

Commit

Permalink
Light Scattering FX: fixed light position calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMostDiligent committed Jul 31, 2024
1 parent b241cfe commit 0b2b228
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2269,8 +2269,11 @@ void EpipolarLightScattering::PrepareForNewFrame(FrameAttribs&
1.f / static_cast<float>(m_uiBackBufferWidth),
1.f / static_cast<float>(m_uiBackBufferHeight));

auto mCameraViewProj = frameAttribs.pCameraAttribs->mViewProjT;
float4 f4LightPosPS = -frameAttribs.pLightAttribs->f4Direction * mCameraViewProj;
const auto& mCameraViewProj = (m_ShaderFlags & SHADER_COMPILE_FLAG_PACK_MATRIX_ROW_MAJOR) ?
frameAttribs.pCameraAttribs->mViewProjT :
frameAttribs.pCameraAttribs->mViewProjT.Transpose();

float4 f4LightPosPS = -frameAttribs.pLightAttribs->f4Direction * mCameraViewProj;
f4LightPosPS.x /= f4LightPosPS.w;
f4LightPosPS.y /= f4LightPosPS.w;
f4LightPosPS.z /= f4LightPosPS.w;
Expand Down

0 comments on commit 0b2b228

Please sign in to comment.