From: divverent Date: Thu, 1 Sep 2011 18:26:25 +0000 (+0000) Subject: change how offsetmapping bias works for less artifacts in offsetmapping mode X-Git-Tag: xonotic-v0.6.0~163^2~234 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f9ece9fb93af941afa603375594334bf6c6c320a;p=xonotic%2Fdarkplaces.git 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 --- 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"