Reputation: 65
In the example Interactive Raycasting Points there are 4 different functions to generate the point cloud:
1. generatePointcloud (with buffer geometry)
2. generateIndexedPointcloud (buffer geometry with indices)
3. generateIndexedWithOffsetPointcloud (buffer geometry with added drawcall)
4. generateRegularPointcloud (with normal geometry)
Could someone explain what the difference is between these 4 types, and if there are any performance benefits/certain situations where one is suited more than the others?
Thanks!
Upvotes: 3
Views: 922
Reputation: 104843
The purpose of the example Interactive Raycasting Points is to demonstrate that raycasting against THREE.Points
works for a variety of geometry types.
So-called "regular geometry", THREE.Geometry
, is the least memory-efficient geometry type, and in general, has longer load times than THREE.BufferGeometry
.
BufferGeometry
can be "indexed" or "non-indexed". Indexed BufferGeometry
, when used with meshes, allows for vertices to be reused; that is, faces that share an edge can share a vertex. In the case of point clouds, however, I do not see a benefit to the "indexed" type.
BufferGeometry
with draw calls -- now called groups -- allows for only a subset of the geometry to be rendered, and also allows for a different material index to be associated with each group.
The function generateIndexedWithOffsetPointcloud
appears to have been named when draw calls, a.k.a. groups, were called "offsets".
I do not believe raycasting in three.js honors groups. I believe it raycasts against the entire geometry. In fact, I am not sure groups are working correctly at all in the example you reference.
three.js r.73
Upvotes: 3