PDA

View Full Version : Textures can't get brighter than their source image



kevinfishburne
02-15-2016, 01:15 AM
I posted about this before (https://www.opengl.org/discussion_boards/showthread.php/186331-Light-sources-do-not-make-textures-brighter-than-texture-source-images) and ended up implementing a workaround, but would like to know a better way. The same question was posted here by someone else but is outdated:

https://www.opengl.org/discussion_boards/showthread.php/127823-Brighter-light

The workaround for me was to set TEXTURE_ENV to COMBINE, set RGB_SCALE_ARB to two, then halve the intensity of all light sources.

To elaborate on the subject, the amount of light applied to geometry appears to be clamped to the RGB values of the texture source image independent of material values used for color tinting. Bright lights "wash out" geometry so it appears ambiently-lit. Ideally a bright light near geometry should wash it out to white (supersaturate it). Here's an animated gif of an exploding ship being effected by the problem:

http://eightvirtues.com/misc/Lighting.gif

To confirm, is this behavior normal? If it is normal, other than resorting to shaders, is there a better way to circumvent it? Thanks, and apologies if the workaround is still the best solution outside of using shaders.

GClements
02-15-2016, 04:10 AM
To confirm, is this behavior normal?

Yes.

In the fixed-function pipeline, vertex colours are clamped to (1,1,1). This is a limitation of most early 3D-capable hardware.



If it is normal, other than resorting to shaders, is there a better way to circumvent it?

"Better" is subjective. E.g. even scaling light intensities by a factor of two, texture colours below 0.5 won't saturate at full lighting intensity. There is probably a way around that using multi-texturing (adding 2*intensity-1.0 to the modulated texture colour). But there aren't many tutorials or examples regarding multi-texturing; by the time that support for it became widespread, it was being superseded by shaders. Or you could just perform a separate additive lighting pass without textures to handle super-saturation.