0

I am trying to figure out how to use a blend model in my three.js code.

My code looks like the following:

const loader = new THREE.JSONLoader();
loader.load( "models/test.blend", function(geometry){
  let material = new THREE.MeshLambertMaterial({color: 0x55B663});
  mesh = new THREE.Mesh(geometry, material);
  scene.add(mesh);
});

Nothing is showing. Every tutorial I can find directs me here which is now deprecated and I cannot find anything in the docs.

I have also tried using a dae file and followed the answer here, but this didn't work either. I used the new THREE.ColladaLoader(); to try and load this file.

halfer
  • 19,824
  • 17
  • 99
  • 186
peter flanagan
  • 9,195
  • 26
  • 73
  • 127
  • Maybe the following guide helps a bit: https://threejs.org/docs/index.html#manual/en/introduction/Loading-3D-models . Besides, you can't load a Blend file directly with `three.js`. Moreover, the usage of Collada is not recommended. Use `glTF` if possible. – Mugen87 Oct 29 '18 at 16:38
  • @Mugen87 I have seen this too. It just isn't very clear to me still from this how to load the model – peter flanagan Oct 29 '18 at 16:44
  • If you exported your model to `glTF`, use the code from the following example as a start template: https://threejs.org/examples/#webgl_loader_gltf – Mugen87 Oct 29 '18 at 17:00
  • Json and blend might be different formats. Why are you using the json loader? – pailhead Oct 29 '18 at 17:15

1 Answers1

1

read this specifically it addresses a tool :

https://github.com/KhronosGroup/glTF-Blender-Exporter

Loading 3D models

3D models are available in hundreds of file formats, each with different purposes, assorted features, and varying complexity. Although three.js provides many loaders, choosing the right format and workflow will save time and frustration later on. Some formats are difficult to work with, inefficient for realtime experiences, or simply not fully supported at this time.

This guide provides a workflow recommended for most users, and suggestions for what to try if things don't go as expected.

Before we start If you're new to running a local server, begin with how to run things locally first. Many common errors viewing 3D models can be avoided by hosting files correctly.

Recommended workflow Where possible, we recommend using glTF (GL Transmission Format). Both .GLB and .GLTF versions of the format are well supported. Because glTF is focused on runtime asset delivery, it is compact to transmit and fast to load. Features include meshes, materials, textures, skins, skeletons, morph targets, animations, lights, and cameras.

this is from the above link and the THREE.js documentation. in it it explains that they deprecated that to increase workflow productivity, which means it wasn't working very well anyway....

the link you provided has substitute resources for exporting blender models as glTF which is recommended for transmission due to its compact size and speed

Technivorous
  • 1,682
  • 2
  • 16
  • 22