rendering system design

Started by
4 comments, last by RuggeroVisintin 8 years, 10 months ago
Hi all,
I'm a little stuck on the design of the Rendering System, specifically I'm not sure how to manage the interaction between a renderMesh and a renderMaterial.
A renderMesh contains handles to the buffers that have to be sent to the GPU (vbo, ibo, etc) plus a pointer to a renderMaterial (just a single material for now).
My doubt came when i think on how to manage instanced rendering, of course a mesh can be rendered multiple times but how can I design the renderSystem so that multiple instances of the same mesh can have different materials?
Advertisement

how can I design the renderSystem so that multiple instances of the same mesh can have different materials?

Put all materials into the shader and reference them via instance index for each model.


L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

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 think I got it.
I would like to ask you another little thing if possible, the vertexBufferHandle is a reference counted pointer, is it a good solution? are there better solutions?
Thanks for your patience

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.

This topic is closed to new replies.

Advertisement