Thread: [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 |
From: Jean-Sébastien G. <jea...@cm...> - 2011-06-16 01:59:08
|
Hi Javier, > What do you guys think about all this stuff? Suggestions? Comments? > Criticisms? Opinions? ... All this sounds good. When you say "What is still not implemented is the parsing of these options", you mean they're not stored in the Maya settings? Are they settable in the plugin GUI? For maxTextureSize, is there a way to keep it unset (no maximum)? I think we'll probably want to set it, but still, it would be nice if it was possible to keep this open. > 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. I'll compile tomorrow when I get to work. I currently have only 32-bit NVTT installed, so I'll have to install the 64 bit version to be able to compile the plugin for my 64-bit version of Maya, but that should be quick. I'll let you know how it goes. Thanks for all your work! J-S -- ______________________________________________________ Jean-Sebastien Guay jea...@cm... http://www.cm-labs.com/ http://whitestar02.dyndns-web.com/ |
From: Javier T. <jav...@gm...> - 2011-06-16 08:13:16
|
Hi J-S, On Thu, Jun 16, 2011 at 3:59 AM, Jean-Sébastien Guay <jea...@cm...> wrote: > Hi Javier, > >> What do you guys think about all this stuff? Suggestions? Comments? >> Criticisms? Opinions? ... > > All this sounds good. When you say "What is still not implemented is the > parsing of these options", you mean they're not stored in the Maya > settings? Are they settable in the plugin GUI? No, I mean the parsing is not implemented AT ALL :) The options are not stored in Maya settings, they are not settable in the plug-in GUI, not even in the command-line parameters, they are absolutely hardwired. They are currently set in the config.cpp initialization. This part of the work is in the to-do list. That's why I was asking Peter about the state of the new config system. But I suppose he is busy this days. > For maxTextureSize, is there a way to keep it unset (no maximum)? I > think we'll probably want to set it, but still, it would be nice if it > was possible to keep this open. Of course! There is no problem, setting 0 as maxTextureSize removes the limit. >> 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. > > I'll compile tomorrow when I get to work. I currently have only 32-bit > NVTT installed, so I'll have to install the 64 bit version to be able to > compile the plugin for my 64-bit version of Maya, but that should be quick. That's great. If you don't have NVTT installed yet, could you please test it before and after installing NVTT? This way we verify that both sections of the code are fine. Regards, -- Javier Taibo |
From: Jean-Sébastien G. <jea...@cm...> - 2011-06-16 13:54:03
|
Hi Javier, > No, I mean the parsing is not implemented AT ALL :) OK, I understand now :-) > That's great. If you don't have NVTT installed yet, could you please > test it before and after installing NVTT? This way we verify that both > sections of the code are fine. Without nvtt there doesn't seem to be a change by default. I see the default is copyTextures=true and texturePath=. , but I don't see any textures in the directory of the exported file, and the file still contains absolute paths to the textures, is this normal? I thought with copyTextures=true, it was supposed to copy the textures to texturePath (where "." I assume means the same directory as the exported file?), and set the path to textures to be relative in the exported .osg file, but that doesn't seem to happen. I'll wait for confirmation on this before testing with nvtt. Thanks, J-S -- ______________________________________________________ Jean-Sebastien Guay jea...@cm... http://www.cm-labs.com/ http://whitestar02.dyndns-web.com/ |
From: Javier T. <jav...@gm...> - 2011-06-16 14:51:44
|
Hi J-S, On Thu, Jun 16, 2011 at 3:53 PM, Jean-Sébastien Guay <jea...@cm...> wrote: > >> That's great. If you don't have NVTT installed yet, could you please >> test it before and after installing NVTT? This way we verify that both >> sections of the code are fine. > > Without nvtt there doesn't seem to be a change by default. > > I see the default is copyTextures=true and texturePath=. , but I don't > see any textures in the directory of the exported file, and the file > still contains absolute paths to the textures, is this normal? I thought > with copyTextures=true, it was supposed to copy the textures to > texturePath (where "." I assume means the same directory as the exported > file?), and set the path to textures to be relative in the exported .osg > file, but that doesn't seem to happen. > > I'll wait for confirmation on this before testing with nvtt. I've just tested it right now with the code in the tunk (SVN revision 213) and it is working OK without NVTT. I exported a model with a color texture and a bump map that were converted to .png and copied to the export directory with the OSG file. I really don't know what is happening here... have you seen any significant message in the console output? -- Javier Taibo |
From: Jean-Sébastien G. <jea...@cm...> - 2011-06-16 15:49:15
|
Hi Javier, > I've just tested it right now with the code in the tunk (SVN > revision 213) and it is working OK without NVTT. I exported a model > with a color texture and a bump map that were converted to .png and > copied to the export directory with the OSG file. > > I really don't know what is happening here... have you seen any > significant message in the console output? I am at the same SVN revision, and is up-to-date in Maya2012\bin\plug-ins. Here is the output in the Output Window: Initialized VP2.0 renderer { Version : 2.7.0.18. Feature Level 3.1. Device : NVIDIA GeForce GTX 260 Driver : nvoglv64.dll:8.17.12.7061. API : OpenGL V.2 Max texture size : 8192 * 8192. Max tex coords : 8 Shader versions supported (Vertex: 4, Geometry: 4, Pixel 4). CPU Memory Limit: 11665 MB. } Loading Maya2OSG plug-in. Maya2OSG 0.4.2c (OpenSceneGraph Library 2.9.17) --------------------------------------------------- --- Maya2OSG - OSG Maya Exporter --- --------------------------------------------------- -- OUTPUT FILE : C:/Users/jeang/Documents/maya/projects/default/scenes/box_normalmap_maya2osg.osg --------------------------------------------------- 0 element(s) selected Geode "pCubeShape2" with Geometries ! Geode "pCubeShape1" with Geometries ! --------------------------------------------------- --- Exportation successfully completed --- --------------------------------------------------- And the script editor just says File Exported : "C:/Users/jeang/Documents/maya/projects/default/scenes/box_normalmap_maya2osg.osg" I'll compile a debug version and see what's going on. Thanks, J-S -- ______________________________________________________ Jean-Sebastien Guay jea...@cm... http://www.cm-labs.com/ http://whitestar02.dyndns-web.com/ |
From: Javier T. <jav...@gm...> - 2011-06-17 07:37:26
|
Hi J-S, I have just committed a fix for this issue. I do a pair of quick tests with OpenGL materials and GLSL shaders and it seems to be working OK. Can you verify it is OK in your tests? Regards, On Thu, Jun 16, 2011 at 5:27 PM, Jean-Sébastien Guay <jea...@cm...> wrote: > Hi Javier, > >> I'll compile a debug version and see what's going on. > > Of course, I found out about 2 seconds after building in debug, but I > wouldn't even have had to... > > I don't want to generate GLSL shaders. I think your texture processing > code should happen even if only "Export Shaders" is checked, not "Build > GLSL Shaders". > > All use of textures should follow the same rules, whether GLSL shaders > are being generated or not. So I think these calls will need to be moved > somewhere else... Perhaps in Texture::exporta(), which is called by both > FileTexture::getCodeBlock() and Shader::exporta() (indirectly). > > Thanks in advance, > > J-S > -- > ______________________________________________________ > Jean-Sebastien Guay jea...@cm... > http://www.cm-labs.com/ > http://whitestar02.dyndns-web.com/ > > ------------------------------------------------------------------------------ > EditLive Enterprise is the world's most technically advanced content > authoring tool. Experience the power of Track Changes, Inline Image > Editing and ensure content is compliant with Accessibility Checking. > http://p.sf.net/sfu/ephox-dev2dev > _______________________________________________ > Maya2osg-users mailing list > May...@li... > https://lists.sourceforge.net/lists/listinfo/maya2osg-users > -- Javier Taibo |
From: Javier T. <jav...@gm...> - 2011-06-18 20:29:59
|
Hi J-S, I tested two of these scene files (the third is in Maya 2012 format) in Maya 2011 and Maya2OSG compiled with NVTT. It works perfectly for me with these options. Actually, I think I always use these three options. Are you using Maya 2012? Is the plug-in compiled with or without NVTT? Regards, On Fri, Jun 17, 2011 at 8:13 PM, Jean-Sébastien Guay <jea...@cm...> wrote: > On 17/06/2011 2:05 PM, Jean-Sébastien Guay wrote: >> Hi Javier, >> >>> I assume you want then to export bump/normal maps without shaders. >>> It should be relatively easy modifying shader.cpp to export them like >>> filetexture.cpp does. >> >> Well, we use normal maps and I just don't want the embedded GLSL. I >> guess I could keep GLSL checked, and post-process the loaded file to >> remove any osg::Program. >> >>> However, I usually have these three options checked in the GUI and I >>> haven't experienced any crash by now... have you got a lightweight >>> scene to reproduce this bug? >> >> I've attached a screenshot to show you which 3 options I mean, and the >> zip containing my scene (very small). If those 3 options are checked >> like in the screenshot, Maya crashes when I press Export. If I uncheck >> one of those (any one) it doesn't. >> >> J-S > > Argh, message was too big for the list, I'll resend privately. Sorry. > > J-S > -- > ______________________________________________________ > Jean-Sebastien Guay jea...@cm... > http://www.cm-labs.com/ > http://whitestar02.dyndns-web.com/ > > ------------------------------------------------------------------------------ > EditLive Enterprise is the world's most technically advanced content > authoring tool. Experience the power of Track Changes, Inline Image > Editing and ensure content is compliant with Accessibility Checking. > http://p.sf.net/sfu/ephox-dev2dev > _______________________________________________ > Maya2osg-users mailing list > May...@li... > https://lists.sourceforge.net/lists/listinfo/maya2osg-users > -- Javier Taibo |
From: Javier T. <jav...@gm...> - 2011-06-27 08:12:16
|
On Mon, Jun 20, 2011 at 2:59 PM, Jean-Sébastien Guay <jea...@cm...> wrote: > Hi Javier, > >> Are you using Maya 2012? Is the plug-in compiled with or without NVTT? > > Yes I am using Maya 2012, and the plug-in is compiled without NVTT right > now. I'm sorry I cannot test the plug-in with 2012, as I am still in 2011. Did you have the chance to debug it? Have you discovered where the problem is? I've uploaded some changes. Now the parsing of texturing options is implemented in the plug-in and a preliminar version of the GUI for these options is already implemented. I am still testing all these stuff, there are some features not working correctly. The most weird is that when converting bump maps to normal map, the behaviour is the opposite of the expected (bumps vs. holes) depdending on whether I use NVTT or my code. Maybe it is a matter of RGB vs BGR ordering. I'll check all this as soon as I have time. Regards, -- Javier Taibo |
From: Jean-Sébastien G. <jea...@cm...> - 2011-06-27 19:52:30
|
Hi Javier, > I'm sorry I cannot test the plug-in with 2012, as I am still in > 2011. Did you have the chance to debug it? Have you discovered where > the problem is? No, and anyways I don't really need these changes, but I'll keep testing off and on at least to give you more info as much as I can... J-S -- ______________________________________________________ Jean-Sebastien Guay jea...@cm... http://www.cm-labs.com/ http://whitestar02.dyndns-web.com/ |
From: Jean-Sébastien G. <jea...@cm...> - 2011-06-16 15:33:28
|
Hi Javier, > I'll compile a debug version and see what's going on. Of course, I found out about 2 seconds after building in debug, but I wouldn't even have had to... I don't want to generate GLSL shaders. I think your texture processing code should happen even if only "Export Shaders" is checked, not "Build GLSL Shaders". All use of textures should follow the same rules, whether GLSL shaders are being generated or not. So I think these calls will need to be moved somewhere else... Perhaps in Texture::exporta(), which is called by both FileTexture::getCodeBlock() and Shader::exporta() (indirectly). Thanks in advance, J-S -- ______________________________________________________ Jean-Sebastien Guay jea...@cm... http://www.cm-labs.com/ http://whitestar02.dyndns-web.com/ |
From: Javier T. <jav...@gm...> - 2011-06-16 15:53:56
|
On Thu, Jun 16, 2011 at 5:27 PM, Jean-Sébastien Guay <jea...@cm...> wrote: > Hi Javier, > >> I'll compile a debug version and see what's going on. > > Of course, I found out about 2 seconds after building in debug, but I > wouldn't even have had to... > > I don't want to generate GLSL shaders. I think your texture processing > code should happen even if only "Export Shaders" is checked, not "Build > GLSL Shaders". > > All use of textures should follow the same rules, whether GLSL shaders > are being generated or not. So I think these calls will need to be moved > somewhere else... Perhaps in Texture::exporta(), which is called by both > FileTexture::getCodeBlock() and Shader::exporta() (indirectly). You're right, I didn't test this case as I was always exporting GLSL shaders. I'll take a look at this issue as soon as I have time. Thanks for the feedback! -- Javier Taibo |
From: Jean-Sébastien G. <jea...@cm...> - 2011-06-17 17:05:02
|
Hi Javier, > I have just committed a fix for this issue. I do a pair of quick > tests with OpenGL materials and GLSL shaders and it seems to be > working OK. > > Can you verify it is OK in your tests? 1) Diffuse (color) texture seems to be copied / converted correctly now, whether or not I enable GLSL shaders. 2) Normal maps are still not being copied / converted if I don't enable GLSL shaders (even with enable bump/normal maps - I guess the intent is that enabling normal maps but without enabling GLSL shaders does nothing, but in my case I just don't want to embed shaders) 3) If I have all 3 options (Export materials, GLSL shaders and bump/normal maps) checked, the plugin makes Maya crash in assign() being called from Mesh.cpp line 477. Thanks, J-S -- ______________________________________________________ Jean-Sebastien Guay jea...@cm... http://www.cm-labs.com/ http://whitestar02.dyndns-web.com/ |
From: Javier T. <jav...@gm...> - 2011-06-17 17:42:20
|
Hi J-S, On Fri, Jun 17, 2011 at 7:04 PM, Jean-Sébastien Guay <jea...@cm...> wrote: > Hi Javier, > >> I have just committed a fix for this issue. I do a pair of quick >> tests with OpenGL materials and GLSL shaders and it seems to be >> working OK. >> >> Can you verify it is OK in your tests? > > 1) Diffuse (color) texture seems to be copied / converted correctly now, > whether or not I enable GLSL shaders. Nice! > 2) Normal maps are still not being copied / converted if I don't enable > GLSL shaders (even with enable bump/normal maps - I guess the intent is > that enabling normal maps but without enabling GLSL shaders does > nothing, but in my case I just don't want to embed shaders) This is what current implementation does. Bump map is only used only with GLSL shaders. I assume you want then to export bump/normal maps without shaders. It should be relatively easy modifying shader.cpp to export them like filetexture.cpp does. > 3) If I have all 3 options (Export materials, GLSL shaders and > bump/normal maps) checked, the plugin makes Maya crash in assign() being > called from Mesh.cpp line 477. Actually the "export materials" option is new to me, I only created the "export shaders as GLSL". When Peter come back from its exams, we should define and document the exporter options. However, I usually have these three options checked in the GUI and I haven't experienced any crash by now... have you got a lightweight scene to reproduce this bug? Regards, -- Javier Taibo |
From: Jean-Sébastien G. <jea...@cm...> - 2011-06-17 18:14:00
|
On 17/06/2011 2:05 PM, Jean-Sébastien Guay wrote: > Hi Javier, > >> I assume you want then to export bump/normal maps without shaders. >> It should be relatively easy modifying shader.cpp to export them like >> filetexture.cpp does. > > Well, we use normal maps and I just don't want the embedded GLSL. I > guess I could keep GLSL checked, and post-process the loaded file to > remove any osg::Program. > >> However, I usually have these three options checked in the GUI and I >> haven't experienced any crash by now... have you got a lightweight >> scene to reproduce this bug? > > I've attached a screenshot to show you which 3 options I mean, and the > zip containing my scene (very small). If those 3 options are checked > like in the screenshot, Maya crashes when I press Export. If I uncheck > one of those (any one) it doesn't. > > J-S Argh, message was too big for the list, I'll resend privately. Sorry. J-S -- ______________________________________________________ Jean-Sebastien Guay jea...@cm... http://www.cm-labs.com/ http://whitestar02.dyndns-web.com/ |
From: Jean-Sébastien G. <jea...@cm...> - 2011-06-20 12:59:53
|
Hi Javier, > Are you using Maya 2012? Is the plug-in compiled with or without NVTT? Yes I am using Maya 2012, and the plug-in is compiled without NVTT right now. J-S -- ______________________________________________________ Jean-Sebastien Guay jea...@cm... http://www.cm-labs.com/ http://whitestar02.dyndns-web.com/ |