Shapebase material question
by Ronald J Nelson · in Torque Game Engine Advanced · 09/04/2008 (9:44 pm) · 3 replies
When switch materials for the skin of a shapebase object like a vehicle or player, does the material's base texture have to be in the same folder as that of the dts file of the shapebase object?
#2
Data
Shapes
Humans
Warrior Wizard
You have DTS' in the Warrior and Wizard folders. Now lets say you call setSkinName("RedCoat") on a DTS from the Warrior folder. The engine will look for that skin in folders in the following order: Warrior-Humans-Shapes-Data. So if that texture is in the Wizard folder it will not be found. So, in this example, any shared textures between Warrior and Wizard should be placed in the Humans folder and they can be used by both.
This technique works for all kinds of objects (DTS, ShapeBase or not, and DIF) even if the do not use setSkinName. With this method, textures that are shared between models only "live" in one place in your build, thus reducing its disk footprint and its memory footprint (since the texture only needs to be loaded once).
09/16/2008 (8:53 am)
A DTS can find a texture that is in the same folder or "above" that folder, but not any folders "lower" or even at a "peer" level. This works for skin swapping too. Try to put common textures in folders above where the model DTS resides. For example, say you have the following structure:Data
Shapes
Humans
Warrior Wizard
You have DTS' in the Warrior and Wizard folders. Now lets say you call setSkinName("RedCoat") on a DTS from the Warrior folder. The engine will look for that skin in folders in the following order: Warrior-Humans-Shapes-Data. So if that texture is in the Wizard folder it will not be found. So, in this example, any shared textures between Warrior and Wizard should be placed in the Humans folder and they can be used by both.
This technique works for all kinds of objects (DTS, ShapeBase or not, and DIF) even if the do not use setSkinName. With this method, textures that are shared between models only "live" in one place in your build, thus reducing its disk footprint and its memory footprint (since the texture only needs to be loaded once).
#3
09/16/2008 (10:17 am)
Thanks Mark. That is very helpful information.
Torque Owner Ronald J Nelson
Code Hammer Games
Thanks in advance.