Search Unity

Materials look glitchy under Spotlight

Discussion in 'AR/VR (XR) Discussion' started by stevenbrent, Feb 19, 2016.

  1. stevenbrent

    stevenbrent

    Joined:
    Nov 22, 2015
    Posts:
    25
    Hello - I'm playing around with a 'head mounted' spotlight, and on the GearVR, this is causing my very simple materials to look glitchy (black flickering lines all over). If the spotlight is hitting the the material straight on it looks ok, but any angle to the light and glitch city. Materials look fine under point light and directional light. I'm guessing this has something to do with the per-pixel nature of spot lights and the difficulty of making this work sterescopically, but I don't really know what I'm talking about here, so could use some pointers. Thanks.
     
    Last edited: Feb 19, 2016
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,342
    It's probably a shadow biasing issue. Try increasing the light's shadow bias and normal bias.
     
    stevenbrent likes this.
  3. stevenbrent

    stevenbrent

    Joined:
    Nov 22, 2015
    Posts:
    25
    Interesting, thanks very much. I will try that ASAP.
     
  4. stevenbrent

    stevenbrent

    Joined:
    Nov 22, 2015
    Posts:
    25
    UPDATE: So cranking up the Shadow and Normal Bias on the light has fixed the glitchy material appearance. Thanks!!! But now my objects are no longer casting shadows. I haven't changed any of the material settings (they are all set to cast and receive shadows). When I use a Directional rather than Spot light, the shadows work. I've read through the docs on Lighting but haven't figured this one out yet!
     
  5. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,342
    You want the bias settings to be as low as possible while removing as much of the shadow acne (which is what you were seeing) as you can. The bias settings are a careful balance of trying to keep shadows showing up and removing the artifacts shadow mapping causes.
     
    stevenbrent likes this.
  6. stevenbrent

    stevenbrent

    Joined:
    Nov 22, 2015
    Posts:
    25
    Thanks for the guidance, @bgolus -- I'll play around with the settings until it looks right or until I go crazy trying ;-)
     
  7. stevenbrent

    stevenbrent

    Joined:
    Nov 22, 2015
    Posts:
    25
    So the textures look good now, but for the life of me, I can't get my objects to cast shadows under the spotlight. No combination of bias settings seemed to work. Looked around and tried a bunch of things including baking shadows but no luck.