diff --git a/src/renderers/shaders/ShaderChunk/common.glsl.js b/src/renderers/shaders/ShaderChunk/common.glsl.js index ef81e9a7c918e89cdc38c374204b1be75d3b46c5..506a7b21adab6fa510f9071b1ccbf98f1c4b1469 100644 --- a/src/renderers/shaders/ShaderChunk/common.glsl.js +++ b/src/renderers/shaders/ShaderChunk/common.glsl.js @@ -109,5 +109,11 @@ float linearToRelativeLuminance( const in vec3 color ) { return dot( weights, color.rgb ); +} + +bool isPerspectiveMatrix( mat4 projectionMatrix ) { + + return projectionMatrix[ 2 ][ 3 ] == - 1.0; + } `; diff --git a/src/renderers/shaders/ShaderLib/points_vert.glsl.js b/src/renderers/shaders/ShaderLib/points_vert.glsl.js index 58240755c75e56d9cd30587b01324ce3e911ebb4..b5bb3598f53d44d2ca4ad594a8f756eb0d7a8201 100644 --- a/src/renderers/shaders/ShaderLib/points_vert.glsl.js +++ b/src/renderers/shaders/ShaderLib/points_vert.glsl.js @@ -20,7 +20,7 @@ void main() { #ifdef USE_SIZEATTENUATION - bool isPerspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); diff --git a/src/renderers/shaders/ShaderLib/sprite_vert.glsl.js b/src/renderers/shaders/ShaderLib/sprite_vert.glsl.js index bffda7c897ebf2093365173d83861250d4fa4e94..604a694afeff6e5049c247fd0c1846005685358b 100644 --- a/src/renderers/shaders/ShaderLib/sprite_vert.glsl.js +++ b/src/renderers/shaders/ShaderLib/sprite_vert.glsl.js @@ -20,7 +20,7 @@ void main() { #ifndef USE_SIZEATTENUATION - bool isPerspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); if ( isPerspective ) scale *= - mvPosition.z;