npm

Need private packages and team management tools?Check out npm Orgs. »

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.

Keywords

none

install

npm i mesh-normals

Downloadsweekly downloads

25

version

1.0.0

license

none

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability