[Maya2osg-users] Texture processing
Status: Alpha
Brought to you by:
jtaibo
From: Javier T. <jav...@gm...> - 2011-06-16 00:09:02
|
Hi all, I have committed some changes to texture processing. A brief description of new features (I will document it, I promise :) - Optional dependency from NVIDIA Texture Tools for processing the textures (check the CMake config). - New options to texture processing: /// Texture options struct TextureOptions { bool regenerateTextures; ///< Regenerate textures (even when they are up-to-date) bool scaleToPOT; ///< Scale to (nearest) power of two bool compressTextures; ///< Compress the texture to a BC format TextureCompressionFormat colorCompressionFormat; ///< Compression format for color textures TextureCompressionFormat normalCompressionFormat; ///< Compression format for normal maps bool generateMipmaps; ///< Generate mipmaps (and store them in the file) int maxTextureSize; ///< Maximum texture side size (when converting with NVTT) std::string textureFileFormat; ///< Texture file format (if compression or mipmap generation, it is forced to .dds) bool copyTextures; ///< Copy textures with exported scene instead of using the path to Maya sourceimages directory std::string texturePath; ///< Texture path to store files into (can be relative to the scene directory) }; With the copyTextures option, textures will be copied from the original path to the directory where the OSG file is created. We can specify a subdirectory there if texturePath has a relative path, or we can set an absolute path there. The exported OSG file will try to use relative paths when possible (it always used absolute paths before). Apart from just copying the textures from the original location to this destination, we can compress them to several texture compression formats supported by NVTT, generate mipmaps and store them in the texture file or resize to the nearest power of two. The original texture will be processed when the destination does not exist or the file timestamp is older than the original one, unless the regenerateTextures options is set true, in which case textures are always processed. This is basically what it does, I think the options are quite descriptive. Most of them match the NVTT options. Texture processing is only available when compiled with NVTT support, and in DDS format. When NVTT is not available or an output format different than DDS is selected, texture files can still be copied to the desired output file format (as long as it is supported by OSG). Bump (height) maps are also converted to normal maps without NVTT as before. What is still not implemented is the parsing of these options. Default values are set in config.cpp (change them there if you want to test with different options). Peter, you suggested to change the Config stuff, so I didn't add the parsing because I don't know if you're already changing the config system. What do you think? May I create the parsing code or is it better to wait for the new config system? What do you guys think about all this stuff? Suggestions? Comments? Criticisms? Opinions? ... J-S, can you test this new code is working for you? I think the problems you commented in your last messages should be fixed. Regards, -- Javier Taibo |