-
instancing?
Hi,
I'm trying to optimize the driver overhead of a certain vegetation rendering system. Problem is this: I have a large number of instances of the same mesh that need to be rendered (on the order of 100-200 worst case). I need some way to reduce the impact of making 100 calls to glDrawElements. Right now I'm binding the VBO, then the shader, and then looping over the instances, setting the transform for each and then calling draw. A pretty basic approach.
What I'm looking for here ideally is some sort of instancing, where I could pass an array of matrices or something to a single draw call and say "ok now draw 97 of these". To my knowledge OpenGL has no such functionality.
Merging my instances into a single array is not really a great option, at least not on a large scale, since the list changes frequently.
Does anyone have any suggestions? Thank you!
-
Member
Regular Contributor
Re: instancing?
You could try display lists but I have no idea how well that works in combination with VBOs and if it will actually accelerate anything on todays hardware.
-
Member
Regular Contributor
Re: instancing?
On G80-series there is an extension http://www.opengl.org/registry/specs..._instanced.txt , which does exactly what you've described.
According to that table - http://delphi3d.net/hardware/extsupp...draw_instanced , it is supported.
Actually, I had no deal with it, so I can't say exactly, if there is some caveats.
-
Re: instancing?
EXT_draw_instanced is interesting... would certainly provide benefit to people with that hardware. Ideally I'd like more support than that, but maybe I'll just have to live with it.
-
Member
Regular Contributor
Re: instancing?
Depending on how 3d-ish the mesh is, you *might* be able to get away with rendering once to a texture, and then just texture-mapping it 100+ times onto a simpler surface.
-
Member
Regular Contributor
Re: instancing?
Unfortunately, for now it is the only way to benefit from "fair" instancing with OpenGL.
Previous hardware may support it in future, but I think nVidia will "push forward" their new generations and will "make a bolt" on elder, it's quite understandable
-
Junior Member
Regular Contributor
Re: instancing?
When I tried EXT_draw_instanced on the g80 it was about half as fast as just looping over DrawElements and setting transforms.
-
Junior Member
Regular Contributor
Re: instancing?
It sounds like you're assuming your bottleneck is on the CPU, and are thus trying to optimize out draw calls. Perhaps your bottleneck is on the GPU? If that was the case, then I could see how it could lower performance. Or... it could very well just be an unoptimized implementation in the driver.
Kevin B
-
Re: instancing?
*Definitely* CPU limited in my app - if I measure time spent simply making all those calls its quite bad. I would love for the bottleneck to be the GPU :-P
-
Junior Member
Regular Contributor
Re: instancing?
It's not that I was actually trying to reduce any CPU bottleneck - OpenGL draw calls are pretty fast if you aren't changing much state - I just wanted to see if instancing had reasonable performance yet. I was hoping it would at least be the same speed as simply looping over a draw call and setting a uniform.
edit: ext_draw_instanced didn't even work correctly until recent drivers, so it could just be a work in progress at this point
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules