How to using image map and fresnel "together" to control glossy layer?

Is there a way to mix in a glossy shader by using an image map to define where something should be shiny and in addition use a fresnel/layer weight node to control the reflection strength based on the view angle?

I seem only be able to do A or B but not find a way to use both together.

Below is a screenshot - you can see how the flower pattern reflection is clipped by a texture map.
I would like to add a fresnel/layer weight node here too.


Looks like the trick is vector math


That will depend on your materials definition… I would keep each fresnel inside each shader type (one fresnel for the fabric, one fresnel for the flower pattern), and mix both with your mask.

Adding values to the IOR is not a nice trick, it means nothing and can give you unexpected values in terms of energy conservative results.

Yeah I see that now too. Darn I was hoping I could maybe escape the need for all those mix shaders.

You can see nicely how for each material they add they have everything from reflection fresnel strength texture modulation/clipping etc block by block


Under the hood, the shader in that screenshot is almost certainly turned into something like what Secrop described.

Depending on the exact shader you need, you might be able to mix two fresnel node outputs with a mixRGB node instead of mixing two entire shaders.

Yup… But even so, it is better to keep the shaders separeted, at least while fine-tunning them. When they are finished, we can then compress the various inputs into just a single principled, or a small group of BSDFs. However, from my experience, there’s no great speed up doing it this way… it may be usefull for some materials, or to prepare/preview final mixed textures for baking, but it makes adjustments in the shaders a bit more difficult without a good organization.