#  How to obtain normal vectors:

**URL:** <https://discourse.threejs.org/t/how-to-obtain-normal-vectors/57636>\
**Category:** Questions\
**Tags:** geometry\
**Created:** [November 1, 2023, 8:06am UTC](https://discourse.threejs.org/t/how-to-obtain-normal-vectors/57636 "2023-11-01T08:06:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![DaikiFujiwara22](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/daikifujiwara22/32/41488_2.png) [@DaikiFujiwara22](https://discourse.threejs.org/u/DaikiFujiwara22)\
**Post date:** [November 1, 2023, 8:06am UTC](https://discourse.threejs.org/t/how-to-obtain-normal-vectors/57636/1 "2023-11-01T08:06:05Z")

</div>

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](https://discourse.threejs.org/uploads/short-url/9zkSlZYFf2nrBNJPDf92eUSPq8V.zip) (1.4 MB)

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

```

---

<div class="post-metadata">

**Author:** ![mjurczyk](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mjurczyk/32/10995_2.png) [@mjurczyk](https://discourse.threejs.org/u/mjurczyk)\
**Post date:** [November 1, 2023, 8:09am UTC](https://discourse.threejs.org/t/how-to-obtain-normal-vectors/57636/2 "2023-11-01T08:09:05Z")

</div>

> [@DaikiFujiwara22](#):
>
> `castRay`

Was is das? 👀 Try just [result.normal](https://threejs.org/docs/index.html?q=ray#api/en/core/Raycaster.intersectObject).

---

<div class="post-metadata">

**Author:** ![prisoner849](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/prisoner849/32/535_2.png) [@prisoner849](https://discourse.threejs.org/u/prisoner849)\
**Post date:** [November 1, 2023, 8:25am UTC](https://discourse.threejs.org/t/how-to-obtain-normal-vectors/57636/3 "2023-11-01T08:25:27Z")

</div>

`face` has `normal` too, that computed from face’s vertices.  
The difference is that `result.normal` is [interpolated](https://threejs.org/docs/index.html?q=triangle#api/en/math/Triangle.getInterpolation) one.  
Source: [https://github.com/mrdoob/three.js/blob/4527c3e8498ebdc42e7eb40fcfa90435b9c95514/src/objects/Mesh.js#L395L421](https://github.com/mrdoob/three.js/blob/4527c3e8498ebdc42e7eb40fcfa90435b9c95514/src/objects/Mesh.js#L395L421)

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

---

<div class="post-metadata">

**Author:** ![DaikiFujiwara22](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/daikifujiwara22/32/41488_2.png) [@DaikiFujiwara22](https://discourse.threejs.org/u/DaikiFujiwara22)\
**Post date:** [November 7, 2023, 9:00am UTC](https://discourse.threejs.org/t/how-to-obtain-normal-vectors/57636/4 "2023-11-07T09:00:30Z")

</div>

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](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/6/d/6daffe47624401dd9de711bc58b297743ae779b3.png)

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.

> <https://github.com/IFCjs/components/blob/0a04332c7a81750aefe7a9d75c6d3a60ba2ab522/src/core/SimpleRaycaster/index.ts#L46-L54>
