Home Technical Talk

manual mip maps? or how to avoid texture bleed in atlas

interpolator
Offline / Send Message
rollin interpolator
Hey!

I want to avoid texture bleeding with mipmapped texture atlases.

What I already use is some kind of uv-offset inside the shader. But this helpes just for the first mipmap level. Higher levels would need a ridiculous high offset.

So atm I'm more looking into a way of mipmapping each tile of the atlas by it's own. That way the borders between the texture tiles keep sharp and I just get the not-to-avoid one pixel bleed.

Here is a short article about it texture-atlases-wrapping-and-mip-mapping/

I'm peparing the textures in substance designer. So I'm wondering if I could do it there. Or maybe some standalone tool which combines several dds files into a big one.

Any insight appreciated :)

Replies

  • Ashaman73
    Offline / Send Message
    Ashaman73 polycounter lvl 6
    rollin wrote: »
    So atm I'm more looking into a way of mipmapping each tile of the atlas by it's own. That way the borders between the texture tiles keep sharp and I just get the not-to-avoid one pixel bleed.
    The issue with bleeding comes from the texture filtering. Linear filters (standard texture filter) will consider the neighbors, which leads to the not-to-avoid one pixel bleed. But this bleed occurs on each mipmap-level.

    A simple example: 2x2 atlas of size 64x64 (each tile 32x32)
    All pixels at x or y position at the center (pixel position 31-32) will bleed.
    At mipmap level 1 (32x32) all pixels at x/y 15-16
    ..
    At mipmap level 3 (8x8 ) all pixels at x/y 3-4 will bleed, that is around 43% of the texture will have bleeding.

    You really will have a hard time to avoid it when using a texture atlas. The far better way to avoid bleeding with tiles is to use a texture array (if available).
  • rollin
    Offline / Send Message
    rollin interpolator
    Hi Ashaman73,

    for sure all you mentioned is right.

    Anyhow the problem roots also to the point where mipmaps are created. In short: don't mipmap your complete atlas at once but each single tile for it's own. Of course you don't avoid the bleeding from filtering that way.

    Texture array is something I would love to use but atm this seems to be bit of a journey with unity.

    I found a few cases where people where able to get rid (at least in a way it wasn't disturbing anymore) of the problem by using manually created mipmaps + bit of padding. for each tile.

    What I'm looking for is a solution that does the above automatically: Pack multiple mipmapped dds files to one atlas.
  • marks
    Offline / Send Message
    marks greentooth
    Padding is pretty much the universal solution to this unfortunately.
Sign In or Register to comment.