instancing

What do you feel instancing in graphics terms means?

  • Using single copy of data to draw same object multiple times on screen.
  • New dx10 way of drawing many copies by drawing one copy.
  • Sharing actors animation frame data.
  • Something to do with MMO’s dungeon handling.

0 voters

I think the term instancing as used in panda3d is wrong.
Instancing in panda3d means all instances will play same animation.

I see instancing always confused with 2 things:

First when people think instancing they think speed up. No duplication of data! Its all shared!
But panda3d does this by default! I think having instancing implies that panda3d does not share data and duplicates crap. New programmers to the engine get hung up on making instances - i know i did.
By default all geometry buffers are shared between model nodes. When you load same model form the egg most of the data (geometry and textures but not nodes and their positions) on that model is shared.

Second they think Geometry instancing introduced with geometry shaders, again it speeds stuff up! “geometry instancing refers to the practice of rendering multiple copies of the same mesh in a scene at once” Again that is not what panda3d does.

I think we should rename instancing to some thing else to clear up confusion. Something like “animationInstancing” or “animationSharing” or “animationLinking” to describe its true form.

yes I agree with you 100% I was thinking that instancing would be a good way to programe, but now that I’ve read this I understand that its not what I orginally thought :slight_smile:

Eh, you kids today. “Instancing” has traditionally meant what it means in Panda: rendering the same node or nodes in multiple contexts. It means more than just sharing animation frames, although that is the most visible side-effect.

But most people today know of the term only in context of geometry shaders, which is a different meaning. I agree that the term is too overloaded and often misunderstood. I was initially against putting any mention of instancing at all in the early part of the manual for this reason.

The manual does make an attempt to clarify what precisely is and is not meant by instancing in Panda, but I think it could do a better job of emphasizing this.

On the other hand, I think we will one day be able to make Panda instancing automatically map to geometry shader instancing, and then this confusion will be less important.

David

A Panda instance is just a node revisted in the scene graph with a different transform, right? That’s what I’ve always known instancing to be…

I think CopyTo should be mentioned somewhere, too, but talk about making it even more confusing.

Adding geometry instancing support to Panda will not be hard. Geometry instancing (and I mean ARB_draw_instanced) is just a matter of adding a “count” number to the draw call, meaning the object will be drawed X times.
Then, one should create a shader with an InstanceID variable where the shader uses an array to give each instance a different position.
I think we will soon get support for this in Panda by adding a ShaderAttrib.setInstanceCount or something like that.

Secondly, there is fake instancing by creating a geometry shader that just issues the geometry X times.

Then there’s ARB_instanced_arrays, which allows you to use instancing with the fixed-function pipeline, but it’s more complicated to use, and this extension is not widely supported.

Maybe one day, we will get a shader generator that supports instancing and we could use our current ‘instanceTo’ system to use geometry instancing as well.

While panda’s instancing is usually not needed for performance reasons, I did have a case where it was necessary to avoid the duplication of geometry. It was a case where I was generating geometry in code that needed to be used more than once. That just prevents duplication on the CPU though, and mainly saved the generation time.

Ah, though instanceTo() is not actually needed for this. copyTo() would have worked just as well, in fact might be preferable; and it would still in fact share the actual geometry structures.

David