From 77e0571f7c77e8516a37ea2544440527e17cd42d Mon Sep 17 00:00:00 2001 From: turanszkij Date: Wed, 24 Jan 2018 15:58:39 +0000 Subject: [PATCH] fix in parallax occlusion mapping --- WickedEngine/objectHF.hlsli | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WickedEngine/objectHF.hlsli b/WickedEngine/objectHF.hlsli index 34846874f..6d2860273 100644 --- a/WickedEngine/objectHF.hlsli +++ b/WickedEngine/objectHF.hlsli @@ -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;