by Spike » Tue Nov 15, 2011 6:02 am
overbrights:
Which of the following 2 has the greater dynamic range?
clamp(texture*clamp(lighting*0.5) * 2)
clamp(texture*clamp(lighting))
yup, the top one. that's the maths you need to set up to do your overbrights, instead of the second one.
or in other words, halve the light values passed per-vertex in your engine, and configure the GL_RGB_SCALE_ARB to double the resulting texture samples (or quater/quadruple, your choice).
with lightmaps its the lightmap samples which are halved (before being clamped to 255=1.0), which allows you to double the maximum range in there. with models its the glVertex values which is halved (before being clamped to 255=1.0)
that's the only difference.
if you calc the light levels in the vertex program using non-clamped colour values etc then you can bypass the inner clamp making any overbrighting limit value much much larger. sadly for world lighting, the inner clamp is limited by the precision provided by a 24bit colour image. you can achieve higher ranges by using a floating-point texture format. In the case of q3bsp, the lightmaps are already scaled down to 0.25, while quake/quake2 scales down in the lightmap generation code.
.