# BatchedMesh for InstancedBufferGeometry

**URL:** <https://discourse.threejs.org/t/batchedmesh-for-instancedbuffergeometry/73404>\
**Category:** Questions\
**Tags:** batchedmesh\
**Created:** [October 29, 2024, 6:53am UTC](https://discourse.threejs.org/t/batchedmesh-for-instancedbuffergeometry/73404 "2024-10-29T06:53:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chaser\_Code](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/chaser_code/32/20199_2.png) [@Chaser\_Code](https://discourse.threejs.org/u/Chaser_Code)\
**Post date:** [October 29, 2024, 6:53am UTC](https://discourse.threejs.org/t/batchedmesh-for-instancedbuffergeometry/73404/1 "2024-10-29T06:53:54Z")

</div>

I found that BatchedMesh convert InstancedBufferGeometry to BufferGeometry. Maybe in future will be added option to save InstancedBufferGeometry it will be hellpfull for grass instancing and performance instead InstancedMesh. I was try replace BatchedMesh.geometry with InstancedBufferGeometry and it work but show only 1 of 5000 objects with customShader.

---

<div class="post-metadata">

**Author:** ![agargaro](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/agargaro/32/35529_2.png) [@agargaro](https://discourse.threejs.org/u/agargaro)\
**Post date:** [October 29, 2024, 9:46am UTC](https://discourse.threejs.org/t/batchedmesh-for-instancedbuffergeometry/73404/2 "2024-10-29T09:46:10Z")

</div>

Why would you want to use `BatchedMesh` if you only have one geometry?

If it is for frustum culling, you can see this:

> **[GitHub - agargaro/instanced-mesh: Enhanced InstancedMesh with frustum culling, fast...](https://github.com/agargaro/instanced-mesh)**
>
> Enhanced InstancedMesh with frustum culling, fast raycasting (using BVH), sorting, visibility management, LOD and more.

---

<div class="post-metadata">

**Author:** ![Chaser\_Code](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/chaser_code/32/20199_2.png) [@Chaser\_Code](https://discourse.threejs.org/u/Chaser_Code)\
**Post date:** [October 29, 2024, 10:00am UTC](https://discourse.threejs.org/t/batchedmesh-for-instancedbuffergeometry/73404/3 "2024-10-29T10:00:56Z")

</div>

Because i want 1 draw call and several frustumCulls and fast calculation.  
For example i have 25 meshes around player. Each mesh with InstancedBufferGeometry which display 100.000 grases and total 2.500.000 grases. To decrese draw calls from 25 to 1 i need for batchedMesh which can merge geometryes to one and show to only visible meshes with instances and decrease rendered triangles. I made script which merging meshes to one and use 1 draw call but if i will use frusum eveery frame then it take about 7ms instead 0-1ms with batchedMesh but configured to display InstancedBufferGeometry with customShader with offsets for instances.  
BatchedMesh at this time is good solution for landscape, water chunck separeted to small meshes.

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/a/0/a01e07957a9e5e5dd0a6b1ebe2eb86d226bda375.jpeg)

---

<div class="post-metadata">

**Author:** ![agargaro](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/agargaro/32/35529_2.png) [@agargaro](https://discourse.threejs.org/u/agargaro)\
**Post date:** [October 29, 2024, 6:37pm UTC](https://discourse.threejs.org/t/batchedmesh-for-instancedbuffergeometry/73404/4 "2024-10-29T18:37:53Z")

</div>

I am working on a similar example, using a BVH for frustum culling and LOD of instances, without having to split into chunks and having a number of draw calls equal to the LODs. The performance is good.

I tried to render all with a single draw call using **multiDrawInstanced** but I read that there is no compatibility with firefox (and it’s not possible to sort) so I gave up after writing a small example.

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/b/8/b805ed1bff99898f3db238fc2499e2614dc79b77.jpeg)

---

<div class="post-metadata">

**Author:** ![Chaser\_Code](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/chaser_code/32/20199_2.png) [@Chaser\_Code](https://discourse.threejs.org/u/Chaser_Code)\
**Post date:** [October 30, 2024, 9:13am UTC](https://discourse.threejs.org/t/batchedmesh-for-instancedbuffergeometry/73404/5 "2024-10-30T09:13:27Z")

</div>

@Mugen87 BatchedMesh.InstancedBufferGeometry instead BatchedMesh.BufferGeometry immposible?
