Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question drawing behind an object

Discussion in 'Shaders' started by Zimaell, Oct 12, 2023.

  1. Zimaell

    Zimaell

    Joined:
    May 7, 2020
    Posts:
    399
    I wrote my own shader and discovered a very big drawback: objects that are behind it are also drawn (I see this in the statistics), although the object completely covers the entire area in front of the camera.

    I also noticed that the editor grid is also visible through the geometry (example in the screenshot).

    Shader for terrain, urp, I tried in the frag to simply set one color without everything else, but in the statistics it is still clear that the geometry behind the object is drawn.

    Tell me how to do it correctly so that objects are not drawn if they are not visible. (cull on)
     

    Attached Files: