# Buffergeometry triangles subdivision

**URL:** <https://discourse.threejs.org/t/buffergeometry-triangles-subdivision/53934>\
**Category:** Questions\
**Tags:** geometry\
**Created:** [July 15, 2023, 11:52am UTC](https://discourse.threejs.org/t/buffergeometry-triangles-subdivision/53934 "2023-07-15T11:52:32Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![oldman](https://avatars.discourse-cdn.com/v4/letter/o/b2d939/32.png) [@oldman](https://discourse.threejs.org/u/oldman)\
**Post date:** [July 15, 2023, 11:52am UTC](https://discourse.threejs.org/t/buffergeometry-triangles-subdivision/53934/1 "2023-07-15T11:52:32Z")

</div>

Are there any utilities within the three.js distribution for subdividing bufferGeometry triangles into smaller ones based on some criteria - such as a maximum triangle side length? Couldn’t find anything in bufferGeometry utils. Not sure if there are other places to look.

Best,  
OLDMAN

---

<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:** [July 15, 2023, 12:24pm UTC](https://discourse.threejs.org/t/buffergeometry-triangles-subdivision/53934/2 "2023-07-15T12:24:41Z")

</div>

@oldman do you think you’d be able to use the [subdivision modifier](https://threejs.org/examples/webgl_modifier_subdivision.html) with the `flatOnly` flag checked?

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

---

<div class="post-metadata">

**Author:** ![PavelBoytchev](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/pavelboytchev/32/38639_2.png) [@PavelBoytchev](https://discourse.threejs.org/u/PavelBoytchev)\
**Post date:** [July 15, 2023, 1:03pm UTC](https://discourse.threejs.org/t/buffergeometry-triangles-subdivision/53934/3 "2023-07-15T13:03:06Z")

</div>

There are also some remnants left inside the implementation of [`PolyhedronGeometry`](https://github.com/mrdoob/three.js/blob/edefdc237b2528b9668fb873a1c06cb835840303/src/geometries/PolyhedronGeometry.js#L56), but you need to extract them if you want to use them. It is better to use the external subdiv library, as @Lawrence3DPK suggests.

---

<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:** [July 15, 2023, 1:07pm UTC](https://discourse.threejs.org/t/buffergeometry-triangles-subdivision/53934/4 "2023-07-15T13:07:36Z")

</div>

that’s cool, i didn’t know about…

> [@PavelBoytchev](#):
>
> PolyhedronGeometry

what do you mean by…

> [@PavelBoytchev](#):
>
> you need to extract them if you want to use them

i wonder how either of these would work with imported models, do you know if converting an imported glb’s `BufferGeometry` to `PolyhedronGeometry` is possible as to access and apply the internal `subdivide` function?

---

<div class="post-metadata">

**Author:** ![PavelBoytchev](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/pavelboytchev/32/38639_2.png) [@PavelBoytchev](https://discourse.threejs.org/u/PavelBoytchev)\
**Post date:** [July 15, 2023, 1:33pm UTC](https://discourse.threejs.org/t/buffergeometry-triangles-subdivision/53934/5 "2023-07-15T13:33:12Z")

</div>

> [@Lawrence3DPK](#):
>
> what do you mean by…
> 
> you need to extract them if you want to use them

Currently they (the functions that subdivide) are inside the class definition and I’m not sure how tightly they are connected to the polyhedron geometry. So, by ‘extracting’ I mean to copy their code somewhere outside the class and use it independently from the polyhedron class. This may or may not require some additional fixes, the first person to do this can tell. In any case, the code is not a complete subdiv algorithm, as it only splits faces and does not smooth surfaces.

Using the polyhedron class as it is may not be good, because apart from the subdivision, it also makes normalization (i.e. scales all vertices after subdivision so they are spread on a sphere).

---

<div class="post-metadata">

**Author:** ![oldman](https://avatars.discourse-cdn.com/v4/letter/o/b2d939/32.png) [@oldman](https://discourse.threejs.org/u/oldman)\
**Post date:** [July 15, 2023, 5:24pm UTC](https://discourse.threejs.org/t/buffergeometry-triangles-subdivision/53934/6 "2023-07-15T17:24:24Z")

</div>

Thanks, I shall give your suggestions a try

---

<div class="post-metadata">

**Author:** ![oldman](https://avatars.discourse-cdn.com/v4/letter/o/b2d939/32.png) [@oldman](https://discourse.threejs.org/u/oldman)\
**Post date:** [September 25, 2023, 11:21pm UTC](https://discourse.threejs.org/t/buffergeometry-triangles-subdivision/53934/7 "2023-09-25T23:21:55Z")

</div>

In these triangle subdivision techniques, is there anything that can also improve triangle aspect ratio while doing the dicing? Particularly if it is starting with narrow, sliver type triangles. Thanks much.

OLDMAN
