From f48057e92592646ad3a444aece218b57696491b0 Mon Sep 17 00:00:00 2001 From: divverent Date: Thu, 1 Sep 2011 18:26:25 +0000 Subject: [PATCH] change how offsetmapping bias works for less artifacts in offsetmapping mode git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11318 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=f9ece9fb93af941afa603375594334bf6c6c320a --- shader_glsl.h | 3 +-- shader_hlsl.h | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/shader_glsl.h b/shader_glsl.h index e0060e7d..b09cb80f 100644 --- a/shader_glsl.h +++ b/shader_glsl.h @@ -706,10 +706,9 @@ " //vec2 OffsetVector = vec2(EyeVectorFogDepth.xy * ((1.0 / EyeVectorFogDepth.z) * ScaleSteps.x) * vec2(-1, 1));\n" " //vec2 OffsetVector = vec2(normalize(EyeVectorFogDepth.xy) * ScaleSteps.x * vec2(-1, 1));\n" " vec2 OffsetVector = vec2(normalize(EyeVectorFogDepth.xyz).xy * ScaleSteps.x * vec2(-1, 1));\n" -" TexCoord.xy = TexCoord.xy - OffsetVector.xy*OffsetMapping_Bias;\n" " OffsetVector *= ScaleSteps.z;\n" " for(i = 0.0; i < ScaleSteps.y; ++i)\n" -" TexCoord += OffsetVector * (1.0 - dp_textureGrad(Texture_Normal, TexCoord, dPdx, dPdy).a);\n" +" TexCoord += OffsetVector * ((1.0 - OffsetMapping_Bias) - dp_textureGrad(Texture_Normal, TexCoord, dPdx, dPdy).a);\n" " return TexCoord;\n" "#endif\n" "}\n" diff --git a/shader_hlsl.h b/shader_hlsl.h index 65242870..cc191292 100644 --- a/shader_hlsl.h +++ b/shader_hlsl.h @@ -574,10 +574,9 @@ " //float2 OffsetVector = float2(EyeVector.xy * ((1.0 / EyeVector.z) * ScaleSteps.x) * float2(-1, 1));\n" " //float2 OffsetVector = float2(normalize(EyeVector.xy) * ScaleSteps.x * float2(-1, 1));\n" " float2 OffsetVector = float2(normalize(EyeVector).xy * ScaleSteps.x * float2(-1, 1));\n" -" TexCoord.xy = TexCoord.xy - OffsetVector.xy*OffsetMapping_Bias;\n" " OffsetVector *= ScaleSteps.z;\n" " for(i = 0.0; i < ScaleSteps.y; ++i)\n" -" TexCoord += OffsetVector * (1.0 - tex2Dgrad(Texture_Normal, TexCoord, dPdx, dPdy).a);\n" +" TexCoord += OffsetVector * ((1.0 - OffsetMapping_Bias) - tex2Dgrad(Texture_Normal, TexCoord, dPdx, dPdy).a);\n" " return TexCoord;\n" "#endif\n" "}\n" -- 2.39.2