[Maya2osg-users] Customized GLSL shaders
Status: Alpha
Brought to you by:
jtaibo
From: Javier T. <jav...@gm...> - 2011-05-21 22:32:18
|
Hi, I have added four new options to the exporter that allow to append custom GLSL code to the shaders exported. -additionalVertexDeclarations <file> -additionalVertexCode <file> -additionalFragmentDeclarations <file> -additionalFragmentCode <file> This way custom declarations can be appended at the end of the shader (vertex or fragment) declarations (i.e. uniforms, varyings, etc.) and custom computations can be added at the end of the shader main() function. It is important to note that they are at the end because this way users can override computations of the default shader, i.e. the custom code has higher precedence. What the user specifies in these command line parameters is the path of a file containing the GLSL code (not the code itself). If any of these options is not supplied, no custom code in this part of this shader is added (unlike most of the other parameters, these don't keep the value of the last invocation). There is an UI option to enable the custom code feature and four corresponding to the four code blocks above mentioned. And here, Peter, I'm going to ask for your skills on Maya UI creation. I created 5 new optionVars and the UI for them (basically copy & paste of your code :). Please, review it when you have time, just in case I have done some nonsens. I also put "Browse" buttons after the text boxes, but I don't know what is the most adequate way to make it work and the script is growing dangerously, so I don't want to complicate it further. Can you take a look at it, please? It would be nice also to enable/disable the four text box / browse buttons depending on the checkbox "Custom GLSL code". Also, the fragment shaders are now writing to gl_FragData[0] instead of gl_FragColor, to allow the use of multiple render targets. In fact, the additional code is especially useful to add the code that computes the value of output in these other render targets (e.g. motion vectors in my case). Btw, Peter, the "reloading" bug of the plug-in is fixed. The new command was not unregistered when unloading the plug-in and this was the reason it failed to load the plug-in again. My mistake! Regards, -- Javier Taibo |