Change diffuse map through masking

Hello all,

I am looking to achieve a paint-on effect where a new diffuse map is applied to a model through masking. I created a simple demo in order to explain what I mean using two render components but would want achieve this on the same model. Any ideas on how I should approach this?

You can write a shader chunk for diffuse.
In my own case, i merge multiple patterns as black and white textures, and used mix function to display different data, using patterns as a mask.


There’s a second texture map that is accessible via code that could be used (detailMap)

1 Like

I glanced that but didn’t realize it was simply another channel. That would make it rather straightforward although I also notice there was no opacityDetailMap – so wondered if the opacityMap would affect both diffuse maps?

It would apply to the model so in that sense, yes it would affect both diffuse maps

In that case – how would I mask one of the diffuse maps? Is there another way apart from using an opacityMap to do it, without using your own shader chunk?

opacityMap would affect the rendering the mesh hence why there isn’t a ‘detail’ version of it.

@TonyLGC did this for their knife configurator: Showing multiple textures on the same model

@TonyLGC are you able to help here?

IIRC, you had to have a big enough border around the decal detail texture and set the texture to clamp so that the mipmapping of the texture doesn’t grab the pixels on the edge of the mipmaps and stretch them.

You can then use the UV offset and tiling properties to position the decal on the detail map.

Hi! Sorry, didn’t see the notification! Is this still unresolved? :sweat_smile:

I’m not really sure how to help though, and no idea how to animate all this… Can a texture be a .gif?
Also, blending the main diffusemap and the diffusedetailmap is hard (for me :stuck_out_tongue:) when the detail is something else than a black&white or black&transparent image.
A B&W diffuseDetailMap with multiply mode makes a nice mask, everything white (or already transparent) becomes transparent.

Here’s an example with a “stain” and the more a pixel is close of white, the more it’s alpha value decreases. This is in MIN mode, which has the best effect in this example but it will vary depending on which of the main or detail texture is the darkest…

Not sure if it helps, but it might be a step towards a solution haha, good luck !

Yep that’s correct! The size of the border varies and the glitching pixels can appear at any zoom level… (in general 10px is good enough in my experience)