Search Unity

Why is transparent object rendered in Render.OpaqueGeometry?

Discussion in 'General Graphics' started by Potaski, Jan 20, 2016.

  1. Potaski

    Potaski

    Joined:
    Aug 21, 2013
    Posts:
    52
    I am working on reducing alpha test objects in out game. My method is to use alpha blended material when objects fade into LOD levels. But when it happens, all of them was covered by skybox. I checked the frame debugger, and found them drawn in Render.OpaqueGeometry, before skybox. No wonder all the skybox pixels are drawn on top of it.

    I don't know why this happens. Because all other transparent objects works fine (particles, etc). The wrong transparent objects are inside lod groups. If anyone know how to solve the problem, please let me know. Thanks.
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    Double check the alpha blended material's (and shader's) queue? Right click on the inspector tab and select debug and look at the custom queue of the materials. They should be 3000 (transparency) or -1 ("use the shader's queue"), if they're not change them to one of those and see if it's still a problem.
     
    theANMATOR2b and Potaski like this.
  3. Potaski

    Potaski

    Joined:
    Aug 21, 2013
    Posts:
    52
    Ok I found solution. It turns out that Material.CopyPropertiesFromMaterial will copy the render queue value as well. So all the alpha blend material generated had the same queue as the alpha test original. Reset their queue to -1 and it works as expected.
     
    theANMATOR2b likes this.