0

I am reading the article "Particles / Instancing"

Here is the quote:

Clearly, we need a way to draw all particles at the same time.

There are many ways to do this; here are three of them :

(a) Generate a single VBO with all the particles in them. Easy, effective, works on all platforms.

(b) Use geometry shaders. Not in the scope of this tutorial, mostly because 50% of the computers don’t support this.

(c) Use instancing. Not available on ALL computers, but a vast majority of them.

Yes, (a) is implemented at the same time.

For (c), I thought glDrawArraysInstanced is equal to a loop of glDrawArrays. Is it real same-time implementation?

For (b), I think we could use vertex to have the same effect.

1 Answer 1

0

For instancing, glDrawArraysInstanced has the same visual effect as calling glDrawArrays multiple times, however, if your driver has support for true instancing (which almost all desktop GPU drivers will, and many mobiles), then it will perform significantly better. The savings, is due to less data transfer between CPU and GPU, and fewer GL API calls.

These days, geometry shaders are also on the vast majority of desktop GPU drivers - the article is a few years old. Mobile adoption is slower, as it is not a core feature of GLES 3.0. Generally, particles are billboard quads (4 vertices), but the vertices can be generated via a geometry shader with a single point, and some meta-data, instead of putting all 4 vertices into a VBO. This just reduces the size of the data transfer from CPU to GPU.

2
  • Thanks. Yes, Method (c) is indeed faster. But I want to know: Is it real same-time implementation? I don't think so. Since for each time, we only draw a tiny patch of pixels, say, a few pixels. I prefer to a method with real parallel implementation. I think Method (b) is truely parallel. And actually we could set different individual patches, say each object needs a triangle vertexes, in the vertex shader, for each triangle vertexes, we set a set of texture cooridnates. I think such set of vertex and fragment shaders can achieve real parallel implementation of many tiny objects rendering. Jun 19, 2015 at 15:53
  • If they are supported, they are all likely implemented at your GPU driver level, and their performance will be dependent on that implementation, and could vary from driver to driver. Jun 19, 2015 at 17:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.