# THREE.Geometry will be removed from core with r125

**URL:** <https://discourse.threejs.org/t/three-geometry-will-be-removed-from-core-with-r125/22401>\
**Category:** Discussion\
**Tags:** geometry\
**Created:** [January 13, 2021, 8:13pm UTC](https://discourse.threejs.org/t/three-geometry-will-be-removed-from-core-with-r125/22401 "2021-01-13T20:13:44Z")\
**Posts on this page:** 20\
**Page:** 1

<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 13, 2021, 8:13pm UTC](https://discourse.threejs.org/t/three-geometry-will-be-removed-from-core-with-r125/22401/1 "2021-01-13T20:13:44Z")

</div>

The upcoming release `r125` will contain a major, potentially breaking change. The class `THREE.Geometry` will be no longer part of the core but moved to `jsm/deprecated/Geometry.js`. It will only be available as an ES6 module and not as a global script.

#### What does that mean for me?

If you are loading your assets with one of the official loaders like `GLTFLoader` or procedurally generate geometry data with `THREE.BufferGeometry`, this change won’t affect you. If you are using `THREE.Geometry`, please note the following changes:

- `THREE.Geometry` is no longer renderable and can’t be used to create 3D objects (meshes, lines, points) anymore.
- All geometry related library features like raycasting, helpers or exporters do not support `THREE.Geometry` anymore.
- All geometry generators (like `THREE.BoxGeometry`) produce `THREE.BufferGeometry` now.

#### Migrating

It’s actually best if you directly work with `THREE.BufferGeometry`. If your project budget is tight and you can’t afford to refactor your code from scratch, you have the possibility to convert your instances of `THREE.Geometry` to `THREE.BufferGeometry` with two new methods:

1. `Geometry.toBufferGeometry()` is the default method for converting a mesh geometry to `THREE.BufferGeometry`. It is used like so:

```javascript
const bufferGeometry = geometry.toBufferGeometry();

```

1. All faceless geometries (lines and points) have to use the **static** method `Geometry.createBufferGeometryFromObject()`. You have to pass in the 3D object so it’s possible for the code to detect the type of render primitive (points, lines, meshes):

```javascript
const bufferGeometry = Geometry.createBufferGeometryFromObject( points );

```

#### Motivation

Deprecating `THREE.Geometry` and focusing on `THREE.BufferGeometry` as our main geometry class was decided years ago and we are happy to finally remove it with `r125`. This will allow us to reduce the complexity of various engine components and make the maintenance and development process more easy. Besides, by forcing users into `THREE.BufferGeometry` they automatically work with the more efficient and future-proof geometry representation.

#### Roadmap

In the future there might be a point where we rename `THREE.BufferGeometry` to `THREE.Geometry` (but keep `THREE.BufferGeometry` as an alias). It’s also possible that more concrete geometry classes will be introduced (`MeshGeometry`, `LineGeometry` and `PointsGeometry`) that make it easier for the engine to detect the actual type of geometry.

---

<div class="post-metadata">

**Author:** ![dubois](https://avatars.discourse-cdn.com/v4/letter/d/e9c0ed/32.png) [@dubois](https://discourse.threejs.org/u/dubois)\
**Post date:** [January 13, 2021, 10:17pm UTC](https://discourse.threejs.org/t/three-geometry-will-be-removed-from-core-with-r125/22401/2 "2021-01-13T22:17:02Z")

</div>

Is this essentially what people refer to as a breaking change? If i upgrade to 125, my project wont work if i refer to `THREE.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:** [January 13, 2021, 10:26pm UTC](https://discourse.threejs.org/t/three-geometry-will-be-removed-from-core-with-r125/22401/3 "2021-01-13T22:26:48Z")

</div>

Yes, it is a breaking change. You will have to move away from `THREE.Geometry` or at least convert your geometries to `THREE.BufferGeometry`.

Let me make this more clear in the original post^^.

---

<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:** [January 13, 2021, 11:31pm UTC](https://discourse.threejs.org/t/three-geometry-will-be-removed-from-core-with-r125/22401/4 "2021-01-13T23:31:54Z")

</div>

This seems curious … with a breaking change this massive, why is BufferGeometry not named Geometry now instead of breaking our projects again in a year or so? Wouldn’t it be better to make it quick and painless, just be done with it? It seems counterproductive to break code but shy away from a small naming inconsistency given that the code breaks anyway, and then break everything … again. Could you still consider it?

---

<div class="post-metadata">

**Author:** ![donmccurdy](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/donmccurdy/32/33209_2.png) [@donmccurdy](https://discourse.threejs.org/u/donmccurdy)\
**Post date:** [January 13, 2021, 11:38pm UTC](https://discourse.threejs.org/t/three-geometry-will-be-removed-from-core-with-r125/22401/5 "2021-01-13T23:38:17Z")

</div>

> [@drcmda](#):
>
> why is BufferGeometry not named Geometry now instead of breaking our projects again in a year or so?

Use of Geometry has been discouraged for a long time, and we’ve removed its support from many parts of three.js already. For any projects that have been reading the deprecation warnings and moving to BufferGeometry as advised, r125 will not be a breaking change at all. Personally, I don’t think we should rename BufferGeometry to Geometry now _or_ in the future, it does not seem like enough benefit for the cost and potential confusion.

---

<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:** [January 13, 2021, 11:41pm UTC](https://discourse.threejs.org/t/three-geometry-will-be-removed-from-core-with-r125/22401/6 "2021-01-13T23:41:59Z")

</div>

> r125 will not be a breaking change at all

How can it not be a breaking change if geometry is removed? I’m for removal, don’t get me wrong, but if 125 breaks code, and it looks like it will, it would be great if it could be one strike instead of two. Personally, i would enjoy not having to write “Buffer” if it can be avoided. In any other project this would be a semver major, and everything’s permitted in a hard change to a new major.

---

<div class="post-metadata">

**Author:** ![dubois](https://avatars.discourse-cdn.com/v4/letter/d/e9c0ed/32.png) [@dubois](https://discourse.threejs.org/u/dubois)\
**Post date:** [January 14, 2021, 12:14am UTC](https://discourse.threejs.org/t/three-geometry-will-be-removed-from-core-with-r125/22401/7 "2021-01-14T00:14:05Z")

</div>

With a semver major, this feels like it would be a non-event though?

---

<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:** [January 14, 2021, 12:31am UTC](https://discourse.threejs.org/t/three-geometry-will-be-removed-from-core-with-r125/22401/8 "2021-01-14T00:31:55Z")

</div>

Looks like it will only be one break for people not using ‘BufferGeometry’ and none for those that do…

> [@donmccurdy](#):
>
> I don’t think we should rename BufferGeometry to Geometry now _or_ in the future

> [@Mugen87](#):
>
> `const bufferGeometry = geometry.toBufferGeometry();`

@Mugen87 would this be more effective/quicker than just renaming ‘Geometry’ to ‘BufferGeometry’ in a project? For instance just using notepad++ to rename all instances at once?

---

<div class="post-metadata">

**Author:** ![donmccurdy](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/donmccurdy/32/33209_2.png) [@donmccurdy](https://discourse.threejs.org/u/donmccurdy)\
**Post date:** [January 14, 2021, 12:42am UTC](https://discourse.threejs.org/t/three-geometry-will-be-removed-from-core-with-r125/22401/9 "2021-01-14T00:42:59Z")

</div>

> [@Lawrence3DPK](#):
>
> Looks like it will only be one break for people not using ‘BufferGeometry’ and none for those that do…

Right — `Geometry` has been deprecated for a long time, and no project written in the past couple of years should have been using it. If you’re already using `BufferGeometry`, and I expect most projects are, then upgrading from r124 → r125 will not change anything.

In other words, renaming “BufferGeometry” to “Geometry” now would make this a major change for _all_ users, with no prior warning. As it is, it’s a major change for only a subset of users, with quite a bit of prior warning.

If your project was using `Geometry` anyway, this would be a great time to upgrade. But if you can’t do that yet you can still import it from the `examples/jsm/deprecated` folder.

---

<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 14, 2021, 10:49am UTC](https://discourse.threejs.org/t/three-geometry-will-be-removed-from-core-with-r125/22401/10 "2021-01-14T10:49:27Z")

</div>

Pinned globally on January 14, 2021, 10:49am UTC



---

<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:** [January 14, 2021, 11:35am UTC](https://discourse.threejs.org/t/three-geometry-will-be-removed-from-core-with-r125/22401/11 "2021-01-14T11:35:24Z")

</div>

@donmccurdy  
one question, the only place i’ve had to use cube geometry is to detect collisions with other objects in “collidableMeshList” like this… where MovingCube is a CubeGeometry…

```
var originPoint = MovingCube.position.clone();

for (var vertexIndex = 0; vertexIndex < MovingCube.geometry.vertices.length; vertexIndex++)
{		
var localVertex = MovingCube.geometry.vertices[vertexIndex].clone();
var globalVertex = localVertex.applyMatrix4( MovingCube.matrix );
var directionVector = globalVertex.sub( MovingCube.position );

var ray = new THREE.Raycaster( originPoint, directionVector.clone().normalize() );
var collisionResults = ray.intersectObjects( collidableMeshList );

```

in r124 if i try to make MovingCube a BoxBufferGeometry it actually breaks the code as it can’t determine geometry.vertices.length, all meshes pushed to collidableMeshList use BoxBufferGeometry so bit confused…

will this not be a problem in r125 if updating MovingCube to a BoxBufferGeometry? or would i have to refer to this…?

> [@donmccurdy](#):
>
> But if you can’t do that yet you can still import it from the `examples/jsm/deprecated` folder.

edit: is there a different syntax to detect vertices of a buffer geometry? are vertices not accessable on buffer geometry or do they need to be declared in a Float32Array first?

---

<div class="post-metadata">

**Author:** ![mjurczyk](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mjurczyk/32/10995_2.png) [@mjurczyk](https://discourse.threejs.org/u/mjurczyk)\
**Post date:** [January 14, 2021, 11:46am UTC](https://discourse.threejs.org/t/three-geometry-will-be-removed-from-core-with-r125/22401/12 "2021-01-14T11:46:22Z")

</div>

> [@drcmda](#):
>
> Personally, i would enjoy not having to write “Buffer” if it can be avoided. In any other project this would be a semver major, and everything’s permitted in a hard change to a new major.

I think someone on discord mentioned that removing `Geometry` is one thing, but renaming `BufferGeometry` to `Geometry` will absolutely confuse anyone trying to learn three.js with tutorials / guides / videos / courses.

If you get an error in the console that `Geometry` doesn’t exist - that’s pretty straight forward. It doesn’t exist → go to docs → learn about BufferGeometry (or just Google: “why doesn’t Three.Geometry exist?”)

But if you follow some tutorial that uses old `Geometry`, and you use new `Geometry` - then only half of the methods work, the other half doesn’t seem to exist at all, and nothing works as described in the tutorial - it’s mind bending for a beginner, and searching Google / SO for “why doesn’t [this] in Three.Geometry work” will then likely lead to outdated answers about the original `Geometry`.

It’d feel kinda like placing [this](https://gist.github.com/aras-p/6224951#file-preprocessor_fun-h-L33) in a beginners code.

---

<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 14, 2021, 11:52am UTC](https://discourse.threejs.org/t/three-geometry-will-be-removed-from-core-with-r125/22401/13 "2021-01-14T11:52:49Z")

</div>

@Lawrence3DPK Your code will definitely not work with `r125` even if you include `THREE.Geometry` from the examples since raycasting does not support `THREE.Geometry` anymore. So you will have to learn how to work with `BufferGeometry`.

As a small teaser, you iterate through all vertices like so:

```javascript
const positionAttribute = MovingCube.geometry.getAttribute( 'position' );

const localVertex = new THREE.Vector3();
const globalVertex = new THREE.Vector3();

for ( let vertexIndex = 0; vertexIndex < positionAttribute.count; vertexIndex ++ ) {

	localVertex.fromBufferAttribute( positionAttribute, vertexIndex );
	globalVertex.copy( localVertex ).applyMatrix4( MovingCube.matrixWorld );

}

```

Notice that you have no `clone()` operation in your `for` loop anymore which is good for performance. Besides, always use `matrixWorld` if you want to transform something to world space.

---

<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:** [January 14, 2021, 12:02pm UTC](https://discourse.threejs.org/t/three-geometry-will-be-removed-from-core-with-r125/22401/14 "2021-01-14T12:02:30Z")

</div>

@Mugen87  
amazing! thanks for the pointers and clarification, the fact that of course `THREE.Geometry` would be stripped from support of raycasting went completely over my head… i do need to learn how to properly work with `BufferGeometry` and this is the perfect time to do so!

---

<div class="post-metadata">

**Author:** ![mrdoob](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mrdoob/32/22417_2.png) [@mrdoob](https://discourse.threejs.org/u/mrdoob)\
**Post date:** [January 14, 2021, 1:41pm UTC](https://discourse.threejs.org/t/three-geometry-will-be-removed-from-core-with-r125/22401/15 "2021-01-14T13:41:49Z")

</div>

I don’t think we should rename `THREE.BufferGeometry` to `THREE.Geometry`, it would be too confusing.

I suggested introducing `THREE.MeshGeometry`, `THREE.LineGeometry` and `THREE.PointsGeometry` (which would extend `THREE.BufferGeometry`) as a solution for prettifying the API.

---

<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:** [January 14, 2021, 2:20pm UTC](https://discourse.threejs.org/t/three-geometry-will-be-removed-from-core-with-r125/22401/16 "2021-01-14T14:20:43Z")

</div>

@Mugen87 I did try try to implement this exact solution to my collision detections but it failed to detect any collisions…

> [@Mugen87](#):
>
> ```javascript
> const positionAttribute = MovingCube.geometry.getAttribute( 'position' );
> 
> const localVertex = new THREE.Vector3();
> const globalVertex = new THREE.Vector3();
> 
> for ( let vertexIndex = 0; vertexIndex < positionAttribute.count; vertexIndex ++ ) {
> 
> localVertex.fromBufferAttribute( positionAttribute, vertexIndex );
> globalVertex.copy( localVertex ).applyMatrix4( MovingCube.matrixWorld );
> 
> }
> 
> ```

Is there something I am missing 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 14, 2021, 2:42pm UTC](https://discourse.threejs.org/t/three-geometry-will-be-removed-from-core-with-r125/22401/17 "2021-01-14T14:42:56Z")

</div>

The code looks like what I have provided. It’s best if you create a new topic with a live example. We can then debug the code.

---

<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:** [January 14, 2021, 2:47pm UTC](https://discourse.threejs.org/t/three-geometry-will-be-removed-from-core-with-r125/22401/18 "2021-01-14T14:47:42Z")

</div>

@Mugen87  
Yes apologies it is a seperate tangential topic. Will create one

---

<div class="post-metadata">

**Author:** ![titansoftime](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/titansoftime/32/1044_2.png) [@titansoftime](https://discourse.threejs.org/u/titansoftime)\
**Post date:** [January 14, 2021, 7:30pm UTC](https://discourse.threejs.org/t/three-geometry-will-be-removed-from-core-with-r125/22401/19 "2021-01-14T19:30:09Z")

</div>

Does BufferGeometry have an equivalent to Geometry.mergeMesh()?

---

<div class="post-metadata">

**Author:** ![donmccurdy](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/donmccurdy/32/33209_2.png) [@donmccurdy](https://discourse.threejs.org/u/donmccurdy)\
**Post date:** [January 14, 2021, 7:50pm UTC](https://discourse.threejs.org/t/three-geometry-will-be-removed-from-core-with-r125/22401/20 "2021-01-14T19:50:21Z")

</div>

The closest method is `BufferGeometryUtils.mergeBufferGeometries([a, b, c, d, ...])`, but when using it you would need to first apply the world transform of each mesh to its geometry.

[Next page](https://discourse.threejs.org/t/three-geometry-will-be-removed-from-core-with-r125/22401.md?page=2)
