How to reduce draw call of 3 lights model?

Hello,
I have a .glb file which containt 3 doulble light, but need 18 draws to render.
How I can do with this file to reduce draw when render with Blender or GltfTransform?

Ray 2.glb (4.1 MB)


Thank you

Try reducing the amount of materials and their duplicates in Blender.

2 Likes

After instacing into blender must be 2-3 draw calls. And if merge triangles into one gepmetry and merge textures into one then maybe 1 draw call

1 Like

If you open the model in https://gltf.report/ and then run the sample in the script tab, you’ll get it down to 1 draw call. This merges the (identical) lighting fixtures, which you might prefer to skip if you’ll be placing them throughout the scene. The script is comparable to running gltf-transform optimize in.glb out.glb and works by generating a small palette texture for all of the unique material colors:

image

3 Likes

Hi Don,
Thank you. I tried and be very impresived.
Can I join all mesh but keep userdata on them ?

  • Scan and set userdata for all object: Allthing of light 1 will have a Userdata:‘light1’.
  • Continue with light 2,3,4…
  • → Join all of them to reduce draw but keep user data.
  • Click a position => raycaster check userdata of clicked area => send back console.

You can have one mesh for rendering, multiple meshes or just nodes for data/raycasting etc

1 Like

Maybe, but it will make everything else more complicated, you’d need to pack identifiers into vertex data. Until you are well over 100+ draw calls and sure it’s causing performance issues, I would not worry about that type of optimization yet.

1 Like

Yes,
My problem is I have to solve with 700 .glb files in to scene without lost interact with objects. I tried to load gltf norrmally, It raised to 8000 calls…
Server side: used blender and gltf transform to optimized them.
Client side: Load them and merged some file gltf less important. But “impotant file” still to much.
So I turn back to server to find the better way to solve

Raycast to not added to scene default not merged meshes with userdata. Added to scene will be only merged.

1 Like

Like I’m understanding. I have merged mesh and original meshs.
Merged mesh will be rendered to scene, original meshs add to scene but not render.
When click, raycast check data on original mesh. Right ?
About highlight object, will I render object from original mesh by glb scene node?
But if I want hide object, I need create custom atributes for vertexs.

This sounds about right, yes. I’d have a look at BatchedMesh as well. It takes some work to set up correctly, but would allow you to show/hide individual objects while still drawing them in batches.

1 Like

I added ID for meshes of each object like this.
So, I think I can merge them all to one mesh with same ID condition, that will reduce draw call.
How can I do this ?
Ray 3.zip (7.7 MB)

Hi everybody,
Finally I had some results from your advices.
To handle interaction with object and reduce draw call. I devide glb file by nodes. Then use Join to reduce draw call.
Now I have to solve logic about view with instancedmesh. But seem looks like it has a solution. :slight_smile:
Thank you everybody

2 Likes