Search Unity

Question Graphics.DrawMeshInstanced and AO issue

Discussion in 'Image Effects' started by Stormer2020, May 27, 2022.

  1. Stormer2020

    Stormer2020

    Joined:
    Sep 14, 2020
    Posts:
    92
    Hi~

    Here is my dev env:
    Win10
    Unity 2020.3.14f1
    BuildIn Pipeline

    In my scene, generate the terrain, then I put some tree models(use Graphics.DrawMeshInstanced()).

    Now, the tree model looks like transparent, the post process's AO mask on it.
    (Tree's material is Standard,opaque,with image texture)

    If I change camera's Render Path from Farword to Deferred, all works fine. But I need Forward rending.

    How can I fix it? Thank you!!!
     

    Attached Files:

  2. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    By using a different AO effect - builtin AO is the culprit there. With that said, if you are drawing your trees after the final depth/normals texture, that will cause an issue with any AO effect, as it needs that depth/normals data to create the occlusion from.
     
    Stormer2020 likes this.
  3. Stormer2020

    Stormer2020

    Joined:
    Sep 14, 2020
    Posts:
    92
    Thank you!
    I sovled it in BuildIn Pipline. (Change main camera to deferred rendering)

    Now, I'm struggle in URP. AO dosen't work at GPU instance. I think that the problem is URP forward rendering.
     
    GoGoGadget likes this.