Home Unreal Engine

Is it possible to use multi-tile textures in UDK?

polycounter lvl 10
Offline / Send Message
Subtle 1rony polycounter lvl 10
Hello Polycounters,

I'm experimenting with some texturing workflows in UDK and was wondering if I could ask a couple questions as well as get your input on the following:

I have my uvs for a number of objects set up the in the following format(using multi-tile textures):
uvs.jpg

The closest I have come to figuring it out is using the terraintLayerCoords node in the Material Editor, which allows you to change the “Mapping Pan” in u and v. In other words it basically lets you slide the uvs in x or y position. The only problem is that uvs seem to tile or “wrap” outside the 0-1 space, keeping me from accessing the uvs I have set up outside the 0-1 space.

Issue demonstrated here:

values at default
multi_tile1.jpg

wrapping texture problem
multi_tile2.jpg

I would like to type in a value of 1,0 in mapping pan u to access my second set of Uvs. However, inputting (1,0) gives me the same image. I did (1.5, 0) to demonstrate the wrapping effect of the texture.

I guess what I'm looking for is a way to turn off the wrap in u and v. To get the multi tile textures to work in maya, there are checkboxes in the 2d placement node to turn this off, and then in the same node you use translate to place each texture over its respective uv layout.

Is there are similar way to do this in UDK, or perhaps an easier method to do this?

As I type this, uv sets are jumping to mind as an alternative. Would that allow me to do the same thing with different steps? If so, is there a limit to the number of uv sets I can have?

If you've read my lengthy inquiry, I thank you:)

tl;dr: Can multi tile textures work in UDK(if so, how?), or should I just use multiple uv sets? If uv sets, how many sets am I limited to? Thanks:)

