Home Technical Talk

Multiple UV channels?

polycounter lvl 20
Offline / Send Message
ScoobyDoofus polycounter lvl 20
I read something somewhere about a model containing multiple UV channels, and my question is this...
Do any current game engines support this? Would it be efficient?

I suppose it would be useful if I wanted to have a object with baked lighting, & normal maps (situations where 100% unique non-mirrored UV's help), but also have repeating high-res diffuse, spec, alpha & bump maps that use seperate mirrored UV coordinates...

Just a randon thought. Anybody have any experience with this?

Replies

  • HarlequiN
    Offline / Send Message
    HarlequiN polycounter lvl 18
    There are quite a few reasons you might wan to have multiple UV's on the same model. Maybe you want a repeating grime map that you can control, so that the players armour gets dirtier as the game goes along. You might use two UV channels for that - one for the mask, indicating which places get dirtier more easily (set up much like an alpha map - white for cleaner, dark for ditier), and another for the actual dirt, which is just tiled over the whole model. As the model gets dirtier the transparency of the dirt map is lowered, based on the levels in the Mask.

    Or you could use it for decals that have a higher resolution than the underlying map channels texture (I believe they use something like this on the Need for Speed Underground series), a bit like the old trick of floating an extra poly over the surface containing a logo or watermarks or whatever, to break up the tiled texture underneath, except you don't need the extra poly's floating on top.

    There are quite a few other uses, but I won't go into detail here.

    And yes, you could use it in the example you mentioned (having normal maps use one channel, and the spec, diffuse and so on use another), but I'm unaware of any engine that is currently doing that, although if the UV map was generated automatically by the same process as the normal map it might make sense to do just that in some cases.
  • MoP
    Offline / Send Message
    MoP polycounter lvl 18
    The only time I've used it was like Harl described, for using "decal" textures for a PS2 game.
    Not sure how many engines support multiple UV maps ... might be worth digging around for more info.
  • Eric Chadwick
    We do. Not publicly available tho, yet. But plenty of good uses to be had.

    One limitation... everytime you include another UV set, you are basically duplicating the vertex count of your model, which can reduce framerate.

    At least if the UVs are different... well you wouldn't want it if it wasn't I guess, but the engine will auto-reduce them to the same set if they're in fact the same UV coords.
  • Ryno
    Offline / Send Message
    Ryno polycounter lvl 18
    Most of the time, I've used the second UV channel for lightmaps. So, in channel 1, we'd have our diffuse, bump, and whatever, which may be tiling quite a bit for environmental stuff. Then in channel 2, we bake out separate lightmaps, which obviously we don't want to tile.

    For example, say you've got a brick wall with a car parked in front of it, casting a shadow upon it. The brick tiles on the wall, and the environment is pre-lit, using lots of fancy radiostiy/final gathering/global illumination stuff, which is done in the 3d package. So, we would apply a brick material to the wall, and tile the UVs in channel 1, so that the brick pattern repeats. Then we would set up our advanced lighting solution, so that the car cast the shadow on the wall. Next, we would bake this lighting information out to UV channel 2, which is not tiled. This bakes out as a new lightmap texture. The game engine then uses this map in an additive/luminosity type of blend, so that the wall appears to be illuminated properly. It aligns the textures based on the two different UV sets, with the brick texture repeating, and the light/shadow texture not repeating.

    So, you could use different UV channels for lots of stuff like this.
  • ScoobyDoofus
    Offline / Send Message
    ScoobyDoofus polycounter lvl 20
    Ryno: That was my understanding of, and assumption for most level geometry in engines where the light is precalculated.

    Eric: Yeah, again, I'd assumed the double vertex count.

    So lets say youve got a character:
    diffuse 1-pass UV:1
    spec 1-pass UV:1
    alpha 1-pass UV:1
    glow 1-pass UV:1
    bump/normal 1-pass UV: 2
    GI Lightmap 1-pass UV: 2

    So those last 2 passes would be the costly vertex count doubling...
    hrm. ok. This is turning out like I thought so far.
    I just saw this option for multiple UV channels in Max and wondered "wtf would you want that for?" and then thought about it for more than 2 seconds and realized it might come in handy.
  • Eric Chadwick
    Some people use the double-UVs as a replacement for 3D paint, to fix seams in their models, then bake it down into a single UV for game use.
    Neil Blevins has an old tutoril that explains kind of how that works, except for the baking part.
    http://www.neilblevins.com/cg_education/map_channels/map_channels.htm

    In your character example, I'd just combine the glow and lightmap passes into a single pass, since they're both emissive effects. But usually for characters, people just bake the GI into the diffuse, instead of using a lightmap.
  • ScoobyDoofus
    Offline / Send Message
    ScoobyDoofus polycounter lvl 20
    Yeah, I know. Thats what I do heh. I was trying to make it overly complicated :P

    Really, trying to figure out a scenario where it would be helpful and worth the extra work & processing overhead. Like, maybe the diffuse can get mirrored, but the model is asymmetrical, so mirrored lighting wouldnt work.
  • Eric Chadwick
    Yeah I figured it might be an extreme example... confused.gif

    We're using multiple UV channels quite a bit here. One thing is to use baked soft lighting vs. tiled diffuse and tiled normalmap (for detail bumpage).

    Another way we use it is to do effects like memory-efficient caustics, where you duplicate the same soft caustic emissive texture on top of itself, with each one using a different UV set and sliding at angles to each other... it produces a moire effect somewhat like waves. Then you have the base wall surface too, for diffuse/specular/whatever, where it uses its own static UV set. If the caustic is too sharp, it gives away the effect, so the blurrier it is the better it hides the scrolling.

    You can see this kind of effect in a game like Prince of Persia. In the first level where you learn to run across the wall over a pool of water... if you fall in you'll see it happening on the walls.

    I find it's much cheaper memory-wise than using an animated sequence of bitmaps, and works pretty well if you massage it a bit.

    You can see tons of this happening in Doom III's animated console screens. All kinds of UV-animated multi-layered gizmos going on.

    You could do it with multiple overlapping sets of polygons, but then you're incurring multiple alpha passes and have to deal with occasional z-fighting... seems it's better to layer the surface ingredients together at once onto a single surface.

    I love figuring out effects. There's just so much cool stuff you can do. But there's not much sharing about how people do their effects.
Sign In or Register to comment.