]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
change how offsetmapping bias works for less artifacts in offsetmapping mode
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 1 Sep 2011 18:26:25 +0000 (18:26 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 1 Sep 2011 18:26:25 +0000 (18:26 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11318 d7cf8633-e32d-0410-b094-e92efae38249

shader_glsl.h
shader_hlsl.h

index e0060e7db36824dfe6554a5090a1da09aeddaded..b09cb80f177783dfdbdc5c6eed4687a762c5e6cb 100644 (file)
 "      //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"
index 652428704e34c95f9b83fa102a2b3f39a5e26f6a..cc191292546ad65ab4d63757f4db62dc2d049024 100644 (file)
 "      //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"