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
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
About the author
#43
An easier way to disable the overexposure is to set SG_LIGHTING_OVERBRIGHT_AMOUNT (located in sgLighting.h) to 1.0. You'll still need to comment out the asm code changes from blender_asm.asm, but that should cover it.
-John
03/16/2006 (6:14 pm)
Hi guys!An easier way to disable the overexposure is to set SG_LIGHTING_OVERBRIGHT_AMOUNT (located in sgLighting.h) to 1.0. You'll still need to comment out the asm code changes from blender_asm.asm, but that should cover it.
-John
#44
edit: Oh yes, setting the overbright amount to 1.0 definitely underlights the interiors. Take a look: img78.imageshack.us/img78/3469/screenshot035000017wv.jpg
03/16/2006 (7:04 pm)
@John: I know we tried that, but I remember the interiors appearing underlit. However, that was probably because the terrain was still overbrighting. I'll see how it works out now.edit: Oh yes, setting the overbright amount to 1.0 definitely underlights the interiors. Take a look: img78.imageshack.us/img78/3469/screenshot035000017wv.jpg
#45
With a sunlight lighting of: direct: 0.1 0.1 0.2 1.0 ambient: 0.02 0.02 0.03 1.0
Dust from players is very overexposed, as well as shell casings, and most other DTS shapes.
The bloom effect is not visible through transparent DTS shapes (as far as I can tell)
When the DRL accounts for the darkness of the surroundings, the sky becomes white unless the skybox is turned off and the sky color set to black.
03/18/2006 (2:06 pm)
This works very well for daylight scenes, but it has some issues with night or low-light situations.With a sunlight lighting of: direct: 0.1 0.1 0.2 1.0 ambient: 0.02 0.02 0.03 1.0
Dust from players is very overexposed, as well as shell casings, and most other DTS shapes.
The bloom effect is not visible through transparent DTS shapes (as far as I can tell)
When the DRL accounts for the darkness of the surroundings, the sky becomes white unless the skybox is turned off and the sky color set to black.
#46
The overexposed dust is a known problem, and we're working on it. Shell casings and DTS shapes is a new issue. That sounds like the lightmaps are using the new sunlight values while the DTS shapes are using different (default?) values.
I'd need to see a couple of screenshots to really explain why the bloom effect isn't working, but in general terms, it'll only kick in on areas that are brighter than the given goal intensity.
As for the skybox, change your skybox. That's really the only option.
Again though, this is all just general feedback. Without screenshots, that's the best I can give.
03/18/2006 (2:56 pm)
@MidhirThe overexposed dust is a known problem, and we're working on it. Shell casings and DTS shapes is a new issue. That sounds like the lightmaps are using the new sunlight values while the DTS shapes are using different (default?) values.
I'd need to see a couple of screenshots to really explain why the bloom effect isn't working, but in general terms, it'll only kick in on areas that are brighter than the given goal intensity.
As for the skybox, change your skybox. That's really the only option.
Again though, this is all just general feedback. Without screenshots, that's the best I can give.
#47
trees and skybox, (this map is actually around 0.1 direct and 0.1+ ambient):
crossbones.us/images/drl1.jpg
The shell casings appear to be 'unlit' (at full brightness) even when laying on an extremely dark (shadowed) surface:
crossbones.us/images/drl2.jpg
(Edited...a few times...too much caffeine, perhaps)
03/18/2006 (3:17 pm)
The trees are the biggest issue in this scene, the skybox obviously needs to be darker...trees and skybox, (this map is actually around 0.1 direct and 0.1+ ambient):
crossbones.us/images/drl1.jpg
The shell casings appear to be 'unlit' (at full brightness) even when laying on an extremely dark (shadowed) surface:
crossbones.us/images/drl2.jpg
(Edited...a few times...too much caffeine, perhaps)
#48
What's your goal intensity? If it's not already lower, I would advise setting it to 0.3 or thereabouts. You might also want to cap your scale off at 3 or 4. That should prevent DRL from overbrighting your scene too much (unless you want your interiors to be that bright, in which case you'd have to modify the other art).
As for the 'unlit' shell casings... well, from the looks of it, they are unlit. Is the same kind of problem present in stock TLK? DRL really shouldn't be affecting this too much.
03/19/2006 (10:32 pm)
@MidhirWhat's your goal intensity? If it's not already lower, I would advise setting it to 0.3 or thereabouts. You might also want to cap your scale off at 3 or 4. That should prevent DRL from overbrighting your scene too much (unless you want your interiors to be that bright, in which case you'd have to modify the other art).
As for the 'unlit' shell casings... well, from the looks of it, they are unlit. Is the same kind of problem present in stock TLK? DRL really shouldn't be affecting this too much.
#49
Anyway I was just wondering if anyone has problems when they try to use the D3D renderer instead of the OpenGL renderer? In my example it crashes when I try to use the D3D renderer.
03/29/2006 (11:42 pm)
Thanks for the resource! It was really useful.Anyway I was just wondering if anyone has problems when they try to use the D3D renderer instead of the OpenGL renderer? In my example it crashes when I try to use the D3D renderer.
#50
EDIT: DRL2.0 isn't compatible with D3D either. We're going to have to write a straight D3D version of it. OpenGL->D3D emulation just plain doesn't work for this.
03/29/2006 (11:47 pm)
@Pisal: That's a known issue. The next release of DRL will hopefully fix that, but at this time, I can't give you any guarantees.EDIT: DRL2.0 isn't compatible with D3D either. We're going to have to write a straight D3D version of it. OpenGL->D3D emulation just plain doesn't work for this.
#51
04/29/2006 (12:14 pm)
I just added the resource. Works great! I have one question. When The camera looks a dark area and then looks anywhere else everything looks too bright, but in a second or two the scene gets darker which looks fine is there anyway to stop this?
#52
Using this resource, you can prevent the brightness/contrast of the scene adjusting by calling setChangeRates(0.0, 0.0);
Using DRL2.0, you can disable brightness/contrast adjustment by calling setDRLSkipTime(-1); , which will be accompanied by an increase in framerate.
04/29/2006 (12:29 pm)
@Donavan: I would recommend that you upgrade to DRL2.0Using this resource, you can prevent the brightness/contrast of the scene adjusting by calling setChangeRates(0.0, 0.0);
Using DRL2.0, you can disable brightness/contrast adjustment by calling setDRLSkipTime(-1); , which will be accompanied by an increase in framerate.
#53
I have just Implemented this resource, but on TGE 1.5, and missing all the code Alex Scarborough talks about..
#define SG_LIGHTING
and
#define SG_USE_TERRAIN_COLOR_CORRECTION
are both missing
and cant find the function sgTerrain::sgRenderBlockDetail() probably because i don't have sgNewMethods.cc :P ... Hope some one has expirienced the same.. and setting SG_LIGHTING_OVERBRIGHT_AMOUNT to 1.0 makes all my interriors totaly black...
01/08/2007 (12:31 pm)
Hi,I have just Implemented this resource, but on TGE 1.5, and missing all the code Alex Scarborough talks about..
#define SG_LIGHTING
and
#define SG_USE_TERRAIN_COLOR_CORRECTION
are both missing
and cant find the function sgTerrain::sgRenderBlockDetail() probably because i don't have sgNewMethods.cc :P ... Hope some one has expirienced the same.. and setting SG_LIGHTING_OVERBRIGHT_AMOUNT to 1.0 makes all my interriors totaly black...
#54
10/08/2008 (2:02 am)
Looking for using it on 1.5 too, DRL without shader would be good to have. 
Associate Alex Scarborough
In sgNewMethods.cc, find void sgTerrain::sgRenderBlockLightsBegin() (line 368). Replace the #endif at the end of the function with and that should return dynamic lights on terrain back to normal.