Replies

  • blankslatejoe
    Options
    Offline / Send Message
    blankslatejoe polycounter lvl 18
    well, similar to maya, you'd need to set up a second texture node and offset it's coordinates. The trick to stopping the first one from displaying is on the texture's properties itself. Double click the texture itself in the content browser.

    There's a field you can set to WRAP, CLAMP, or REPEATEDGEPIXEL, iirc. You want clamp.

    Then, it's a matter of offsetting UVs of each texture paths in your material and lerping or adding them together.
  • blankslatejoe
    Options
    Offline / Send Message
    blankslatejoe polycounter lvl 18
    ooh, looking again, youre UVs are outside 0to1...so that won't work as UDK will stack them all in the 0/1 range. The same theory applies though if you shrink the UVs to fit within the 0/1 range and use smaller offsets.

    Course, you could just apply a second material to those faces in maya and then itll import with two material slots to fill. Costwise, that adds drawcalls, but is the normal pipeline for doing this sort of thing.
  • Subtle 1rony
    Options
    Offline / Send Message
    Subtle 1rony polycounter lvl 10
    Hello, and thank you for your response. I think i'm a little confused, in your last sentence do you mean each texture should have its own material network? rather than trying to add them all together within one material? Two ways to do the same thing, but I'm not sure if one is better optimized than the other.

    Also, wouldnt scaling down my maps to fit all within the 0-1 space crush my resolution when I go to texture them? The reason I have multiple tiles is so I can maintain a decent amount of resolution on multiple objects. I.e. if all my shells were on one map, they would be too small to receive enough pixel resolution.

    I didnt know about turning on the clamp option in the texture properties, so thanks for that tip! I will check into it and see if it helps.

    And as always, if there is an easier way to do this, I am all ears. blankslatejoe, I think you already mentioned one, but I am just confused as to what you meant exactly.
  • blankslatejoe
    Options
    Offline / Send Message
    blankslatejoe polycounter lvl 18
    1: yes, rather than try and fit them into one material, you can simply apply multiple materials to the object in maya (select faces and then apply the material to them), and then export/import again and where you normally apply the material to a mesh in UDK there will now be more slots...and each slot can have its OWN material. This adds "draw calls" (basically, it counts the object as drawing again for every material), but it's not a huge concern so long as you're not doing it for every rock and crate. In a past project I've worked on we had up to 7 or 8 materials applied to some important buildings and such.

    Thats definitely the easiest--and most common way to add multiple materials to an object. No need to set textures to clamping or anything if you do that, either. If you've got special circumstances (super low spec mobile game or something) then you might consider going down the more complicated route you were talking about.

    Even if you DID go down that more complicated route: Scaling your uvs won't crush the resolution in Unreal--so long as you dont resize the textures that go on them. UVs themselves are resolution independent--it's the textures that would be crushed--when you apply those 'texture coordinate' nodes you basically would be scaling the UVs back up...then applying that to the full res texture. I've used this sort of trickery in the past to add some complexity to materials for simple objects that needed low draw calls...but, yeah, it's not standard practice. You also won't be able to easily preview this in maya/max without building a shader network in those aps to match the behavior.
  • Angry Beaver
    Options
    Offline / Send Message
    Angry Beaver polycounter lvl 7
    U/V information is not stored relative to the picture. What he's suggesting is to scale down your U/V co-ords so they all fit in 0-1 at export and then during runtime scale them back up and offset the upscaled version.

    Personally I think you're doing a very odd pipeline. There's no way pixel data will exist outside 0-1 so what are you trying to do by having them outside of that? Make it easier to work with so that they're good in editor? that's fine but it's going to get compressed into 0-1. So you have multiple textures right? well each texture is going to need it's own material or material instance. There's no way around that. This means your going to have to split up which polys get which material. At that point it doesn't matter if the u/vs for the other textures overlap because they're in a different material and not pulling from the same diffuse.

    I'm just perplexed by what your trying to do because it doesn't really seem to solve any problems.
  • Obscura
    Options
    Offline / Send Message
    Obscura grand marshal polycounter
    Hi, Just use multiple material id's, that's the easiest solution for what you want. You don't need to use the outer uv spaces, overlappings are working good with this. Also, You don't need to make more material than one. If you use texturesample parameters, then you can change the textures in the material's instance. If you have a mesh with multiple material id's applied to it, then if you doubleclick to your mesh, you will be able to assign multiple materials to this mesh.
  • Subtle 1rony
    Options
    Offline / Send Message
    Subtle 1rony polycounter lvl 10
    So I made a quick demonstration image to show you guys what I'm talking about. it looks like turning address X and Y in the texture properties fixes the wrapping of the texture, so I can access uv coordinates outside of my 0-1 space with a panning node. Angry Beaver, hopefully this makes it clearer what I was trying to do.

    process.jpg

    essentially I can use 3 textures on an object within 1 material, rather than 3 textures with 3 materials. Am I being silly and making this more complicated than it needs to be, or are there benefits to doing it this way?

    Basically I was looking into this method to apply multiple high res maps to a mesh, and it seemed logical because it uses only one material.
    Thanks for all your help!
  • blankslatejoe
    Options
    Offline / Send Message
    blankslatejoe polycounter lvl 18
    Well, it's a much more complicated workflow to get the same visual effect as applying multiple materials...there's no visual benefit to doing it your way since you're applying things still on a per-face value and not a per-pixel (since you are using UVs to mask what texture goes where, and not a painted mask, for example).

    So, that said, the only benefit to this method I can come up with is the drawcall one.

    If you're not working for web/mobile, or you don't have a ba-jillion of these objects in the scene, or if you're not planning on making a per-pixel mask instead of using UVs/panners to mask things, then it's almost certainty not worth the effort to go this route. I'd just use multiple materials.
  • Hourences
    Options
    Offline / Send Message
    Hourences polycounter lvl 18
    http://www.polycount.com/forum/showthread.php?t=90092

    You may be after that. Second thread somewhat the same (I think, didn't read it): http://www.polycount.com/forum/showthread.php?t=91942

    Also the built in material function for CroppedEmissive has a setup inside of it that allows you to move and offset a material, without having it tile, in case you are looking for that behaviour instead of the above.

    You can also turn off tiling on textures entirely if you double click a texture - and set wrap to clamp. You can however not offset a texture indefinitely in clamp mode, you can only offset it about 5 times or so before it stops working.

    The drawcall advantage you can get from this is rather big, though your material complexity goes up. If you can find the balance between the two it can be pretty decent. Does only work on PC/console though.

    If you use the first method you will experience problems with seams between the various parts, because of mipmapping. There are some setups that counter that, or you can manually add buffer space in Photoshop.
Sign In or Register to comment.