2
$\begingroup$

I'm building a shader where a single UV-mapped texture is applied as the back and front of a plane using the geometry > backfacing property. The mapped image looks like this:

enter image description here

In the end the top part should be on the front and the bottom part should be on the back. That would look something like this:

enter image description here

This node setup does the trick and so far it's working as expected:

enter image description here

Now, in this simplified setup, both image texture nodes load the same file. Only their vector input is different. What I would like to do now is have the geometry node define the Vector mapping rather than to have two image texture nodes and two diffuse nodes.

The reason is that in my final implementation there are five image texture nodes, each defining a property like diffuse, glossy, glass, roughness, ... The whole setup is powered by a python script so I prefer to define five different image texture nodes rather than ten.

$\endgroup$
3
$\begingroup$

Yes, you can do this pretty easily in Cycles using a Mix RGB node. Since Cycles considers colors and vectors to be no different from each other you can actually run vectors through color sockets and vice-versa.

Just use a Mix RGB node to mix the two vectos with the Backfacing value plugged into the factor. You can then plug the "Color" output from the Mix node right into the image texture nodes.

enter image description here

$\endgroup$
  • $\begingroup$ Ah I also use this technique often to transition or mix between different vector settings! Nice to see someone else making use of the fact that vector and color info actually play well with each other in cycles too $\endgroup$ – Duarte Farrajota Ramos Jul 13 '16 at 23:34
  • $\begingroup$ So simple. :) Being able to use color nodes to mix vectors settings, that's a revelation. Thanks PGmath! $\endgroup$ – wout Jul 14 '16 at 6:58

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.