How to export and import 3d models into threejs of .js file?

This might be the stupid question, but here goes nothing.

I have seen people using .js file for model instead of .glb, but now sure how they export and import in threeJs.

For Reference, I was looking to this example +360º - Car Visualizer - Three.js
and when I Inspected it most of the part of these are Downloaded separately but that too In .js format as show below


So far I have been using .gltf/.glb and .obj format … but I am not sure how to do this.
And In this example, the models switch way quickly.

Any link or guide is much appreciated.

Thank you

What you see in the car visualizer app is an outdated workflow (the app uses r68).

The .js extension was used in the past by a legacy JOSN loader. If you export with recent three.js versions a 3D object or scene to JSON, you end up with a .json file that can be loaded with THREE.ObjectLoader.

However, the internal JSON format is mainly relevant for the three.js editor. If you want to load 3D assets into an application, glTF should be your first choice.

1 Like

Thanks for replying @Mugen87.

Just one Minor doubt,
what would be the recommended way to hide your 3d models, so It’s not easily accessible from network tab or at least harder to make out any sense from those files.

Let’s say I’m making a 3d model store similar to sketchfab.
For visual representation of model, I’m using threejs, but I don’t want people to directly download those models from network tab.

Thank you

You find some information about this topic here:

The title is a bit misleading but later on there is a suggestion on how to encrypt/decrypt arbitrary binary data (so it also works for glb files).

1 Like

I have answered about the process here,

Hope it helps the community - Is there a way to not allow the user to publicly download the 3d model and texture files that i'm showing? - #18 by Suraj_VIBROMECH

1 Like