4

I am creating my first shader using the the Shader Graph, and I am seeing weird behaviour with my vertex positions when I have several objects in the scene using the Shader/Material I have created.

It looks like Unity is batching the objects, not sure yet what does mean, but it looks like I have to deactivate the batching so the vertex positions on my shader remain relative to the object and not to the objects.

Some open threads without solution:

Long story short: How can I add tags, and specifically the DisableBatching tag in my shader created using Shader Graph?

fguillen
  • 36,125
  • 23
  • 149
  • 210

1 Answers1

1

This does not answer your question, but I ended up doing what d2clon did in the forum post you posted, which is to duplicate the material at runtime through a script that you add to the object.

I'm posting this as an answer so people can try out something that worked (for me), without having to read all the threads you posted. I'm also wondering how to disable the batching flag myself, but this will suffice.

public class MaterialDuplicator : MonoBehaviour
{
  void Awake()
  {
    Renderer renderer = gameObject.GetComponent<Renderer>();
    renderer.material = new Material(renderer.material);
  }
}
John
  • 10,165
  • 5
  • 55
  • 71