[w]tech combines next generation technologies like full dynamic lighting, voxel based terrain and bullet physics, which are brought to you via a self-explanatory user interface. We are thinking in innovative ways to combine the available technologies and ideas to an edgeless package. Visit wtechportal.com to get more information about the newest features integrated into [w]tech!
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
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.
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 wtechportal.com for more updates: