1
\$\begingroup\$

Unity Version: 2019.4.1f1

Render Pipeline: URP

I created a shader using Unity's ShaderGraph, 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
    Jul 6 '20 at 17:03
  • \$\begingroup\$ @DMGregory No, how can i do that? could you write an answer please. \$\endgroup\$
    – Fadi Obaji
    Jul 6 '20 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
    Jul 6 '20 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\$ Dec 4 '20 at 1:55
0
\$\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
    Jul 6 '20 at 17:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.