Game Development Community

dev|Pro Game Development Curriculum

Dynamic Range Lighting

by Jeff Raab · 03/07/2006 (11:21 am) · 54 comments

Download Code File

Alright, This resource allows you to add Dynamic Range Lighting to the TLK.
We've talked with John, and he helped us get this all together.

What you need to do is download the attached file, and copy the files over what's currently in your directory.(If you've modified these files, the relevent changes can be found pretty easily and moved into your files without much struggle)
Once you've got these copied over, go into your code and open sgLighting.h.

In there, find the defines near the top:
#define SG_LIGHTING
and
#define SG_USE_TERRAIN_COLOR_CORRECTION

and comment them out. If they stay active with DRL on, you'll get super brightened stuff, and that's just painful to look at.

Once those have been commented out, compile your code, and your done!
Load up a mission and run around and check out the apature adaptation, as well as blooming, etc.
Tips on performance management and modifying the DRL settings can be found in the included readme, as well as contact info if needed.

Enjoy!

-Jeff "Reno" Raab
-Alex "Delerium" Scarborough
Page «Previous 1 2 3 Last »
#1
03/06/2006 (8:34 pm)
Screenshots are available here.
#2
03/07/2006 (11:13 am)
Nice work guys. :)
#3
03/07/2006 (11:45 am)
What is Dynamic Range Lighting?
#4
03/07/2006 (12:29 pm)
Hi Chris, DRL adjusts the screen's exposure based on the scene's brightness, just like HDRL, but without shaders.

This resource also supports bloom and tone mapping - awesome stuff. :)


Jeff and Alex, excellent work guys!

-John
#5
03/07/2006 (12:31 pm)
Edit: Arg, John beat me to it ;)

Long boring explination anyways:

Basically, It works alot like HDR, but instead of dealing with shaders or floating point surfaces/buffers, we're doing it in fixed function(and as such, it's still constrained by the 0.0f to 1.0f color range clamp)
what DRL allows us to do is to more of less fake the higher range of colors by adapting the exposure and apature based on the current scene's average light intensity, and scales it. Because of this, when you're looking in a dark area, bright areas will seem much brighter than they would in fixed range lighting, and vice versa. It's an awful lot like HDR, minus the extra shiney(though our DRL setup supports a limited bloom for people that have a bit beefier card)

Hope that helps more than confuses ;)
-Reno
#6
03/07/2006 (1:21 pm)
Wow, can't wait to check this out. Thanks.
#7
03/07/2006 (2:43 pm)
Beautiful ;)

Only complaint is it doesn't seem to work well with night lit scenes - and the "reduces frame rate by half" part (from the readme).

- Eric
#8
03/07/2006 (4:43 pm)
I hadnt done too much with night scenes, but i'll look at it.
As for the halving the framerate: if you really wanna keep it in there(and on) but want to get some performance back, type "optimizeDRL(true);" into your console.
This will turn off bloom(the main pull of the DRL code) and will add some delay between scene intensity checks, giving a pretty hefty boost in some cases.

edit: Alex told me to tell ya to bump the max scalar to the 20-ish and the max bias to 0.0. THe functions for that are in the readme. should help some.
hope that helps :)
-Reno
#9
03/08/2006 (4:34 am)
as soon as I get free time - I'll try this ;)
but from the description I feel that's really great stuff!
Thanks Jess&Alex! Good work!
#10
03/08/2006 (5:33 am)
Excellent resource! The only problem I'm having so far is trying to make it look good in a dark mission (stays too bright) and get the skybox to not be as bright. But, I haven't had time to mess with the settings all that much yet.

Great work!
#11
03/08/2006 (5:32 pm)
@Jeff:

Yeah changing those values really did help a lot - thanks for the tip.

As a little extra nit-picky thing, it would be nice if there was a little more explination into what exactly each value was or what it represented other than having to fiddle around with trial and error to try to achieve the correct lighting.

Thanks again,

- Eric
#12
03/08/2006 (6:14 pm)
ok what I am I doing wrong. I read the instruction many times, recheck everything. I have super super bright even on new mission. Yes I comment them out the ones above.
#13
03/08/2006 (7:18 pm)
Michael try setting setScaleLimits to 0.1 and 10.0, and turning on optimizeDRL, that should help some.

Eric, the functions should be pretty well documented, i'd take a look through the code as Alex tossed some decent documentation in there as is.
#14
03/08/2006 (8:26 pm)
Jeff, I'm having the same trouble as Michael.

When I first loaded it up, it was really good in that 30-yard radius around the player but everything farther away was really overbright, and the sky was completly washed out.


the setScaleLimits(0.1, 10.0) helped some things. In particular that setting seems to nail-down the sky box. Bright terrain in the distance can still be TOO-bright but is much closer than before. However, that 30-yard circle around the player is now starting to get too dark.

I think this is an awesom effect, I just need to find the correct settings. right now it's too-much, the contrast is WAY too high.

I'm going to keep playing with it, but if you think of anything else to try let us know.
#15
03/08/2006 (8:34 pm)
can you post a sceenie by any chance?
#16
03/08/2006 (8:41 pm)
screenshot directory

Here's a link, I don't want to junk up your thread with these...

The bright ones were done with the default setting: setScaleLimits(2.0, 8.0);
The darker ones were done with the reccomended setting: setScaleLimits(0.1, 10.0);


Once again:
- this is a standard "like new": TGE-TLK 1.4
- - Only mods are that advanced camera resource, and joystick controls; which shouldn't factor in...
- I DID comment out those two #define(s) and recompile
- I have optimizeDRL(true); set.


I've been playing with other combinations of setScaleLimits(x, y). But everything is too light or too dark. after a certain point, I think there's a second setting I need to be changing but not sure which.
#17
03/09/2006 (12:07 am)
Is it normal that the TLK lights i use ingame are overbright ?
(did everything accordingly, including commenting out those definrd)

Everything else works fine.

This rescource does not work with Matrox cards btw :)

I used the tonemapping rescource before this one, i was wondering if i can set the tonemap values with this rescource?

I just found out that with this rescource the game will crash when you change from windowed to fullscreen and visa versa.
#18
03/09/2006 (7:03 am)
There's a few things that would make this resource a little more useful and amazing than it already is.

1) A description of what each setting affects (most people including me don't know what the "bias" is doing)

2) The ability to have custom settings applied on a mission load, and working on client/server basis. It seems pretty clear that some missions and scenes require different settings than others. Having this work on a client/server model would be awesome.

- Eric
#19
03/09/2006 (7:13 am)
I noticed something unusual, when I look up at the skybox, it grows increasingly brighter until it's white. When I look back down, the scene gradually dims down to normal. Is this normal?
#20
03/09/2006 (1:24 pm)
A new zip file has been uploaded with a more complete readme. The readme now includes a description of the various components of the overall DRL effect, which should make understanding it significantly easier.

@Vincent: It definitely should not be crashing when you change resolutions. Can you give me more information about the computer you're running it on? Also, double check to be sure that you merged all the changes in platformVideo.cc . You can force the tonemap settings by calling setScaleLimits with the same minimum and maximum values, and setBiasLimits with the same minimum and maximum values, though that negates the purpose of DRL. As for overbrighting lights, yes, that is supposed to happen. That's just a natural side effect of the way the code works. Now, as for Matrox cards... I can't give you a straight answer. This code is written against the OpenGL 1.1 specification with no extensions. It should work on all available graphics cards.

@Dave: No, that's not normal. If you could get some screenshots of it doing that, the minimum/maximum of the scale, min/max of the bias, and the goal intensity, we'll take a look at it and try to figure out what's going wrong.

@Eric: Item 1 should be taken care of now. We'll work on getting 2 done for the next release.

@Steven: You might try setBiasLimits(-0.4, 0.0) and adjusting the goal intensity. setGoalIntensity(0.65) should help brighten up the image a bit without overdoing it.
Page «Previous 1 2 3 Last »