Question about Instancing and performance

Hi everyone,
I try to learn more about instancing cause we do a lot of space with 30+ chair, lamp, desk, ( sometimes plants )

At first I was enough with the following exemple :
__lounge_chair_red__0
__lounge_chair_red__01
__lounge_chair_red__02

Since in Shapespark in instance count it semmed working


Lately I improve a lot with JavaScript and API of Shapespark and try to have the most control of everything

At first I notice something fun :

For instance work and detected with my scene I don’t need following the following name convention :
__lounge_chair_red__0
__lounge_chair_red__01
__lounge_chair_red__02
So I guess the fact it was mandatory was because my lack of English when I read about those topics

Other funny things when you follow this convention you can somehow trick Shapespark count
Even with completly not instancied different object,

I dig a bit and find the scene.json when you load a scene
Here I find the definitive information if instance really effective or not ( because we can have a missinformation in the software of Shapespark )

But anyway it’s not so important all that story to ask my questiont :

Cause when I instance by exemple a plant I try to instance leaf, then plant, so a plant can have a lot of object
If I do instancing of course finally it’s not so much even for 100 x plants

But the object count in Shapespark definitively increasing …

image

My question is more about knowledge, how it impact performance ?
Is it impacting ? Or is it false positive cause i use instance ?
If I duplicate a mesh composed by many mesh I can avoid this object increasing but
According what I learn it’s bad to make instance from 3D software for export from a multi mesh mesh ( for some software it make group but I’m on Maya it create a new mesh )
But somehow in scene.json it look ok the subpart ( so all meshes from the combine mesh ) are well instancied
Maybe lucky or maybe I just was wrong about the fact to instance every mesh separatly then instance a group of those mesh )
It’s working too but create a lot of little mesh and increase object count

What is really the perfect way to do an instance for performance ?
And if I instance a multiple x100 mesh group this object count increasy is right or fake because I use instance ?
Do you know in scene.json or any other place where I can have the info to look myself this object count information and analyse the result myself ?
and is for a plant instance leaf, then tree is the good way ? or just a mesh with the tree ? but i lost a lot of instanced leaf for the parent tree against the price of object count …

thanks a lot

Object instancing in Shapespark is logical instancing, not instancing at the rendering level. It’s main purpose is to make managing groups of identical objects easier, for example by letting the user to change lightmap resolution or mesh simplification level for all the identical chairs in the scene in one go.

Shapespark extracts instance information when importing the 3D model, however it’s not always possible. When a SketchUp model is imported, SketchUp component instances are turned into Shapespark object instances. However, on the other hand, if you export a 3D model to FBX/DAE/glTF file, and instance information is lost on the export, Shapespark doesn’t have a way to recover this information (except if you pass it using the __OBJECT_TYPE_NAME__SUFFIX object naming convention).

Logical instancing doesn’t affect rendering performance. No matter if there are three separate chair objects or three object instances sharing the same chair object type, Shapespark has to render the same amount of triangles in both cases. So, if you’re looking for improving the frame-rate, you have to simplify meshes or reduce the number of objects in the scene, instancing won’t be helpful.

As a side note, Shapespark has an optimization to speed up rendering of identical geometries in the scene, however this is independent from whether the objects are instanced or not.

1 Like

thanks a lot of the tech details :slight_smile: