Search Unity

The problem with the adding GPU Instancing for shader

Discussion in 'Shaders' started by Talentplace, Nov 4, 2019.

  1. Talentplace

    Talentplace

    Joined:
    May 3, 2017
    Posts:
    1
    Hello,
    We need to use TreeSoftOcclusionLeaves (it is build in shader). And we need it with GPU Instancing to increase FPS. Original shader doesn't have GPU Instancing.
    I added the line "#pragma multi_compile_instancing" and now i see that batching is working when i have objects (bushes) on scene. But when i draw those objects on the terrain the batching stop working.
    Also i found that if delete the "#pragma fragment frag" then the batching start working even if the objects on terrain. I suppose i need to write something into "fixed4 frag(v2f input) : SV_Target" to made GPU Instancing works fine but i don't know what.
    upload_2019-11-4_21-48-14.png

    Thank you in advance for any help!