Convert points into circles in 3d model

Anyone know how to convert points into circles of a 3d model?

https://codepen.io/AlainBarrios/pen/YoNooV?editors=0010

Yes. The most straightforward way is to add a few lines in the fragment shader (written from my memory and untested right now, but I hope you get the idea):

if (length(gl_PointCoord.xy-vec2(0.5)) > 0.5) {
    discard;
}
3 Likes

Live example: https://jsfiddle.net/12tb60qx/

It uses the same approach like the official example: https://threejs.org/examples/webgl_points_waves

Here is the verified code:

if ( length( gl_PointCoord - vec2( 0.5, 0.5 ) ) > 0.475 ) discard;
1 Like