Преглед на файлове

Fixes size attenuation calculation for GL points

The calculation for perspective-based size attenuation of GL points was wrong; the scale should be entirely based on distance in the z-axis relative to the camera. This change makes points fit perfectly with identical quads in the same scene (where previously the point size would nonsensically shrink towards the sides of the image). A comparison can be seen here: http://imgur.com/a/G3sJ7
omgitsraven преди 10 години
родител
ревизия
7a881cd843
променени са 1 файла, в които са добавени 1 реда и са изтрити 1 реда
  1. 1 1
      src/renderers/shaders/ShaderLib.js

+ 1 - 1
src/renderers/shaders/ShaderLib.js

@@ -601,7 +601,7 @@ THREE.ShaderLib = {
 			"	vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",
 
 			"	#ifdef USE_SIZEATTENUATION",
-			"		gl_PointSize = size * ( scale / length( mvPosition.xyz ) );",
+			"		gl_PointSize = size * ( scale / -mvPosition.z );",
 			"	#else",
 			"		gl_PointSize = size;",
 			"	#endif",