Hi,
I've got hardware instancing working in Direct3D 9 with around 500 NPCs moving around, however, I've noticed that when zoomed out there is a sort of shimmering effect as if they're being drawn. Does anyone know the reason why this would be happening?
I am locking and unlocking the (dynamic) vertex buffer that contains the transformation matrices of each instance every frame with the NO_OVERWRITE flag if that makes a difference.
Any help would be much appreciated!
~Ray
Shimmering artifact when using hardware instancing
Started by raydey, Jul 18 2012 05:03 PM
1 reply to this topic
Ad:
#2 Moderators - Reputation: 5416
Posted 18 July 2012 - 07:12 PM
With NO_OVERWRITE you basically promise not to touch any data that the GPU is still using. This can actually be tricky to pull off, since there can be a long latency between when you issue a draw call and when the GPU finishes processing it. So to be robust you'll need to have a buffer big enough to hold 2-3 frames worth of instance data, or you'll need to have 2-3 different buffers that you swap between.
The other alternative is to use DISCARD, which makes things a lot easier since the driver manages the actually buffer memory transparently behind the scenes. But to do that you'd need to make sure you only lock the buffer once per frame.
The other alternative is to use DISCARD, which makes things a lot easier since the driver manages the actually buffer memory transparently behind the scenes. But to do that you'd need to make sure you only lock the buffer once per frame.






