Is swapping materials with custom vertex attributes supported? After the painful mysteries found in this thread, I’d rather not do something that’s akin to tip-toeing around potential bugs in the engine.
More specifically, let’s say I have material A
and material B
. My sprites are all drawn with A
, then I want to use render.enable_material("B")
to draw them again, but with the new shaders that B
offers.
Material A
has three custom vertex attributes, whereas material B
has four custom vertex attributes. Some of these attributes are unique to the material, others might be the same and should be shared across draw calls:
Material A
Attribute 1: color (UNIQUE)
Attribute 2: light (SHARED)
Attribute 3: normal (SHARED)
Material B
Attribute 1: normal (SHARED)
Attribute 2: light (SHARED)
Attribute 3: flavor (UNIQUE)
Attribute 4: enthusiasm (UNIQUE)
The other option would be to use multiple sprites on the same game object, where each sprite uses the same texture but a different material. I would like to take the render.enable_material()
route if possible.