javascript - Transforming vertex normals in three.js -
i'm having difficulties vertex normals in three.js. (for reference i'm using revision 58.) various reasons i'd first calculate face vertex normals when setup geometry, free transform it, merge , whatnot.
while realize normals depend on vertices transformed when apply matrix, thought geometry.applymatrix able transform them well. however, while following works fine:
geometry.applymatrix(new three.matrix4().makescale(1, -1, 1)); geometry.computefacenormals(); geometry.computevertexnormals();
...the following order of operations yields reversed vertex normals:
geometry.computefacenormals(); geometry.computevertexnormals(); geometry.applymatrix(new three.matrix4().makescale(1, -1, 1));
so i'm wondering, working intended? need first transformations on geometry before calculate vertex normals?
three.js not support reflections in object matrix. setting negative scale factor, reflecting geometry of object.
you free apply such matrix geometry directly, however, of course, doing.
however, result in number of undesirable consequences, 1 of geometry faces no longer have counterclockwise winding order, clockwise. result in reversed face normals calculated geometry.computefacenormals()
.
i advise against doing unless familiar inner-workings of library.
three.js r.58
Comments
Post a Comment