Home Technical Talk

Some environment texturing technical Q's

Hi, I haven't found much information around on these things so I'm going to ask them here!

(1) When doing UVs for buildings, is it much better to use overlapping UV's (or tiling textures) or are most games steering away from these and having unique UV's for all polys? I'm thinking current/next gen games with massive use of normal/spec maps etc.

(2) For terrain, I guess tiling textures are still required,. Is most terrain texture generated from a blend of multiple maps? With different tiling counts? Does each texure that is blended have different UV's then? How many blends are usual in a detailed terrain and thus how many blend maps? As you can't bake lighting into tiled UV's I'm guessing that multiple UV's are used for this....?

(3) What are the differences/advantages of overlapping as opposed to tiling? Is tiling supported by most engines?

(4) How many UV channels are typically supported by engines?

That's about it for now, I know theres a lot of questions and it's not possible to answer for all engines as they have different capabilities, but any help anyone can give using their experiences in the industry would be appreciated. As would any links to any tips on best practices for this sort of thing!

Thanks and regards

Replies

  • Eric Chadwick

    1. Usually... tiling for repeatable details, decals to break it up, and lightmaps for unchanging lighting (ambient occlusion, constant lighting & self-shadowing).

    2. Yes, blend of multiple tiling maps. All using same UV is more economical, though many engines support per-texture local UV pos/rot/scale within the base shared UV. Usually around four bitmaps can be blended together. Games use usually either vertex color to blend the maps, or they use RGBA channels of a blend bitmap. Lightmap requires its own dedicated non-tiling UV, same UV the blend bitmap uses.

    Exceptions... Crysis seems to not use a lightmap. QuakeWars uses !!MEGATEXTURE!! (non-tiling large-resolution bitmap).

    Some reading.
    http://developer.amd.com/assets/Andersso...MD_Session).pdf
    http://reality.artificialstudios.com/twiki/bin/view/Main/MixMapTutorial
    http://udn.epicgames.com/Two/VertexBlendingTutorial.html

    3. Tiling is supported by all engines, unless there's some weird hardware limitation (mobile perhaps?). Tiling requires the texture to tile at the edges (left-right or top-bottom or both), also uses less in-game vertices (every UV split requires multiple verts, read this).

    Overlapping is reusing the same pixels, uses more in-game verts (potential slowdown), but allows lots of customization per polygon/area since the UVs can be rotated/scaled/moved/mirrored differently.

    4. We support 99, but I'd never use that many, way too expensive.


    That's my experience, other artists around here with more level design experience than I, hopefully they'll chime in.

    Also do a search, these topics have been discussed recently.
  • rhumba
    Thanks a lot! Sorry it took so long to respond, I was waiting on some email telling me about your reply but surprisingly didn't get one. So this is the first time I've had to check the forum. All makes perfect sense, I did do some searching, also some finding of great (+old) posts but couldn't relocate them again when I wanted to... never mind.

    Currently studying your links, best regards
  • Eric Chadwick
    You're welcome. Polycount's forum software doesn't default to sending you mail, I find I have to hit the Favorite Topic button if I want an email from a thread.
  • Justin Meisse
    Offline / Send Message
    Justin Meisse polycounter lvl 16
    check out Crazybutcher's vertex blend FX material

    It lets you veiw vertex blending in the viewport, which is nice for terrain stuff, and it also does multiply and overlay textures so you can have a repeating brick pattern on a wall and then use a dirt overlay that is using a seperate UV channel

    here's a sloppy drawing to help illustrate
    fxexample.jpg
  • rhumba
    Actually thats great and very timely, I've been searching for some way of doing this recently!! Ideally though I'd like to use a blend map instead of vertex colours [Edit: I see the shader has this option too..] but unfortunately I haven't worked out a way to paint the blend maps while seeing the result... I know Max comes with a DirectX blend shader which will display this in the viewport, but Max isn't exactly a painting program.
    Anyways, cheers for the input!
  • Eric Chadwick
    I've been looking for a tool to paint grayscale masks between diffuse+normalmap materials, haven't found much yet.

    Tried to do this with Modo's 3D paint awhile back, but it couldn't do it. Maybe they're improved since then.

    Then CrazyButcher wrote a quickie 3D painting tool for his Luxinia engine awhile back. Very bare-bones, but it does the trick.

    One of the other artists here was checking out Body Paint 3D to see if it could do a similar thing, it does support multiple UVs (each has to be diffferent material, but you can layer the materials)... but it can't show the results in its real-time view, only with its offline renderer. frown.gif
  • rhumba
    Interesting links you gave there, nice one. I've found a way to paint the blends in Max and view it in realtime using that shader from your earlier link, so I'm quite happy with that. Unfortunately it goes the VertexPaint route, and to get an image at the end (the greyscale blend map) of it you must render to texture, and then do some touchup. But it's a great way to get started and if you're limited by the geometry you can always turbosmooth as you are only rendering to texture via UV's at the end.

    It basically involves using the DirectX9 material and the vcolorblend .fx file, then assigning the material used in the render to be 100% self illuminated with a VertexColor shader in the Diffuse Map slot. Then the render to texture output will just show the vertex colors. If anyone's interested I can post some more info on this.
  • Eric Chadwick
    Yeah, that totally makes sense. Limited to vert res, but certainly usable. Good job. Going to try this out when I get some time.
  • rhumba
    Had some luck with using the Max DirectX 9 Material shaders with full vertex color + alpha channel for blending of four different textures. Updates in the viewport as you paint using VertexPaint, there are two to choose from:

    http://www.loopit.org/downloads/vcolorblend4.fx
    http://www.loopit.org/downloads/vcolorblend_bump4.fx

    The _bump one has normal maps and specularity and looks tasty, nice when painting four different normal channels.
    Let me know if it's any use!
  • Eric Chadwick
    Wow, thanks for sharing. Sounds great, I'll check it out and let you know.
  • CrazyButcher
    Offline / Send Message
    CrazyButcher polycounter lvl 16
    max allows in some way to paint on textures directly, too. There is a maxscript tutorial in the help files, which manages just that. (How To ... Develop a Bitmap Painting Tool - 3D Painting)
    I suspect its not so hard to make that script write into single color channels. maybe the texture uploading isnt as responsive as it should so. (wait I think that was the reasion I wrote the texture painter in luxinia for you in the first place wink.gif )

    I also just modified my shader doing the blend4, although I do a bit different I use the sum of RGB to compute a "rest" weight which is applied to texture D. If you dont like that just change the weight generation function. Optionally you can apply vertexalpha as brightness for vertexpainted shadows at the end.
  • Eric Chadwick
    Yeah, I recall something about how max wouldn't let you refresh the bitmap in a FX shader, or something.

    Ah, here it is.
    http://boards.polycount.net/showthreaded.php?Cat=0&Number=159459&page=1&vc=1
  • polarize
    The "vertex blend FX material" looks great. Does anyone know if there is a similar shader for maya?
    I'm especially interested in this feature:
    "The third technique blends 4 Textures based on Vertex R G B Channels individually. The 4th weight is the rest value that is left (if all others are summed to 1)"
    Other nonshader solutions would be also much appreciated. wink.gif
  • Eric Chadwick
    Hey rhumba, got a chance to play with your shader. Works great! Specular's a bit hot, and max tends to slow way down when I tesselate my mesh then try to paint the vert colors. But it's real nice being able to bake vert color from another material (like a top/bottom or a falloff or whatever), then swap to yours and edit away.

    At some point I'll try to edit it some, adding a shadowmap and some other things. I'll be sure to post the file if I do. Thanks again man.

    Also CrazyButcher I'm going to play with the Luxinia tool again when I get a chance, let you know how it goes. Not doing much terrain these days, but will probably do so in about a month.
  • rhumba
    Thanks for all the replies. Crazy Butcher I'll have a look at the painting method you mentioned, haven't had a chance yet, thanks for letting me know! Oh, and thanks for providing some hlsl for me to mangle. I like the sound of using the magnitude as extra data, by normalising we are throwing away some info. I was thinking that normal maps should be using the magnitude as extra data too the other day, as normalising chucks half away.

    Glad you had a chance to try the shader Eric! Yeah the specular is pretty hot as I find it easier to see surface details like that, but it's probably not ideal. I found painting very responsive using lower res meshes but with larger meshes even just VertexPaint alone tends to slow down. But certainly the fx file is not optimised at all, would be interesting how it performed in pipelined assembly.

    Yes, I would really appreciate any improvements you can suggest/provide!
    I also had some luck with displaying zbrush MatCap materials in Max using a custom shader and they look really similar, apart from the cavity detection of course.
  • MoP
    Offline / Send Message
    MoP polycounter lvl 16
    Matcap display in Max sounds pretty cool! Any chance you'd be able to share that shader?
  • StrangeFate
    Offline / Send Message
    StrangeFate polycounter lvl 16
    [ QUOTE ]
    Tried to do this with Modo's 3D paint awhile back, but it couldn't do it. Maybe they're improved since then.

    [/ QUOTE ]
    The way you would do it in modo is by just painting with your textures as you want them to blend, the transparency of what you're painting is stored in the alpha channel (unless you're using a format with no alpha).
    You can then take the resulting alpha channel and save it as a proper grayscale or whatever you need for the game engine.
    The painting has gotten a lot better in v3 but is still not perfect nor perfectly stable.


    As for environment pieces, we use vertex blending here and a trim shader for details. It doesn't give you a custom unique look for all the single buildings and there's some limitations but it was the best i could come up with without using lots of custom textured details that will only work for 1 material etc.

    http://www.strangefate.com/webby/dshow.jpg
    http://www.strangefate.com/webby/dshow2.jpg
    The vertex blending is pretty obvious, i was only given the blue channel as the others were already being used for other stuff. Ideally i would have liked 2 channels so i could blend the bottom of the buildings with brighter dust/dirt or whatever blends better with the ground.
    Also i never got around to experiment properly with decals to add large weatheration covering the whole building or on selected areas under windows etc.

    For the details i came up with a trim shader which isn't exactly revolutionary. It takes a normalmap and a grayscale occlusion map mapped to UV1 and blends it with the tiling textures in UV0 and doesn't require a new material.
    If you have detail normalmaps or otherwise can blend textures and normals you're mostly there i'd say.

    The advantage is that it's quick to use and the same trim texture (a 2048x256 map) is used all over the game for all kinds of architecture or even street lamps.
    The biggest drawback i found is that people often don't know when to stop, and will either overuse it, use the trims in ways that don't make sense, or use it on pieces that should really have a custom texture and normalmap.

    Plus obviously... all shading will go to black from the occlusion, whereas if you skinned the stuff properly, you'd have brighter dirt and soft highlights here and there.

    With the right mix of custom and tiling-trimmed stuff you can get some really neat results, it's an easy way to have bumpy details everywhere and higher res textures with details than if you had to make them custom, and cheaper.

    http://www.strangefate.com/webby/dshow3.jpg
  • IronHawk
    Offline / Send Message
    IronHawk polycounter lvl 10
    This is going in the reference folder. Thanks SF!
  • Eric Chadwick
    Hey thanks Mario I appreciate the pics. Looks great.
  • rhumba
    great, that trim texture approach sounds like it would save me some time, its especially helpful for multiple models with the same theme.

    MoP, about the matcap shader, I'm not really ready to let it loose yet, sorry.
  • Sage
    Offline / Send Message
    Sage polycounter lvl 16
    That's some nice work you got there Strangefate.

    Alex
  • CrazyButcher
    Offline / Send Message
    CrazyButcher polycounter lvl 16
    rhumba, the speed loss comes from max having to update vertexbuffers, not the shader itself. The sahder is so simple that I am very positive that HLSL compiler does a very good job, and even if you wrote the asm by hand, wouldnt really help much.

    its nice the hlsl code helps, but I'd urge you to add your name to the fx file, too. Like I am happy you left my name in there for saying where the original stuff came from, but you should also say its not all mine wink.gif and give yourself some credit for changes made.
Sign In or Register to comment.