Browse Source

Merge branch 'dev' of https://github.com/mrdoob/three.js into dev

Mr.doob 10 years ago
parent
commit
945f99a6bd

+ 3 - 9
examples/js/ShaderSkin.js

@@ -197,9 +197,7 @@ THREE.ShaderSkin = {
 
 					"for ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {",
 
-						"vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );",
-
-						"vec3 lVector = lPosition.xyz + vViewPosition.xyz;",
+						"vec3 lVector = pointLightPosition[ i ] + vViewPosition.xyz;",
 
 						"float attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[i] );",
 
@@ -628,9 +626,7 @@ THREE.ShaderSkin = {
 
 					"for( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {",
 
-						"vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );",
-
-						"vec3 lVector = lPosition.xyz - mvPosition.xyz;",
+						"vec3 lVector = pointLightPosition[ i ] - mvPosition.xyz;",
 
 						"float attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[i] );",
 
@@ -717,9 +713,7 @@ THREE.ShaderSkin = {
 
 					"for( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {",
 
-						"vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );",
-
-						"vec3 lVector = lPosition.xyz - mvPosition.xyz;",
+						"vec3 lVector = pointLightPosition[ i ] - mvPosition.xyz;",
 
 						"float attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[i] );",
 

+ 3 - 4
examples/js/ShaderTerrain.js

@@ -168,8 +168,7 @@ THREE.ShaderTerrain = {
 
 					"for ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {",
 
-						"vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );",
-						"vec3 lVector = lPosition.xyz + vViewPosition.xyz;",
+						"vec3 lVector = pointLightPosition[ i ] + vViewPosition.xyz;",
 
 						"float attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[i] );",
 
@@ -198,7 +197,7 @@ THREE.ShaderTerrain = {
 
 					"for( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {",
 
-						"vec3 dirVector = transformDirection( directionalLightDirection[ i ], viewMatrix );",
+						"vec3 dirVector = directionalLightDirection[ i ];",
 						"vec3 dirHalfVector = normalize( dirVector + viewPosition );",
 
 						"float dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );",
@@ -222,7 +221,7 @@ THREE.ShaderTerrain = {
 
 					"for( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {",
 
-						"vec3 lVector = transformDirection( hemisphereLightDirection[ i ], viewMatrix );",
+						"vec3 lVector = hemisphereLightDirection[ i ];",
 
 						// diffuse
 

+ 149 - 36
examples/js/controls/OrbitControls.js

@@ -35,9 +35,10 @@
 		this.minAzimuthAngle = - Infinity; // radians
 		this.maxAzimuthAngle = Infinity; // radians
 
-		// Set to true to disable damping (inertia)
-		this.staticMoving = false;
-		this.dynamicDampingFactor = 0.2;
+		// Set to true to enable damping (inertia)
+		// If damping is enabled, you must call controls.update() in your animation loop
+		this.enableDamping = false;
+		this.dampingFactor = 0.25;
 
 		////////////
 		// internals
@@ -253,15 +254,15 @@
 
 				this.object.lookAt( this.target );
 
-				if ( this.staticMoving ) {
+				if ( this.enableDamping === true ) {
 
-					thetaDelta = 0;
-					phiDelta = 0;
+					thetaDelta *= ( 1 - this.dampingFactor );
+					phiDelta *= ( 1 - this.dampingFactor );
 
 				} else {
 
-					thetaDelta *= ( 1 - this.dynamicDampingFactor );
-					phiDelta *= ( 1 - this.dynamicDampingFactor );
+					thetaDelta = 0;
+					phiDelta = 0;
 
 				}
 
@@ -321,13 +322,13 @@
 
 		this.getPolarAngle = function () {
 
-			return constraint.phi;
+			return constraint.getPolarAngle();
 
 		};
 
 		this.getAzimuthalAngle = function () {
 
-			return constraint.theta;
+			return constraint.getAzimuthalAngle();
 
 		};
 
@@ -338,24 +339,26 @@
 		this.center = this.target;
 
 		// This option actually enables dollying in and out; left as "zoom" for
-		// backwards compatibility
-		this.noZoom = false;
+		// backwards compatibility.
+		// Set to false to disable zooming
+		this.enableZoom = true;
 		this.zoomSpeed = 1.0;
 
-		// Set to true to disable this control
-		this.noRotate = false;
+		// Set to false to disable rotating
+		this.enableRotate = true;
 		this.rotateSpeed = 1.0;
 
-		// Set to true to disable this control
-		this.noPan = false;
+		// Set to false to disable panning
+		this.enablePan = true;
 		this.keyPanSpeed = 7.0;	// pixels moved per arrow key push
 
 		// Set to true to automatically rotate around the target
+		// If auto-rotate is enabled, you must call controls.update() in your animation loop
 		this.autoRotate = false;
 		this.autoRotateSpeed = 2.0; // 30 seconds per round when fps is 60
 
-		// Set to true to disable use of the keys
-		this.noKeys = false;
+		// Set to false to disable use of the keys
+		this.enableKeys = true;
 
 		// The four arrow keys
 		this.keys = { LEFT: 37, UP: 38, RIGHT: 39, BOTTOM: 40 };
@@ -457,7 +460,7 @@
 
 			if ( event.button === scope.mouseButtons.ORBIT ) {
 
-				if ( scope.noRotate === true ) return;
+				if ( scope.enableRotate === false ) return;
 
 				state = STATE.ROTATE;
 
@@ -465,7 +468,7 @@
 
 			} else if ( event.button === scope.mouseButtons.ZOOM ) {
 
-				if ( scope.noZoom === true ) return;
+				if ( scope.enableZoom === false ) return;
 
 				state = STATE.DOLLY;
 
@@ -473,7 +476,7 @@
 
 			} else if ( event.button === scope.mouseButtons.PAN ) {
 
-				if ( scope.noPan === true ) return;
+				if ( scope.enablePan === false ) return;
 
 				state = STATE.PAN;
 
@@ -501,7 +504,7 @@
 
 			if ( state === STATE.ROTATE ) {
 
-				if ( scope.noRotate === true ) return;
+				if ( scope.enableRotate === false ) return;
 
 				rotateEnd.set( event.clientX, event.clientY );
 				rotateDelta.subVectors( rotateEnd, rotateStart );
@@ -516,7 +519,7 @@
 
 			} else if ( state === STATE.DOLLY ) {
 
-				if ( scope.noZoom === true ) return;
+				if ( scope.enableZoom === false ) return;
 
 				dollyEnd.set( event.clientX, event.clientY );
 				dollyDelta.subVectors( dollyEnd, dollyStart );
@@ -535,7 +538,7 @@
 
 			} else if ( state === STATE.PAN ) {
 
-				if ( scope.noPan === true ) return;
+				if ( scope.enablePan === false ) return;
 
 				panEnd.set( event.clientX, event.clientY );
 				panDelta.subVectors( panEnd, panStart );
@@ -563,7 +566,7 @@
 
 		function onMouseWheel( event ) {
 
-			if ( scope.enabled === false || scope.noZoom === true || state !== STATE.NONE ) return;
+			if ( scope.enabled === false || scope.enableZoom === false || state !== STATE.NONE ) return;
 
 			event.preventDefault();
 			event.stopPropagation();
@@ -602,7 +605,7 @@
 
 		function onKeyDown( event ) {
 
-			if ( scope.enabled === false || scope.noKeys === true || scope.noPan === true ) return;
+			if ( scope.enabled === false || scope.enableKeys === false || scope.enablePan === false ) return;
 
 			switch ( event.keyCode ) {
 
@@ -638,7 +641,7 @@
 
 				case 1:	// one-fingered touch: rotate
 
-					if ( scope.noRotate === true ) return;
+					if ( scope.enableRotate === false ) return;
 
 					state = STATE.TOUCH_ROTATE;
 
@@ -647,7 +650,7 @@
 
 				case 2:	// two-fingered touch: dolly
 
-					if ( scope.noZoom === true ) return;
+					if ( scope.enableZoom === false ) return;
 
 					state = STATE.TOUCH_DOLLY;
 
@@ -659,7 +662,7 @@
 
 				case 3: // three-fingered touch: pan
 
-					if ( scope.noPan === true ) return;
+					if ( scope.enablePan === false ) return;
 
 					state = STATE.TOUCH_PAN;
 
@@ -689,7 +692,7 @@
 
 				case 1: // one-fingered touch: rotate
 
-					if ( scope.noRotate === true ) return;
+					if ( scope.enableRotate === false ) return;
 					if ( state !== STATE.TOUCH_ROTATE ) return;
 
 					rotateEnd.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY );
@@ -707,7 +710,7 @@
 
 				case 2: // two-fingered touch: dolly
 
-					if ( scope.noZoom === true ) return;
+					if ( scope.enableZoom === false ) return;
 					if ( state !== STATE.TOUCH_DOLLY ) return;
 
 					var dx = event.touches[ 0 ].pageX - event.touches[ 1 ].pageX;
@@ -734,7 +737,7 @@
 
 				case 3: // three-fingered touch: pan
 
-					if ( scope.noPan === true ) return;
+					if ( scope.enablePan === false ) return;
 					if ( state !== STATE.TOUCH_PAN ) return;
 
 					panEnd.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY );
@@ -965,17 +968,125 @@
 
 		},
 
+		enableDamping : {
+
+			get: function () {
+
+				return this.constraint.enableDamping;
+
+			},
+
+			set: function ( value ) {
+
+				this.constraint.enableDamping = value;
+
+			}
+
+		},
+
+		dampingFactor : {
+
+			get: function () {
+
+				return this.constraint.dampingFactor;
+
+			},
+
+			set: function ( value ) {
+
+				this.constraint.dampingFactor = value;
+
+			}
+
+		},
+
+		// backward compatibility
+
+		noZoom: {
+
+			get: function () {
+
+				console.warn( 'THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead.' );
+				return ! this.enableZoom;
+
+			},
+
+			set: function ( value ) {
+
+				console.warn( 'THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead.' );
+				this.enableZoom = ! value;
+
+			}
+
+		},
+
+		noRotate: {
+
+			get: function () {
+
+				console.warn( 'THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead.' );
+				return ! this.enableRotate;
+
+			},
+
+			set: function ( value ) {
+
+				console.warn( 'THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead.' );
+				this.enableRotate = ! value;
+
+			}
+
+		},
+
+		noPan: {
+
+			get: function () {
+
+				console.warn( 'THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead.' );
+				return ! this.enablePan;
+
+			},
+
+			set: function ( value ) {
+
+				console.warn( 'THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead.' );
+				this.enablePan = ! value;
+
+			}
+
+		},
+
+		noKeys: {
+
+			get: function () {
+
+				console.warn( 'THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead.' );
+				return ! this.enableKeys;
+
+			},
+
+			set: function ( value ) {
+
+				console.warn( 'THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead.' );
+				this.enableKeys = ! value;
+
+			}
+
+		},
+
 		staticMoving : {
 
 			get: function () {
 
-				return this.constraint.staticMoving;
+				console.warn( 'THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead.' );
+				return ! this.constraint.enableDamping;
 
 			},
 
 			set: function ( value ) {
 
-				this.constraint.staticMoving = value;
+				console.warn( 'THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead.' );
+				this.constraint.enableDamping = ! value;
 
 			}
 
@@ -985,13 +1096,15 @@
 
 			get: function () {
 
-				return this.constraint.dynamicDampingFactor;
+				console.warn( 'THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead.' );
+				return this.constraint.dampingFactor;
 
 			},
 
 			set: function ( value ) {
 
-				this.constraint.dynamicDampingFactor = value;
+				console.warn( 'THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead.' );
+				this.constraint.dampingFactor = value;
 
 			}
 

+ 5 - 9
examples/js/shaders/NormalDisplacementShader.js

@@ -186,8 +186,7 @@ THREE.NormalDisplacementShader = {
 
 		"		for ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {",
 
-		"			vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );",
-		"			vec3 pointVector = lPosition.xyz + vViewPosition.xyz;",
+		"			vec3 pointVector = pointLightPosition[ i ] + vViewPosition.xyz;",
 
 		"			float pointDistance = 1.0;",
 		"			if ( pointLightDistance[ i ] > 0.0 )",
@@ -222,8 +221,7 @@ THREE.NormalDisplacementShader = {
 
 		"		for ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {",
 
-		"			vec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );",
-		"			vec3 spotVector = lPosition.xyz + vViewPosition.xyz;",
+		"			vec3 spotVector = spotLightPosition[ i ] + vViewPosition.xyz;",
 
 		"			float spotDistance = 1.0;",
 		"			if ( spotLightDistance[ i ] > 0.0 )",
@@ -231,7 +229,7 @@ THREE.NormalDisplacementShader = {
 
 		"			spotVector = normalize( spotVector );",
 
-		"			float spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - vWorldPosition ) );",
+		"			float spotEffect = dot( spotLightDirection[ i ], spotVector );",
 
 		"			if ( spotEffect > spotLightAngleCos[ i ] ) {",
 
@@ -267,8 +265,7 @@ THREE.NormalDisplacementShader = {
 
 		"		for( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {",
 
-		"			vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );",
-		"			vec3 dirVector = normalize( lDirection.xyz );",
+		"			vec3 dirVector = directionalLightDirection[ i ];",
 
 					// diffuse
 
@@ -297,8 +294,7 @@ THREE.NormalDisplacementShader = {
 
 		"		for( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {",
 
-		"			vec4 lDirection = viewMatrix * vec4( hemisphereLightDirection[ i ], 0.0 );",
-		"			vec3 lVector = normalize( lDirection.xyz );",
+		"			vec3 lVector = hemisphereLightDirection[ i ];",
 
 					// diffuse
 

+ 5 - 4
examples/misc_controls_orbit.html

@@ -72,9 +72,10 @@
 				camera.position.z = 500;
 
 				controls = new THREE.OrbitControls( camera, renderer.domElement );
-				//controls.addEventListener( 'change', render ); // only add this if there is no animation loop and no damping
-				controls.dynamicDampingFactor = 0.2;
-				controls.noZoom = true;
+				//controls.addEventListener( 'change', render ); // add this only if there is no animation loop (requestAnimationFrame)
+				controls.enableDamping = true;
+				controls.dampingFactor = 0.25;
+				controls.enableZoom = false;
 
 				// world
 
@@ -133,7 +134,7 @@
 
 				requestAnimationFrame( animate );
 
-				controls.update(); // required if there is damping or if autoRotate = true
+				controls.update(); // required if controls.enableDamping = true, or if controls.autoRotate = true
 
 				stats.update();
 

+ 12 - 8
src/renderers/WebGLRenderer.js

@@ -1852,7 +1852,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 				if ( _lightsNeedUpdate ) {
 
 					refreshLights = true;
-					setupLights( lights );
+					setupLights( lights, camera );
 					_lightsNeedUpdate = false;
 
 				}
@@ -2558,7 +2558,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	}
 
-	function setupLights ( lights ) {
+	function setupLights ( lights, camera ) {
 
 		var l, ll, light,
 		r = 0, g = 0, b = 0,
@@ -2568,6 +2568,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		zlights = _lights,
 
+		viewMatrix = camera.matrixWorldInverse,
+
 		dirColors = zlights.directional.colors,
 		dirPositions = zlights.directional.positions,
 
@@ -2630,7 +2632,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 				_direction.setFromMatrixPosition( light.matrixWorld );
 				_vector3.setFromMatrixPosition( light.target.matrixWorld );
 				_direction.sub( _vector3 );
-				_direction.normalize();
+				_direction.transformDirection( viewMatrix );
 
 				dirOffset = dirLength * 3;
 
@@ -2653,6 +2655,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 				setColorLinear( pointColors, pointOffset, color, intensity );
 
 				_vector3.setFromMatrixPosition( light.matrixWorld );
+				_vector3.applyMatrix4( viewMatrix );
 
 				pointPositions[ pointOffset + 0 ] = _vector3.x;
 				pointPositions[ pointOffset + 1 ] = _vector3.y;
@@ -2675,16 +2678,17 @@ THREE.WebGLRenderer = function ( parameters ) {
 				setColorLinear( spotColors, spotOffset, color, intensity );
 
 				_direction.setFromMatrixPosition( light.matrixWorld );
+				_vector3.copy( _direction ).applyMatrix4( viewMatrix );
 
-				spotPositions[ spotOffset + 0 ] = _direction.x;
-				spotPositions[ spotOffset + 1 ] = _direction.y;
-				spotPositions[ spotOffset + 2 ] = _direction.z;
+				spotPositions[ spotOffset + 0 ] = _vector3.x;
+				spotPositions[ spotOffset + 1 ] = _vector3.y;
+				spotPositions[ spotOffset + 2 ] = _vector3.z;
 
 				spotDistances[ spotLength ] = distance;
 
 				_vector3.setFromMatrixPosition( light.target.matrixWorld );
 				_direction.sub( _vector3 );
-				_direction.normalize();
+				_direction.transformDirection( viewMatrix );
 
 				spotDirections[ spotOffset + 0 ] = _direction.x;
 				spotDirections[ spotOffset + 1 ] = _direction.y;
@@ -2703,7 +2707,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 				if ( ! light.visible ) continue;
 
 				_direction.setFromMatrixPosition( light.matrixWorld );
-				_direction.normalize();
+				_direction.transformDirection( viewMatrix );
 
 				hemiOffset = hemiLength * 3;
 

+ 7 - 1
src/renderers/shaders/ShaderChunk/common.glsl

@@ -54,7 +54,13 @@ float calcLightAttenuation( float lightDistance, float cutoffDistance, float dec
 
 vec3 F_Schlick( in vec3 specularColor, in float dotLH ) {
 
-	return ( 1.0 - specularColor ) * pow( 1.0 - dotLH, 5.0 ) + specularColor;
+	// Original approximation by Christophe Schlick '94
+	//;float fresnel = pow( 1.0 - dotLH, 5.0 );
+
+	// Optimized variant (presented by Epic at SIGGRAPH '13)
+	float fresnel = exp2( ( -5.55437 * dotLH - 6.98316 ) * dotLH );
+
+	return ( 1.0 - specularColor ) * fresnel + specularColor;
 
 }
 

+ 5 - 7
src/renderers/shaders/ShaderChunk/lights_lambert_vertex.glsl

@@ -14,8 +14,7 @@ vec3 normal = normalize( transformedNormal );
 
 		vec3 lightColor = pointLightColor[ i ];
 
-		vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );
-		vec3 lVector = lPosition.xyz - mvPosition.xyz;
+		vec3 lVector = pointLightPosition[ i ] - mvPosition.xyz;
 		vec3 lightDir = normalize( lVector );
 
 		// attenuation
@@ -45,11 +44,10 @@ vec3 normal = normalize( transformedNormal );
 		vec3 lightColor = spotLightColor[ i ];
 
 		vec3 lightPosition = spotLightPosition[ i ];
-		vec4 lPosition = viewMatrix * vec4( lightPosition, 1.0 );
-		vec3 lVector = lPosition.xyz - mvPosition.xyz;
+		vec3 lVector = lightPosition - mvPosition.xyz;
 		vec3 lightDir = normalize( lVector );
 
-		float spotEffect = dot( spotLightDirection[ i ], normalize( lightPosition - worldPosition.xyz ) );
+		float spotEffect = dot( spotLightDirection[ i ], lightDir );
 
 		if ( spotEffect > spotLightAngleCos[ i ] ) {
 
@@ -85,7 +83,7 @@ vec3 normal = normalize( transformedNormal );
 
 		vec3 lightColor = directionalLightColor[ i ];
 
-		vec3 lightDir = transformDirection( directionalLightDirection[ i ], viewMatrix );
+		vec3 lightDir = directionalLightDirection[ i ];
 
 		// diffuse
 
@@ -107,7 +105,7 @@ vec3 normal = normalize( transformedNormal );
 
 	for ( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {
 
-		vec3 lightDir = transformDirection( hemisphereLightDirection[ i ], viewMatrix );
+		vec3 lightDir = hemisphereLightDirection[ i ];
 
 		// diffuse
 

+ 5 - 7
src/renderers/shaders/ShaderChunk/lights_phong_fragment.glsl

@@ -38,8 +38,7 @@ vec3 totalSpecularLight = vec3( 0.0 );
 		vec3 lightColor = pointLightColor[ i ];
 
 		vec3 lightPosition = pointLightPosition[ i ];
-		vec4 lPosition = viewMatrix * vec4( lightPosition, 1.0 );
-		vec3 lVector = lPosition.xyz + vViewPosition.xyz;
+		vec3 lVector = lightPosition + vViewPosition.xyz;
 		vec3 lightDir = normalize( lVector );
 
 		// attenuation
@@ -70,11 +69,10 @@ vec3 totalSpecularLight = vec3( 0.0 );
 		vec3 lightColor = spotLightColor[ i ];
 
 		vec3 lightPosition = spotLightPosition[ i ];
-		vec4 lPosition = viewMatrix * vec4( lightPosition, 1.0 );
-		vec3 lVector = lPosition.xyz + vViewPosition.xyz;
+		vec3 lVector = lightPosition + vViewPosition.xyz;
 		vec3 lightDir = normalize( lVector );
 
-		float spotEffect = dot( spotLightDirection[ i ], normalize( lightPosition - vWorldPosition ) );
+		float spotEffect = dot( spotLightDirection[ i ], lightDir );
 
 		if ( spotEffect > spotLightAngleCos[ i ] ) {
 
@@ -110,7 +108,7 @@ vec3 totalSpecularLight = vec3( 0.0 );
 
 		vec3 lightColor = directionalLightColor[ i ];
 
-		vec3 lightDir = transformDirection( directionalLightDirection[ i ], viewMatrix );
+		vec3 lightDir = directionalLightDirection[ i ];
 
 		// diffuse
 
@@ -132,7 +130,7 @@ vec3 totalSpecularLight = vec3( 0.0 );
 
 	for( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {
 
-		vec3 lightDir = transformDirection( hemisphereLightDirection[ i ], viewMatrix );
+		vec3 lightDir = hemisphereLightDirection[ i ];
 
 		// diffuse