diff --git a/src/renderers/shaders/ShaderChunk/common.glsl.js b/src/renderers/shaders/ShaderChunk/common.glsl.js index ad0453e0e2702ca838d97c44b5730ee9c6749fd3..6bfaf5c34ede991fb6ae784d18b2da5d4599c733 100644 --- a/src/renderers/shaders/ShaderChunk/common.glsl.js +++ b/src/renderers/shaders/ShaderChunk/common.glsl.js @@ -106,5 +106,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;