Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Issue with point filter mode on a rendertexture

Discussion in 'General Graphics' started by lostinthe4th, May 2, 2022.

  1. lostinthe4th

    lostinthe4th

    Joined:
    Mar 23, 2022
    Posts:
    3
    Hi all, I'm using a rendertexture to simulate a pixelated camera view, in conjunction with a toon shader via the URP. Despite using the "Point" Filter Mode on the rendertexture, I'm getting artifacts of colors that should not even be in the general vicinity (see example photo of red color presenting in blue pants and grey shoes of character). Any suggestions would be appreciated!

     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,256
    How is the character's color being assigned? Is it texture based? If so does the texture have mip maps enabled? When rendering at a super low resolution like this the GPU may be dropping to a small mip where the color values may be getting blurred together.

    Also, are you assigning the low resolution render texture to the camera directly, or copying the full resolution output of the camera to a low resolution render texture via a render feature or post process? If the later, it's possible the URP has some form of anti-aliasing enabled that you'll want to disable ... or don't use that method and directly assign the render texture to the camera which will avoid that problem (or make the anti-aliasing more obvious if that's enabled).
     
  3. lostinthe4th

    lostinthe4th

    Joined:
    Mar 23, 2022
    Posts:
    3
    The character's color is being assigned via texture (the shirt and pants together use a single texture), of the options that say "mip maps" only "generate mip maps" is active on the textures in the editor. I changed the wrap mode and filter mode of the textures to clamp and point respectively, this did change the behavior and reduce it a bit, but did not eliminate it.

    I think the rendertexture is directly assigned to the camera (in the camera in the editor, the output drop down has the rendertexture set as the output texture), not certain how to check. I'm using https://github.com/RyanNielson/PixelCamera2D to achieve the effect. I did previously set up a rendertexture and camera in the world space to achieve the effect, it had the issue occur as well.

    Thanks for the help!
     
    Last edited: May 5, 2022
  4. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,256
    Disable “Generate Mip Maps” on the character’s texture, and you may also want to set the “Compression” to None.
     
  5. lostinthe4th

    lostinthe4th

    Joined:
    Mar 23, 2022
    Posts:
    3
    That fixed it, thank you!
     
    bgolus likes this.