Browse Source

fix mip levels

sunag 7 years ago
parent
commit
5c7f034998

+ 2 - 1
examples/js/nodes/bsdfs/RoughnessToBlinnExponentNode.js

@@ -27,10 +27,11 @@ RoughnessToBlinnExponentNode.Nodes = (function() {
 		//	float envMapWidth = pow( 2.0, maxMIPLevelScalar );
 		//	float desiredMIPLevel = log2( envMapWidth * sqrt( 3.0 ) ) - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );
 
-		"	float desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );",
+		"	float desiredMIPLevel = maxMIPLevelScalar + 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );",
 
 		// clamp to allowable LOD ranges.
 		"	return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );",
+
 		"}"
 	].join( "\n" ) );
 	

+ 1 - 1
examples/js/nodes/utils/MaxMIPLevelNode.js

@@ -28,7 +28,7 @@ Object.defineProperties( MaxMIPLevelNode.prototype, {
 
 				var image = this.texture.value.image ? this.texture.value.image[0] : undefined;
 
-				this.maxMIPLevel = image !== undefined ? ( Math.log( Math.max( image.width, image.height ) ) + 1 ) * Math.LOG2E : 0;
+				this.maxMIPLevel = image !== undefined ? Math.log( Math.max( image.width, image.height ) ) * Math.LOG2E : 0;
 
 			}