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. Dismiss Notice

Rendering & lighting problem that resembles z-fighting?

Discussion in 'General Graphics' started by domportera, Feb 13, 2016.

  1. domportera

    domportera

    Joined:
    Sep 12, 2013
    Posts:
    23
    I'm encountering an issue resembling z-fighting problems. There is no geometry overlapping in focus to cause this to happen - this actually happens on all of the geometry in the game. The lighting is a realtime spotlight, and the error only occurs on lit geometry. How can I fix this problem? I am applying materials through code using the following lines:

    Code (CSharp):
    1. rend = GetComponent<Renderer>();
    2. rend.material.SetColor ("_Color", randColor);
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,209
    domportera likes this.
  3. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    ^That, and keep your light's own frustum as short as possible, as that can introduce shadow acne.

    As a side-note, you thinking it's z-fighting's almost spot on, as shadow acne is caused by z-fighting in the part that applies the shadow map. :) (The depth bias remedies it by offsetting the depth values to fix it, but then... you get peter pan on ridiculous settings. ;))
     
  4. domportera

    domportera

    Joined:
    Sep 12, 2013
    Posts:
    23
    Thanks guys! :)
    Another thing I found that contributed to this is that that wall of cubes was actually scaled up to 20,000x in the Y axis. I noticed when I scaled this down to a "mere" 1,000 or 2,000, the problem was much less severe as well.
     
  5. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    ...
    How big?! :D
     
  6. domportera

    domportera

    Joined:
    Sep 12, 2013
    Posts:
    23
  7. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    So... you're navigating infinitely tall beams? Sounds cool, have a linux build around? (I can run windows builds, but I'm currently booted into Linux right now)

    EDIT: nvm, oversaw the links, will try it out. :)
    EDIT2: dang... is it possible to provide a 64-bit build? I'd rather not bloat my system more with having to install 32-bit libGL... :-/
     
    Last edited: Mar 4, 2016
  8. domportera

    domportera

    Joined:
    Sep 12, 2013
    Posts:
    23
    Thanks for your interest! I just rebuilt it as a "universal" app and replaced the DL link, so it should now have both 64 and 32 bit versions in there. Hope that works! Let me know what you think :) Also, I highly recommend using headphones. Not because the sound is great, but because sound direction is important for navigating the game.
     
  9. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    Thank you. :) Now I don't have to bloat my already bloated system even more... ;)
    Anyway, in my lunch break, will definitely try it. :)
     
    domportera likes this.