molstar icon indicating copy to clipboard operation
molstar copied to clipboard

Investigate non-normalized normals

Open arose opened this issue 4 years ago • 2 comments

Investigate non-normalized normals observed by @sukolsak in #174.

arose avatar May 04 '21 05:05 arose

Hey @sukolsak, not sure if I remember correctly: was there another source of non-normalized normals?

arose avatar Aug 08 '21 20:08 arose

@arose There are two sources that I have found so far:

  • Normals in arrowheads. See #179
  • The add*Cylinder methods. These methods call MeshBuilder.addPrimitive(state, tmpCylinderMat, cylinder), which does this
const n = mat3directionTransform(tmpMat3, t);
...
// normal
v3transformMat3(tmpV, v3fromArray(tmpV, na, i), n);

tmpV is not normalized because of the non-uniform scaling of cylinders.

sukolsak avatar Aug 08 '21 21:08 sukolsak