Best way to render a lot of slightly different objects?

Started by
3 comments, last by kauna 11 years, 2 months ago

Hi,

I am building an information visualization system similar to a 3D treemap (i.e.: using stacked boxes to represent the proportional size of nodes in a tree). So basically I need to render a lot of 3D boxes. What techniques can I use to improve performance, beside occlusion culling?


Right now, being a prototype, I'm using a very brute force approach: every object has its own VB/IB etc. So when I have to render several hundreds of them, things begin to slow down. I was thinking about having only one VB/IB and just modify the translation and scaling matrices (to obtain different sizes). Is there any other better way?

--Avengers UTD Chronicles - My game development blog
Advertisement

What techniques can I use to improve performance, beside occlusion culling?

Instancing is the way to go. There are several techniques available, here's an article to get a basic understanding of instancing and different techniques to archieve it (the article is ~7 years old, using modern API like DX11 will ease instancing a lot).

I was thinking about having only one VB/IB and just modify the translation and scaling matrices (to obtain different sizes).

That is definitely the first step you should take. Rendering all from one vertex/index buffer is going to be faster than switching buffers for each object.

After that, you should be in good shape to tackle instancing, which should be ideally suited to your use-case.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

I agree, a few pointers:

- create separate classes for mesh and meshinstance
- keep track of all properties per instance, rotation, translation, scale, material maybe
- make an index and render by material and then by mesh

Ealrly rejections of meshes you wont't draw is always best and reduces state and buffer changes

Crealysm game & engine development: http://www.crealysm.com

Looking for a passionate, disciplined and structured producer? PM me

You may also make some per-instance parameters affect the material. If the differences between the boxes are small (such as diffuse color changes), you may have a diffuse color as a instance parameter. If you are able to use texture array, it is possible to have per-instance index to the texture array slice so you can actually have a lots of variation for each instance.

Cheers!

This topic is closed to new replies.

Advertisement