How to add a 3D model in my scene?

Hello:
I got a “floating island” in a free web page for 3D models.
I see 3 files:

Set of Floating Islands.fbx
Set of Floating Islands.obj
Set of Floating Islands.stl

and a - UV Island.png

In the treejs talks about a : loader.load( 'path/to/model.glb', function ( gltf )

so I have no idea what to do: glb, obj, stl, fbx — what’s going on?

is there a simple way to just put a 3D model in my scene…
thanks for all your help.

You have four different model formats.

.fbx -> FBX format. You need to use the FBXLoader. See this example.
.stl -> STL format. You need to use the STLLoader. See this example.
.obj -> OBJ format. You need to use the OBJLoader or OBJLoader2. See this example.
.glb -> glTF format. You need to use the GLTFLoader. See this example.

You should choose one version of the file. I would choose .glb if possible, otherwise try the others.

You can download the .obj format . I feel that’s the most easiest format .
Then use the code below to display your 3d model .

// Refer your OBJLoader.js file
<script src="../js/three/OBJLoader.js"></script>
.
.
.

 var objLoader = new THREE.OBJLoader();
 objLoader.load('withfilepath/Your3dObjfile.obj', function(object) {
     scene.add(object);
 });

For reference check : GitHub Example

1 Like