Do the textures HAVE to be in the same location as the exported DTS?
by Nicolai Dutka · in Torque Game Engine Advanced · 11/12/2009 (3:31 pm) · 8 replies
I was always told that when I export a mesh to DTS, the texture I used on that mesh must be located in the same folder as that DTS, otherwise the texture will not show up on the DTS shape. Is there any way around this? I'd like to have:
bin/data/shapes
bin/data/textures
Each one of those with the following example sub-folders:
Shapes:
bin/data/shapes/vehicles/cars
bin/data/shapes/vehicles/trucks
bin/data/shapes/vehicles/other
bin/data/shapes/buildings/houses
Textures:
bin/data/textures/metal
bin/data/textures/paint
bin/data/textures/wood
Then, I just create a collection of 1024x tiling textures to place in each of the texture folders and my meshes can use anything from the collection as a sub-object texture. Any specialized textures would be kept as small as possible and added only as needed (such as a car's emblem/logo as a 32x32, etc).
As it is currently setup, if we want to use a 'steel' texture at 1024x, we need a copy of that texture inside every single folder that has a DTS shape that is using said 'steel' texture. This is a very terrible waste of resources...
bin/data/shapes
bin/data/textures
Each one of those with the following example sub-folders:
Shapes:
bin/data/shapes/vehicles/cars
bin/data/shapes/vehicles/trucks
bin/data/shapes/vehicles/other
bin/data/shapes/buildings/houses
Textures:
bin/data/textures/metal
bin/data/textures/paint
bin/data/textures/wood
Then, I just create a collection of 1024x tiling textures to place in each of the texture folders and my meshes can use anything from the collection as a sub-object texture. Any specialized textures would be kept as small as possible and added only as needed (such as a car's emblem/logo as a 32x32, etc).
As it is currently setup, if we want to use a 'steel' texture at 1024x, we need a copy of that texture inside every single folder that has a DTS shape that is using said 'steel' texture. This is a very terrible waste of resources...
#2
So.. for example, if I have a materials.cs file here:
bin/data/textures/metal/materials.cs
Then in 3ds Max, I use that texture on a car and export the DTS here:
bin/data/shapes/vehicles/cars/testCar.dts
When I get into the game and add that car to a level, the texture will show up on it??
11/12/2009 (3:49 pm)
Quote:If the texture is registered in a material.cs, it should load up in-game regardless of where it and the model is located.
So.. for example, if I have a materials.cs file here:
bin/data/textures/metal/materials.cs
Then in 3ds Max, I use that texture on a car and export the DTS here:
bin/data/shapes/vehicles/cars/testCar.dts
When I get into the game and add that car to a level, the texture will show up on it??
#3
eg:
My texture exported on the model is bluemetal2, it's registered in the above material.cs, it doesn't matter where it and the model is in the folders, because the material info is registered in-game, by the material.cs.
11/12/2009 (4:40 pm)
As long as the material has the name of the texture, it shouldn't matter where you put it. eg:
new Material(bluemetal2)
{
mapTo = "bluemetal2";
basetex[0] = "bluemetal2";
bumptex[0] = "lightspec_nm";
pixelSpecular[0] = true;
specular[0] = "0.7 0.7 0.7 1.0";
specularPower[0] = 16.0;
};My texture exported on the model is bluemetal2, it's registered in the above material.cs, it doesn't matter where it and the model is in the folders, because the material info is registered in-game, by the material.cs.
#4
Thanks a BUNCH for this!! Now we can improve the visual quality of our game while maintaining less hard drive usage and a centralized texture location! My artists are going to love this! :D
11/12/2009 (4:46 pm)
Awesome! I can't believe my college never told us this stuff.... Most likely the instructors didn't know about it themselves... At any rate, I did a quick test, moved one of my flooring textures for a couple rooms into a completely different folder, registered them in a materials.cs, and voila, it still shows up on the rooms that are using it!Thanks a BUNCH for this!! Now we can improve the visual quality of our game while maintaining less hard drive usage and a centralized texture location! My artists are going to love this! :D
#5
Also, just so you know, once a texture is loaded into texture memory, that texture gets reused regardless of how many different models use that texture. So if you have 200 different models exported, but all using the same texture, they'll just reference the one material.
Textures can be a bit of an overhead, 1024 is 4 times bigger than 512 - and it's easy to forget that and think that it's just twice as big. 4 times bigger means 4 times as much memory. Before I went with T3D, I found that reducing my textures in TGEA from 1024 to 512, really helped give me a performance boost. Having said that, even with T3D I stick with 512 as my average size - not everyone has a supercomputer ...
So if you have any big old 1024 textures, it's still cheaper to split it up into 3 512 textures. example: character model, instead of 1x1024 texture for the whole thing, it's better (performance-wise) to have 3 textures at 512 (1 for skin, 1 for jacket, 1 for pants). When you have lots and lots and lots of textures - as is likely in a level, it can really free up some extra frames-per-second.
11/12/2009 (4:58 pm)
That's okay, mate. :)Also, just so you know, once a texture is loaded into texture memory, that texture gets reused regardless of how many different models use that texture. So if you have 200 different models exported, but all using the same texture, they'll just reference the one material.
Textures can be a bit of an overhead, 1024 is 4 times bigger than 512 - and it's easy to forget that and think that it's just twice as big. 4 times bigger means 4 times as much memory. Before I went with T3D, I found that reducing my textures in TGEA from 1024 to 512, really helped give me a performance boost. Having said that, even with T3D I stick with 512 as my average size - not everyone has a supercomputer ...
So if you have any big old 1024 textures, it's still cheaper to split it up into 3 512 textures. example: character model, instead of 1x1024 texture for the whole thing, it's better (performance-wise) to have 3 textures at 512 (1 for skin, 1 for jacket, 1 for pants). When you have lots and lots and lots of textures - as is likely in a level, it can really free up some extra frames-per-second.
#6
Nicolas Buquet
www.buquet-net.com/cv/
11/13/2009 (4:45 am)
Having more small textures rather than one big, ease the texture swapping on the graphic bus too, that is THE big bottleneck nowadays on low-cost computer.Nicolas Buquet
www.buquet-net.com/cv/
#7
11/17/2009 (11:21 pm)
Wow, this is nice to know. I didn't realize that you could do that. I must say it's better then having a mess of texture files everywhere in and out of your models.
#8
11/24/2009 (12:38 am)
one thing to note..i have had experiences were not having the texture file were the dts thinks it is will cause multiplayer games to error out with invalid packet messages
Associate Steve Acaster
[YorkshireRifles]