PDA

View Full Version : Instancing looks interesting to me.



Obli
07-20-2004, 05:01 AM
I just read something about a thing called "Instancing" from nvidia's website.

Now, I won't mention the API it runs for obvious reasons, but I would like to know comments about this. Could it be useful on GL?
I actually think it could even if per-batch overhead is lower here and the examples looked a bit fake to me (I'll never draw 100k trees of 100 triangles each).

What are your considerations on this?
Thank you.

CrazyButcher
07-20-2004, 06:49 AM
wouldnt this be similar to a display list ? just that its even more efficiently stored or so ? Then again not much knowledge on how it is done, and what makes it special.

Alessandro_dup1
07-20-2004, 07:11 AM
Can you post the link ? i can't find it.

SeskaPeel
07-20-2004, 07:17 AM
Instancing is a feature of NV40 boards.
The purpose is to store a mesh only once, and then pass "differenciate" streams for each instance, thus saving vertex pos / normals / mapping coos ... or whatever you wish. You can then choose to add eg. a different vertex color stream, have a different matrix for each instance.

The simple advantage : one draw call for as many instance as you wish.

A point has to be clear : after several tests, nVidia announce that the most optimal use is with 100 polys models. This is why they use a forest as example. They have another demo running some asteroid field with a lot of floating rocks.

SeskaPeel.

SeskaPeel
07-20-2004, 07:25 AM
Phil Scott explains that better than I do :
http://download.nvidia.com/developer/pre...t_Practices.pdf (http://download.nvidia.com/developer/presentations/2004/6800_Leagues/6800_Leagues_SM3_Best_Practices.pdf)

SeskaPeel.

Dirk
07-21-2004, 04:42 AM
Originally posted by SeskaPeel:
Instancing is a feature of NV40 boards.
The purpose is to store a mesh only once, and then pass "differenciate" streams for each instance, thus saving vertex pos / normals / mapping coos ... or whatever you wish. You can then choose to add eg. a different vertex color stream, have a different matrix for each instance.

The simple advantage : one draw call for as many instance as you wish.

A point has to be clear : after several tests, nVidia announce that the most optimal use is with 100 polys models. This is why they use a forest as example. They have another demo running some asteroid field with a lot of floating rocks.

SeskaPeel.Did you they give any reason why that's the magic number?

What I thought about when reading this was doing particles with it, so you don't have to have all vertices 4 times in your data. But hat would be 1 polygon objects, not a hundred...

Are there any plans to put this API on OpenGL at all? I can hear the wheel of reinvention squeakily starting to turn again, but if the feature is there it might make sense to use it.

SeskaPeel
07-21-2004, 08:10 AM
nVidia internals told me that this feature is planned for OGL, but this not an official answer.
And I fear we won't get any.

The magic numbers come from test, they did not choose to implement their drivers for this, the fact is that after implementation, it yields that 100 polys is the best choice (refer to the graph in the link I posted).
They say that you can use this method for particles, but I'd rather picture volumetric particles.

To render billboarded planar (1 or 2 polys) particles with this method, you'll have to pass a different matrix for each particle, being 4 vectors. It makes 16 floats, and this is precisely what you need to render them correctly with 2 polys, and without this method (refer to the recent thread on particles, where I explained my weapon of choice : http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=3;t=012151).

SeskaPeel.

Dirk
07-22-2004, 02:03 PM
Originally posted by SeskaPeel:
They say that you can use this method for particles, but I'd rather picture volumetric particles.
What do you mean by that?



To render billboarded planar (1 or 2 polys) particles with this method, you'll have to pass a different matrix for each particle, being 4 vectors. It makes 16 floats, and this is precisely what you need to render them correctly with 2 polys, and without this method (refer to the recent thread on particles, where I explained my weapon of choice : http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_ topic;f=3;t=012151). (http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=3;t=012151).)
Why do need to pass 16 floats? For a simple, fixed sized, screen-aligned particle all you need is its position. You might want to pass other parameters like transparency, up vector/angle, age or things like that, but just for rendering you can get most of the info from the state's matrices. I couldn't look at the post you referenced, the link doesn't seem to work.

In any case, this is going off-topic. In essence it looks like we might be able to get it in OpenGL, but it wouldn't work for particles. Oh well, that's the way it is.

Dirk

Obli
07-23-2004, 02:28 AM
My apologies for the amount of posts in that message. Since I've originated the discussion, I feel I have to keep an eye on it...

Posted by CrazyButcher (07-20-2004 08:49 AM)
wouldnt this be similar to a display list?I also think it is, but it allows probably some degree of dinamicity which is totally lacking on display lists... if you ever tried to look at how much the driver takes to compile a list, you know what I mean.

Posted by dirk (07-21-2004 06:42 AM)
What I thought about when reading this was doing particles with it, so you don't have to have all vertices 4 times in your data. But hat would be 1 polygon objects, not a hundred...I don't think this would be a good idea considering you have to supply the MVP and possibly other infos per-instance.
I don't even think it's possible at all (but I think I've misunderstanding what I would like to do) because I think it's not possible to take a vertex from an instance, mangle it and take the other two (for a triangle) by two following instances... There's probably some sort of T&L caching but I don't think it can do infra-primitive assembly.
SeskaPeel seems to have the same idea.
I hear there's something like a "repetition count" somewhere in the same API but I don't really know how it works and if it can do this trick. If it can, then it's another interesting feature.

Posted by SeskaPeel (07-21-2004 10:10 AM)
I'd rather picture volumetric particles.I'm also rather interested in this. Could you give us some more hints? The link seems to be broken.

SeskaPeel
07-23-2004, 07:06 AM
The link has a closed parenthesis at the end that should be removed.
Here it is again http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_ topic;f=3;t=012151

Volumetric particles :
You might be thinking of depth sprites (papers on nvidia website, or google), but it wasn't what I was talking of.
Volumetric particles are simply small 3D objects. Like in asteroids when you break a big rock into a myriads of smaller. These smaller could be rendered by a particle system, meaning they can have some age, color, forces, ...

I think this is the most interesting use of instancing.

SeskaPeel.