Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

It occurred to me that the standard lighting setup you see in all the tutorials doesn't allow lights to actually make an object appear brighter than its texture. The light value is always clamped between 0 and 1. Which means at maximum brightness, the resulting color will be exactly the same as the value from the texture. Even if you didn't clamp it manually, in a deferred renderer, the graphics card/driver will end up clamping it for you.

This seems very unusual to me. Do AAA games actually use lighting like this? Or is there a solution? My thought was maybe this is what HDR "fixes" but the only thing I've noticed HDR doing is that rather annoying light-transition effect.

share|improve this question
2  
Yes, this is conventional. Yes, this is a bad thing. But as soon as you allow for lighting > 1.0, then bright parts of the texture may be multiplied to over 1.0, and then you have to handle in some way those values; i.e. you are doing HDR of some kind. –  Kevin Reid Jul 12 '12 at 4:02
add comment

1 Answer

up vote 4 down vote accepted

Specular light is not modulated by the diffuse texture, so specularity can easily make a surface appear brighter than its texture at times, even in an LDR renderer.

But more generally, ordinary materials can't reflect more light than they receive, so (considering only diffuse for a moment) the reflected light will be no brighter than the incoming light, and if the incoming light is clamped to 1 then the reflected light will be no brighter than the texture.

In an HDR renderer the lights can have an arbitrary brightness, but that's not the whole story. Two keys to doing HDR properly are: setting the exposure properly based on the brightness of the scene and your aesthetic goals, and using a good tonemapping filter. If you want the image to look brighter you have to adjust the exposure to do so. Even if the lights are still in the [0, 1] range, you can adjust the exposure to make the image brighter. This is an artistic choice and it's perfectly permissible to set the exposure in such a way that well-lit objects end up brighter than their textures. The tonemapping filter allows you to alter the exposure without losing too much detail either in the bright or dark areas. It also makes bright colors ramp to white in a natural way as they get brighter, rather than simply being clamped, which can produce unwanted color shifts and loss of detail.

There's a good tonemapping equation on slide 140 of this talk (which is also highly worth reading, at least the first two sections on gamma correction and HDR, if you want to understand how to do physically based rendering correctly).

share|improve this answer
    
So if I understand you correctly, this is normal for an LDR renderer and HDR is the solution? Very interesting slides by the way. –  Telanor Jul 12 '12 at 5:36
    
@Telanor Yep, it's normal in an LDR renderer. Even in an LDR renderer, you can set the lights higher than 1 if you want; it just won't behave very well with it. :) HDR+tonemapping lets you use a wider range of light brightnesses and gives more control over how different levels of brightness are rendered. –  Nathan Reed Jul 12 '12 at 6:03
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.