"#else\n",
" mediump float LODSteps = ceil(GuessLODFactor * OffsetMapping_ScaleSteps.y);\n",
"#endif\n",
-" mediump float LODFactor = LODSteps / OffsetMapping_ScaleSteps.y;\n",
-" mediump vec4 ScaleSteps = vec4(OffsetMapping_ScaleSteps.x, LODSteps, 1.0 / LODSteps, OffsetMapping_ScaleSteps.w * LODFactor);\n",
+" mediump vec4 ScaleSteps = vec4(OffsetMapping_ScaleSteps.x, LODSteps, vec2(1.0, OffsetMapping_ScaleSteps.w * LODSteps) / vec2(LODSteps, OffsetMapping_ScaleSteps.y));\n",
"#else\n",
" #define ScaleSteps OffsetMapping_ScaleSteps\n",
"#endif\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",
" OffsetVector *= ScaleSteps.z;\n",
+" vec2 OneMinusBias_OffsetVector = (1.0 - OffsetMapping_Bias) * OffsetVector;\n",
" for(i = 0.0; i < ScaleSteps.y; ++i)\n",
-" TexCoord += OffsetVector * ((1.0 - OffsetMapping_Bias) - dp_textureGrad(Texture_Normal, TexCoord, dPdx, dPdy).a);\n",
-" return TexCoord;\n",
+" TexCoord += -dp_textureGrad(Texture_Normal, TexCoord, dPdx, dPdy).a * OffsetVector + OneMinusBias_OffsetVector;\n",
+" return TexCoord;\n"
"#endif\n",
"}\n",
"#endif // USEOFFSETMAPPING\n",