Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Occlusion and transparent shaders

Discussion in 'Developer Preview Archive' started by theinfomercial, Dec 31, 2011.

  1. theinfomercial

    theinfomercial

    Joined:
    Sep 9, 2008
    Posts:
    1,000
    For the Unity devs: When you bake a scene, it seems that any renderers that have a transparent shader throw up a warning in the console about making the renderer not be an occluder.

    The question is, can it be made so that Unity can somehow do this for you? It's a given that transparent objects are inherently "see-through-able" and would be useless as occluders. Is there a way to make the occlusion system bypass transparent objects as occluders automatically, rather than make me change however many objects to have the right checkbox?

    I'll be filing a bug report on it.

    Thanks. :)
     
  2. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    Transparent objects can't be occluders no cause the occlusion is calculated basing on geometry not the textures on it. If you mark a transparent object as occluder it will simply lead to major errors in the scene.

    This limitation always existed, the old PVS calculator simply didn't warn you that you F***ed up your scene (terrain with trees was a major thing to totally trash the OC behavior in the scene, prior 3.5 terrains must NEVER be static if you put trees and bushes with nature shaders on it!)
     
  3. theinfomercial

    theinfomercial

    Joined:
    Sep 9, 2008
    Posts:
    1,000
    I meant if there was a way Unity could automatically check a transparent object's static checkbox to see if the occluder option is selected and uncheck it at runtime. If not, then I'll just do it manually.
     
  4. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    You can not change static (independent of which one) at runtime, thats editor time only settings used for bakings.

    What you can and must do is set it to occluder not static and occludee to static (as you want it to be occluded and not act as occluder as it can't), otherwise you will get the warning and it will have the corresponding consequences.