[Beta 5 Bug] Full Relight Does Nothing
by Ryan Mounts · in Torque 3D Professional · 08/12/2009 (7:53 am) · 4 replies
The first time you load a level, advanced lighting (AL) is enabled by default. If you switch to basic lighting (BL) and try to do a full relight, it does nothing, apparently because it can't find an existing lighting file. Now exit the mission and close Torque. Next time you open it, a full relight is performed upon mission load because it is starting up in BL and no lighting file exists. Now that a lighting file has been created, you can perform full relights ingame.
#2
I realize that an all-DTS level would not relight. I noticed this on the out-of-the-box Full template. Beta 5 shipped with no .ML files in the Levels folders. So when you run Full.exe (from a fresh install, or just delete the .ML files and make sure T3D starts up in AL mode), switch from AL to BL and do a Full Relight, the RelightStatus window pops up and immediately disappears. No relight occurred. Leave the mission in BL and close T3D. Now when you re-run Full.exe, the lighting will calculate during mission load. Now if you do a Full Relight from the World Editor, it will work.
I can't track it down either, since the relight works from the beginning in a Debug build. It seems like only the Release build has an issue.
08/12/2009 (2:10 pm)
Hey Tom,I realize that an all-DTS level would not relight. I noticed this on the out-of-the-box Full template. Beta 5 shipped with no .ML files in the Levels folders. So when you run Full.exe (from a fresh install, or just delete the .ML files and make sure T3D starts up in AL mode), switch from AL to BL and do a Full Relight, the RelightStatus window pops up and immediately disappears. No relight occurred. Leave the mission in BL and close T3D. Now when you re-run Full.exe, the lighting will calculate during mission load. Now if you do a Full Relight from the World Editor, it will work.
I can't track it down either, since the relight works from the beginning in a Debug build. It seems like only the Release build has an issue.
#3
08/13/2009 (6:37 am)
Actually, it looks like the problem occurs only when T3D starts up in AL. If I switch to BL via the World Editor, I cannot relight whether the .ML file exists or not. I have to start T3D in BL to be able to relight.
#4
So when you startup in AL mode, the AL SceneLighting instance gets initialized. Then when you switch to BL and try to relight, the new BL SceneLighting object cannot initialize itself, which leaves its mAvailableObjectTypes as zero, which causes the gClientContainer.findObjects() in SceneLighting::light() to find nothing, hence the relight fails.
If you startup in BL mode, however, the BL SceneLighting instance gets initialized, and all is fine because the AL Scenelighting instance seems perfectly happy not getting initialized.
Now the reason it was working "correctly" in debug mode and not in release, is because the AvailableSLInterfaces member variables (/lighting/lightingInterfaces.h) were not initialized in the constructor (naughty programmer). So in debug mode, mAvailableObjectTypes just had garbage in it, which allowed gClientContainer.findObjects() to find objects purely by accident causing the relight to succeed.
So please ignore my previous comments about the .ML file. That was just a wrong assumption on my part. That teaches me for assuming anything, especially during beta!
08/13/2009 (8:26 am)
It took alot of manual debugging using print statements spammed throughout a release build, but I tracked down the culprit. The problem lies in the SceneLighting constructor (/lighting/common/sceneLighting.cpp). There is a static flag there that allows only one initialization of a SceneLighting Object per execution. So when you startup in AL mode, the AL SceneLighting instance gets initialized. Then when you switch to BL and try to relight, the new BL SceneLighting object cannot initialize itself, which leaves its mAvailableObjectTypes as zero, which causes the gClientContainer.findObjects() in SceneLighting::light() to find nothing, hence the relight fails.
If you startup in BL mode, however, the BL SceneLighting instance gets initialized, and all is fine because the AL Scenelighting instance seems perfectly happy not getting initialized.
Now the reason it was working "correctly" in debug mode and not in release, is because the AvailableSLInterfaces member variables (/lighting/lightingInterfaces.h) were not initialized in the constructor (naughty programmer). So in debug mode, mAvailableObjectTypes just had garbage in it, which allowed gClientContainer.findObjects() to find objects purely by accident causing the relight to succeed.
So please ignore my previous comments about the .ML file. That was just a wrong assumption on my part. That teaches me for assuming anything, especially during beta!
Associate Tom Spilman
Sickhead Games
Only terrain and the outer parts of interiors work via the old static relight methods for light maps.
So if your level is all DTS models... a relight does nothing at all.