6
$\begingroup$

Red & Green: Perfect channel separators

I'd like to do three things:

  1. Make the Red area glossy
  2. Make the Green area roughly diffuse
  3. Make the Green area appear higher than/on top of the red area (bump height).

Basically I'm looking for a procedural/node technique I can use to treat areas separated by color (or alpha). In the pictured set-up I'm using red and green (as I thought splitting colors to RGB could be a solution), but I'd like the solution to be used with any colors required.

Any clues would be gratefully appreciated :)

$\endgroup$
8
$\begingroup$

With two different known colours you can use the Separate RGB node:

enter image description here

The R output of the node already give us a map of the red areas (full white=1)

enter image description here

You can use the mask both in a Bump Node and in a Mix Shader node.


If you would like to implement a similar process with every possible colour you can set up a Node tree capable of recognize where a given color is.

enter image description here

Basically you have to mask where the the color that correspond to the shader to mix is on the map by masking individually each component. Starting from the HUE values we check with math nodes where the subtraction gives almost = 0.

enter image description here

Than we can copy this node also for the Saturation and Value...ehm...values! By multiplying their output we are running an Logical AND operation, so at the and we'll have only the places where all three parameters have the same values.

enter image description here


By making a whole group of these operations you'll be able to match each colour to a shader simply by giving the color to pick:

enter image description here

Here's an example of usage with files made by an external application such as the SciFi Helmet by Michael Pavlovic. You can pick the colour from the Colour Id mask directly from the render preview.

enter image description here

$\endgroup$
  • $\begingroup$ ...It's going to take me weeks to get my head around that Blend file, but WOW! The power! Thanks Carlo! $\endgroup$ – OroNZ Sep 5 '15 at 10:27
  • $\begingroup$ I've written a more in depth explanation at: carlobergonziniplayground.tumblr.com/post/128405180147/… (still working on it) $\endgroup$ – Carlo Sep 5 '15 at 14:46
  • $\begingroup$ Hi can we make this work with soft edges ? $\endgroup$ – DB3D Apr 3 at 0:49
  • $\begingroup$ the concept is amazing but for hard sodt edges, it dont work at all blender.stackexchange.com/posts/136035/edit $\endgroup$ – DB3D Apr 3 at 8:43
4
$\begingroup$

Here's a simple set up to do what you asked for:

Nodes

The noise texture is converted to greyscale (a value between 0.0 and 1.0). Then we test to see if the greyscale value is greater than 0.5. (If it's < 0.5 then we get a value of 0.0. If it's greater than 0.5 we get a value of 1.0).

That value of 0.0 or 1.0 can then be used as the factor in a mix shader, and also directly for the surface displacement. (You could add a multiply node in there if necessary).

(I believe the RGB to BW node happens implicitly - as in your set up above, so you could skip it.)

$\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.