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
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Unity 5 strange light flickering

Discussion in 'General Graphics' started by Boris1998, Mar 25, 2015.

  1. Boris1998

    Boris1998

    Joined:
    Jul 5, 2013
    Posts:
    82
    I have to say first, that I am new to all this stuff.
    I was experiencing some problems with point light which at specific angle, showed lines instead of full shadow.

    As I read somewhere, shadow bias can fix shadow artifacts, hovewer, they are still present after adjusting and increasing bias. I see that Unity 5 has "Normal Bias", so could someone explain what is this and how it affects shadows?
    I am using point light, and there is slight difference between Low Resolution and High and between so, it has nothing to do with it. Shadow artifacts appear on basic Unity's meshes also.
    It seems that Hard shadows don't have that much of those "lines", but they still appear on some places, but just on edges or similar..

    So, I just went to mesh import settings and set Mesh compression from Off to High. That stopped it from happening on the doors, however, it looks like there was some Z-fighting also, but my model of doors is just fine and I double checked it, so what could it be?

    I am currently on Nvidia GeForce 8800 GT, maybe that helps?

    I think this theme is worth discussion...so...feel free to share your knowledge here...
     

    Attached Files:

    Last edited: Mar 25, 2015
  2. KingMatthew

    KingMatthew

    Joined:
    Jul 7, 2013
    Posts:
    166
    Try lowering your shadow distance. It always helped me. I have had some problems with shadows since the unity5 update... maybe its just a bug?

    It could also be that your light is at such a low angle.
     
  3. Boris1998

    Boris1998

    Joined:
    Jul 5, 2013
    Posts:
    82
    http://forum.unity3d.com/threads/official-5-0-feedback-request-for-directional-light-shadows.285287/

    Basically....bias and normal bias both have no impact on shadows nor shadow acne...is this a bug in Unity 5 that should be reported?
    Yes, at those pictures, light is coming out from red cube at the floor, and yes, angle between it and white cube at the floor is very low and angle between and walls while near them is also low.

    I really need a flexible point light source because I am planning to put movable lantern or candle into game.
    It wouldn't change things that much if I put light in the middle of camera and it would be simpler to use spot light if realtime light was always infront of character, but I need more realtime point lights that can be set very close to other objects....sooo.....

    Should I wait for someone from Unity team to reply or should I sumbit a report to them?

    I've read about "shadow acnes" and.... it should be easyly avoided by increasing shadow bias, right? However, that will have huge impact on scene look + AS I SAID, shadow bias in U5 f4 does nothig, just as normal bias. But if you find another way of getting rid of them, feel free to share it. :D

    Edit: Matthew, you meant "shadow distance" settings in the Quality Settings? I think those have impact on directional shadows quality only...or this is just annother bug? Btw, everything except Shadow Resolution changes nothing about shadow quality
     
  4. KingMatthew

    KingMatthew

    Joined:
    Jul 7, 2013
    Posts:
    166
    The Number of Shadow cascades effect shadow quality. That's the last thing I can think of that could help solve your problem. If everything should work right but isn't then maybe sending a bug report to the devs is the right thing to do.

    I have only ever tested shadow distance with directional lights so you are most likely correct on that. Maybe if you try hard shadows instead of soft?

    Also, a slight possibility could be that you are using Directx9. Maybe Directx11 will fix it.
     
  5. Boris1998

    Boris1998

    Joined:
    Jul 5, 2013
    Posts:
    82
    No help from DirectX 11...
    Shadow acne problem has alredy been discussed a lot without result, but if someone meanwhile discovered solution, post it here please. :D
     
  6. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    I have not messed with the new lighting system yet in U5 so forgive if this is unhelpful.
    Isnt shadow bias supposed to be reduced to correct shadow errors? Unless it is different in Unity - shadow bias is the distance the shadow drops from the shadow casting object.
    In all 3D applications Ive ever used shadow bias is usually set to a default 1.0 unit. This is an arbitrary unit, but essentially causes the shadow to cast at 1.0 distance from the shadow casting object - which results in a more optimized shadow 'render' at the expense of accuracy.
    Reducing the shadow bias (in 3D apps) results in a more accurate cast shadow - resulting in a longer render time.

    Dont know if this is helpful in any way because Im describing shadow bias in 3D applications but I thought Id chime in just in case it was.

    Hope you find a solution.
     
    dualcarbon likes this.
  7. Alabatross

    Alabatross

    Joined:
    Dec 15, 2012
    Posts:
    223
    Having this exact same problem

    Bias and normal bias have no effect on the stripping, and it only happens from certain angles

    Also tried hard/soft and playing with cascading. Actually changing the cascades has no effect on the quality of the artifacts, just the main shadow
     
  8. Zomby138

    Zomby138

    Joined:
    Nov 3, 2009
    Posts:
    659
    Yeah I've seen this too. Point lights totally ignore both bias settings. Spot lights only respond to bias and not normal bias. Directional lights respond to both.

    I assume it's a bug.
     
  9. lokolokoa

    lokolokoa

    Joined:
    Nov 2, 2012
    Posts:
    1
  10. wjduhe

    wjduhe

    Joined:
    Oct 29, 2014
    Posts:
    2
    Changing the near clipping distance of my camera from .01 to .1 fixed the flickering for me. If that's inconvenient for you, a hacky way to fix it is to use a bunch of spotlights instead of a directional light.
     
  11. Electric Fountain Studios

    Electric Fountain Studios

    Joined:
    Oct 15, 2013
    Posts:
    1
    Fixed! I had the same issue earlier with Unity. Turns out that if you reduce the near clipping on your camera, it messes with the light bias's in all types of lights. I have mine set to 0.1 right now, as it was 0.05 earlier. Problem solved!
     
    theANMATOR2b likes this.
  12. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    Really? That would explain why I wasn't getting any such problems myself.

    BTW, like your graphical style; is it meant to resemble something like "fancy minecraft?" :D
     
  13. Boris1998

    Boris1998

    Joined:
    Jul 5, 2013
    Posts:
    82
    Yeah, it was horror game with fancy minecraft graphical style. I abandoned it and got back on the new thing with same idea but just a little bit better. So, I would really appriciate not having these flickerings on realtime pointlights shadows. :)
     
  14. alexandresk

    alexandresk

    Joined:
    Jul 11, 2013
    Posts:
    51
    I have workout something similar. It turn out that objects exported with center very far from the object give a very strange error in shadows when moving. So if it is a imported object, it worth give a try re-exporting it placed in center.
     
  15. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    Odd time to ask now, but have you tried adjusting your near clip? I got really bad flickering with it set too low!

    EDIT: Woops, already said! :D
     
    theANMATOR2b likes this.
  16. Dostekhob

    Dostekhob

    Joined:
    Nov 4, 2016
    Posts:
    1
    same problem and i`ve solved it by setting bias of spotlight from 0 to 0.01 now no FLIKERS ;)