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

Flickering textures during runtime.

Discussion in 'Editor & General Support' started by EnsurdFrndship, Mar 2, 2011.

  1. EnsurdFrndship

    EnsurdFrndship

    Joined:
    Apr 17, 2010
    Posts:
    786
    Hello,
    I was wondering if there is a setting to change in Unity so that when a game runs, you don't see the textures flicker if the z-axis of 2 different objects are too close to each other during render. Is there a way to get my game window to render exactly like how the scene windows render (where there is no flickering)?

    Thank you,
    Michael S. Lowe
     
  2. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,339
    What exactly is happening?
     
  3. EnsurdFrndship

    EnsurdFrndship

    Joined:
    Apr 17, 2010
    Posts:
    786
    When I try to edit my scene in the scene windows, there are no flickering of textures as I move along when I have one box with one texture behind another box with a different texture, but in my game window, as the camera moves along, I noticed the further away I move away from the two boxes, the further apart in distance the 2 boxes need to be in comparason to their distance away from the camera they need to be to prevent texture overlapping. It would be nice if my game window renders the 2 boxes the same way my scene windows do (where I can have 1 floor that is .00001 in y-axis below another floor, and the topmost floor renders while parts of the other floor below it doesn't render on and off). How do I do that?
     
  4. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,061
    Sounds like a z-fighting issue. Try playing a bit with the clip near and far values of the camera.
     
    steven_scottyd likes this.
  5. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,339
    Yes you can't have 2 planes at exact same height, otherwise you will occur into Zbuffer fight.
    In this case you MUST slightly change the height of one plane to not overlap them exactly at the same distance.
    To reduce this effect you can close down the camera distance rendering plane: this increases the rendering precision for Zbuffer for the smaller rendered region.
     
  6. linusnag

    linusnag

    Joined:
    Dec 1, 2021
    Posts:
    1
    For me changing the z-value or the layerorder didn't work. I had to turn off MSAA in order for it to go away. I know this is 10 years ago, but maybe if someone else comes here to find answers this helps them. :)
     
    sagarhinsu, Red_Uk and Katana750GWG like this.
  7. PawPrintProductionsLLC

    PawPrintProductionsLLC

    Joined:
    Mar 14, 2021
    Posts:
    3
    Note for all future googlers This sort of worked. Not perfect in my case and I worry I'm personally pushing the limits of the engine but worked well enough I can work with if anyone else wanders here.