Mon, Nov 25, 1:02 PM CST

Renderosity Forums / Poser - OFFICIAL



Welcome to the Poser - OFFICIAL Forum

Forum Coordinators: RedPhantom

Poser - OFFICIAL F.A.Q (Last Updated: 2024 Nov 25 12:38 pm)



Subject: Python question: evaluated shader tree node output?


Michael314 ( ) posted Sun, 06 July 2014 at 1:19 PM · edited Fri, 22 November 2024 at 7:46 AM

Hi,

for a Python script, I want the computed value of a shader tree node input.

I can get the value set at the node itself by myInput.Value(), but I need the evaluated output of any tree connected to it as well (if myInput.InNode() is not None).

Is there a way to do that?

Best regards,

   Michael

 


Pret-a-3D ( ) posted Sun, 06 July 2014 at 2:09 PM

Hi Michael.

What do you mean by "evaluated output"? What kind of value would that be?

Paolo

https://www.preta3d.com
FB: https://www.facebook.com/RealityPlugIn
Tw: @preta3d
G+: https://plus.google.com/106625816153304163119
The Reality Gallery: https://reality-plug-in.deviantart.com


Michael314 ( ) posted Sun, 06 July 2014 at 2:43 PM

file_505520.png

Hi Paolo,

I have the following code:

        scaleNode = NodeByName(previewMat.ShaderTree(), prefix, actor.Name())
        if scaleNode is not None:
            # extract the Preview material's scale and apply it
            xScale *= scaleNode.Inputs()[0].Value()
            yScale *= scaleNode.Inputs()[1].Value()
            zScale *= scaleNode.Inputs()[2].Value()

 

The nodes look as follows:

 

The scaleNode.Inputs()[2].Value() method returns 1 (which makes sense), but I want to get the value of 5 of the math_add as well, in order to compute the effective parameter of the node input.

 

Best regards,

  Michael


bantha ( ) posted Sun, 06 July 2014 at 4:00 PM

I don' think that's possible, since shaders are evaluated at render time only. Many nodes give different results when rendering, so everything containing a texture node, an u- or v- node, an edge blend or a fresnel node will give different results on different pixels of the render. The only cases in which the results can be caclulated are those with simple, nonvariable numbers - and those can easily be entered in the node directly.

What do you exactly want to do with that?


A ship in port is safe; but that is not what ships are built for.
Sail out to sea and do new things.
-"Amazing Grace" Hopper

Avatar image of me done by Chidori


Michael314 ( ) posted Sun, 06 July 2014 at 4:17 PM

Hi,

what I want to achieve is to combine Bagginsbill's Parmatic with external renderers.

 

With the OctanePoserPlugin, it is possible to store Octane material information inside a Poser material (it creates extra nodes for that, so it does not impact the Poser shader).

I have written a small script which can modify the scaling of the color, bump and displacement channels, based on additional disconnected nodes.

Now my idea was to feed in information from dials (the Parmatic approach). Parmatic uses a single node type only, so I will still be able to achieve that for that special case, but a general solution which would allow to hook in arbitrary node trees would be preferrable, of cause.

Best regards,

   Michael


face_off ( ) posted Sat, 26 July 2014 at 4:17 PM

Michael - if you are using the Octane plugin, you just need to keyframe animate the color, bump amount, etc in the Poser material, and then when rendering the animation with the Octane plugin, tick the "Recovert materials each frame" checkbox - then the bump amount at that frame will be used to re-build the Octane material.

Paul

Creator of PoserPhysics
Creator of OctaneRender for Poser
Blog
Facebook


Privacy Notice

This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.