[Fixed]Interior LOD Problems.
by CSMP · in Torque Game Engine · 09/02/2009 (12:57 am) · 6 replies
Ever since I've started messing with the MG Starter Kit I've noticed that the Texture and Model LOD for Interiors "pops" at a distance thats WAY closer than in stock TGE.
Now I've tried to find any differances between the Stock TGE and MG Starter Kit scripts but have not been able to find anything that has fixed this problem.
I think the worst part is that some pieces of a given interior will "pop" before others and this looks very strange.
Without LOD "POP"
With LOD "POP"
Now if you can notice this obviously is happening to soon, as in Stock TGE the interior looks fine until it is out of sight, It has something to do with the MGSK Scripts and the only place that modifies the culprit code is the Options Menu, Though I have the settings all the way up, and I have looked through the code with no results!?
Now I've tried to find any differances between the Stock TGE and MG Starter Kit scripts but have not been able to find anything that has fixed this problem.
I think the worst part is that some pieces of a given interior will "pop" before others and this looks very strange.
Without LOD "POP"
With LOD "POP"
Now if you can notice this obviously is happening to soon, as in Stock TGE the interior looks fine until it is out of sight, It has something to do with the MGSK Scripts and the only place that modifies the culprit code is the Options Menu, Though I have the settings all the way up, and I have looked through the code with no results!?
#2
I just tried the .setdetaillevel on one of my interiors and it did nothing, checked the console for any errors and it seems like it should have worked but no change, also searched for setDetailLevel and no deal.
possible codeblocks:(inside Options.cs: SaveSettings function)
I've tried changing the $pref variables to reflect that of known working $prefs and it has not changed anything from what i've seen.
09/02/2009 (4:44 pm)
Thanks for the help, this has been bugging me since I started with the MG Starter Kit, and before I release my demo I would like to have this fixed.I just tried the .setdetaillevel on one of my interiors and it did nothing, checked the console for any errors and it seems like it should have worked but no change, also searched for setDetailLevel and no deal.
possible codeblocks:(inside Options.cs: SaveSettings function)
%temp = 5 - mFloor( OP_BuildingTexSlider.getValue() );
if ( $pref::OpenGL::interiorMipReduction != %temp )
{
$pref::OpenGL::interiorMipReduction = %temp;
setOpenGLInteriorMipReduction( $pref::OpenGL::interiorMipReduction );
%flushTextures = true;
}Though: $pref::OpenGL::interiorMipReduction = "0";$pref::TS::detailAdjust = $min_TSDetailAdjust + OP_ShapeSlider.getValue() * ( $max_TSDetailAdjust - $min_TSDetailAdjust ); $pref::Interior::detailAdjust = OP_InteriorDetailSlider.getValue();And: $pref::TS::detailAdjust = "1";
I've tried changing the $pref variables to reflect that of known working $prefs and it has not changed anything from what i've seen.
#3
EDIT: oh you've already tried that! I should refresh more often :D
09/02/2009 (5:03 pm)
You could maybe try overriding the $pref::Interior::detailAdjust preference that gets set by the Graphics Options... I think that it is also calculated in combination with the $pref::ts::detailAdjust preference -- so it could be the one interfering with the other, maybe.EDIT: oh you've already tried that! I should refresh more often :D
#4
I never noticed that before, I'll take those two into consideration as well! :)
Edit:
Somehow the MGSK Options.cs/Options.gui is setting Building, Texture AND Shapes/Vehicles to load there LOD settings before the hardcoded values...
I've noticed when I started with the MGSK that the vehicles hardcoded LOD were being nulled along time ago, though I now feel its relevant to the problem at hand.
Edit2: I'm going to go through and set the $pref variables to stock TGE settings and remove the suspect Options.cs $prefs and functions to see if I can somehow make it use the hardcoded LOD distance again...
09/02/2009 (5:10 pm)
lol, ya i'm trying to search for solutions and posting results fairly often.I never noticed that before, I'll take those two into consideration as well! :)
Edit:
Somehow the MGSK Options.cs/Options.gui is setting Building, Texture AND Shapes/Vehicles to load there LOD settings before the hardcoded values...
I've noticed when I started with the MGSK that the vehicles hardcoded LOD were being nulled along time ago, though I now feel its relevant to the problem at hand.
Edit2: I'm going to go through and set the $pref variables to stock TGE settings and remove the suspect Options.cs $prefs and functions to see if I can somehow make it use the hardcoded LOD distance again...
#5
I still cant manage to get the hardcoded LOD's to take effect... :(
09/02/2009 (11:02 pm)
WOW, this is really starting to amaze me at this point, I've reset the $prefs and commented out almost all of the graphical code from the OptionsDlg.cs and a few functions found in the canvas.cs.I still cant manage to get the hardcoded LOD's to take effect... :(
#6
http://www.garagegames.com/community/forums/viewthread/34246
The changes made by Bryce Kaminsky in the resource posts fixed my main interior problems... (I may have been thinking too much into my problem and made debugging a hassle)
Thanks for the help guys!
I still dont understand why I had to resort to engine changes as my engine was based on TGE1.5.2 and in the 1.5.2 scripts the Interiors show up fine, it was only when I switched to MGSK(Which worked with my core.exe) that the Interiors started using the premature MIPMapping!? (Oh well, fixed either way) :)
09/03/2009 (2:53 am)
OK, This resource fixed all my problems!http://www.garagegames.com/community/forums/viewthread/34246
The changes made by Bryce Kaminsky in the resource posts fixed my main interior problems... (I may have been thinking too much into my problem and made debugging a hassle)
Thanks for the help guys!
I still dont understand why I had to resort to engine changes as my engine was based on TGE1.5.2 and in the 1.5.2 scripts the Interiors show up fine, it was only when I switched to MGSK(Which worked with my core.exe) that the Interiors started using the premature MIPMapping!? (Oh well, fixed either way) :)
Torque 3D Owner Thomas Bang
There is a method called setDetailLevel(number);
So it is possible to set the current LOD for a interior at runtime. Maybe the MG Starter Kit does something like that.
Example: Your interior has 6 LODs and ingame the id 1500.
1500.setDetailLevel(0);
1500.setDetailLevel(1)
...
1500.setDetailLevel(5);
0 is always the highest LOD.
The LODs are always set in Constructor.
Scene -> Manage Entities... -> detail_number
Scene -> Manage Entities... -> min_pixels
TGE is looking for detail_number and min_pixels in your DIF and shows the appropriate LOD. But with setDetailLevel you can explicit set the current LOD-Stage.