Jump to content
  • Advertisement
Sign in to follow this  
AgentShiva

DirectX/SharpDX Render Batching

This topic is 528 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

[Originally posted in Beginners, moved to DirectX and XNA]

 

I'm toying around with a hobby engine of mine and I was looking at implementing batching to reduce the number of calls to the device and context.

 

I have several classes that assemble to represent a single entity in the game world. My thought for breaking them down into batches for rendering goes something like this:

 

1. Frustum cull Entities (with the help of a QuadTree)

2. Sort all entities by their Shader type (IShader interface with many different implementations for various shaders), Place any semi transparent objects in a separate list

3. Sort entities sharing the same Shader by their Mesh (ending up with a Dictionary<IShader, Dictionary<Mesh, List<Entity>>>

4. For each Shader apply it to the pipeline

5. For each key of Dictionary<Mesh, List<Entity>> bind that mesh to the pipeline

6. For each Entity in the list for that Mesh, apply the transformation matrix and any other instance data (animations, etc)

7. Draw the Mesh

8. Repeat 5-7 for each Entity

9. Repeat 4-8 for each Shader

10. Z order the semi transparent list

11. Render the semi transparent list

 

One pitfall that comes to mind with this system are Mesh's that have submeshes that use different shaders.

 

My question is, does this sound at all efficient and further, is this close to what is usually done to batch draw calls in DirectX11/SharpDX?

 

Thank you.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!