Hamish Todd
Hamish Todd

Reputation: 213

Threejs - how much do you gain from using buffergeometries?

So I'm pretty much fine using either BufferGeometry or Geometry, I'm used to both at this point. I'm even used to using BufferGeometry in places where I have to modify things a lot - the code is more verbose, but not too much so.

So are there any guidelines that can be given on when to use which?

Upvotes: 0

Views: 92

Answers (1)

WestLangley
WestLangley

Reputation: 104763

Many of the loaders in three.js are being modified to return BufferGeometry instead of Geometry. This is because the loading is faster, and BufferGeometry is more memory efficient.

BufferGeometry stores the data in a format that is easy to pass to the GPU. Geometry stores the data in a format that, in some regards, is more user-friendly. Geometrycan be more convenient if you need to manipulate the geometry programatically.

three.js provides methods to convert between Geometry and BufferGeometry, so you can use either.

How much you gain in speed, or save in reduced memory usage, is use-case-specific.

Become familiar with both data structures, and you will be able to decide for yourself which one is best for your application.

three.js r.75

Upvotes: 1

Related Questions