mesh-normals

1.0.0 • Public • Published

mesh-normals experimental

Given a list of vertices and faces, generate the normals for a triangle mesh.

Geared more towards "soft" low-poly normals, as you can't use indexed draw calls with the resulting normals. If you're just planning on straight smooth vertex normals, use the normals module. If you want low-poly and only have a "triangle soup" mesh, face-normals will still work for you.

view demo

Installation

mesh-normals

Usage

normals(cells, positions, flatness, [output])

cells is an indexed list of faces. Each face should be three elements long, one element per point.

positions is a list of vertex positions.

flatness is a value between 0 and 1, where 0 will return results only from the vertex normals and 1 will return results only from the face normals. 0.5 will be the middle ground between them.

Optionally, you can pass in an array-like output object to set the values directly. If not, a Float32Array will be created for you - either way, the new/updated array will be returned.

Readme

Keywords

none

Package Sidebar

Install

npm i mesh-normals

Weekly Downloads

8

Version

1.0.0

License

MIT

Last publish

Collaborators

  • hughsk