View Full Version : Shader -> Expression and IPR Update
06-02-2012, 02:42 PM
I have a shader network with some condition nodes. First Term is linked to some other nodes and the second term is variable. To make thinks easier (I thought till now) I added some Attributes to the main shader and linked them via expression to the several condition nodes (second term).
I need an expression as I want to do some simple math.
conditionNode.secondTerm = 0.9 + mainNode.Term / 100;
This works like expected.
However: If I call IPR to adjust these values, IPR did not update if I change any value.
IPR did refresh the rendering, but the image is still the same with no changes. If I start a new IPR I see the changes with the actual value.
Probably because expressions only get evaluated when the currentTime changes.
A workaround would be to build your math around nodes (if it is that simple, it shouldn't be to complicated to link up mutliplyDivide nodes etc.) or to use a scriptJob/scriptNode and possibly pre-Render MEL.
I think this is a big shortcoming of Maya that I'm experiencing myself; the only way to get realtime evaluation of something is by using a scriptJob with the "-idle" flag set, which makes my spine shiver just thinking about it. Apparently there is no such thing as an efficient listener object. Similarly, condition nodes that can be linked up to scriptJobs are absolutely useless because they either need manual triggering or have to be made dependant on some built-in condition (of which there are only so many, none of which are guaranteed to cover your particular needs).
By the way, for your particular needs a scriptJob linked to "attributeChanged" should do the trick.
06-03-2012, 10:02 AM
"workaround would be to build your math around nodes"
That's what I did now. I like a smart and simple network and now I have a big network, only to be able to adjust my shader with ipr... Holy Moly...
The behaviour of Maya drives me sometimes crazy. All standard attributes I change will reflect in IPR - even if I translate/rotate my camera. If I change my custom attributes, ipr is starting to render, but not reflecting this changes as Maya did not evaluate the expressions. Does this make any sense? From my point of view (and of course I am no coder and maybe I missed some important points) it would be great if Maya take care of the expressions in IPR-Mode....
"By the way, for your particular needs a scriptJob linked to "attributeChanged" should do the trick."
Whoops! I would try that! Cool hint.
Again thank you,
06-03-2012, 10:02 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2015, Jelsoft Enterprises Ltd.