Knive
Knive

Reputation: 81

Three js STL loading

I am trying to load an stl file by just modifying the url of the function load of the loader in this example : http://threejs.org/examples/webgl_loader_stl.html

But I don't know why, it loads and after a certain time the rotation of the scene begins but I can't visualize anything... I tried to put the mesh informations in the console and the mesh does exist, has a geometry, etc.

The STL in itself is quite big (28.2 MB) and comes from CATIA V5.

And loading it in this free online viewer using three.js works : http://www.viewstl.com/

But it doesn't use the STLLoader.js the example uses.

Upvotes: 3

Views: 5139

Answers (1)

i did that :

var loader = new THREE.STLLoader();
				loader.load( 'MY-STL.stl', function ( geometry ) {
					var material = new THREE.MeshPhongMaterial( {
                      ambient: 0xff5533, 
                      color: 0xff5533, 
                      specular: 0x111111,
                      shininess: 200 } 
                                                              
                   );
					var mesh = new THREE.Mesh( geometry, material );
					
					scene.add( mesh );
				} ); 

so you need to define the material and also need to use

Upvotes: 1

Related Questions