PDA

View Full Version : better method of combining lights



zed
12-16-2004, 09:20 AM
ive always done it the standard way.
ie enable blending with ONE ONE for each pass, now personally this doesnt look so good, its looks overbright/washed out. whats a better method? instead of plain addition some sort of addition + modulation perhaps

knackered
12-16-2004, 12:55 PM
Light is additive - it's in its nature.

sqrt[-1]
12-16-2004, 02:50 PM
There is a hack called "smooth blend"
First pass : ONE, ZERO
all other passes: ONE, ONE_MINUS_SRC_COLOR

This should stop the over-brightness...

jwatte
12-16-2004, 03:58 PM
The correct solution is to not overbright your scene. If your average texel is illuminated by 3 lights, then your average light strength should be 1/3 or less to avoid saturation, if you're rendering to 8-bit fixed-function frame buffers.

If you have a GeForce 6800, it can blend into 16-bit floating point surfaces, so you can use regular lighting, not worry about saturation so much, and then do tone mapping to the frame buffer.

zed
12-16-2004, 10:08 PM
First pass : ONE, ZERO
all other passes: ONE, ONE_MINUS_SRC_COLORyeah that looks much better
http://uk.geocities.com/sloppyturds/nelson/richmond.html



The correct solution is to not overbright your scene. If your average texel is illuminated by 3 lights, then your average light strength should be 1/3 or less to avoid saturation, if you're rendering to 8-bit fixed-function frame buffers.a bit hard to do when the number of lights is chopping and changing from 0 - 10, but yeah youre right that the problem is the lack of 'range' with 8bits its very easy to become saturated ie 1,1,1

RAMman
12-17-2004, 02:46 AM
As Jwatte also pointed out, I would suggest you to give HDR a try. Iím working with it myself right now, because I believe its the only way to achieve proper lighting of very bright objects, say an lightning for example.
Itís not that difficult to implement, you can check out the ATI demo in the Rendermonkey. Nvidia also has a presentation about it. Only problem is that here you can also get the over brightened scenes and white pixels if you run out of precision in the floating buffer.
So even if you use HDR, you still have to look out for those intensities becoming too high. (Especially in HDR, as it uses convolution, which will give very big temp. values in the filtering process).

But unless you have to support all kinds of older hardware, I would take a look at it. It is fun too :)

zed
12-18-2004, 09:40 AM
yes HDR would be ideal unfortunatly its out of the question at the moment (hardware)
also decided that ONE, ONE_MINUS_SRC_COLOR is not much better than ONE ONE in that it doesnt matter how many lights u add u will only get a certain level of brightness
i want some sort of inverse exponential lighting eg 0.75 is 2x as strong as 0.5,
0.875 is 4x as strong as 0.5 etc
i dont think this is possible?

JustHanging
12-19-2004, 04:14 AM
Hi,

It's possible to get that too, as I describe in this old thread: http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=3;t=008447

Same thing in short: Start from white, render with negative colors, modulate lights instead of adding them and negate the final result.

-Ilkka