Texture and Mask

Hello everyone! Please tell me if there is an opportunity to stretch the texture over the mask? The attached image will make it clearer what I mean… I need the mask not to take part of the texture, making the rest transparent, but to stretch it over the white zone.

Hey there @MellonHooly! To get a better idea of what you mean, are you just trying to only the white portion show the texture behind the mask?

With a simple overlay using lerp the upper texture will be displayed only partially when using this mask. I need this texture to cover on top in its original form when using such a mask

So you just want to mask the black and make that transparent and allow the texture to show on the white? Like this?

Just using it as an opacity mask works out if that’s the case.

@SupportiveEntity As a result, it turns out that the mask takes only part of the texture. In your example, it should turn out that all the colors are displayed in these small rectangles

Ahhhh so effectively you’re trying to shrink the texture to only the unmasked area right? This get’s to be much more complex depending on your use case. How is this material going to be used? Is it going to be on something that won’t need to change the texture in the center during runtime? I might be able to recommend a better way to accomplish this.

That’s right! The texture will not change. However, the mask will acquire different options. I think if there is no simple universal solution for pulling the texture under the mask, then this problem will not be solved with ue tools

If the masks little boxes are always the same size there is a really math intensive way to pull it off. It’d be basically finding the right tile size per surface area and applying it in the tiling coords. However if your squares in your mask aren’t uniform that won’t work out. How much change will the mask be undergoing? Are they going to be presets or something procedural?

The mask will take a variety of forms.

I use this method. The only thing that I need is not drawing with color, namely the imposition of another texture (sticker) on top of the mesh… Dynamic Mesh Painting in Unreal Engine 4 | raywenderlich.com

I gotcha, so be able to scale the texture automatically to a bounding box style of thing inside of the UV’s? That’d be a tough one. There’s no easy way to determine the size of the mask purely in material. If we could somehow determine the size, then it would be somewhat straight forward to shift the texture coordinates how you’d need, since your tutorial kind of already went over that no worries there.

Alternatively if you’re in something like say a character creator and you could move the onus to handling the tiling on the player. Basically you change the coordinate and UV tiling (or none) to mirror the positioning of the texture, but obviously the size of the tiling makes that something you’d need to modify manually as you’re painting.

I didn’t understand a little about the first one… The second method would be a good solution, however, since the opaque parts of the mask are located in different parts of this mask itself, then there will be problems

What about this method?:

Instead of using the render target as a mask draw the images directly into the render target?

Hi! This method works fine if the uv of the mesh is perfect, otherwise there will be problems at the joints. That is, yes, I need such a result, apply this to a mesh with a complex uv. Ideally, we need to combine this 2 methods

That’s the great part about having the players handle the tiling location, if they can also freely paint the mask then (while a bit more tedious) allows for great control. That said, it does come at the cost of allowing more authoring control, and if you’re in a multiplayer environment that could be less than ideal.

@L1z4rD89 Ohhhh! It looks like great solution. Thanks!)

1 Like

You are certainly right. But I really need this function, ahah) Thank you so much for your response and desire to help! I hope the latter method will suit me