From: divverent Date: Sun, 15 Jan 2012 15:18:32 +0000 (+0000) Subject: offsetmapping LOD: at least 3 steps! X-Git-Tag: xonotic-v0.8.0~96^2~366 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=cd68a897502cec8b4d31ea105a47b118f942a385;p=xonotic%2Fdarkplaces.git offsetmapping LOD: at least 3 steps! git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11647 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/shader_glsl.h b/shader_glsl.h index bb489c8f..c7b5ebff 100644 --- a/shader_glsl.h +++ b/shader_glsl.h @@ -729,7 +729,12 @@ " //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" diff --git a/shader_hlsl.h b/shader_hlsl.h index b8d851fe..8e9ee064 100644 --- a/shader_hlsl.h +++ b/shader_hlsl.h @@ -597,7 +597,12 @@ " //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"