]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
offsetmapping LOD: at least 3 steps!
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 15 Jan 2012 15:18:32 +0000 (15:18 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 15 Jan 2012 15:18:32 +0000 (15:18 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11647 d7cf8633-e32d-0410-b094-e92efae38249

shader_glsl.h
shader_hlsl.h

index bb489c8f92ba1d234f9fd6fdaf5902c7b236b39a..c7b5ebffb698690a7b9952f862f3c9fbf7c009c2 100644 (file)
 "      //mediump float LODFactor = min(1.0, OffsetMapping_LodDistance / EyeVectorFogDepth.z);\n"
 "      //mediump vec4 ScaleSteps = vec4(OffsetMapping_ScaleSteps.x, OffsetMapping_ScaleSteps.y * LODFactor, OffsetMapping_ScaleSteps.z / LODFactor, OffsetMapping_ScaleSteps.w * LODFactor);\n"
 "      mediump float GuessLODFactor = min(1.0, OffsetMapping_LodDistance / EyeVectorFogDepth.z);\n"
+"#ifdef USEOFFSETMAPPING_RELIEFMAPPING\n"
+"      // stupid workaround because 1-step and 2-step reliefmapping is void\n"
+"      mediump float LODSteps = max(3.0, ceil(GuessLODFactor * OffsetMapping_ScaleSteps.y));\n"
+"#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"
 "#else\n"
index b8d851fea84e9a1805d335388e08373260aa6659..8e9ee06405cc3f3e2def9e9b553b12096fa57337 100644 (file)
 "      //float LODFactor = min(1.0, OffsetMapping_LodDistance / EyeVectorFogDepth.z);\n"
 "      //float4 ScaleSteps = float4(OffsetMapping_ScaleSteps.x, OffsetMapping_ScaleSteps.y * LODFactor, OffsetMapping_ScaleSteps.z / LODFactor, OffsetMapping_ScaleSteps.w * LODFactor);\n"
 "      float GuessLODFactor = min(1.0, OffsetMapping_LodDistance / EyeVectorFogDepth.z);\n"
+"#ifdef USEOFFSETMAPPING_RELIEFMAPPING\n"
+"      // stupid workaround because 1-step and 2-step reliefmapping is void\n"
+"      float LODSteps = max(3.0, ceil(GuessLODFactor * OffsetMapping_ScaleSteps.y));\n"
+"#else\n"
 "      float LODSteps = ceil(GuessLODFactor * OffsetMapping_ScaleSteps.y);\n"
+"#endif\n"
 "      float LODFactor = LODSteps / OffsetMapping_ScaleSteps.y;\n"
 "      float4 ScaleSteps = float4(OffsetMapping_ScaleSteps.x, LODSteps, 1.0 / LODSteps, OffsetMapping_ScaleSteps.w * LODFactor);\n"
 "#else\n"