Bitbybit Docs
    Bereite Suchindex vor...

    Funktion computeVertexNormals

    • Compute smooth vertex normals for a mesh that arrives without them. Accumulates each triangle's cross product onto its three vertices, then normalizes, so a vertex shared by several triangles ends up with their average and the mesh shades smoothly.

      Parameter

      • positions: number[]

        Flat array of vertex positions [x,y,z,x,y,z,...]

      • indices: number[]

        Triangle indices

      Rückgabewert number[]

      Flat array of normals [nx,ny,nz,nx,ny,nz,...]