Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/api/materials/PointsMaterial.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ <h3>[property:Number size]</h3>
<p>Sets the size of the points. Default is 1.0.</p>

<h3>[property:Boolean sizeAttenuation]</h3>
<p>Specify whether points' size will get smaller with the distance. Default is true.</p>
<p>Specify whether points' size is attenuated by the camera depth. (Perspective camera only.) Default is true.</p>


<h2>Methods</h2>

Expand Down
10 changes: 7 additions & 3 deletions src/renderers/shaders/ShaderLib/points_vert.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@ void main() {
#include <morphtarget_vertex>
#include <project_vertex>

gl_PointSize = size;

#ifdef USE_SIZEATTENUATION
gl_PointSize = size * ( scale / - mvPosition.z );
#else
gl_PointSize = size;

bool isPerspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 );

if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );

#endif

#include <logdepthbuf_vertex>
Expand Down