How do I get LOD working ?
by Necrode · in Torque 3D Professional · 11/27/2009 (12:42 am) · 9 replies
I want to start implementing LOD on some of the larger models in my mission. I'm modeling with XSI and exporting collada files. there still no documentation. how do I implement LOD ?
1. what should I be naming my meshes (in XSI) ?
2. is there some special hierarchy that needs to be created ?
3. can XSI even export a collada file that T3d can parse correctly as an LOD mesh ?
All I've seen is someone mention that this is what I should be naming my different meshes:
HighDetailMesh128
MedDetailMesh64
BB::LowDetailMesh32
however I've tried renaming my meshes this, but t3d doesn't see the meshes as separate levels of an LOD model. I've played around with the new 'detail' window of the shape editor, but again, T3d doesn't seem to recognize the separate meshes in my DTS file as various LOD models, so they're all being displayed at the same time.
1. what should I be naming my meshes (in XSI) ?
2. is there some special hierarchy that needs to be created ?
3. can XSI even export a collada file that T3d can parse correctly as an LOD mesh ?
All I've seen is someone mention that this is what I should be naming my different meshes:
HighDetailMesh128
MedDetailMesh64
BB::LowDetailMesh32
however I've tried renaming my meshes this, but t3d doesn't see the meshes as separate levels of an LOD model. I've played around with the new 'detail' window of the shape editor, but again, T3d doesn't seem to recognize the separate meshes in my DTS file as various LOD models, so they're all being displayed at the same time.
About the author
They locked me in here with a computer, and said I don't get to leave until I've completed a computer game.
#4
now I have an entirely new problem: for about 4 hours lods were working fine, and I kept tweaking them in the shape editor so that I could get seamless transitions between states... and now they're showing all kinds of bugs. some of them don't save their states when I save the Mission file, and now I have ones that are LOD-ing in reverse order, with the low detail when I'm close, and the high-detail when I'm far away. when I look into the Shape's .cs file, there's an unusually long list of those threshold amounts:
11/27/2009 (6:44 pm)
I've got the LODs working, I hadn't previously placed them in a hierarchy, with a "start01" null as a parent. but I tried that and it seemed to work. of course, I had to apply that quick fix patch so that I could adjust the pixel size/detail amounts multiple times in the shape editor. now I have an entirely new problem: for about 4 hours lods were working fine, and I kept tweaking them in the shape editor so that I could get seamless transitions between states... and now they're showing all kinds of bugs. some of them don't save their states when I save the Mission file, and now I have ones that are LOD-ing in reverse order, with the low detail when I'm close, and the high-detail when I'm far away. when I look into the Shape's .cs file, there's an unusually long list of those threshold amounts:
function Mailbox_02_LODDae::onLoad(%this)
{
%this.setDetailLevelSize("128", "1");
%this.setDetailLevelSize("64", "80");
%this.setDetailLevelSize("32", "32");
%this.setDetailLevelSize("80", "80");
%this.setDetailLevelSize("32", "32");
%this.setDetailLevelSize("80", "64");
%this.setDetailLevelSize("32", "16");
%this.setDetailLevelSize("64", "64");
%this.setDetailLevelSize("16", "16");
%this.setDetailLevelSize("64", "64");
%this.setDetailLevelSize("16", "32");
%this.setDetailLevelSize("64", "48");
%this.setDetailLevelSize("32", "16");
%this.setDetailLevelSize("1", "1");
%this.setDetailLevelSize("16", "32");
%this.setDetailLevelSize("48", "48");
%this.setDetailLevelSize("32", "16");
}
#5
11/29/2009 (5:02 pm)
@Necrode: Hmmm. Looks like something has gone wrong when TSShapeConstructor compressing the command list. Remove the commands from this function manually to start again. I'll try to figure out what is going wrong.
#6
So the highest detail level (128) is now the lowest (1). I guess you did that by mistake, but you can easily correct it in the Shape Editor.
11/29/2009 (5:55 pm)
I made some changes to TSShapeConstructor and feeding it your command list above saves to (the much nicer looking):function Mailbox_02_LODDae::onLoad(%this)
{
%this.setDetailLevelSize("128", "1");
%this.setDetailLevelSize("64", "48");
%this.setDetailLevelSize("32", "16");
}So the highest detail level (128) is now the lowest (1). I guess you did that by mistake, but you can easily correct it in the Shape Editor.
#7
should I be manually editing my shape file's .cs, removing the list entirely, and then redoing everything in the shape editor ? I feel like this problem is stemming from some bug in the shape editor, rather than my own files. I'm tempted to wait until the next release, and hopefully LOD will have taken a higher priority.
maybe I applied the bugfix incorrectly ? I tried replacing that section in the shapeEditorActions.ed.cs, but the instructions were pretty vague, maybe I overwrote something ?
this is the fix I tried: http://www.garagegames.com/community/forums/viewthread/106533
11/30/2009 (6:38 pm)
hey Chris, for looking into this, but I'm afraid I still don't follow you. should I be manually editing my shape file's .cs, removing the list entirely, and then redoing everything in the shape editor ? I feel like this problem is stemming from some bug in the shape editor, rather than my own files. I'm tempted to wait until the next release, and hopefully LOD will have taken a higher priority.
maybe I applied the bugfix incorrectly ? I tried replacing that section in the shapeEditorActions.ed.cs, but the instructions were pretty vague, maybe I overwrote something ?
this is the fix I tried: http://www.garagegames.com/community/forums/viewthread/106533
#8
The script you posted tells me that you reversed the LODs yourself in the Shape Editor. Perhaps you forgot to save after making some changes?
TSShapeConstructor was not doing a very good job of compressing the list of commands, but your long list and my short list give the exact same result.
To fix the problem, just manually remove the commands from the script and start again.
That is the right bugfix - just replace the named function with the indicated code. Which part did you find unclear?
BTW - I just noticed in an earlier post you said this:
To save changes to the shape, hit save in the Shape Editor, not File->Save Level.
11/30/2009 (10:44 pm)
Quote:hey Chris, for looking into this, but I'm afraid I still don't follow you.
The script you posted tells me that you reversed the LODs yourself in the Shape Editor. Perhaps you forgot to save after making some changes?
TSShapeConstructor was not doing a very good job of compressing the list of commands, but your long list and my short list give the exact same result.
To fix the problem, just manually remove the commands from the script and start again.
Quote:maybe I applied the bugfix incorrectly ? I tried replacing that section in the shapeEditorActions.ed.cs, but the instructions were pretty vague, maybe I overwrote something ?
That is the right bugfix - just replace the named function with the indicated code. Which part did you find unclear?
BTW - I just noticed in an earlier post you said this:
Quote:states when I save the Mission file
To save changes to the shape, hit save in the Shape Editor, not File->Save Level.
#9
one problem I kept having, was that I noticed my changes in the shape editor wouldn't save if I pressed the little "disk" save icon, but rather, only when I selected from another shape in the list, and that prompt window would come up asking if I wanted to save changes. I believe this is where some of my stuff began to get mixed up. perhaps I was selecting different shapes of the same dts in my world editor, making changes, and saving them. that might explain how I ended up with those long lists...
11/30/2009 (11:04 pm)
hey chris, thanks for the clarification, I'll give it a shot and hopefully won't be seeing the same errors.one problem I kept having, was that I noticed my changes in the shape editor wouldn't save if I pressed the little "disk" save icon, but rather, only when I selected from another shape in the list, and that prompt window would come up asking if I wanted to save changes. I believe this is where some of my stuff began to get mixed up. perhaps I was selecting different shapes of the same dts in my world editor, making changes, and saving them. that might explain how I ended up with those long lists...
Associate Chris Robertson
Collada Import GUI:
LOD: Controls how level-of-detail is generated for the model:
- DetectDTS: Attempts to detect whether the shape uses the DTS node markup scheme, and if found, uses TrailingNumber mode (below). If not detected, SingleSize mode is used. The shape is determined to be using DTS markup if there is a root level node called “base*” (where * is anything) with a child node called “start*”. See Scene hierarchy and LOD for more details.[/li]
- SingleSize: All geometry in the shape will be added to a single detail level, with size given by the value in the gui. The exception is collision meshes which will be at a fixed negative detail size.[/li]
- TrailingNumber: The detail size for geometry in the shape will be determined by the number at the end of the node (or mesh, if the modelling app does not distinguish between the two) name. An underscore before the number will be interpreted as a negative sign. eg. "mesh1" (size=1), "mesh3 1" (size=1), "mesh_1" (size=-1)[/li]
-----To summarize: if you’re used to exporting scenes to DTS, you are welcome to keep using the DTS scene hierarchy, and the exported COLLADA model should import exactly the same. If you’re new to Torque, or don’t want to use the DTS scene markup anymore, just put the detail size as a number at the end of the mesh name, and select TrailingNumber as the LOD type in the COLLADA import gui.