How to obtain normal vectors:

I attempted to perform raycasting on an IFC model using the following method to obtain the faces and their normal vectors of the geometry. However, there are geometries for which I cannot obtain accurate normal vectors.

Is my approach incorrect? What is the correct way to obtain accurate normal vectors?
IFC.zip (1.4 MB)

const result = this.raycaster.castRay(meshes);
const normal = result.face.normal;

Was is das? :eyes: Try just result.normal.

1 Like

face has normal too, that computed from face’s vertices.
The difference is that result.normal is interpolated one.
Source: https://github.com/mrdoob/three.js/blob/4527c3e8498ebdc42e7eb40fcfa90435b9c95514/src/objects/Mesh.js#L395L421

And I’m curious too, what that .castRay() method is/does? :thinking:

1 Like

I’ve examined result.normal, and it appears to be the same as result.face.normal.
I expected to obtain the normal vector of the face as shown in the image,
but it seems that incorrect values are being stored in the result.normal.
image

I’m not sure if this issue is related to the library I’m using or if I might have overlooked something in my code.

Below is the content of the castRay method.