CG Dynamic Gamma & Water Upgrade
by Paul Jan · 07/11/2006 (12:43 pm) · 171 comments
Download Code File
I've merged the code files with the sample files because I found the gui was required, and with other changes goes over the 100k limit on uploads - the full file can be downloaded here:
dynamic_gamma.zip
Update (2006/10/29): Torque 1.5 version code here:
Update (2006/11/23): Some more bug fixes added.... dynamic_gamma-1_5.zip
I'll leave the old one up for folks who aren't moving to Torque 1.5. I haven't had the chance to test it as well as I'd like, so let me know if its not working right!
Before/After:


Outdoor Before/After


Night Before/After


To be honest, the code is a cobbled mess in some places. Still framerate is pretty good, and I've tested it on ATI (radeon 9800) and NV ( 6800 GS) platforms.
It should pretty much be unzip, copy into TLK & recompile. You will still need to install the Nvidia CG libraries as well.
Previous resources and credit where credit is due:
CG Water (Manoel Neto) has not changed from the original resource (adjusted to make DRL work)
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=10357
+ Sky::render fix by David Laurie
CG Dynamic Gamma is similar in effect to the DRL 2.0 resource (Alex "Delerium" Scarborough)
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=10232
using CG shaders increases performance.
It also takes parts from 5.10 Game Programming Gems 4 "Dynamic Gamma Using Sampled Scene Luminance", and VERC "Real time TRON 2.0" collective.valve-erc.com/index.php?go=tron1
edit (Aug 11, 2006) Fixed bloom-crippling bug.
I've merged the code files with the sample files because I found the gui was required, and with other changes goes over the 100k limit on uploads - the full file can be downloaded here:
dynamic_gamma.zip
Update (2006/10/29): Torque 1.5 version code here:
Update (2006/11/23): Some more bug fixes added.... dynamic_gamma-1_5.zip
I'll leave the old one up for folks who aren't moving to Torque 1.5. I haven't had the chance to test it as well as I'd like, so let me know if its not working right!
Before/After:


Outdoor Before/After


Night Before/After


