From 8cf4174612856f6c871d13e551a91a7791e5f3a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E8=82=B2=E5=98=89?= Date: Sun, 5 Jan 2025 15:00:34 +0800 Subject: [PATCH 1/2] Fixed fraction calculating for pbr landscape --- package/Shaders/Lighting.hlsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/Shaders/Lighting.hlsl b/package/Shaders/Lighting.hlsl index eac2f4963..2c01a0502 100644 --- a/package/Shaders/Lighting.hlsl +++ b/package/Shaders/Lighting.hlsl @@ -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); From a6a10c2f26b5bd6d2441dfeaeb1f50df15116f67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E8=82=B2=E5=98=89?= Date: Sun, 5 Jan 2025 15:12:22 +0800 Subject: [PATCH 2/2] Skip refract calculation for pbr landscape --- package/Shaders/Lighting.hlsl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/package/Shaders/Lighting.hlsl b/package/Shaders/Lighting.hlsl index 2c01a0502..3a6368042 100644 --- a/package/Shaders/Lighting.hlsl +++ b/package/Shaders/Lighting.hlsl @@ -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; @@ -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);