Download

Materials, UV Channels and maps

I am sure that by now (after many hours of reading the unreal engine documentation), we all can agree that we would usually need 2 UV channels for our game assets:

1[SUP]st[/SUP] UV channel is usually for our standard baked textures to be mapped from, you can overlap UVs (only if necessary) and can go beyond the 0-1 space

2[SUP]nd[/SUP] UV channel is for the lightmap, and the UV cannot be overlapping and must be within the 0-1 space.

My question is, if for example I have a sofa, the main portion of it which requires a standard fabric material, is a lot/huge, whereas the fabric texture is small, therefore I have to enlarge the polygon in the UV mapping, so that the size of the fabric texture fits the sofa. But then it will mean that I have to go beyond the 0-1 space. If I were to keep it all within the 0-1 space, texture quality will suffer and going to a higher res map is not really a good thing to do.However, it works fine, as there is a 2[SUP]nd[/SUP] UV channel for the lightmap. I think this tutorial explaining texture density pretty much covers what I’m to say.

Texture Density

But what if I want to texture that way (outside 0-1 space and overlapping UVs), so that I can reuse my seamless fabric material in UE4, but I want to add an AO map and normal map for my sofa? How will I proceed in the material creation for my sofa? Can I, for example, assign my AO and normal map using the 2[SUP]nd[/SUP] UV channel since it is not overlapping and all within 0-1 space, and also because the 1[SUP]st[/SUP] UV channel will not work for AO and normal map? Or do I have to, no matter what, all maps be used through the first UV channel? Or is there another way around to tackle this problem? Thank you in advance. :slight_smile:

You can use the lightmap UV channel or even add a third one. Just drop in a Texture Coordinate node in your material and set it’s UV channel to 1 then connect it’s output to the UV pin on your texture sample.

If you have your AO as a single channel in a texture that needs to be tiled you just need to have to sample nodes to give them different UV channels.

Edit: Another way to do it that should work well in most cases is to UV map for the AO/normals etc in one channel, light map in another one. Then just scale the AO/Normal UVs when applying a tiling texture.

Thank you very much Parkar! That is exactly what I am trying to find out. But just to clarify things, so my sofa has 4 material IDs, for fabric1, fabric2, fabric3 and metal. So, where would my AO and normal map be placed in? I tried to open my fabric1 material and put in the AO map, and did the Texture Coordinate node like you said, and it seems to work fine, I did see the difference. But now since I have 4 material IDs, does that mean that if I put my AO into fabric1, the AO will only appear in areas where there are fabric1? Because it is masked by the material IDs? So does that mean I have to apply to all 4 of my materials to see the full AO effect?

Yes.

Note that it may be better from a performance point of view to make it just one or two materials that handles all the textures and blends them based on vertex colors or a texture working as a mask. Makes for a more complicated material though.