4
$\begingroup$

Is it possible to output a color ramp node in a material to it's own compositor pass?

I need to mask out part of a material which is controlled by a colour ramp, so I can add filters to that specific part of the material only.

enter image description here

$\endgroup$
3
  • 1
    $\begingroup$ Assign a pass index to the material that uses the color ramp. Then enable the material index as a render pass. Use the ID mask node connected to the index/Mat socket of the render layer to access the texture. See this answer as a reference: blender.stackexchange.com/questions/9394/… $\endgroup$
    – user1853
    Commented Jan 29, 2019 at 20:13
  • $\begingroup$ Hi Cegaton, that creates a mask for the entire material rather than just the color ramp. $\endgroup$ Commented Jan 29, 2019 at 21:02
  • $\begingroup$ I've added a picture for clarification. $\endgroup$ Commented Jan 30, 2019 at 23:56

2 Answers 2

0
$\begingroup$

You could try duplicating the entire scene. (Full copy) Then in the new scene change the material duplicate to an emission type, with the output being the grayscale of the color ramp. The new scene is also set to only render an emission pass.

enter image description here

Then in compositing output you can use the main scene for the render, and the duplicate scene's emission output as the masking pass. Not exactly what it's intended for (likely to need some adjustment), but I think this may be workable.

Also on the new scene, you can turn samples way down to speed it up a bit, since it's only being used as a mask.

$\endgroup$
1
  • $\begingroup$ Thanks pauljs, that's actually what i've been doing as a temporary workaround, but it's adding around 10 minutes per frame onto my render time. I may have found a better workaround though, just about to test it out. Going to mix an emission into the silver part of the material (in the above example, this is not my actual scene), and then mask off that part of the emission pass with a material ID pass for this material. The emission will be set to a value so low that's it doesnt impact the look of the actual material. </ br> Fingers crossed! $\endgroup$ Commented Feb 1, 2019 at 19:36
0
$\begingroup$

The solutions was to mix in an emission with a mix shader, but have the factor extremely low so that the emission was imperceptible. Add a pass Id to the material. Then in the compositor use the MatID to mask off just the emission for that object (in case there is other emission in the scene), then multiply the result until the emission is bright, and then multiply the result by the render (so that only the brightly reflective parts get increased). Then subtract the render from the result, to leave just the amplified reflections, add glow to it, and then add it back to the final render.

A matID node which could be used within a material would make life massively easier, but this works.

$\endgroup$

You must log in to answer this question.

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