Announcement

Collapse
No announcement yet.

Texture atlas Frac pixel artifacts

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Texture atlas Frac pixel artifacts

    So, I just got informed that we are now able to split textures in a texture atlas and have them tile.

    I didn't notice the change but I'm pretty sure we couldn't do (like we were able to in UDK) a while back.

    Anyways, as many of you might know, this usually cause bleeding (grid-like lines in the material surface).
    There are two different things about it that cause these problems:

    The first (and most simple) problem is that when mipmaps are generated for the texture they will bleed into each other, so having big contrasts between textures that are close to each other in the atlas will cause more bleeding. This can be circumvented by adding padding to the texture and then cropping the texture in the material to use a smaller part of the texture.
    For example my texture sheet have textures that are 2048^2, these have been re sized to 2000^2 and have a 24 pixel border (padding) around itself. This increase the distance at which the pixel will bleed into each other and works fine.

    The second problem is that somehow the Frac node that we use to crop the texture cause a thin line of pixel artifacts.
    Like this:
    Click image for larger version

Name:	textureatlas_frac01lpkc3.jpg
Views:	1
Size:	120.1 KB
ID:	1137629
    (picture kindly provided by Oliver M H)

    These could be removed back in UDK by using the following setup (and code in a custom node):
    Click image for larger version

Name:	textureatlas_matfrac0zjkhb.png
Views:	1
Size:	230.5 KB
ID:	1137623
    (picture by Oliver M H)

    You can read more about the process in this post by Oliver: http://oliverm-h.blogspot.se/2013/04...e-atlases.html

    I've tried doing this in UE4 and haven't been able to get it to work.
    I'm at work right now and can't recall exactly what the error said, I'll add it when I get home.

    So my two questions are:
    Is there a way of getting this to work in UE4, so I can get rid of the pixel artifacts?

    And

    Is there a better way of removing the bleeding (not caused by Frac)?
    My atlas is 8192^2 pixels with 16 2048^2 textures. Each texture have 24 pixels border around it's edges which removes bleeding close to the player but it get's rather apparent further away. I've reduced it by blending in a flat color by depth (replacing the diffuse) but I would prefer not to do that.
    Is there a way to control how the mip maps are generated? or possibly making them by hand in some software? If the borders between each texture wasn't blurred/blended together I wouldn't have this issue.
    Last edited by Sitrec; 08-20-2014, 05:47 AM.

    #2
    You can get rid of the frac artifacts by manually computing the Mip level. There is a material function called CimputeMipLevel which provides the necessary math.
    The downside is it will add ~15 instructions due to the log2 function and it removes anisotropic filtering (although Temporal AA helps to fight the aliasing/noise).

    Here's a simple material setup for 2 sub-textures of one atlas:
    Click image for larger version

Name:	textureatlas01adyuc9.png
Views:	1
Size:	295.1 KB
ID:	1053703
    Last edited by mAlkAv!An; 08-20-2014, 07:18 AM.
    3.14159265359

    Comment


      #3
      Originally posted by mAlkAv!An View Post
      You can get rid of the frac artifacts by manually computing the Mip level. There is a material function called CimputeMipLevel which provides the necessary math.
      The downside is it will add ~15 instructions due to the log2 function and it removes anisotropic filtering (although Temporal AA helps to fight the aliasing/noise).

      Here's a simple material setup for 2 sub-textures of one atlas:
      [ATTACH=CONFIG]9300[/ATTACH]
      Thank you! I hadn't even thought about checking if there were something like that available in materials.
      I'll try it when I get home

      Comment


        #4
        Originally posted by mAlkAv!An View Post
        You can get rid of the frac artifacts by manually computing the Mip level. There is a material function called CimputeMipLevel which provides the necessary math.
        The downside is it will add ~15 instructions due to the log2 function and it removes anisotropic filtering (although Temporal AA helps to fight the aliasing/noise).

        Here's a simple material setup for 2 sub-textures of one atlas:
        [ATTACH=CONFIG]9300[/ATTACH]
        It worked pretty well, the artifacts are gone and there is hardly any noticeable bleeding now, only on hills far away.
        I have a new problem though, in certain angles (it seems) the texture turns brown instead of the green it should be and there are some new lines appearing.

        I've included a picture. Please ignore how horrible it looks.
        Click image for larger version

Name:	bleeding2.jpg
Views:	1
Size:	180.3 KB
ID:	1053725

        Any idea what might be causing this?
        Thanks in advance!

        *edit* It seems like this is also some kind of bleeding as it matches the color of adjacent textures.
        Last edited by Sitrec; 08-20-2014, 06:31 PM.

        Comment


          #5
          This is definitely a mipmapping issue.
          What I did as a workaround is to modify the ComputeMipLevel function to select higher mips at steep viewing angles.

          Click image for larger version

Name:	computemip01yvkek.png
Views:	1
Size:	115.3 KB
ID:	1053745
          Click image for larger version

Name:	computemip01azyjdf.jpg
Views:	1
Size:	216.6 KB
ID:	1053746Click image for larger version

Name:	computemip01b27k1v.jpg
Views:	1
Size:	94.0 KB
ID:	1053747
          3.14159265359

          Comment


            #6
            Thank you once again mAlkAv!An.

            Hadn't thought about doing that at all. I'll try it when I get home.

            *Edit* that worked great. Thanks for all the help mAlkAv!An!
            Last edited by Sitrec; 08-21-2014, 11:38 AM.

            Comment


              #7
              Hi guys, I m struggling to figure out how do control the sub-texture tiling scale, after the frac function from an atlas.
              I guess it would make sense to set the texcoords scaling of the atlas first, and then frac using decimals, but that will obvisouly cause severe floating point problems (with values like 0.1), is there a way I can control the UVmapping scale, after the frac and divide? So from a Texture sample, then scale it?

              Rahter than setting the texcoords scale, then trying to frac and divide/offset the correct amount for the tile?

              Ehm... Is that maybe what the compute miplevel can be used for *(other than fixing the tiling artifacts)?
              Last edited by alwynd; 04-30-2015, 10:24 AM.

              Comment

              Working...
              X