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

artifacts using custom lighting model #pragma glsl w deferred lighting

Discussion in 'Shaders' started by cherub, Jun 23, 2013.

  1. cherub

    cherub

    Joined:
    Apr 26, 2006
    Posts:
    493
    I noticed that (on my mac) i get these artifacts when i use a custom lighting model, #pragma glsl, deferred lighting, a directional light.
    Interestingly, on the same machine in win bootcamp the issue is not there. nor is it in forward rendering.

    its not the lighting model itself because as a test i copied it exactly from the Lighting.cginc file.
    it isnt using #pragma hlsl either. it is only when i use both together.(I do need to use a custom lighting model glsl)

    I think it is my video driver (nvidia hasnt updated in two years) but is a shame because i need to get a new machine to work and also others w my set up will see the issue. forcing the shader to render in forward mode does not fix it. only turning off receive shadows fixes it.

    another interesting bit is that if i use Pass{anything} the spots turn black.

    has anyone seen this behavior? i could continue to develop but i don't want to screw people with my set up.


    $shader error.jpg
     
    Last edited: Jun 23, 2013
  2. cician

    cician

    Joined:
    Dec 10, 2012
    Posts:
    233
    Do you have some vertex displacement or tessellation in there?
    If it's the same issue I have, if you translate all the vertices in the vertex shader you'll see a second sphere.
     
  3. cherub

    cherub

    Joined:
    Apr 26, 2006
    Posts:
    493
    nope, no vertex manipulation.
     
  4. Langano

    Langano

    Joined:
    Dec 18, 2012
    Posts:
    10
    Hey, I can confirm this.

    Getting the same error on mac(OSX) when using #pragma glsl.
    Even the most basic shader, regardless if its a vertex/fragment shader or a surface shader.
    Strange streaking blobs and artifacts appear on the surface of the model.

    Would be great if someone could shed som light on this.

    Cheers
     
  5. Justafin

    Justafin

    Joined:
    Aug 6, 2012
    Posts:
    30
    I'm having this exact same problem. Even with the simplest of shaders, just adding #pragma glsl causes this artifacting. Any ideas?
     
  6. cherub

    cherub

    Joined:
    Apr 26, 2006
    Posts:
    493
    bump
     
  7. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,785
    le me necro bump this thread.
    Just curious did this issue is fixed? anyone have a fix for this?
     
  8. cician

    cician

    Joined:
    Dec 10, 2012
    Posts:
    233
    The related issue with custom lighting models and vertex displacement is fixed in Unity 5, so I guess this one is too? I doubt they'll fix it in 4.x though.
     
  9. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,785
    Damn.....well that's kinda annoying, then what happen with some developer that stuck in Unity4 and developing for Mac :/
     
  10. cician

    cician

    Joined:
    Dec 10, 2012
    Posts:
    233
    I'm just guessing because it's probably fixed in U5 indirectly together with other changes in the area. If you fill a bug report they may fix it anyway.

    I'm not sure if it'll work, but as a workaround you may try adding a depth offset of a pixel in your shader.
     
    Reanimate_L likes this.
  11. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,785
    Using depth offset are working, thanks for reminding me about that :).
    I'll test it out any further.