Home Technical Talk

Seams...

TSM
TSM
http://img148.imageshack.us/my.php?image=swordlevel2ti7.jpg

As you can see, the seams appear at a distance. Does this always happen? I've written my own normal map shader and tried different samplers but that didn't fix the problem (when I'm in MAX).

Ideas?

Replies

  • Eric Chadwick
    Options
    Offline / Send Message
    Are you using edge padding? Should be set to at least 4 pixels.

    Also you should fill the empty parts of your maps with average colors (not black or some other contrasting color). For normal maps use 128,128,255 as the empty color.
  • TSM
    Options
    Offline / Send Message
    TSM
    Hmm, ... yes (but only 3 edge... I'll try 4 next bake) but no.

    I use edge padding but I multiply an AO bitmap that is outputted from Xnormal's simple AO baker.. it makes your textures look 10x cleaner for display.. That's my issue then.. Cool, for the real textures I simply wont use it.. but when I put them on display I will.

    I'll report back! But before I leave... does anyone have technical information as too why this happens?
  • Eric Chadwick
  • TSM
    Options
    Offline / Send Message
    TSM
    Thanks! That explains most of it... does that mean that Xnormal generated mip-maps from my textures? Do most current rendering engines (OGRE, UE3, SOURCE) generate mip-maps runtime?

    Thanks so much EricChadwick!
  • Eric Chadwick
    Options
    Offline / Send Message
    Sure, glad to help.

    Mips are only stored by a program if you're using a bitmap format that can store them, like DDS, and only if the program actually creates those mips.

    Every game engine has a mip-creator that it runs either at load time or as a pre-processing step, for all bitmaps that don't already have their own mips.
  • McBradd
    Options
    Offline / Send Message
    McBradd polycounter lvl 12
    TSM wrote: »
    ...I use edge padding but I multiply an AO bitmap that is outputted from Xnormal's simple AO baker.. it makes your textures look 10x cleaner for display...

    What exactly do you mean? Are you saying that your shader multiplies the diffuse by the AO, or that you're adding it directly to to color channel?
  • Eric Chadwick
    Options
    Offline / Send Message
    I think he simply multiplies it on top of his map because it makes the texture flat look purdy.

    Don't do this. Don't multiply an AO map only on the flat but not on the bitmaps used on the model, because an employer wants to see exactly what you use. Not some prettified revision.

    A properly-filled even-colored bkg is actually more professional. But I can see the benefit of using black in the empty bits, makes it easier for someone to evaluate your UV layout.
  • EarthQuake
    Options
    Offline / Send Message
    Generally i use like 12 pixels for padding, for normals and AO and also fill in the empty space in the normals with 127,127,255.


    [edit]lol no i mean 12 padding for nm/ao =D
  • Eric Chadwick
    Options
    Offline / Send Message
    You fill in AO with blue? :poly105:
  • Mark Dygert
    Options
    Offline / Send Message
    12 pixels, wow. How low do your mips go? Or how big are your maps that 12px isn't that big? I thought 2-6 was standard. Maybe I need to get with the times...
  • Eric Chadwick
    Options
    Offline / Send Message
    1 by 1 baby, hardcore
  • EarthQuake
    Options
    Offline / Send Message
    Thats generally for a 1024 or 2048. Really whats the disadvantage of having a large padding? That your mipmaps work too well? =P
  • Mark Dygert
    Options
    Offline / Send Message
    I'd have to see your layout but I'd imagine that sticking to a strict 12px padding would impact your overall pixel density, and lead to most of your layout being blank in anticipation of mip lose?

    I guess the question goes back to you as to how much bleeding are you getting that 6px isn't enough?

    To each their own I guess. It's not like your a slouch when it comes to this game art stuff. I'm sure you're making the best decision for what you're working on, it just seems a tad bit like overkill to me.
  • Neox
    Options
    Offline / Send Message
    Neox godlike master sticky
    I always use 8 or 16, why exactly would some one use 6 pixels? as i understood it, the texture gets rescaled from lets say 1024 to 512 in the first mipmao which means it has only a quarter of the size (damn my enlish, is this correct?) so you're losing 4 pixels, next mipmap goes from 512 to 256 which means that you're losing 8 pixels from your initial texturesize, next step 16 etc. right?
    I normally have at least 4 pixels space between all the uv chunks but that doesn't mean that there aren't any spaces that have a bit more, so why not go higher? I only have less then 4 pixels distance in unimportant areas where the bleeding wouldn't impact the look.
  • Mark Dygert
    Options
    Offline / Send Message
    I use 6 on 512x512 (my standard map size, I think I'm a dinosaur) because at one mip down it gives me 3px, at the next down mip down it gives me 1. It's pretty rare for my textures to be mipped more then 3 levels and if it is, and I notice a problem I pad that specific area a little. Going nuts with the padding for those rare cases seems like paranoia but maybe not for larger textures...

    6 seems to be the max for 512 I want to use and not have it impact my layout. If I work on smaller textures then I use the padding ratio for that texture size. 1024 still seems big and a bit of a waste in most cases, but maybe not anymore.

    Maybe I'm getting more seam bleeding then I realize... But then again most of the textures I've been making have been for Source and Unreal runs on a bigger scale and might run on higher res textures? last I checked 1024 was almost standard in Unreal.
  • Neox
    Options
    Offline / Send Message
    Neox godlike master sticky
    But you're loosing three quarter of your initial size not only the half, the textures are 2dimensional not 1dimensional 512x512 are 262144 pixels, half of that is 131072 pixels but 256x256 is 65536 pixels which is a quarter of your initial size, so 6 pixels end up in 1,5 pixels which is an error source, it might not be noticeable and because of that irrelevant, but it still is and the next mipmap will end up in 0,375 pixels which is an even bigger error source.
    This is pure theoretical and maybe 6 pixels are enough and no difference is noticeable but on power of 2 textures i always try to keep my pixel ratios also power of 2.
  • Mark Dygert
    Options
    Offline / Send Message
    ahh crap, I'm going to have to run some tests later... son of a...

    Thanks for the heads up!
  • TSM
    Options
    Offline / Send Message
    TSM
    Wow! Good read guys!

    My model doesn't suffer the black lines anymore since I followed the advice here, and my normal maps look better on edges too! Awesome! :)
  • Ryno
    Options
    Offline / Send Message
    Ryno polycounter lvl 18
    The bigger the texture map and the object, the more padding. A 2048 will may mip first to 1024, then to 512, then to 256. On a large object like a building, this may still be taking up a fair amount of space on the screen, and the mipping will be visible if you only used padding of 4 or 6.

    For a small prop that's using a 256, padding of four or six should be plenty, as the object will be so small at that point that you won't notice mip bleed anyhow.

    I had this issue with a bunch of buildings for Sega Rally Revo that had to use a single 1024. Some of the buildings were quite large, so had to be diced up into squares or strips to be UVd onto the single texture sheet. Since they were so large, if I used a tiling square somewhere on the sheet it needed a lot of padding around it to avoid mip bleed. If it were strips, then I'd have to make sure that there was a lot of padding vertically.

    Another really easy thing to do in addition to the propper padding is to just set your background color in the texture to the neutral that most closely matches your problem area's color. In the case of the sword, the background should be gray. That way if you still get some bleed, at least it's less noticeable.
  • Eric Chadwick
    Options
    Offline / Send Message
    I think for a portfolio it's actually better to have black in the unused areas (minus some padding) just so I can see how the artist packed and laid out their UVs.

    I was looking at thomasp's site the other day (nice work, if you're listening), and here's an example, where it's tougher to make out how tight the UV is because it's filled with average colors.
    http://www.thomaspecht.de/img/ninja

    Shows he's a pro for using the technique, but on the other hand it's not as easy to judge the UV. Which I think is probably more important for up-and-comers' portfolios.
  • kio
    Options
    Offline / Send Message
    kio polycounter lvl 15
    well i guess for portfolio stuff, having some uv wires plus the texture itself (with plenty of edge padding) would be best ;)
  • Mark Dygert
    Options
    Offline / Send Message
    Ahh Ryno brought up a really good point. It also depends on the size of the object and its scale in game space as to how much padding you'll need.

    Most of the props I've done lately are roughly player size and I haven't noticed any major mip map problems using 2-6px for padding. I've also been careful to keep a consistent pixel density with the game world so I don't have a sharply detailed prop sitting on a pixelated blurry wall.

    But I DID notice it when I scaled the same objects up to 20x. Which breaks one of my personal rules, don't use 10 gal of paint to cover a 2000 gal wall. Either use the right amount, or get crafty. Which is easier said then done most of the time...

    So I guess there is another really important factor to keep in mind =/
  • EarthQuake
    Options
    Offline / Send Message
    Setting it to 12 or so dosent mean i try to leave 12 pixel borders between uv islands, as that would be pretty wasteful in most cases. A lot of the time its ok if the mips bleed to another part of the uv, as longs as its not bleeding to a black area etc. No of course if you have drasticly diferent materials, using 8-16 pixels inbetween materials with difference value(say dark metal and light concrete) well REALLY help with things such as modular building sets where you have 12 or whatever textures all fit onto one map.
  • jogshy
    Options
    Offline / Send Message
    jogshy polycounter lvl 17
    I think the minimum edge padding(dilation) to use is:

    log2(max(width,height)) + 1 = nMipmap Levels + 1

    for example... for a 2k x 2k texture is (12+1) = 13

    in that way it's guaranteed that if two pixels use the maximum and minimum mipmap LOD then a 2x2 box filter result won't present visible seams. The default in xNormal is set to 16 so it should be ok even for a 8k x 8k map... So keep it at 16, it will take just a few miliseconds more to process the bitmap but you will avoid better the possible seams. However, as Earth mentions, you cannot increase it without limits because then a lot of texture space will be wasted...

    And remember... don't fill the texture margins with data... keep them empty... so the dilation filter does not clamp the nearest neighbors.

    To reduce the seams more you can also fill the background with the (0,0,1) tangent-space normal RGB888 value = ( (0,0,1)*0.5 +0.5f )*255 = (127,127,255)
  • IronHawk
    Options
    Offline / Send Message
    IronHawk polycounter lvl 10
    great info guys. Thanks
Sign In or Register to comment.