From: divverent Date: Sun, 15 Jan 2012 14:14:19 +0000 (+0000) Subject: fix scale issue with offsetmapping LOD due to calculated fractional steps count X-Git-Tag: xonotic-v0.8.0~96^2~367 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=6dec6a79c594d96f510004b3798153d4373e6486;p=xonotic%2Fdarkplaces.git fix scale issue with offsetmapping LOD due to calculated fractional steps count git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11646 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/shader_glsl.h b/shader_glsl.h index f968e3eb..bb489c8f 100644 --- a/shader_glsl.h +++ b/shader_glsl.h @@ -726,8 +726,12 @@ " float i;\n" " // distance-based LOD\n" "#ifdef USEOFFSETMAPPING_LOD\n" -" 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 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" +" mediump float LODSteps = ceil(GuessLODFactor * OffsetMapping_ScaleSteps.y);\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" " #define ScaleSteps OffsetMapping_ScaleSteps\n" "#endif\n" diff --git a/shader_hlsl.h b/shader_hlsl.h index d09307cf..b8d851fe 100644 --- a/shader_hlsl.h +++ b/shader_hlsl.h @@ -594,8 +594,12 @@ " float i;\n" " // distance-based LOD\n" "#ifdef USEOFFSETMAPPING_LOD\n" -" float LODFactor = min(1.0, OffsetMapping_LodDistance / EyeVectorFogDepth.z);\n" -" mediump vec4 ScaleSteps = float4(OffsetMapping_ScaleSteps.x, OffsetMapping_ScaleSteps.y * LODFactor, OffsetMapping_ScaleSteps.z / LODFactor, OffsetMapping_ScaleSteps.w * LODFactor);\n" +" //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" +" float LODSteps = ceil(GuessLODFactor * OffsetMapping_ScaleSteps.y);\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" " #define ScaleSteps OffsetMapping_ScaleSteps\n" "#endif\n"