To be honest, the code is a cobbled mess in some places. Still framerate is pretty good, and I've tested it on ATI (radeon 9800) and NV ( 6800 GS) platforms.
It should pretty much be unzip, copy into TLK & recompile. You will still need to install the Nvidia CG libraries as well.
Previous resources and credit where credit is due:
CG Water (Manoel Neto) has not changed from the original resource (adjusted to make DRL work)
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=10357
+ Sky::render fix by David Laurie
CG Dynamic Gamma is similar in effect to the DRL 2.0 resource (Alex "Delerium" Scarborough)
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=10232
using CG shaders increases performance.
It also takes parts from 5.10 Game Programming Gems 4 "Dynamic Gamma Using Sampled Scene Luminance", and VERC "Real time TRON 2.0" collective.valve-erc.com/index.php?go=tron1
edit (Aug 11, 2006) Fixed bloom-crippling bug.
About the author
#62
Use CG Toolkit 1.4.1. Do not use the 1.5 beta. it will not work properly.
@Paul
I'll take a look at your conversion to see if there is any problem. my port seems to work fine.
BTW
all the playgui does it show the proper water reflection. the default one just doesnt reflect the world objects, just the sky. Also Remember you have to actually set the normal maps under the water datablock
10/30/2006 (2:46 pm)
@Vince McMullin Use CG Toolkit 1.4.1. Do not use the 1.5 beta. it will not work properly.
@Paul
I'll take a look at your conversion to see if there is any problem. my port seems to work fine.
BTW
all the playgui does it show the proper water reflection. the default one just doesnt reflect the world objects, just the sky. Also Remember you have to actually set the normal maps under the water datablock
#63
Bugs
--------
CG Under Water doesnt work
DRL
- setBaseStrength doesnt work
- setBlurSamples doesnt work
Pretty much the code is broken
I'll go fix the water bugs. but and will attempt fixing the DRL bugs. but i'm sure you might be better at that.
Edit:
Okay, i fixed all the DRL bugs. only thing left to fix is the underwater code. i will have the code online soon
10/30/2006 (3:42 pm)
Okay, DRL works, same with CG water. Bugs
--------
CG Under Water doesnt work
DRL
- setBaseStrength doesnt work
- setBlurSamples doesnt work
Pretty much the code is broken
I'll go fix the water bugs. but and will attempt fixing the DRL bugs. but i'm sure you might be better at that.
Edit:
Okay, i fixed all the DRL bugs. only thing left to fix is the underwater code. i will have the code online soon
#64
i just regot the 1.5 one, it doesnt seem to have changed
, and its still broken
10/30/2006 (5:41 pm)
did you upload it right?i just regot the 1.5 one, it doesnt seem to have changed
, and its still broken
#65
10/30/2006 (5:48 pm)
paul ill stop trying to rush you.. but ya know ;) make sure it has all the fixes youve added over time, and that it works in debug, and that all the scripts dont give errors
#66
- This is for OpenGL as well, right?
- In default TGE, underwater you take no damage and you can't even swim up properly (unless you look and move up) by pressing jump. Is this possible in this one? (damage and proper swimming)
Oh, and it looks damn impressive :)
10/30/2006 (6:22 pm)
I have some noob questions:- This is for OpenGL as well, right?
- In default TGE, underwater you take no damage and you can't even swim up properly (unless you look and move up) by pressing jump. Is this possible in this one? (damage and proper swimming)
Oh, and it looks damn impressive :)
#67
Dude. this has nothing to do with that. If you want proper swimming. then you got to script that yourself. All this resource does is change the way the water is being Rendered.
@Eric "Intangir" Rutherford
His code is still broken. I got everything working now. (after some debugging) except for the underwater code. still seems broken. but will take another hack at it later today.
10/30/2006 (7:02 pm)
@Nikhil SharmaDude. this has nothing to do with that. If you want proper swimming. then you got to script that yourself. All this resource does is change the way the water is being Rendered.
@Eric "Intangir" Rutherford
His code is still broken. I got everything working now. (after some debugging) except for the underwater code. still seems broken. but will take another hack at it later today.
#68
i noticed there is alot of things added since the original resource
10/30/2006 (7:15 pm)
@T Squared does yours work in debug mode too?cause the 1.5 version is throwing asserts in debug because of not restoring a canonical state or whatever, after gl calls, i think its after fluidrenderi noticed there is alot of things added since the original resource
#69
@Eric "Intangir" Rutherford
I just built a release. but a debug.
10/30/2006 (7:18 pm)
Good news guys. I got underwater working. but its seems to not render the lightmaps underwater. a bit strange. going to have to take a better look at it. @Eric "Intangir" Rutherford
I just built a release. but a debug.
#70
whats the deal with so many different versions of this resource, its very confusing. i dont know which one to try to merge in. the 1.5 one doesnt work for me though im pretty well stumped with this whole thing
10/30/2006 (7:37 pm)
geez i just did a compare between the last version, and the 1.5 version, so many changeswhats the deal with so many different versions of this resource, its very confusing. i dont know which one to try to merge in. the 1.5 one doesnt work for me though im pretty well stumped with this whole thing
#71
I finally got everything working right. Including underwater working fully properly. I will have the code uploaded shortly.
Edit:
Here is the new Port. working and tested for TGE 1.5, please let me know if you got a problem
e2g.50webs.com/dynamic_gamma-1_5_port.rar
@Paul Jan
The code is not going to be up on the server for too long. you might want to grab it and upload it to yours.
Edit:
Okay found another bug. the SetMinExposure() method is broken again. i think its taking an int value rather then a float value. i'm not sure where that might be. so its up to you Paul to fix that.
Edit:
Okay. fixed. just changed dAtoi to dAtof in scenegraph.cc Code has been updated
Edit:
Another Bug
SetChangeRate(bool,int); seems to be missing again.
I think i merged an earlier Build. will fix later
10/30/2006 (7:39 pm)
Good News Guys!I finally got everything working right. Including underwater working fully properly. I will have the code uploaded shortly.
Edit:
Here is the new Port. working and tested for TGE 1.5, please let me know if you got a problem
e2g.50webs.com/dynamic_gamma-1_5_port.rar
@Paul Jan
The code is not going to be up on the server for too long. you might want to grab it and upload it to yours.
Edit:
Okay found another bug. the SetMinExposure() method is broken again. i think its taking an int value rather then a float value. i'm not sure where that might be. so its up to you Paul to fix that.
Edit:
Okay. fixed. just changed dAtoi to dAtof in scenegraph.cc Code has been updated
Edit:
Another Bug
SetChangeRate(bool,int); seems to be missing again.
I think i merged an earlier Build. will fix later
#72
so is this building and running? or is that last bug causing an error?
10/30/2006 (10:12 pm)
oh boy ;)so is this building and running? or is that last bug causing an error?
#73
also it still has the issue with not restoring the same state after glcalls so its not debugable ;(
10/30/2006 (10:45 pm)
hrm when i try to load the .mis file in your zip T Squared it segfaults right out immediatelyalso it still has the issue with not restoring the same state after glcalls so its not debugable ;(
#74
10/30/2006 (11:02 pm)
still no luck here, i tried cg 1.4.1, same exact errors
#75
10/31/2006 (6:35 am)
I had to build as release to get this resource to work. Looks amazing but its not debuggable?
#76
@Eric "Intangir" Rutherford
You made sure you built a release right? the file(exe), should be no bigger then 2.95MB, not 7.49MB.
@Vince McMullin
To debug the source, just echo thing to the console. and you can check the bugs by hitting '~', or by reading the console.log file afterwards.
10/31/2006 (9:43 am)
My build has all the bug fixes. the last bug i found, really isnt a bug. just missing a function, that can be useful. @Eric "Intangir" Rutherford
You made sure you built a release right? the file(exe), should be no bigger then 2.95MB, not 7.49MB.
@Vince McMullin
To debug the source, just echo thing to the console. and you can check the bugs by hitting '~', or by reading the console.log file afterwards.
#77
There are still a couple of differences though - I think mine picked up a couple more lines of code from 1.5 along the way.
10/31/2006 (1:12 pm)
Totally my fault. Somehow I picked an early buggy version to merge. Updated mine with T Squared's port.There are still a couple of differences though - I think mine picked up a couple more lines of code from 1.5 along the way.
#78
printing things to console is a lousy way of debugging ;)
i also tried release but the stronghold.mis file crashes immediately when i try to load it
ill try the new version but i hope this one is problem free
10/31/2006 (2:21 pm)
this needs to be fixed so it can run in debug modeprinting things to console is a lousy way of debugging ;)
i also tried release but the stronghold.mis file crashes immediately when i try to load it
ill try the new version but i hope this one is problem free
#79
10/31/2006 (2:39 pm)
I dont understand why would you have so much trouble compiling this and getting it to run. esp on the release. Try reinstalling the SDK, but in a different directory. to guarentee a fresh build. then copy and paste everything over. except the mis file. then try to see how that works.
#80
and it does run
as long as i dont use that .mis file ;)
everything is compiling and running (in release)
but it just doesnt run in debug
and also it doesnt work! like there is no drl or water for me
ill try again with this newest version
i have tried with Cg 1.4.1 and Cg 1.5
10/31/2006 (8:07 pm)
it does compileand it does run
as long as i dont use that .mis file ;)
everything is compiling and running (in release)
but it just doesnt run in debug
and also it doesnt work! like there is no drl or water for me
ill try again with this newest version
i have tried with Cg 1.4.1 and Cg 1.5

Torque Owner Paul Jan