Primitive type in DTS models
by Robert Mikuszewski · in Torque Game Engine Advanced · 03/02/2009 (7:09 am) · 9 replies
Hi!
Today I was looking at out game using NVPerfHUD, and I found something very strange. I realised, that our models have much more primitives in game, than in 3dmax. After some research, I found, that models are rendered using D3DPT_TRIANGLESTRIP, which indicates, that the DTSExporter converts vertex and index buffers from trinaglelist to trianglestrip format, which increases sometimes drasticly primitive count in models (6000 trianglelist -> 10500 trianglestrip). What is the reason of this? As far as I know, graphic cards work better with trianglelists?
Is there a way to make exporter use trianglelist?
Is there a source for dts exporter, so we could change this?
Today I was looking at out game using NVPerfHUD, and I found something very strange. I realised, that our models have much more primitives in game, than in 3dmax. After some research, I found, that models are rendered using D3DPT_TRIANGLESTRIP, which indicates, that the DTSExporter converts vertex and index buffers from trinaglelist to trianglestrip format, which increases sometimes drasticly primitive count in models (6000 trianglelist -> 10500 trianglestrip). What is the reason of this? As far as I know, graphic cards work better with trianglelists?
Is there a way to make exporter use trianglelist?
Is there a source for dts exporter, so we could change this?
#2
I sent you an e-mail. Please, contact me here, if you won't receive it, or you have any problem with response.
03/02/2009 (12:10 pm)
I'm looking for anything that is appropriate for Max2009, but if you have any other code, I would be also interested. Maybe it can be adapted easly to the newer version.I sent you an e-mail. Please, contact me here, if you won't receive it, or you have any problem with response.
#3
You can try changing smUseTriangles to true and smUseOneStrip to false.
You may also try setting both to false and increasing smMinStripSize, which I believe will leave any strips from the exporter intact unless they are smaller than the size indicated, in which case they will put them in a triangle list.
03/03/2009 (5:35 am)
I think it's not the exporter doing it but the TSMesh class when loading/assembling. I haven't tested any of this, but here's something you can try. Near the top of tsMesh.cpp there are these default values:bool TSMesh::smUseTriangles = false; // convert all primitives to triangle lists on load bool TSMesh::smUseOneStrip = true; // join triangle strips into one long strip on load S32 TSMesh::smMinStripSize = 1; // smallest number of _faces_ allowed per strip (all else put in tri list)
You can try changing smUseTriangles to true and smUseOneStrip to false.
You may also try setting both to false and increasing smMinStripSize, which I believe will leave any strips from the exporter intact unless they are smaller than the size indicated, in which case they will put them in a triangle list.
#4
There is a patch available to upgrade the TGE exporter source to the Max 9 exporter source here www.garagegames.com/static/pg/resource/15015.max2dtsexporter_max9_patch.zip.
Cheers
03/03/2009 (6:32 am)
Okay, I was probably wrong, looking at the Max exporter they do a lot of stripifying, so that may be where the increased triangle count is occurring. You can still try those static values and see if it helps.There is a patch available to upgrade the TGE exporter source to the Max 9 exporter source here www.garagegames.com/static/pg/resource/15015.max2dtsexporter_max9_patch.zip.
Cheers
#5
I'm wondering, if the code of TGE exporter is also available for TGEA users?
03/03/2009 (12:20 pm)
Thank you Gerald for the hint. I was told, that this flag actually works, and when it's properly set the engine actually is converting models to trianglelist when loading. The problem is, that the process of loading models is much, much longer, so it is still not the solution I was looking for.I'm wondering, if the code of TGE exporter is also available for TGEA users?
#6
03/03/2009 (1:22 pm)
I'm not sure what the license implications are for that. I *thought* that having a TGEA license also gave you a TGE license since you could upgrade from TGE to TGEA for the difference, but I can't find anything on that now so I'm not sure. I always figured that was the reason they didn't ship the various exporter stuff and the DTS SDK with TGEA as well. Check your account page and see if you have a download link for TGE. If not, I don't know, unless we can get an answer from somebody from GG.
#7
03/03/2009 (1:25 pm)
i'm unfamiliar with this exporter, but if it's automatically generating LODs that could cause an increase in total triangles in the DTS.
#8
@Orion: I'm quite sure, that is not the case.
03/03/2009 (2:22 pm)
@Gerald: Unfortunately TGEA license means only TGEA license. It's strange for me, that there is no exporter source in TGEA.@Orion: I'm quite sure, that is not the case.
#9
If I get some time later I'll see if I can take a look at the exporter and try to build a copy that doesn't convert to strips.
Also, you may be able to load the files with the convert to triangle list option set, and then save them back out to file using TSShape::write. That may or may not save it out using triangle lists, I'm not too sure but it's something you could try. If it works you could build a separate tool with it to fix all of your DTS before adding them to your project.
03/03/2009 (3:33 pm)
Ah, well that sucks. I guess the reason that they don't provide the source for the exporter is because it's not a standalone source code and uses part of the TGE engine code to compile, so if you don't have a TGE license you won't have those files.If I get some time later I'll see if I can take a look at the exporter and try to build a copy that doesn't convert to strips.
Also, you may be able to load the files with the convert to triangle list option set, and then save them back out to file using TSShape::write. That may or may not save it out using triangle lists, I'm not too sure but it's something you could try. If it works you could build a separate tool with it to fix all of your DTS before adding them to your project.
Torque Owner TheGasMan
G.A.S. [+others]
What version of Max are you using Robert ?
I would like the source for Max9...if versions are used.
BTW Robert, your email address listed in your profile bounced..I had wanted to show this to you: A Forum Post