3
$\begingroup$

Example

So I want to control the rotation of y axis of both the mapping nodes using a single value/node in such a manner that for every increase in 1 degree in the first mapping node ( the above node) the second mapping node(the below one)shall increase by 90 degree.

Is it possible by using nodes/drivers??

$\endgroup$

2 Answers 2

4
$\begingroup$

You can use this node setup :

enter image description here

The input value (in degrees) is converted to radians then mapped to the Z value of a XYZ Vector. Then it's plugged into one of the mapping nodes on one side, and scaled on the other side then plugged in the other mapping node.

$\endgroup$
2
  • 1
    $\begingroup$ Nice neat solution - and good use of the Scale node. The original question mentioned the Y axis instead of Z, but obviously it's just a minor change to the connection to the Combine XYZ node to achieve that (so just mentioning for completeness). $\endgroup$ Commented Mar 24, 2021 at 10:28
  • $\begingroup$ @RichSedman Oh, right, didn't see that :) Thansk for pointing it out $\endgroup$
    – Gorgious
    Commented Mar 24, 2021 at 11:13
3
$\begingroup$

One solution is to add a value node (Add -> Input -> Value) and a math node (Add -> Converter -> Math). You set the math node to multiply, set one of the values to 90 and plug the value of the value node into the other. Then plug the output of the math node to the second mapping node and the value of the value node directly to your first mapping node. The value of the value node will then control both your mapping nodes.

You are also correct in that you can use drivers for this and that might be better solution. What you need to do is add a driver to the second mapping node value. You can do that by right clicking on the value and selecting add driver. The field should now be purple. Right click again and select edit driver. At the bottom select show in drivers editor. This should open a new window with drivers editor. Alternatively, you can split one of your panes and open drivers editor there. On the left side you can see all your drivers. Navigate to this one. If you don't see them, make sure the little arrow option on the top which says "only show selected" is off. Now you shoud see something like this:

Driver editor with context menu open

Now you need to set your drivers properties. You need to change your input variable (by default there is one, if you need to, you can add more). Click on the (X) menu and select "Single Property". A "Prop:" menu should appear, click on it, select material and select the material you want in the input field next to it

enter image description here

enter image description here

Now you need to add the path to the exact property. To do that, you need to open the info window (it is under "scripting") and then change the value you want to reference. This will show you exactly the path to your property in the info window. You need to copy this path to the path field of your variable. Note, that the variable already knows the path to your material and you should provide only the relative path from there, so don't copy the bpy.data.materials["some_material_name"] part. The path will probably look something like node_tree.nodes["Diffuse BSDF"].inputs[1].default_value (this is a path to the roughness of a diffuse node)

enter image description here

You can then edit the expression to do what you need, in your case that will probably be something like var * 90

Hope this helps.

$\endgroup$
3
  • $\begingroup$ The First method wouldn't work for two reasons. One Being that since you connected the value node and math node directly to the rotation vector the value will control all the axis but I want to control only y axis well that can be fixed by using combine XYZ node, The Second reason being the input given in the value node is not in radian i.e. if I enter value as 90 the 90 here is not radian but some different value so I wouldn't be giving input of 90 degree but some other value but by playing around the value node 90deg is 1.556 value. $\endgroup$
    – Okie Pokie
    Commented Mar 24, 2021 at 15:18
  • $\begingroup$ I don't know about the second method as I don't know phyton $\endgroup$
    – Okie Pokie
    Commented Mar 24, 2021 at 15:19
  • $\begingroup$ You don't need to know python, all you need is the path, which you can copy from the info window, no coding necessary and to be able to write the relationship using a formula. Combine XYZ node will probably still be necessary. As for the first method, both problems are solvable and the result would look very similar to what the other answer suggests $\endgroup$
    – aky-her
    Commented Mar 25, 2021 at 11:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .