Does converting a Geometry to a BufferGeometry in Three.js increase the number of vertices?

前端 未结 2 1353
走了就别回头了
走了就别回头了 2021-01-22 07:59

I\'ve been using the fromGeometry method to make BufferGeometry objects from regular Geometry objects, and I\'ve found that it seems the number of vertices increases during the

2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-22 08:13

    Lets take the simple case of a BoxGeometry(80,80,80,1,1,1), For the box BufferGeometry we get 36 vertices and for the box Geometry we get 8 vertices. How is this possible? Lets do the math:

    To define a box we only need 8 vertices to define 12 triangles that make up that shape; but for each vertex of the box you have 6 triangles sharing it. Keep in mind that each face of the cube has 2 triangles.

    If you unroll all the triangles of the box Geometry into a box BufferGeometry you have: 6 faces x 2 triangles per face x 3 vertices per triangle x 3 floats per vertex = 108 floats

提交回复
热议问题