8
$\begingroup$

How can I get a Node input/output (e.g. a single Color/Value) that I can control from the one spot, but have mapped across multiple materials? For example, to control a value (say, Glass Shader IOF, or a Mix Shader Fac) across 30 different materials (that may or may not have different node setups, but all use the input I want as a driving factor somewhere inside).

I've got a few ideas so far, but am not sure which will work and/or which will be the best way to go about it:

  • Use a Node Group

    I tried setting up an input inside a node group, then using the node group in various locations - however I could only seem to automate/keyframe the 'default' values of things inside the group (these changes didn't flow through into the instances of the group).

  • Script node

    I could set up a Script Node that returns the value I want - however I imagine this would be tricky to automate, and it would also lock me into OSL, which feels a bit roundabout and also rules out GPU rendering (not essential but it would be nice)

  • Driver

    I could set up a dummy object or material, set up drivers through to the things I want to control, then keyframe the dummy object and that might achieve what I want. However this again feels a bit roundabout/messy.


Background: I'm working on a model that has a non-trivial number of materials (just over 100, auto-generated from a 3D scanner), and am trying to set up effective backface culling in rendering by using the method described here. This involves scripting the addition and connecting of all the extra nodes (Mix shader controlled by Geometry Backfacing, and a Transparent BSDF node to make the faces be rendered transparent from the back), because doing it manually for all 100+ materials would be a pain. It's not essential, but I was thinking it would be nice to be able to control the overall effect by automating all the Transparent BSDF Alpha amounts - I'm just not sure how I'd go about controlling that from a single point though.

$\endgroup$
9
$\begingroup$

This can be done with node groups.

I think you were trying to edit the attributes of the node group instance itself. Instead, try editing/animating the attributes of the nodes inside the group:

enter image description here

Just add a value node (or any input nodes you want, e.g. RGB for color) and press ⎈ CtrlG to make it into a group.

Changes the values of the nodes inside the group will take effect everywhere the group is used, even across different materials. So in this case changing the value node will change the brightness of the diffuse material and the AO material.

$\endgroup$
  • 1
    $\begingroup$ To supplement this answer, you can then edit the value inside the group simply by pressing Tab when the group is selected (took me a while to find out) $\endgroup$ – Romuald Brunet Jan 13 at 19:22
1
$\begingroup$

Just a reminder : the "rendered preview" mode from "3d view" do not update animated node values from node group (With Blender version 2.79b) but the result is ok during "rendering animation / image".

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.