Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  3. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Graphics.DrawMeshInstanced Does Not Write To _CameraDepthNormalsTexture in Forward Rendering

Discussion in 'Graphics Experimental Previews' started by jknight-nc, Apr 3, 2017.

  1. jknight-nc

    jknight-nc

    Joined:
    Jun 10, 2014
    Posts:
    52
    When using DrawMeshInstanced in Forward RenderingMode, meshes do not write to _CameraDepthNormalsTexture. This is exemplified by the Standard Assets' Triangle Depth Normals Edge Detection Image Effect not applying to the Left Cube in the attached example project on bug number 863415.

    This only applies when Forward Rendering is enabled on the camera, however many users need Forward Rendering to have this functionality, since orthographic cameras must use Forward Rendering.

    When the Edge Detection is set to use either the Sobel Depth or Triangle Luminance modes, the Edge Detection filter is drawn on the Left Cube. However, the Triangle Depth Normals mode is desirable, since it also uses the Normal to calculate edges.

    In addition to identifying the issue with the Standard Assets Edge Detection Image Effect, I have also added a (disabled) Image Effect to the Example Project's Camera which renders the _CameraDepthNormalsTexture. This image effect definetively shows that the _CameraDepthNormalsTexture is not written to for meshes drawn with DrawMeshInstanced.