Report article RSS Feed [w]tech – Instancing feature

The instancing-feature of Direct3D has just found its way into [w]tech. You may don’t know what it is, so let’s just say “It helps us with drawing lot of meshes”. For a better explanation you may enlarge this news-posting, now.

Posted by [WuTz]! on Jan 24th, 2011

Where is the Problem?

Let's just come to the point: Whenever we want to draw something in Direct3D, we have to pay a little price. Each Draw-Call costs a few CPU-Cycles, which can really hurt the performance when drawing a lot of stuff.
Each time we make such a draw-call, we pass some information about our mesh and other things to the GPU. This is slow and unnecessary when we are drawing just the same mesh a few thousand times.

How can it be solved?

That is where instancing comes into play. By doing instancing, we just register the world-matrices (position, rotation, scale) of all instances of one mesh we want to draw into a list.
Then we do only one Draw-Call and send our list to the GPU, which draws them all in one batch, saving us a lot of CPU cycles.


Here are two shots, comparing the speed of the engine now, and of an older version of [w]tech (We ran them on my crappy old laptop to make the difference more obviously):

Both scenes are running at about 27 FPS.

Oh yeah, asking why we would want to draw one mesh so many times?
Just take a look at this nice grassy scene:

Remember that you can check for more updates:

Post comment Comments
Silverfisk Jan 26 2011, 4:41pm says:

Keep it commin! :)

+1 vote     reply to comment
Post a Comment
click to sign in

You are not logged in, your comment will be anonymous unless you join the community today (totally free - or sign in with your social account on the right) which we encourage all contributors to do.

2000 characters limit; HTML formatting and smileys are not supported - text only

Report Abuse
Report article
Related Engines
[w]tech Creative Commons TBD
Related Groups
[w]tech team
[w]tech team Developer with 3 members