5
\$\begingroup\$

Unity Version: 2019.4.1f1

Render Pipeline: URP

I created a shader using Unity's Shader Graph, and I want to apply GPU Instancing on this shader, but there is no way to declare per-instance properties inside the shader graph.

Is there a way to make GPU Instancing work on shader graphs' materials?

\$\endgroup\$
4
  • \$\begingroup\$ It looks like the SRP Batcher is intended to replace the previous instanced rendering behaviour. Have you considered using a custom node in your shader graph to look up per-material properties from cbuffer UnityPerMaterial inside your graph? \$\endgroup\$
    – DMGregory
    Commented Jul 6, 2020 at 17:03
  • \$\begingroup\$ @DMGregory No, how can i do that? could you write an answer please. \$\endgroup\$
    – Fadi Obaji
    Commented Jul 6, 2020 at 17:05
  • \$\begingroup\$ If I had an answer for you, I'd have posted that instead of a comment. All I have to offer you at the moment are potentially useful avenues of exploration. \$\endgroup\$
    – DMGregory
    Commented Jul 6, 2020 at 17:07
  • \$\begingroup\$ I can't say for certain but I think I remember something about using MaterialPropertyBlocks in scripts was supposed to get around the instancing issues. But I could be wrong, this might have just been to increase performance when transferring data to the GPU. \$\endgroup\$ Commented Dec 4, 2020 at 1:55

1 Answer 1

1
\$\begingroup\$

You can set the GPU Instancing in the inspector directly on the material you created:

enter image description here

\$\endgroup\$
1
  • 1
    \$\begingroup\$ I did, but changing the material's properties will break the Instancing. \$\endgroup\$
    – Fadi Obaji
    Commented Jul 6, 2020 at 17:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .