rendering system design
Put all materials into the shader and reference them via instance index for each model.how can I design the renderSystem so that multiple instances of the same mesh can have different materials?
L. Spiro
Or if the materials need a different shader, build instance queues/buckets on the CPU before rendering so that the queue key is a combination of the mesh pointer and the material pointer.
e.g. queue 1 contains instances of mesh A with material A, these will be rendered with one instanced draw call
queue 2 contains mesh A with material B, another draw call for them
...
I'd only put a "default material" pointer to the actual mesh resource, and allow the mesh scene nodes (instances) to override that.
I personally like the concept, that's explained here: https://molecularmusings.wordpress.com/2013/05/02/adventures-in-data-oriented-design-part-3a-ownership/
I personally like the concept, that's explained here: https://molecularmusings.wordpress.com/2013/05/02/adventures-in-data-oriented-design-part-3a-ownership/
Well, is what I was thinking about, thanks for the advice, I use to visit this blog but i missed this specific article, thanks again.