# Octree examples no longer available?

**URL:** <https://discourse.threejs.org/t/octree-examples-no-longer-available/5888>\
**Category:** Questions\
**Tags:** examples\
**Created:** [January 27, 2019, 1:46pm UTC](https://discourse.threejs.org/t/octree-examples-no-longer-available/5888 "2019-01-27T13:46:11Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mike\_Lee](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mike_lee/32/6460_2.png) [@Mike\_Lee](https://discourse.threejs.org/u/Mike_Lee)\
**Post date:** [January 27, 2019, 1:46pm UTC](https://discourse.threejs.org/t/octree-examples-no-longer-available/5888/1 "2019-01-27T13:46:11Z")

</div>

Hi, I want to try to use Octree raycasting in my application.

I found the `threeoctree` package that implements Octree in THREE, but it only supports up to r60. The author of the package did include a link to a version last year that is supposedly compatible with “latest” THREE, so I went to the link, but the link is unavailable. It seems like it was once part of the `examples/js` directory, but was taken down for some reason. That being said, I could not find any example usage of Octree in THREE that were occasionally mentioned across forums/stackoverflow/etc.

Have these examples been moved somewhere else, or are they taken down because they no longer works with the latest THREE?

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [January 27, 2019, 3:24pm UTC](https://discourse.threejs.org/t/octree-examples-no-longer-available/5888/2 "2019-01-27T15:24:02Z")

</div>

> [@Mike\_Lee](#):
>
> The author of the package did include a link to a version last year that is supposedly compatible with “latest” THREE, so I went to the link, but the link is unavailable.

I have made a PR at the original repo in order to avoid such confusion. But the owner of `Octree` seems to ignore it 😑

> <https://github.com/collinhover/threeoctree/pull/25>
>
> \`THREE.Octree\` has been removed from the \`three.js\` repo, see https://github.com…/mrdoob/three.js/pull/15451

> [@Mike\_Lee](#):
>
> Have these examples been moved somewhere else, or are they taken down because they no longer works with the latest THREE?

No, they were deleted with this [PR](https://github.com/mrdoob/three.js/pull/15451). `Octree` uses an old geometry format that is going to be removed from the library. Since the implementation is complex and a migration to `BufferGeometry` time-consuming, we decided to remove `Octree` from `three.js` and refer to the original repo instead. So please make any form of feature requests at the original repo.

---

<div class="post-metadata">

**Author:** ![Mike\_Lee](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mike_lee/32/6460_2.png) [@Mike\_Lee](https://discourse.threejs.org/u/Mike_Lee)\
**Post date:** [February 8, 2019, 5:22pm UTC](https://discourse.threejs.org/t/octree-examples-no-longer-available/5888/3 "2019-02-08T17:22:08Z")

</div>

Thank you for the comment. I missed your reply.

---

<div class="post-metadata">

**Author:** ![diem389](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/diem389/32/6378_2.png) [@diem389](https://discourse.threejs.org/u/diem389)\
**Post date:** [July 17, 2019, 12:32am UTC](https://discourse.threejs.org/t/octree-examples-no-longer-available/5888/4 "2019-07-17T00:32:42Z")

</div>

I made a just ported version of old threeoctree.

> **[diem389/threeoctree2](https://github.com/diem389/threeoctree2)**
>
> threeoctree revision supporting latest three.js (v106) - diem389/threeoctree2

---

<div class="post-metadata">

**Author:** ![looeee](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/looeee/32/59_2.png) [@looeee](https://discourse.threejs.org/u/looeee)\
**Post date:** [July 17, 2019, 4:03am UTC](https://discourse.threejs.org/t/octree-examples-no-longer-available/5888/5 "2019-07-17T04:03:09Z")

</div>

> ported version of old threeoctree

Just to be clear, the still has the same problem as the previous version. That is, it uses `Geometry`, but it needs to be updated to use `BufferGeometry`.

---

<div class="post-metadata">

**Author:** ![EliasHasle](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/eliashasle/32/3010_2.png) [@EliasHasle](https://discourse.threejs.org/u/EliasHasle)\
**Post date:** [July 17, 2019, 10:07am UTC](https://discourse.threejs.org/t/octree-examples-no-longer-available/5888/6 "2019-07-17T10:07:48Z")

</div>

@diem389 Welcome to the community! 😃

@looeee Support for BufferGeometry will be a nice update, but making the old version work on the newest release of three.js is a good step too.

---

<div class="post-metadata">

**Author:** ![Usnul](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/usnul/32/2355_2.png) [@Usnul](https://discourse.threejs.org/u/Usnul)\
**Post date:** [July 17, 2019, 10:12am UTC](https://discourse.threejs.org/t/octree-examples-no-longer-available/5888/7 "2019-07-17T10:12:49Z")

</div>

@EliasHasle I think there’s a lot wrong if you’re using a spatial index for your geometry and don’t use a `BufferGeometry`. But that’s just my take, I think most people don’t need it, and those who need this `octree` - probably want something more advanced anyway.

As far as I see it - it’s a learning tool, and for learning - it’s best to learn the right way from the start. The right way to use `three.js` is to use `BufferGeometry`, since that’s the main path forward currently and all of the documentation points in that direction generally.

---

<div class="post-metadata">

**Author:** ![diem389](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/diem389/32/6378_2.png) [@diem389](https://discourse.threejs.org/u/diem389)\
**Post date:** [July 17, 2019, 3:09pm UTC](https://discourse.threejs.org/t/octree-examples-no-longer-available/5888/8 "2019-07-17T15:09:06Z")

</div>

Conversion between buffergeometry and geometry is a very easy step. If I have some time after closing some urgent work, I could make it support buffergeometry. I hope.

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [July 17, 2019, 3:37pm UTC](https://discourse.threejs.org/t/octree-examples-no-longer-available/5888/9 "2019-07-17T15:37:21Z")

</div>

> [@diem389](#):
>
> Conversion between buffergeometry and geometry is a very easy step.

The idea is to avoid any dependency to `THREE.Geometry` since the class will be removed at some point (at least it will be renamed to `THREE.LegacyGeometry`). So you have to develop the code from scratch based on `BufferGeometry`.

---

<div class="post-metadata">

**Author:** ![Fyrestar](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/fyrestar/32/52793_2.png) [@Fyrestar](https://discourse.threejs.org/u/Fyrestar)\
**Post date:** [July 17, 2019, 3:41pm UTC](https://discourse.threejs.org/t/octree-examples-no-longer-available/5888/10 "2019-07-17T15:41:18Z")

</div>

> [@Mugen87](#):
>
> at least it will be renamed to `THREE.LegacyGeometry`

Is BufferGeometry getting renamed to Geometry?

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [July 17, 2019, 3:47pm UTC](https://discourse.threejs.org/t/octree-examples-no-longer-available/5888/11 "2019-07-17T15:47:05Z")

</div>

Maybe. I mean it would be the ideal case however the impact of this change might be too radical. I think we first want to see the community’s reaction when `WebGLRenderer` stops rendering `Geometry` 😉

> <https://github.com/mrdoob/three.js/pull/15514>

---

<div class="post-metadata">

**Author:** ![Fyrestar](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/fyrestar/32/52793_2.png) [@Fyrestar](https://discourse.threejs.org/u/Fyrestar)\
**Post date:** [July 17, 2019, 4:03pm UTC](https://discourse.threejs.org/t/octree-examples-no-longer-available/5888/12 "2019-07-17T16:03:05Z")

</div>

> [@Mugen87](#):
>
> I think we first want to see the community’s reaction when `WebGLRenderer` stops rendering `Geometry`

[![](https://miro.medium.com/v2/resize:fit:640/1*AjjSTJG6cqaMcBUSROPw0Q.jpeg) ](https://miro.medium.com/v2/resize:fit:640/1*AjjSTJG6cqaMcBUSROPw0Q.jpeg)  
I totally agree with this move, it is just logical 👍 also since the internal conversion is hidden a lot people still use the old geometry class.

---

<div class="post-metadata">

**Author:** ![diem389](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/diem389/32/6378_2.png) [@diem389](https://discourse.threejs.org/u/diem389)\
**Post date:** [July 17, 2019, 4:46pm UTC](https://discourse.threejs.org/t/octree-examples-no-longer-available/5888/13 "2019-07-17T16:46:56Z")

</div>

Thanks for your information.

---

<div class="post-metadata">

**Author:** ![Aaa\_Aaa](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/aaa_aaa/32/8470_2.png) [@Aaa\_Aaa](https://discourse.threejs.org/u/Aaa_Aaa)\
**Post date:** [December 23, 2019, 9:27pm UTC](https://discourse.threejs.org/t/octree-examples-no-longer-available/5888/15 "2019-12-23T21:27:49Z")

</div>

I came searching for a more recent implementation of octree for three.js and here you are. THANK YOU. Did you ever end up implementing BufferGeometry?

---

<div class="post-metadata">

**Author:** ![3kynox](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/3kynox/32/8400_2.png) [@3kynox](https://discourse.threejs.org/u/3kynox)\
**Post date:** [December 30, 2019, 4:23pm UTC](https://discourse.threejs.org/t/octree-examples-no-longer-available/5888/16 "2019-12-30T16:23:43Z")

</div>

I’m also curious 🙂

---

<div class="post-metadata">

**Author:** ![Sakaggi](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/sakaggi/32/5795_2.png) [@Sakaggi](https://discourse.threejs.org/u/Sakaggi)\
**Post date:** [January 27, 2020, 10:30am UTC](https://discourse.threejs.org/t/octree-examples-no-longer-available/5888/17 "2020-01-27T10:30:11Z")

</div>

Another curious one here!

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [January 27, 2020, 11:52am UTC](https://discourse.threejs.org/t/octree-examples-no-longer-available/5888/18 "2020-01-27T11:52:03Z")

</div>

If you want to use an Octree to speed up raycasting, I suggest you use this alternative instead:

> **[gkjohnson/three-mesh-bvh](https://github.com/gkjohnson/three-mesh-bvh)**
>
> A BVH implementation to speed up raycasting against three.js meshes. - gkjohnson/three-mesh-bvh
