This question already has an answer here:
I am trying to figure out how to get the 2D screen coordinates for a 3D point.
I am using three.js to generate some snowflakes that fall slowly down the screen. I originally wrote the script just as a 2d canvas animation and added mouse interaction so you could blow the snow around with mouse movement. It worked well, but when switching to webgl the snowflakes were now represented as 3D points and getting the distance of the mouse to each particle makes particles further from the center of the screen behave in an undesired way because of the perspective.
What you need to do is to transform your worldPos vec3 by the viewProjection matrix and then perform the perspective divide. This brings it to NDC space where (-1,-1,x) = bottom left of your screen and (+1,+1,x) = upper right of your screen. Adjust this by your screen width and screen height and you have the coordinate in screen space.
In code, this is what it looks like:
Btw this is what essentially what the GPU is doing under the hood to render stuff, minus the NDC to screen coordinate conversion.
Check the THREE Vector3 methods, very likely it is implemented there, or just use the code snippet above.