Browse Source

#11270 OBJLoader assigns flat shading if smoothing group is defined as 0 or off. All other values lead to smooth shading

Kai Salmen 8 years ago
parent
commit
bd3eda311e
1 changed files with 12 additions and 1 deletions
  1. 12 1
      examples/js/loaders/OBJLoader.js

+ 12 - 1
examples/js/loaders/OBJLoader.js

@@ -615,7 +615,18 @@ THREE.OBJLoader.prototype = {
 				// Example asset: examples/models/obj/cerberus/Cerberus.obj
 
 				var value = result[ 1 ].trim().toLowerCase();
-				state.object.smooth = ( value === '1' || value === 'on' );
+				/*
+				 * http://paulbourke.net/dataformats/obj/
+				 * or
+				 * http://www.cs.utah.edu/~boulos/cs3505/obj_spec.pdf
+				 *
+				 * From chapter "Grouping" Syntax explanation "s group_number":
+				 * "group_number is the smoothing group number. To turn off smoothing groups, use a value of 0 or off.
+				 * Polygonal elements use group numbers to put elements in different smoothing groups. For free-form
+				 * surfaces, smoothing groups are either turned on or off; there is no difference between values greater
+				 * than 0."
+				 */
+				state.object.smooth = ( value !== '0' && value !== 'off' );
 
 				var material = state.object.currentMaterial();
 				if ( material ) {