medium tones / gray selection ISOLATE

I guess is trivial, but I’v spent a whol day trying to solve:

How can i get just the medium tones (i.e medium gray in my case) from an image.

I’ve tryed math node, color ramp, map value node but I can’t ISOLATE just the medium.


thank you.

You will get a mask for medium gray tones with a ColorRamp set up similar to this:


Adjust the location of knobs to isolate the range you want the mask for.

kesonmis, you are a life safer, I would never took this route !

after that, since i want just to isolate “projected” shadows, and the shadows pass give me a wider ranges, isolating midtones give me also the “contour” of the object. (see spots and contour detail attachment).
So I thought, I use a colour for (projeted) shadows and voilà, I isolate the colour.

But then, again not so easy: how would you isolate a colour with a colour ramp ?
(see midtones_with_Blue colour ramp attachment - clearly the wrong way)

thank you again.

Attachments




Isolating color is more difficult, but you can do it to some degree with colorramp also. The limitation of colorramp is that it has a one channel input (gray dot), but colors are three channel (RGB) sets. You can try to get a range of hues by using the Separate HSV node and connecting the H output to the input of ColorRamp. But the knobs in ColorRamp node must still be black and white, as they define the output image, not input! And the output you want (I guess) is a black&white mask that you can use as a Fac or whatever input in other nodes.

Easier way is to use a some of the keying nodes in Matte menu, most of them have an option to create a mask based on some chosen color.

Contour is the unfortunate sideeffect you get, because some pixels will be antialiased or simply have similar values to shadow area. To get rid of the contour erode the resulting mask a bit and then dilate after that to get back to similar edge position. Or you could also use a roto matte as a garbage matte and block out the stuff that you want to get rid of.

thanks,

I understand a bit better how the color ramp works.
The erode/dilate node, as you suggest works perfectly.
I’m trying to get a separate layer for shadows (shadow pass give more than “projected” shadows) for a NPR illstration.

thank you again for your help!

Daniele