0
\$\begingroup\$

I have this idea for creating a point cloud and passing an integer into geometry shader to determine which model to draw, each model has the same amount of vertices etc and it would be hardcoded into shader, this would function somewhat like instancing but models have to have the same data size and you can draw multiple meshes in one call. What do you think about it?

\$\endgroup\$
  • 1
    \$\begingroup\$ It definitely is a plan. Have you tried profiling it? \$\endgroup\$ – Bálint Feb 15 '18 at 22:58
1
\$\begingroup\$

All theory here.

Thoughts come to mind is, compress all your models into a single structured unoredered access buffer, not a vertex buffer.

In your Vertex Shader, do not attach a vertex buffer for your geometry, but attach a structured buffer as a resource would Unordered access buffers.

Now the bit im not sure of. Create an instance buffer, attach this as a buffer (slot 1 - when you get to this, you will understand). your instance buffer holds thigns such as the model offset, and colours etc.

Instead, call the draw call without (See reference -> Using Input Assembler without buffers ). Using the SV_VertexID, plus instance buffer offset, reference into the structured buffer.

All theory, but what i would try first.

To be honest, I think its no benefit. I would firstly compress your models into 1 buffer, but draw call itself has low overheads are close to 0 (it's queued, and will be dependent on the complexity of the geometry). I would just call the draw calls with the relevant offset. I would get your mind around instance buffering and DrawindexInstanced as I have been able to draw thousands of different items very quickly. Reference my game to see lots of trees rendered quickly and effectively -> Game link

With the instance call, you can actually tell to render all instances in the buffer to render with a certain vertex or index offset.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.