Reputation: 44356
As I understood using buffer geometries will increase performance and decrease memory usage because it reduces the cost of passing all this data to the GPU.
And as I understood from @WestLangley his post here:
THREE.BufferGeometry
is slowly replacingTHREE.Geometry
as it is computationally more efficient.
I am currently using three.js - r72.
When I draw my geometries make meshes and add them to the scene I see that there are two properties inside my geomtries __directGeometry
and _bufferGeometry
.
Here in a THREE.BoxGeometry
:
Here in a THREE.Geometry
:
Here in a THREE.ShapeGeometry
:
My questions:
THREE.DirectGeometry
and what does it do? (I cannot seem to find any documentation on this)THREE.BufferGeometry
stored in _bufferGeometry
already automatically used? If not, can I simply use it instead of my geometry to boost performance?THREE.BufferGeometry
has toGeometry
and THREE.Geometry
has toBufferGeometry
. If I convert all my normal geometries to buffer geometries using this method, will it give me the same performance increase compared to drawing them as a THREE.BufferGeometry
from the start?THREE.BufferGeometry
?THREE.Geometry
in favor of THREE.BufferGeometry
?NOTE: I couldn't find detailed information on when and how to use buffer geometries or when it is going to be replacing THREE.Geometry
. But if someone has a good source or reference please leave a comment.
Upvotes: 10
Views: 2633
Reputation: 104793
__directGeometry
is an internal data structure used to transition between THREE.Geometry
and THREE.BufferGeometry
. Do not mess with it.THREE.BufferGeometry.toGeometry()
and THREE.Geometry.toBufferGeometry()
are convenience methods. The first one is helpful if your model loads as BufferGeometry
and you feel more comfortable manipulating Geometry
. If you want answers regarding performance, you need to do a test. Buffer geometries definitely load faster.BufferGeometry
. It would be wise if you understood the difference between "indexed" and "non-indexed" BufferGeometry
. BufferGeometry
with the index
attribute defined allows for the sharing of vertices. Non-Indexed BufferGeometry
is what we call "triangle soup".THREE.Geometry
will remain for the foreseeable future.three.js r.73
Upvotes: 9