DTS: Multiple materials and memory
by Greg Gardinier · in Torque Game Engine · 04/05/2007 (5:54 pm) · 16 replies
How does torque handle multiple materials...
Example: If have an object that has several components that need to be 2sided I will make 2 separate materials. One that is 2sided and one that is just a standard material. However each material shares the same 512x512 texture.
So when then model shows up in torque how is the texture handled? Does torque load 2 separate version of the 512 texture into memory, or does it just load the one and then only inherit the attributes from that materials.
Would it be better to move the few 2sided objects I have to a different 128x128 texture...would that take up more or less memory?
Sorry if this is a really basic question but how torque handles textures in memory is somewhat of a mystery to me and I want to create the most optimized assets I can.
Edit: I just found this www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=4878
If I am reading that right Lfoster is saying that for every material my model is essentially duplicated? Is there anyway to avoid this by breaking up the models hierarchy before exporting? Taking one material and making it a separate mesh but have it linked in through the export hierarchy?
Example: If have an object that has several components that need to be 2sided I will make 2 separate materials. One that is 2sided and one that is just a standard material. However each material shares the same 512x512 texture.
So when then model shows up in torque how is the texture handled? Does torque load 2 separate version of the 512 texture into memory, or does it just load the one and then only inherit the attributes from that materials.
Would it be better to move the few 2sided objects I have to a different 128x128 texture...would that take up more or less memory?
Sorry if this is a really basic question but how torque handles textures in memory is somewhat of a mystery to me and I want to create the most optimized assets I can.
Edit: I just found this www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=4878
If I am reading that right Lfoster is saying that for every material my model is essentially duplicated? Is there anyway to avoid this by breaking up the models hierarchy before exporting? Taking one material and making it a separate mesh but have it linked in through the export hierarchy?
About the author
#2
04/05/2007 (6:37 pm)
Is there anyway around this? Like breaking up the model in the hierarchy...?
#3
I have an object with 7 textures using multisuboject texturing at roughly 2k polygons. This would mean the model has in fact 14k polygons. :(
Im an artist not a programmer so the simplest test I figured would be to place the same model with 1 texture and with the 7 multisubtextures in game and look at the fps diffrence.
I placed 200 static meshes of this object (with one texture) in the starter.fps stronghold. I got 16 fps and 62.5mspf
then I replaced the models with 200 times the object with the multiple textures and I get exactly 16fps and 62.5mspf again.
So I would venture it is no longer a problem? Or is there a better test I could do to see the impact of the multisub textures?
04/05/2007 (7:49 pm)
Tim, is this still true? And how could I test that? I have an object with 7 textures using multisuboject texturing at roughly 2k polygons. This would mean the model has in fact 14k polygons. :(
Im an artist not a programmer so the simplest test I figured would be to place the same model with 1 texture and with the 7 multisubtextures in game and look at the fps diffrence.
I placed 200 static meshes of this object (with one texture) in the starter.fps stronghold. I got 16 fps and 62.5mspf
then I replaced the models with 200 times the object with the multiple textures and I get exactly 16fps and 62.5mspf again.
So I would venture it is no longer a problem? Or is there a better test I could do to see the impact of the multisub textures?
#4
Using an object with multiple materials will use more memory and will eventually drain framerate and overall performance if used too frequently.
04/05/2007 (8:16 pm)
Poly count won't directly affect frame rate, many other factors such as lighting, shadowing etc do. It's not that your model has extra polys added to it, it's that it will be rendered in the scene 7 times (thus your 2k model effectively becomes a 14k model).Using an object with multiple materials will use more memory and will eventually drain framerate and overall performance if used too frequently.
#5
If I export the whole shebang in one DTS, is that less efficient than exporting a trunk object, a leaf object, and a branch object as individual DTS's?
Or does this issue only affect multi/subobjects with multiple textures?
04/05/2007 (11:39 pm)
Does this same issue apply to DTS objects created from multiple objects in 3DS Max? Let's say I have a tree with the trunk, branches, and leaf canopy as separate objects with their own textures.If I export the whole shebang in one DTS, is that less efficient than exporting a trunk object, a leaf object, and a branch object as individual DTS's?
Or does this issue only affect multi/subobjects with multiple textures?
#6
Applying multiple materials to a single mesh will create the need for Torque to render it in the scene per material.
04/06/2007 (12:50 am)
I believe a tree, that is broken up into various pieces and exported as a single dts file is fine. Applying multiple materials to a single mesh will create the need for Torque to render it in the scene per material.
#7
04/06/2007 (2:41 am)
Thanks Tim. ;)
#8
04/06/2007 (4:10 am)
Yeap, this affects only DTS objects, where multi-textures applied onto SAME mesh. Having separate meshes with different textures does not "add extra polys" for render.
#9
04/06/2007 (4:25 am)
Bee-yootiful! Thanks for the info. =)
#10
Does anyone know if TGEA does it likewise (multiple renderings) ?
04/06/2007 (6:41 am)
Now this was really interesting info!Does anyone know if TGEA does it likewise (multiple renderings) ?
#11
I wanted to know how textures were handled in memory. So if I have two objects (as in two separate DTS files ) sharing the same 512x512 texture is that 512x512 texture going to take up double the memory space... In other words would I be better of using one 512x512 and then another 256x256 texture for a smaller object instead of just using the one 512x512 texture?
I am also interested to hear if this has changed in TGEA.
04/06/2007 (8:03 am)
Also if someone has some info on my original question of how memory is handled that would be helpful as well. I wanted to know how textures were handled in memory. So if I have two objects (as in two separate DTS files ) sharing the same 512x512 texture is that 512x512 texture going to take up double the memory space... In other words would I be better of using one 512x512 and then another 256x256 texture for a smaller object instead of just using the one 512x512 texture?
I am also interested to hear if this has changed in TGEA.
#12
04/06/2007 (8:17 am)
All unique textures are only loaded once, regardless of how many objects use the texture.
#13
I mean, if you have DIF object and DTS object in same folder, and two object shares same texture - it will be loaded twice, as Torque create separate materials for DTS and DIF objects.
This can be easily found by using RivaTuner software - it shows the load of video memory.
04/06/2007 (8:25 am)
Allyn, this is correct, but only if you use same texture between same material manager instance.I mean, if you have DIF object and DTS object in same folder, and two object shares same texture - it will be loaded twice, as Torque create separate materials for DTS and DIF objects.
This can be easily found by using RivaTuner software - it shows the load of video memory.
#14
04/06/2007 (8:39 am)
Well, yeah.
#15
04/06/2007 (8:46 am)
Thanks for the responce Allyn, and thanks for the RivaTuner Tip. I wasn't aware of that.
#16
02/12/2009 (11:02 am)
I need to know how TGEA 1.8.1 handles multiple textures on the same mesh. Is it the same as TGEA?
Torque Owner Tim Heldna