Re: [Maya2osg-users] Customized GLSL shaders
Status: Alpha
Brought to you by:
jtaibo
From: Javier T. <jav...@gm...> - 2011-05-27 07:54:24
|
Hi Peter On Fri, May 27, 2011 at 9:07 AM, Peter Wrobel <pp...@cg...> wrote: >>> The shader code does not end up in the osg file. Don't know what I'm >>> doing wrong. >> You're passing the wrong options to the plug-in. Unless you have >> renamed them in osgwrite.cpp and not committed the changes. > > > Till now I only changed UI element names and envVars, but I kept the > flags that are send to the plug-in untouched, so this shouldn't be the > issue. See this code snippet: if ( `optionVar -query "maya2osg_custom_shader_code"` ) { if ( `optionVar -query "maya2osg_glsl_vert_declare"` != "" ) { $command += " -additionalVertexdeclare \"" + `optionVar -query "maya2osg_glsl_vert_declare"` + "\"\n"; } if ( `optionVar -query "maya2osg_glsl_vert_compute"` != "" ) { $command += " -additionalVertexCode \"" + `optionVar -query "maya2osg_glsl_vert_compute"` + "\"\n"; } if ( `optionVar -query "maya2osg_glsl_frag_declare"` != "" ) { $command += " -additionalFragmentdeclare \"" + `optionVar -query "maya2osg_glsl_frag_declare"` + "\"\n"; } if ( `optionVar -query "maya2osg_glsl_frag_compute"` != "" ) { $command += " -additionalFragmentCode \"" + `optionVar -query "maya2osg_glsl_frag_compute"` + "\"\n"; } } The parameters -additionalVertexCode and -additionalFragmentCode are right (in fact they are working), but -additionalVertexdeclare and -additionalFragmentdeclare are wrong. This is the reason for this code not appearing in the shaders. If you didn't change it in revision 202, then svn is lying :) >> I'm OK with it. You're right in that I left these names inconsistent >> (in some places I said "compute" and others "code"). I think compute >> is more adequate, as the declarations are also code, after all. >> > > O.K., I will change the flags in the plugin to the suggested ones >> One other thing, Apart from the options being wrong, I tried it and >> the scripts are not loading the plug-in as always. I had to manually >> load it to be able to export a scene. I saw you changed a lot of code >> but I didn't take a deep look at it. I think I wouldn't have too much >> time these days. >> >> > Will look into this, should be fixed today. > > Some more stuff from my side, I will start editing the cmake files as > well, but need some assitance in the begining. What are you editing CMake for? > The maya2osg_utility.mel needs to be installed properly. I found 2 files > to edit and 2 deprecated VS files: > configure_installer.cmake > maya2osg-maininstaller.iss > maya2osg.vcxproject > maya2osg.vcxproject.filters Careful! Some of these are CMake scripts and others are generated by CMake (you can delete it without problem, and they are not in svn). Probably you only would need to edit the CMakeLists.txt file in the Maya2OSG root directory. Some of these files are for the Windows installer contributed by Ryan Pavlik in the osg-users mailing list. See this page: https://sourceforge.net/apps/mediawiki/maya2osg/index.php?title=Windows_installer > I will edit all 4 files ( with allmighty copy and paste tool :-) ), > please to confirm. Just be careful to know exactly what you are doing. > For my understanding, about the new textfields, and to be able to test > functionality: > Vertex / Fragment Declare are injected into GLSL code after the existing > declaration block and before any procedure definition. > Vertex / Fragment Compute are injected at the end of the GLSL code, so > in the main procedure befor the closing braces. > Is this right ? Right, I tried to explain it in this page: https://sourceforge.net/apps/mediawiki/maya2osg/index.php?title=Shading_Networks#Custom_GLSL_code If you don't find it clear or want to add something, feel free to edit it. > In an earlier mail you mentioned that the injection happens if ALL the > textfields do specify a file, is this correct ? > Is there in no case, where one wants to just overwrite the Fragment > color, without the need for any other ( Declare / Compute ) requirement ? No, no, no... I didn't say anything like that. Once you enable the "custom code" check box, then the fields that have any valid content will be used, the others will be simply ignored. If you don't pass any of these options to Maya2OSG, it just ignores the corresponding piece of code (doesn't remember the last value as other options). Regards, -- Javier Taibo |