Turning off the automatic mission relight
by Manoel Neto · in Torque Game Engine · 02/23/2005 (11:01 am) · 6 replies
Hi,
Our whole game is set in a single mission file. There are small villages and houses scattered around the map, and lots of trees. It's a no-brainer that the mission relight times are growing more and more as we add more detail to the map.
Since Torque does *not* see new files added to it's folders, we have to re-open the .EXE everytime we want to add a new art asset to the map. And then we are forced to wait for the automatic relight process, that's will reach the 5 minute mark pretty soon.
Did anyone have success in forcing TGE to not relight the mission automatically during load? I first tried changing the missionDownload.cs to make it skip the lightScene() function, but it would load none of the existing lightmaps. I then went into the source, tried to fool it into using the same .ML file every time, but then I found it performed lots of extra checks to validate the ML file, what makes me think if I'll just make TGE crash nice and hard if I force it to load a different ML file...
So, can someone help me?
Our whole game is set in a single mission file. There are small villages and houses scattered around the map, and lots of trees. It's a no-brainer that the mission relight times are growing more and more as we add more detail to the map.
Since Torque does *not* see new files added to it's folders, we have to re-open the .EXE everytime we want to add a new art asset to the map. And then we are forced to wait for the automatic relight process, that's will reach the 5 minute mark pretty soon.
Did anyone have success in forcing TGE to not relight the mission automatically during load? I first tried changing the missionDownload.cs to make it skip the lightScene() function, but it would load none of the existing lightmaps. I then went into the source, tried to fool it into using the same .ML file every time, but then I found it performed lots of extra checks to validate the ML file, what makes me think if I'll just make TGE crash nice and hard if I force it to load a different ML file...
So, can someone help me?
About the author
Recent Threads
#2
-- EDIT --
Works like a charm! Thanks! The mission still relights if you add/remove interiors, but that's OK, since it'll keep the old lighting file if I just mess with DTS'es, triggers and etcetera, what was my main concern.
02/24/2005 (10:31 am)
Thanks, I'll try that. I tried messing with the CRC before, but I think it wa somewhere else.-- EDIT --
Works like a charm! Thanks! The mission still relights if you add/remove interiors, but that's OK, since it'll keep the old lighting file if I just mess with DTS'es, triggers and etcetera, what was my main concern.
#3
Does this mean that we can calculate the lightmaps during dev, then comment out those lines in our final version and used the precomputed lightmaps? So that when someone plays the game it wont compute the lighting and the mission loads alot faster for the player?
02/25/2005 (4:43 pm)
@RobertDoes this mean that we can calculate the lightmaps during dev, then comment out those lines in our final version and used the precomputed lightmaps? So that when someone plays the game it wont compute the lighting and the mission loads alot faster for the player?
#4
03/01/2005 (5:35 am)
That almost begs to be a simple script call or a $Prefs setting so you dont have to rebuild the engine for a release version.
#5
03/01/2005 (5:42 am)
In prefs.cs:$pref::sceneLighting::cacheLighting = 1; $pref::sceneLighting::cacheSize = 20000; $pref::sceneLighting::purgeMethod = "lastCreated";
#6
That change tweak doesn't need to be undone for release version. Torque will still load a cached ML file, like it always did. Even better, it just becomes more tolerant when it comes to deciding the cached lighting is valid or not.
It will *only* force a relight during load if the number (and maybe ordering) of "lightable" entities has changed (aka: changes on the terrain and interiors). Changes on other objects (DTS shapes, replicators, triggers, paths etc) will not make the engine purge the cache, and it will just load the cached lighting instead.
03/01/2005 (12:27 pm)
Chris, you might've misread it. That change tweak doesn't need to be undone for release version. Torque will still load a cached ML file, like it always did. Even better, it just becomes more tolerant when it comes to deciding the cached lighting is valid or not.
It will *only* force a relight during load if the number (and maybe ordering) of "lightable" entities has changed (aka: changes on the terrain and interiors). Changes on other objects (DTS shapes, replicators, triggers, paths etc) will not make the engine purge the cache, and it will just load the cached lighting instead.
Torque 3D Owner Robert Blanchet Jr.
U32 SceneLighting::calcMissionCRC() { // .... // return(calculateCRC(crc.address(), sizeof(U32) * crc.size(), 0xffffffff)); return 0; }common/server/missionLoad.cs
function loadMissionStage2() { // .... // $missionCRC = getFileCRC( %file ); $missionCRC = 0; // .... }You'll have to light the mission the first time, after that it shouldn't have to unless you specifically ask to relight in the mission editor.