DIFFERENT TXT MAPPING FOR EACH UV IN THE SAME UDIM?

Hello ev! :slightly_smiling_face:
Suppose I have multiple uvs in the same udim, and I want to apply a different mapping/tiling of the same trim sheet on each of them. (for example, the texture on this uv, will have scales 1x1, this other 2x3..etc)
Is there a way on UE to do this?

Thank y’all so much!

Yes there are multiple ways to do it,

simple answer: make material and manipulate uvs inside it,

longer answer, would require pictures of mesh setup (material slots) and material you want to use, and textures (more like number of them)

this topic about mixing textures, mapping them in different ways is too big for general answer to single post.

1 Like

@Nawrot You are right, I propose a more specific example. From the software where I model, I can get the uv vertex that tell me the exact coordinates of each uv inside the same udim. Suppose I have in this udim, the uv of the wall and the floor, how can I create a mask on those coordinates so that the subsequent nodes manipulate only what is inside the mask, manipulating for example only the uv of the wall and excluding that of the floor and vice versa? Could you help me understand the necessary nodes inside the ue material? At the moment I am able to create a switch static parameter to isolate for example operations for one udim rather than another. But I am not sure how to do it for the coordinates of the individual uv.

Thank you so much!

i can give you general descriptions that you can read, then decide what is best for you:

So some methods to mix materials:

  • use vertex colors (painted on skeletal mesh) then apply different material (with its own UVs) based on vertex colors. You can easily mix 4 materials with just RGBA, or even more but it needs more complicated function to detect colors of vertex
  • use texture masks. You paint 8 or 16 bit black and white mask then lineary interpolate beetwen two textures using that mask. You also can compact 4 masks (RGBA) into single texture
  • you can have multiple material slots in single mesh, each slot can have its own quads/triangles that it is displayed on. This is like you would connect together multiple meshes, each having separate material into bigger mesh (or slice bigger mesh into smaller pieces and applied different material to each). However this should be done in 3d apps that you creating meshes with.
  • you can mix that all with blending functions and layers. Something like this is usually done for landscapes, but same materials can be done for static meshes. I am not sure how performance would be if you had multiple blended materials for bunch on static meshes. Ie. landscape is usually single object, making it many objects (meshes) all with different blends may be not so nice for GPU.
  • and there is “Mutable” plugin, it is experimental, but it can split meshes (and skeletal meshes) into smaller pieces. With it in unreal you could split wall from floor, and have two meshes each could have its own material. Then you could combine it back into single mesh with two material slots.

Ps.
Each material layer can have its own UV mapping, so you can resize floor tiles to 0.5 UV and bricks to 1.25 UV

1 Like

@Nawrot
Very kind indeed!
Can I share with you the logic I’m using in one of my materials?
So maybe you can tell me better if I’m doing something wrong and/or if it can be done better in terms of optimization?

post pictures of material and of example mesh.

Usual problem ith unreal: you do not know some system, so you do not know keywods, when searching or describing it , you may use wrong keywors, and get wrong answer. And when you know correct keywors you usually do not need help with that system anymore. So pictures. :smiley:

1 Like

@Nawrot

I’m trying to multiply the float of the perInstanceRandom to determine with the switch, which texture will be applied. I’m doing the same for color, rough and normal. Is there something missing?

You need to explain whole setup ie. whole material and example of mesh.
You also never mentioned this is for instanced static meshes.
So whole setup, so i know what you need, and then can make some better example.

Btw. try out “named reroutes” they really reduce all those wires all over place.

1 Like

@Nawrot

Yes you are right forgive me, I have a bit of confusion in my head. Basically what I’m trying to do is to assign to my hisms, one of multiple textures in run time at random, while they spawn. I thought about it to reduce RAM waste. So if the value is one for example, it should pick color/rough and normal on 1. And so on, for all the sets I want to create.

So in addition to this, randomization and recycling, I wanted to know if there was a way to isolate and perform correction actions on single uvs in the same udim. To understand if I can best reuse a trim sheet on multiple different meshes, or if I should create different trim sheets for each of them. Considering that I have merged meshes. I hope you understand what I mean.

I hope this is what you are looking for:

my older post about mixing colors for instanced meshes, you can easily modify this to mixing textures. it can mix up to 10 colors. With textures you kind of need atlas that selects correct cell, or you flood gfx VRAM really bad.

You should use 4x4 atlases for al textures, then use FlipBook node (and then just give it random parameter*16 then truncated). Or there is that new thing “texture array” just research which one is faster.

ps. use functions and named reroutes.

pps. I think that you can use multiple materials like this one (improved for your needs) to be applied to separate material slots in meshes.

You may also find this function useful:

it creates random scalar from object world location, however for instanced meshes it is same location per cluster of meshes, and that is one of limitations for such meshes. Function uses some “standard” formula for calculating randoms. Numbers inside DO MATTER, use exact same numbers, or google for any of them you will get explanation for math.

1 Like

@Nawrot
Good morning mate

Do you mean to collapse my nodes into a function? and also.. So in my case this material is not optimazed?

I’m avoiding channel packaging because the last time I did it I noticed that the final weight of the txt was almost identical to having separate textures and also completely altered the final result of the shader, as for the flipbook I knew it was used to create a grid of frames to then animate..so I wouldn’t even have an idea of ​​how to use it in my case. As for material optimization, I don’t know much about it. Apart from instancing and avoiding some settings that have more impact on the ram.

I have no idea about your material, i never seen it.

And i mean not optimize , just split material into section (with named reroutes), then pack common pieces into functions, organize it. When you do it all you will see structure in that stuff, and may get ideas how to do it all better.

1 Like

anyway currently from the tests I have done the random assignment of a set of textures works, now I just have to find a way to integrate the randomization, the identification of single uvs, to then apply a more appropriate tiling to the mesh. The material I was talking about was the one in screen. If you have nothing else to recommend, anyway I thank you very much for your answers, as soon as I have the chance I will let you know if the nodes you suggested will work for me. It is not easy as solo dev.