I see conceptually what is going on.. but unfortunately I do not see how it would be coded. I'll have to go through the sdk docs a bit and see how I can transform these in world space.
The only thing I don't get is that starting vertex for each index part. Is there any good tutorial on how to do this stuff out there? Something with code that is easily understood?
Truly terrible rendering performance...
Quote:Original post by jollyjeffers
Sadly there is no trivial way of combining multiple transforms and single draw calls. There is a technique called "Geometry Instancing" that can achieve this, but it's fairly advanced and isn't available on all hardware - thus it doesn't make sense to be relying on it for such a basic feature [oh]
Geometry instancing is available on all ATI SM2 cards and up (Radeon 9500 and up) and GeForce 6x00 and up, so these days I'd say that most users are likely to have it, and it's worth implementing. That said, for ATI pre-SM3 cards it's a cludge, and it won't run in Direct3D Debug, because it's defined to be a SM3 feature.
Note also that in my experience instancing becomes slower at higher numbers. On my Radeon 9800 Pro it because horrendously slow over 1000 instances (with the drivers a few months ago). On the GeForce 6600 it also became slower, but to a lesser extent and at a higher number. Still I won't recommend more than about 1000 instances at a time.
For simple objects, like your boxes, the constant instancing method works well. This works by storing the transforms in shader constants. The number of constants changes by the shader model, but you should be able to get a few tens of transforms in any shader model, let's say 40. Your vertex buffer contains your box duplicated these 40 times, with an instance index appended to the position (therefore xyzw instead of xyz). This index is then used for indexing into the constants.
For a good demo of instancing methods, including const instancing and how to enable instancing on SM2 ATI cards, see http://www.humus.ca/index.php?page=3D&ID=52 (Humus' is a great site).
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement