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$
  • 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$ – cegaton Jan 29 '19 at 20:13
  • $\begingroup$ Hi Cegaton, that creates a mask for the entire material rather than just the color ramp. $\endgroup$ – user3597862 Jan 29 '19 at 21:02
  • $\begingroup$ I've added a picture for clarification. $\endgroup$ – user3597862 Jan 30 '19 at 23:56
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$
  • $\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$ – user3597862 Feb 1 '19 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$

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.