1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-12 16:15:20 +02:00

Reuse normal offset calculation for nodes

This commit is contained in:
Dmitry Kostenko
2022-02-20 00:18:39 +01:00
committed by x2048
parent 4801bdf45a
commit b651bbf446
2 changed files with 16 additions and 5 deletions

View File

@@ -74,8 +74,7 @@ vec3 getLightSpacePosition()
#if DRAW_TYPE == NDT_PLANTLIKE
pLightSpace = m_ShadowViewProj * vec4(worldPosition, 1.0);
#else
float offsetScale = (0.0057 * getLinearDepth() + normalOffsetScale);
pLightSpace = m_ShadowViewProj * vec4(worldPosition + offsetScale * normalize(vNormal), 1.0);
pLightSpace = m_ShadowViewProj * vec4(worldPosition + normalOffsetScale * normalize(vNormal), 1.0);
#endif
pLightSpace = getPerspectiveFactor(pLightSpace);
return pLightSpace.xyz * 0.5 + 0.5;