Way to hide Points if geometry is seen from backside?

Is there a way to hide Points if geometry faces are seen from backside?
I am using:
points = new THREE.Points( Geometry, Material );
However, there is no option to limit the points from displaying from only one side of the polygon.
With normal models, the texture becomes invisible from the backside. but with points, they are visible from any angle even if the geometry polygons face away from the camera. I am using the points to represent the vertices of a model, and am interested in hiding the Points when the geometry of the model is not visible.
I can’t find any options to enable this with Points, and am wondering if I am overlooking something. Is there a way to accomplish this?
backside

Just from the scratch.
Is this what you’re looking for? https://codepen.io/prisoner849/pen/yLYOYmE?editors=0010

1 Like

I don’t think that’s what I’m looking for. It’s not a clipping issue, but rather whether the polygon face that the points belong to are visible or not. I’m assuming there’s no option on the material to enable this. So I may just have to calculate each vertex normal and determing whether it points towards or away from the camera and then hide or show the point… but I guess then I would need to figure out how to hide one irrespective of another.

Have you seen those lines in the codepen?

var geometry = new THREE.SphereBufferGeometry( 10, 36, 18 );
//var geometry = new THREE.PlaneBufferGeometry(20, 20, 20, 20);

Have you tried to change geometry to see the result with a plane?

Can you explain how it works?
What if I need to enable/disable it during runtime? Does it effect any of the normal functionality of Points?

Use a uniform to pass the data in shaders.

It just extends/adds some functionality to the existing shader, keeping the rest of functionalities intact.

thanks, i’ll experiment with this.

Seems you’re looking for this: https://codepen.io/prisoner849/pen/gOaMXMy?editors=0010

    vec3 vNormal = normalMatrix * normal;
    vVisible = step( 0., dot( -normalize( mvPosition.xyz ), normalize( vNormal ) ) );

2 Likes