instanced drawing requires a VB of worldmats, one worldmat for each instance.
if i want to draw a whole bunch of grass plants (10K to 100K instances), how do i deal with frustum cull?
lets say i want to draw a plant every foot in a 300 foot radius bounding box around the camera. that's 300x300= 90,000 instances.
do i frustum cull 90,000 plants, and for those that pass cull, i copy their worldmat into the vb? would that be a static vb created and discarded each time? or a dynamic one that gets reused?
or do i simply have a terrain chunk of grass plants, and if the chunk is visible, i draw them all with no frustum cull, and let viewport clipping sort it out?
i currently use terrain chunks 300 feet across (game scale: 1 foot = 1 d3d unit). one plant per foot will probably be the desired vegetation density. thats 90,000 instances per chunk. i draw 4 or 6 chunks each time, depending on direction of view. so that's 360,000 or 540,000 plants i'm talking about drawing.
and what about user defined clip range? (fade out distance?).
instanced drawing might be all fine and good, but the plants really still need to be culled on an individual basis, or at least in groups or chunks.
this is the old "efficient database" of renderables problem.
Databases and Culling
Building a reliable database of the objects in your world is key to excellent performance in Direct3D. It is more important than improvements to rasterization or hardware.
You should maintain the lowest polygon count you can possibly manage. Design for a low polygon count by building low-polygon models from the start. Add polygons if you can do so without sacrificing performance later in the development process. Remember, the fastest polygons are the ones you don't draw.
any suggestions?
each frame, for each plant, range clip, frustum cull, calc worldmat, add to VB? then draw instanced? sounds slow. dynamic buffers. will the speed of draw instanced more than make up for that? try it and find out?