Light mask on meshes?

IIs there a way to use a texture in the shader editor in a material of a mesh as a mask such that when you place lighting on the mesh, you can control the amount of light on the part of the mesh that is masked or you could even make the effect of light to be zero on the masked part?

Hm, this is not how physics works to my knowledge (except maybe for a black hole) and therefore will not work so easily in Blender. But what you can do is to simulate it according to your ideas. So e.g. connect your mask with two shader inputs (to mix them) and adjust the shaders according to your ideas.

2 Likes

Create a Mix Shader node, plug your regular shader in the top input and a black diffuse in the bottom, and then your mask in to the factor input. Maybe control the amount either with the opacity of the mask or/and with a Map Range node between the mask and factor input. Should do the trick :slight_smile:

2 Likes

Watch this video…It is GREAT for helping with the functions that you asked for…
After watching 1st time…re-play and slow it down to get the most out of it!!

2 Likes

@Ruwo Good idea. Thanks

@Tell It does the trick but I am trying to avoid using multiple shaders in my material to reduce rendering time but I think using only diffuse shader like you suggested should work fine. Thanks a ton.

@RSEhlers Yeah, I have seen it but its for lights not meshes. I can mask a light not the mesh. There may be a trick to it though

No problem :slight_smile:
Not sure how much multiple shaders actually slow down the render time. Maybe I’m just spoiled with my 3060ti, but I use multiple shaders in a material aaaall the time. Would be interested to see if anyone actually have tried this, you know of any test or something? :slight_smile:

2 Likes

That is the principle of plugging a texture in a shader.
A shader controls shades on the object.

In principle shader, main setting is Base Color.
If you plug a B&W texture in this setting and Specular setting, surface will reflect light on white parts or no light in black ones.

If you coloured your mesh, your black and white texture has to control values of colors.
To do it, you just have to use a set-up modifying what is plugged into those settings.
You have a large variety of nodes to modify colors in Color nodes or Converter nodes categories.

Nope. Unfortunately I don’t so I am also curious about it so I am trying them out and asking questions. :slightly_smiling_face:

I have an RTX 2080, not as powerful but with better optimization, faster rendering time I am hoping.

@zeauro Yeah, was tinkering with the specular in the principled shader. Most times, it supposed to be left at 0.5 but I think its a parameter that needs a map for more photorealism.