There’s a simple exmaple to shade geometry instances in one primitive with same material but different color.
You might have doubt that why I don’t create 5 primitives and add 5 different appearances? Because its material are approximately the same but the color. And in some situation, I need to render a large number of geometries and I found I could add them to one
geometryInstances to get high performance.
As you see in my code, I make it come ture but there’s still some problems and it’s important. In my shader code, I have four compoent values:
alpha(See line 137), I find that I can pass color by adding an attribute when create GeometryIsntace, but can’t pass others in the same way.
After reading some source codes, I notice there is a
vertexFormat property which seems to specify which attribute is supported. But it is a very simple object which just has some string values. There must be some more low-level codes controlling it, but I do not know how to start with.
All in all. my questions are here:
- Is really
vertexFormatproperty limit my passing attributes?
- If so, how to extend?
- If not, Is there any other ways to pass other attribues?
Thanks a lot.