You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Three.js加载Blender模型失败问题求助

Troubleshooting Your GLB Model Not Showing in Three.js

Hey there! Let's walk through why your Blender-exported GLB model isn't rendering in Three.js—even with no console errors, there are a few common culprits to check:

1. Did you add your children group to the main scene?

Looking at your code, you create a children Object3D and add both the model and cylinder to it, but I don't see where you add children to your main Three.js scene. If the cylinder isn't showing up either, this is almost certainly the issue!

Add this line after setting up your children group:

scene.add(children);

Without this, none of the objects inside children will be rendered to the screen.

2. Verify your model is loading correctly (and access it properly)

Even if there's no error, the model might not be loading in the way you expect. Let's add some debugging and adjust how you access the model:

  • First, add a console log in your handle_load function to confirm the model loads:
    function handle_load(gltf) {
      console.log("Model loaded successfully!", gltf); // Check if this appears in the console
      // Try using the entire scene instead of children[0]—sometimes Blender exports the model as the root scene
      mesh = gltf.scene; 
      mesh.position.set(-50, 15, -50);
      // Add a scale check in case the model is too small/large
      mesh.scale.set(5, 5, 5); 
      children.add(mesh);
    }
    
  • If gltf.scene.children[0] was pointing to an empty node (common if you have extra objects in your Blender scene), using gltf.scene directly will ensure you're adding the entire model hierarchy.

3. Check for lighting issues

GLTF models typically use physically-based materials (like MeshStandardMaterial) which require lighting to be visible. If your scene has no lights, the model might be completely black and appear "missing".

Add these lights to your scene setup:

// Ambient light for overall illumination
const ambientLight = new THREE.AmbientLight(0xffffff, 0.6);
scene.add(ambientLight);

// Directional light for realistic shadows/highlights
const dirLight = new THREE.DirectionalLight(0xffffff, 0.8);
dirLight.position.set(100, 100, 50);
scene.add(dirLight);

4. Confirm your model path is accessible

You logged the path as "/media/accounts/2878836292/2878836292.glb"—make sure this path is reachable from your web page. If you're running a local server, ensure the GLB file is in a directory that's served statically, or try using a relative path (e.g., "./2878836292.glb" if it's in the same folder as your HTML file).

5. Adjust camera position to ensure you can see the model

Your model is positioned at (-50, 15, -50)—make sure your camera is positioned to view that area. For example:

// If your camera is at (0,0,0), move it back to see the model
camera.position.set(0, 30, 100);
camera.lookAt(-50, 15, -50); // Point camera directly at the model

Start with these checks—most likely, one of these fixes will get your model showing up!

内容的提问来源于stack exchange,提问作者user11929397

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 08:39:23