How to ascertain if a vertex is within the camera's field of view (Front View)?

I’ve been trying to determine whether a vertex lies within the camera’s field of view for past couple of days.
Specifically, I want to identify vertices positioned on the visible front side while excluding the backside (backside view) and lateral views (Side Views).

Here’s what I’ve attempted:

Used scene.pickWithRay() function to check if the ray intersects with any other objects in the scene, but it didn’t yield the expected results.
The idea was… If the ray hits something, it means that the vertex is not in the camera’s front view, and if it doesn’t hit anything, the vertex is in the camera’s front view.
However, the method mentioned above proved to be ineffective, as it falsely identified all vertices as hits.

Any help on this issue would be greatly appreciated.

I’m not entirely sure that I understand your goal here.

Are you trying to determine whether or not a vertex is within the frustum of the camera? You can then use isInFrustum(planes) on the vector.

Are you instead trying to determine whether or not another object is in front of the object the vertices belong to? Could you use occlusion culling?

Or are you simply trying to determine whether or not the face belonging to a vertex is facing the camera? You could do some Dot products between the normal of the vertex and the camera direction

2 Likes

I just can’t thank you enough!
This is precisely what I was looking for:

Thanks again! Thanks a lot!

1 Like