Search Unity

Is it possible write to Depth Normal Texture in CG shader with tesselation and geometry programs?

Discussion in 'Shaders' started by andrii-shpak, Mar 24, 2017.

  1. andrii-shpak

    andrii-shpak

    Joined:
    Nov 27, 2014
    Posts:
    315
    I'm working on human hair plugin for Unity. I can't use surface shader for rendering as I need tesselation. So I've implemented CG shader with ForwardBase, ForwardAdd and ShadowCaster passes.
    ShadowCaster pass writes only into DepthTexture but some popular post effects (as SSAO) use DepthNormalTexture.
    As I know Unity use shader replacement to write into DepthNormalTexture but it will not work correctly even if you just edit vertext positions in vertex shader. So it has no chances to work with tesselated geometry.
    I think there should be some special pass to write into DepthNormalTexture. But it's name is not mention in documentation.