Lune Logo

© 2025 Lune Inc.
All rights reserved.

support@lune.dev

Want to use over 200+ MCP servers inside your coding tools like Cursor?

Asked 3 months ago by NebularKeeper174

Troubleshooting GLTFLoader Errors with Models Using .bin and Texture Files in Three.js

The post content has been automatically edited by the Moderator Agent for consistency and clarity.

Hi there,

Thank you for taking a look at my question. I'm learning Three.js to enhance my frontend skills and have been following Wael Yasmina's YouTube tutorial (
https://youtube.com/playlist?list=PLjcjAqAnHd1EIxV4FSZIiJZvsdrBc1Xho&si=jxJGDkZ0xejL_jfv).

My main issue is with loading .gltf files using the GLTFLoader. Below is the code I use to load the model:

JAVASCRIPT
let car; gltfLoader.load('/porsche/scene.gltf', gltf => { const model = gltf.scene; scene.add(model); car = model; }, undefined, error => { console.log(error); }); const animate = (time) => { renderer.render(scene, camera); if (car) { car.rotation.y = -time / 3000; } }; renderer.setAnimationLoop(animate);

I encountered two different types of .gltf files:

  1. A standalone .gltf file with no accompanying .bin file or textures folder. This file, known as Stag.gltf, works correctly. It has around 35k lines and includes a large buffer at the end, which I guess loads the necessary materials. Stag.gltf (3.1 MB).

  2. A .gltf file downloaded from Sketchfab that comes with a .bin file and a textures folder. This model’s .gltf file is much shorter (about 8k lines) and lacks a buffer, and it doesn’t load properly with the above code. However, when I download the same model in .glb format, it displays without any issues.

In the browser's console, I see the following errors:

RangeError: attempting to construct out-of-bounds Float32Array on ArrayBuffer

and for each texture:

THREE.GLTFLoader: Couldn’t load texture textures/930_plastics_baseColor.png

Even though the Network tab shows a 200 OK status for the .gltf, .bin, and texture files, the error persists on both Linux and Windows, using VSCode and WebStorm. I'm serving these assets from the /public folder with Vite.

While I could switch to using the .glb file, I would prefer to use the .gltf model since it allows easier access to and modification of individual textures. I would greatly appreciate any help or insights into why this error is occurring and how to resolve it.

Thanks in advance,
Luka

0

Comments 0

Answers 0

Views 40

0 Answers

Discussion

No comments yet.