Texture Atlas, please help
by Renzo Sanchez · in General Discussion · 09/15/2006 (9:19 am) · 1 replies
Hi,
I am using many small and optimized textures for my game. I am using an average of 8 small textured per object, 3 of this 8 textures are tiling textures. I have 200 objects.
I am using NVidia Texture Atlas for my non tiling textures, this tool give me a .tai file with information about how I can remap the texture again.
This file looks like this:
Image1.jpg Default.dds, 0, 2D, 0.000244, 0.001953, 0.000000, 0.124512, 0.996094
Image2.jpg Default.dds, 0, 2D, 0.125244, 0.001953, 0.000000, 0.124512, 0.996094
So, I have to cropping the texture in 3ds max using this file information.
The problem is that I can't convert my .max file to .X file with cropping information. Does .X file store cropping information?
I am using Deep Exploration and Panda export to convert my .max to .X. but I can't read cropping information
A solution of this could be using wrap mapping instead of cropping, but it will take more time to re-mapping all models again. It could be done with a max script in two seconds using .tai file. Anyway, if NVidia give us this information file is because there is a way of working with this file, the problem is that I don't know how. Any idea?
About my tiling textures, is it ok to have 600 tiling textures (it means 600 render state changes), of there is a tip to resolve this problem.
I am using many small and optimized textures for my game. I am using an average of 8 small textured per object, 3 of this 8 textures are tiling textures. I have 200 objects.
I am using NVidia Texture Atlas for my non tiling textures, this tool give me a .tai file with information about how I can remap the texture again.
This file looks like this:
Image1.jpg Default.dds, 0, 2D, 0.000244, 0.001953, 0.000000, 0.124512, 0.996094
Image2.jpg Default.dds, 0, 2D, 0.125244, 0.001953, 0.000000, 0.124512, 0.996094
So, I have to cropping the texture in 3ds max using this file information.
The problem is that I can't convert my .max file to .X file with cropping information. Does .X file store cropping information?
I am using Deep Exploration and Panda export to convert my .max to .X. but I can't read cropping information
A solution of this could be using wrap mapping instead of cropping, but it will take more time to re-mapping all models again. It could be done with a max script in two seconds using .tai file. Anyway, if NVidia give us this information file is because there is a way of working with this file, the problem is that I don't know how. Any idea?
About my tiling textures, is it ok to have 600 tiling textures (it means 600 render state changes), of there is a tip to resolve this problem.
Torque Owner Renzo Sanchez
No, the X file does not implicitly support this type of custom information.
Having said that, the X file format is completely open and you can store any user defined data in it that you wish. Support is provided for building custom data templates in the file itself, and reading them back in your application.
While the X format can be easily extended, it is of course not really that simple because this is only really suitable if the application you're using to export the file supports the export of that custom data in the specific format you require. As far as I am aware, neither panda or deep exploration provide support for custom data templates.
An alternative would be to convert the information provided in the atlas info file into a format suitable for you (or import it directly) and store it as a separate file along with your X file. There is no harm in reading from multiple sources to build the data for a single mesh, object or scene in your world.
There is very little that you can do to combine tiling textures without using vertex and pixel shaders. When using shaders, you can use a similar approach, placing all of your tiling textures into a single texture surface and then developing a pixel shader to perform the correct tiling at render time. This involves the liberal use of the modulus / remainder intrinsics however which is not cheap.
In the fixed function, you will really have to switch textures at least 600 times and there are no workarounds that I know of. While this is fine (technically there is nothing wrong in doing so), you may want to invest in a good visibility determination scheme such as the BSP & PVS combo covered in module II in order to ensure that you render as little as possible in any given frame (thereby reducing the number of state switches / texture uploads you have to do).