Model loading · function

faceNormals

Each face's normal, by the rule Blender uses for its size: two edges of a triangle, the two diagonals of a quad, and Newell's method beyond that.

Explained in Importing models.

function faceNormals(mesh: BlendMeshData): Float64Array
import { faceNormals } from '@driftengine/assets';

Parameters

ParameterTypeDescription
meshBlendMeshData

In depth

Not Newell's method throughout, which is what this was until a real file disagreed: a quad with two coincident corners has no area, so Newell gives it no normal, while its diagonals still cross. And where even they cancel — a quad whose corners coincide in pairs — Blender calls the face's normal straight up rather than zero, and averages that into its smooth neighbours. Both were found on a 2.79 wheel, where one such face moved a vertex normal 0.68 from Blender's.