From 2945a966e1e98be4c4b92b49e285e4207350b036 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Thu, 18 Jul 2013 18:08:15 +0000 Subject: [PATCH] Polymer/ART mapping: fix formula for globalvisibility. Also, very slightly tweak a factor toward a "brighter" (farther visible) scene overall to account for the "circular" nature of the fragment distance (as opposed to an "ortho" distance in Build). git-svn-id: https://svn.eduke32.com/eduke32@3962 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/src/polymer.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/polymer/eduke32/build/src/polymer.c b/polymer/eduke32/build/src/polymer.c index fccbc3085..ad1cbed80 100644 --- a/polymer/eduke32/build/src/polymer.c +++ b/polymer/eduke32/build/src/polymer.c @@ -283,7 +283,12 @@ _prprogrambit prprogrambits[PR_BIT_COUNT] = { "varying vec3 horizDistance;\n" "\n", // frag_prog - " float shadeLookup = length(horizDistance) / 1.024 * visibility;\n" + + // NOTE: the denominator was 1.024, but we increase it towards a bit + // farther far clipoff distance to account for the fact that the + // distance to the fragment is the common Euclidean one, as opposed to + // the "ortho" distance of Build. + " float shadeLookup = length(horizDistance) / 1.07 * visibility;\n" " shadeLookup = shadeLookup + shadeOffset;\n" "\n" " float colorIndex = texture2D(artMap, commonTexCoord.st).r * 256.0;\n" @@ -4965,7 +4970,7 @@ static int32_t polymer_bindmaterial(_prmaterial material, int16_t* lights, texunit++; bglUniform1fARB(prprograms[programbits].uniform_shadeOffset, material.shadeoffset); - bglUniform1fARB(prprograms[programbits].uniform_visibility, (globalvisibility - 2048.0) / 2048.0 + material.visibility); + bglUniform1fARB(prprograms[programbits].uniform_visibility, globalvisibility/2048.0 * material.visibility); } // PR_BIT_DIFFUSE_MAP