# GLB's disappearing from certain angles after instancing

**URL:** https://discourse.threejs.org/t/glbs-disappearing-from-certain-angles-after-instancing/62132
**Category:** Questions
**Tags:** instancing, glb, usegltf
**Created:** [March 1, 2024, 5:49am UTC](https://discourse.threejs.org/t/glbs-disappearing-from-certain-angles-after-instancing/62132 "2024-03-01T05:49:12Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![ZainAliHaider](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/zainalihaider/32/45239_2.png) [@ZainAliHaider](https://discourse.threejs.org/u/ZainAliHaider)
#### Post date: [March 1, 2024, 5:49am UTC](https://discourse.threejs.org/t/glbs-disappearing-from-certain-angles-after-instancing/62132/1 "2024-03-01T05:49:12Z")

</div>

I don’t know why but my houses are diapering form certain angle as I applied instancing on my GLBs to optimize the overall performance.

  
Here is the code for instancing the models

interface HouseConfig {  
houses: any,  
asset: string  
}  
export const HouseTwo: FC = ({ houses, asset }) =\> {  
const { nodes } = useGLTF(asset);  
console.log(nodes);  
const meshes = useMemo(() =\> ({  
Tabley001\_1: (nodes.Tabley001\_1 as THREE.Mesh),  
Tabley001\_2: (nodes.Tabley001\_2 as THREE.Mesh),  
Tabley001\_3: (nodes.Tabley001\_3 as THREE.Mesh),  
Tabley001\_4: (nodes.Tabley001\_4 as THREE.Mesh),  
Tabley001\_5: (nodes.Tabley001\_5 as THREE.Mesh),  
Tabley001\_6: (nodes.Tabley001\_6 as THREE.Mesh),  
Tabley001\_7: (nodes.Tabley001\_7 as THREE.Mesh),  
Tabley001\_8: (nodes.Tabley001\_8 as THREE.Mesh),  
Tabley001\_9: (nodes.Tabley001\_9 as THREE.Mesh),  
Tabley001\_10: (nodes.Tabley001\_10 as THREE.Mesh),  
Tabley001\_11: (nodes.Tabley001\_11 as THREE.Mesh),  
Tabley001\_12: (nodes.Tabley001\_12 as THREE.Mesh),  
Tabley001\_13: (nodes.Tabley001\_13 as THREE.Mesh),  
Tabley001\_14: (nodes.Tabley001\_14 as THREE.Mesh),  
}), [nodes]);  
return (  
  
{(models:any) =\> {  
return (  
  
{houses.map((house: any, i: any) =\> {  
return ;  
})}  
);  
}}  
  
);  
};

const Model = ({ models, data }: { models: any, data: any }) =\> {  
return (  
\<group  
position={[data.position.x, data.position.y, data.position.z]}  
rotation={[degreesToRadians(data.rotation.x), degreesToRadians(data.rotation.y), degreesToRadians(data.rotation.z)]}  
scale={[0.001, 0.001, 0.001]}  
frustumCulled={false}  
\>  
\<models.Tabley001\_1 /\>  
\<models.Tabley001\_2 /\>  
\<models.Tabley001\_3 /\>  
\<models.Tabley001\_4 /\>  
\<models.Tabley001\_5 /\>  
\<models.Tabley001\_6 /\>  
\<models.Tabley001\_7 /\>  
\<models.Tabley001\_8 /\>  
\<models.Tabley001\_9 /\>  
\<models.Tabley001\_10 /\>  
\<models.Tabley001\_11 /\>  
\<models.Tabley001\_12 /\>  
\<models.Tabley001\_13 /\>  
\<models.Tabley001\_14 /\>  
  
);  
};

---

<div class="post-metadata">

### Author: ![drcmda](https://avatars.discourse-cdn.com/v4/letter/d/91b2a8/32.png) [@drcmda](https://discourse.threejs.org/u/drcmda)
#### Post date: [March 1, 2024, 8:17am UTC](https://discourse.threejs.org/t/glbs-disappearing-from-certain-angles-after-instancing/62132/2 "2024-03-01T08:17:29Z")

</div>

most likely [three.js docs](https://threejs.org/docs/index.html?q=mesh#api/en/core/Object3D.frustumCulled)

add this to the main instance, be it instancedmesh, merged or instances: `frustumCulled={false}`

to explain why three does that, it calculates bounds and culls (=refuses to render) the object if it isn’t seen by the camera (ie not in the cameras frustum). the individual instances that you define won’t contribute to the bounds.

---

<div class="post-metadata">

### Author: ![ZainAliHaider](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/zainalihaider/32/45239_2.png) [@ZainAliHaider](https://discourse.threejs.org/u/ZainAliHaider)
#### Post date: [March 1, 2024, 10:06am UTC](https://discourse.threejs.org/t/glbs-disappearing-from-certain-angles-after-instancing/62132/3 "2024-03-01T10:06:21Z")

</div>

Thank you so much dude you saved my day.

---

<div class="post-metadata">

### Author: ![Lawrence3DPK](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/lawrence3dpk/32/29184_2.png) [@Lawrence3DPK](https://discourse.threejs.org/u/Lawrence3DPK)
#### Post date: [March 1, 2024, 10:35am UTC](https://discourse.threejs.org/t/glbs-disappearing-from-certain-angles-after-instancing/62132/4 "2024-03-01T10:35:08Z")

</div>

Alternatively if you wanted to keep frustum culling intact you should be able to use [InstancedMesh.computeBoundingBox](https://threejs.org/docs/index.html#api/en/objects/InstancedMesh.computeBoundingBox) once instance matrices have been transformed and updated… This may have performance implications if perpetually updating this when animating instances.

---

<div class="post-metadata">

### Author: ![drcmda](https://avatars.discourse-cdn.com/v4/letter/d/91b2a8/32.png) [@drcmda](https://discourse.threejs.org/u/drcmda)
#### Post date: [March 1, 2024, 10:46am UTC](https://discourse.threejs.org/t/glbs-disappearing-from-certain-angles-after-instancing/62132/5 "2024-03-01T10:46:51Z")

</div>

👍 looks like the houses are static, might be a good idea to calculate it indeed

---

<div class="post-metadata">

### Author: ![ZainAliHaider](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/zainalihaider/32/45239_2.png) [@ZainAliHaider](https://discourse.threejs.org/u/ZainAliHaider)
#### Post date: [March 4, 2024, 4:50am UTC](https://discourse.threejs.org/t/glbs-disappearing-from-certain-angles-after-instancing/62132/6 "2024-03-04T04:50:26Z")

</div>

How I can do that? I’m new to this it would be pleasure if you have a little guidance.
