File tree Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -361,10 +361,26 @@ document.addEventListener(
361361 "color" ,
362362 new THREE . BufferAttribute ( prtl_colors , 3 ) ,
363363 ) ;
364- const material = new THREE . PointsMaterial ( {
365- sizeAttenuation : true ,
366- size : 0.2 ,
367- vertexColors : true ,
364+ const material = new THREE . ShaderMaterial ( {
365+ depthWrite : false ,
366+ transparent : true ,
367+ vertexShader : `
368+ attribute vec3 color;
369+ varying vec3 vColor;
370+ void main() {
371+ vColor = color;
372+ vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
373+ gl_PointSize = 100.0 / -mvPosition.z;
374+ gl_Position = projectionMatrix * mvPosition;
375+ }
376+ ` ,
377+ fragmentShader : `
378+ varying vec3 vColor;
379+ void main() {
380+ float dist = distance(gl_PointCoord, vec2(0.5, 0.5));
381+ gl_FragColor = vec4(vColor, step(dist, 0.5));
382+ }
383+ ` ,
368384 } ) ;
369385 const mesh = new THREE . Points ( prtl_geometry , material ) ;
370386 scene . add ( mesh ) ;
You can’t perform that action at this time.
0 commit comments