mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-09-18 00:45:39 -04:00
Don't overcorrect parallax Y
This commit is contained in:
parent
944925663d
commit
b011b81d77
@ -126,13 +126,10 @@ void main()
|
||||
#if @parallax || @diffuseParallax
|
||||
#if @parallax
|
||||
float height = texture2D(normalMap, normalMapUV).a;
|
||||
float flipY = (passTangent.w > 0.0) ? -1.f : 1.f;
|
||||
#else
|
||||
float height = texture2D(diffuseMap, diffuseMapUV).a;
|
||||
// FIXME: shouldn't be necessary, but in this path false-positives are common
|
||||
float flipY = -1.f;
|
||||
#endif
|
||||
offset = getParallaxOffset(transpose(normalToViewMatrix) * normalize(-passViewPos), height, flipY);
|
||||
offset = getParallaxOffset(transpose(normalToViewMatrix) * normalize(-passViewPos), height);
|
||||
#endif
|
||||
|
||||
vec2 screenCoords = gl_FragCoord.xy / screenRes;
|
||||
|
@ -49,7 +49,8 @@ void main()
|
||||
vec2 adjustedUV = (gl_TextureMatrix[0] * vec4(uv, 0.0, 1.0)).xy;
|
||||
|
||||
#if @parallax
|
||||
adjustedUV += getParallaxOffset(transpose(normalToViewMatrix) * normalize(-passViewPos), texture2D(normalMap, adjustedUV).a, -1.0f);
|
||||
float height = texture2D(normalMap, adjustedUV).a;
|
||||
adjustedUV += getParallaxOffset(transpose(normalToViewMatrix) * normalize(-passViewPos), height);
|
||||
#endif
|
||||
vec4 diffuseTex = texture2D(diffuseMap, adjustedUV);
|
||||
gl_FragData[0] = vec4(diffuseTex.xyz, 1.0);
|
||||
|
@ -4,9 +4,9 @@
|
||||
#define PARALLAX_SCALE 0.04
|
||||
#define PARALLAX_BIAS -0.02
|
||||
|
||||
vec2 getParallaxOffset(vec3 eyeDir, float height, float flipY)
|
||||
vec2 getParallaxOffset(vec3 eyeDir, float height)
|
||||
{
|
||||
return vec2(eyeDir.x, eyeDir.y * flipY) * ( height * PARALLAX_SCALE + PARALLAX_BIAS );
|
||||
return vec2(eyeDir.x, -eyeDir.y) * ( height * PARALLAX_SCALE + PARALLAX_BIAS );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user