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 culling and transparent objects. Occlusion forced disabled.

Discussion in 'General Graphics' started by koirat, Aug 21, 2021.

  1. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,068
    Hi, today unity again "surprised" me.

    Basically it looks like it is forcibly disabling my static transparent objects from being an occluder.

    You might be asking why would anyone want a transparent occluder ?

    Example:
    Imagine this situation, you will have a "dense fog"/"occluding effect" in particular place that will act as an occluder. This effect will not be present in editor but it will be generated at run-time. The solution would be to create a placeholder in edit mode and then just swap it's material for invisible at runtime.

    Problem is that I cannot have opaque placeholders on scene in editor since this will make my scene completely cramped and not readable.
    Solution was to make this placeholders transparent - but as I said it looks like it is not working.

    Have you got any idea ?
     
  2. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,631
    If I remember correctly it used to just put out a warning, are you sure it actually prevents you from doing it?

    Also, I don't think you can add occluders at runtime (unless something changed recently) so I'm a little confused by your description.
     
  3. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,068
    I'm pretty sure, just tested it two times with one big wall made out of cube.
    No I cannot add occluders runtime. That's why I need to add occluder placeholder during editor - than at runtime add invisible material to it and spawn my final object at the same position.
     
  4. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,631
    You could have opaque geometry that is editor only, add a script that disables it on play (so if you play in editor you don't see it) and if you're using a new-ish version of Unity also toggle the visibility so you also don't see it in scene view.

    upload_2021-8-21_19-45-19.png
     
  5. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,631
    Now that I've said all that, I do think that stopping a mesh from acting as an occluder because it has a transparent material is pretty stupid. A warning was enough.

    Its stupidity is on par with being unable to move lightmapped objects in scene view when in play mode because "it would make things look wrong", which is a behavior that they changed, completely breaking my workflow, but they won't change back because they are afraid of breaking people's workflows.
     
  6. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,068
    I want to see it in editor, but I want it to be semitransparent so I can see other objects also.
     
  7. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,068
    Did not know about this.
    But non static light-mapped objects also cannot be moved ?
     
  8. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,631
    koirat likes this.