Skip to main content
GameDev.net gamedev.net
🔒 Locked

Shimmering artifact when using hardware instancing

Started by raydey Jul 18, 2012 at 11:03 PM 0 replies 1.3k views
Original Post
raydey
raydey
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
MJP
MJP
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.