Skip to content

Commit

Permalink
fix: skipping refract calculation for pbr landscape (#887)
Browse files Browse the repository at this point in the history
* Fixed fraction calculating for pbr landscape

* Skip refract calculation for pbr landscape
  • Loading branch information
jiayev authored Jan 6, 2025
1 parent 3c2d4c5 commit da11deb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions package/Shaders/Lighting.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -1885,7 +1885,7 @@ PS_OUTPUT main(PS_INPUT input, bool frontFace
# endif

float3 refractedDirLightDirection = DirLightDirection;
# if defined(TRUE_PBR)
# if defined(TRUE_PBR) && !defined(LANDSCAPE) && !defined(LODLANDSCAPE)
[branch] if ((PBRFlags & PBR::Flags::InterlayerParallax) != 0)
{
refractedDirLightDirection = -refract(-DirLightDirection, coatModelNormal, eta);
Expand Down Expand Up @@ -2058,10 +2058,12 @@ PS_OUTPUT main(PS_INPUT input, bool frontFace
{
float3 pointDiffuseColor, coatPointDiffuseColor, pointTransmissionColor, pointSpecularColor;
float3 refractedLightDirection = normalizedLightDirection;
# if !defined(LANDSCAPE) && !defined(LODLANDSCAPE)
[branch] if ((PBRFlags & PBR::Flags::InterlayerParallax) != 0)
{
refractedLightDirection = -refract(-normalizedLightDirection, coatModelNormal, eta);
}
# endif
PBR::LightProperties lightProperties = PBR::InitLightProperties(lightColor, lightShadow, 1);
PBR::GetDirectLightInput(pointDiffuseColor, coatPointDiffuseColor, pointTransmissionColor, pointSpecularColor, modelNormal.xyz, coatModelNormal, refractedViewDirection, viewDirection, refractedLightDirection, normalizedLightDirection, lightProperties, pbrSurfaceProperties, tbnTr, uvOriginal);
lightsDiffuseColor += pointDiffuseColor;
Expand Down Expand Up @@ -2164,7 +2166,7 @@ PS_OUTPUT main(PS_INPUT input, bool frontFace
}

float3 refractedLightDirection = normalizedLightDirection;
# if defined(TRUE_PBR)
# if defined(TRUE_PBR) && !defined(LANDSCAPE) && !defined(LODLANDSCAPE)
[branch] if ((PBRFlags & PBR::Flags::InterlayerParallax) != 0)
{
refractedLightDirection = -refract(-normalizedLightDirection, coatWorldNormal, eta);
Expand Down

0 comments on commit da11deb

Please sign in to comment.