fix in parallax occlusion mapping

This commit is contained in:
turanszkij
2018-01-24 15:58:39 +00:00
parent fc4278c7bd
commit 77e0571f7c
+1 -1
View File
@@ -135,7 +135,7 @@ inline void ParallaxOcclusionMapping(inout float2 UV, in float3 V, in float3x3 T
}
float2 prevTCoords = currentTextureCoords + dtex;
float nextH = heightFromTexture - curLayerHeight;
float prevH = xDisplacementMap.SampleGrad(sampler_linear_wrap, prevTCoords, derivX, derivY).r - curLayerHeight + layerHeight;
float prevH = 1 - xDisplacementMap.SampleGrad(sampler_linear_wrap, prevTCoords, derivX, derivY).r - curLayerHeight + layerHeight;
float weight = nextH / (nextH - prevH);
float2 finalTexCoords = prevTCoords * weight + currentTextureCoords * (1.0 - weight);
UV = finalTexCoords;