Particle Shadows Three.js

Shadowing bug?

by Diogo Slepetys

HTML

<script src="https://rawgit.com/mrdoob/three.js/r85/build/three.min.js"></script>
<body>

  <button id="sunButton">DIRECTIONAL LIGHT</button>
  <button id="pointButton">POINT LIGHT</button>
  <button id="lightsButton">BOTH LIGHTS</button>
  <button id="basicButton">BASIC MATERIAL</button>
  <button id="billButton">BILLBOARD MATERIAL</button>

</body>

JavaScript

//Shaders/////////////////////////////////////////
//Light Billboards//
function ParticlePlaneMaterial( texPath ) {

	this.texPath = texPath;
	var tex = new THREE.TextureLoader().setCrossOrigin("anonymous").load(texPath);
	tex.magFilter = THREE.NearestFilter;
	tex.minFilter = THREE.LinearMipMapLinearFilter;

	var pUniforms= THREE.UniformsUtils.merge([
		THREE.UniformsLib["fog"],
		{
		fog: true, 
		texture: { type: "t", value: null },

		"cameraup": {
		  type: "v3",
		  value:{x: 0, y: 0, z: 0}
		},
		"camerart": {
		  type: "v3",
		  value:{x: 0, y: 0, z: 0}
		},
		"sun": {
			  type: "f",
			  value: null
			},
		"light": {
			  type: "v3",
			  value:{x: 0, y: 0, z: 0}
			}
		},
		]);
	
	pUniforms.texture.value = tex;
	
	return new THREE.ShaderMaterial({
		
		fog: true,
		
		uniforms : pUniforms,	
		
		vertexShader:[
			'varying vec2 vUv;',
			'uniform lowp vec3 light;',
			'uniform lowp vec3 cameraup;',
			'uniform lowp vec3 camerart;',
			'varying lowp float distl;',
			'uniform lowp float sun;',
			'attribute lowp vec3 centers;',
			THREE.ShaderChunk[ "fog_pars_vertex" ],
			
			'void main() {',
				
				'vUv = uv;',				 //zero rotation
				'lowp vec4 c = modelMatrix * 	vec4(0.0,0.0,0.0,1.0) + vec4(centers,1.0);',
				'lowp vec3 centers2 = c.xyz/c.w;',
				
				//billboarding
				'lowp vec3 wolney = position - centers;',
				'lowp vec3 vertexPosition = centers2 + camerart * wolney.x + cameraup * wolney.z;',
				
				'lowp vec3 offsetS = vec3(0.0,0.0,0.0);',
																		
				'lowp vec4 mvPosition = viewMatrix * vec4(vertexPosition+centers2+offsetS, 1.0);',
				'gl_Position = projectionMatrix * mvPosition;',
				
				THREE.ShaderChunk[ "fog_vertex" ],
				
				//lights
				'lowp vec3 lightCenter = vec3(vertexPosition+centers2);',
				'lowp vec2 diff = lightCenter.xz - light.xz;',
				'lowp float mult = dot(diff,diff);',
				'lowp float dist = inversesqrt(mult);',
				
				'dist = 80.0*(dist);',
				'lowp vec4 light = vec4(dist*dist, dist, dist,...