Is it possible to use the UV of another mesh as a mask in a shader? (with nodes)

Hey, is there a way to look at the geometry of another mesh, see how that maps on its uv, then use that as a mask for a shader, for example plug it in to the factor of a mix color node? I know you can do it manually in an image editor, but can it be done procedurally?

For example the geometry outlined in grey here would be filled as the mask:
Screenshot_18

Hi,

Isn’t that what you’re looking for?

1 Like

Thanks im gonna try it. It’s too late now but will soon as i have time

it’s probably possible with geometry nodes in a probably quick, dirty and un-optimized way…

First try that on a monkey mesh :

This allows to put each faces in their UV space.
Next step is to do the same with the other mesh, create the mask probably using the geometry proximity node, and finally transfer that to the original mesh…

Not super easy for a start with geo nodes, but maybe someone will be kind enough to make the full setup for you …

There are a few issues with that technique tho :
first it’s dependent on geometry, if you don’t have enough mesh definition the mask is likely to be very coarse and maybe not usable.

On the other hand, it’s doing a few operation on geo data, especially with dense mesh this is going to slow things down, which is probably going to be ok unless you work on heavy meshes, or you plan to animate the mesh, in that case it’s possible that you’ll loose a few playback fps depending on the mesh…

Maybe it’s worth looking if there isn’t a simpler way to make what you want, do you really need to do that in the first place ?

3 Likes

No, it won’t have to worry about animation or performance beyond texturing. This seems to be sort of what I want. Don’t have much time with geometry nodes but I’m sure I can get something working. All I really cared for was to make masks from UVs quickly.