Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using WebGPURenderer, putting the loaded GLB model into the scene will result in an error "TypeError: Cannot read properties of undefined (reading 'isInterleavedBufferAttribute') #27221

Closed
chengxiaowan opened this issue Nov 20, 2023 · 9 comments · Fixed by #27398

Comments

@chengxiaowan
Copy link

chengxiaowan commented Nov 20, 2023

Description

I use GLTFloader to load a GLB model and ADD it into the scene, but it will cause a "TypeError: Cannot read properties of undefined (reading 'isInterleavedBufferAttribute')" error. I also found that loading the GLTF model will directly lead to a white screen in the scene. This problem does not exist when I use webGL's renderer.

Reproduction steps

Load GLB or GLTF model

Code

three-webgpu

Live example

Screenshots

图片

Version

r158

Device

Desktop

Browser

Chrome

OS

MacOS

@mrdoob
Copy link
Owner

mrdoob commented Nov 20, 2023

Here's the file we care about:
https://github.com/chengxiaowan/three-webgpu/blob/main/public/RobotExpressive.glb

@sunag sunag added the WebGPU label Nov 20, 2023
@sunag sunag changed the title Using webGpurender, putting the loaded GLB model into the scene will result in an error "TypeError: Cannot read properties of undefined (reading 'isInterleavedBufferAttribute') Using WebGPURenderer, putting the loaded GLB model into the scene will result in an error "TypeError: Cannot read properties of undefined (reading 'isInterleavedBufferAttribute') Nov 23, 2023
@sunag
Copy link
Collaborator

sunag commented Nov 29, 2023

This bug still valid? The GLB model is currently opening normally.

image

@mrdoob
Copy link
Owner

mrdoob commented Nov 30, 2023

Is that how it's supposed to look like?

@chengxiaowan
Copy link
Author

It feels like this is not what I expected, some small parts are misplaced.

@pecopeco
Copy link

pecopeco commented Dec 18, 2023

same problem, unstable

@pecopeco
Copy link

pecopeco commented Dec 26, 2023

version 160 still has problems,occasionally, an error occurs and I cannot locate it.

QQ截图20231226104217

@sunag
Copy link
Collaborator

sunag commented Dec 27, 2023

version 160 still has problems,occasionally, an error occurs and I cannot locate it.

I recreated your example in vanilla because for some reason your example in vue is not install on my computer. Apparently everything is ok, or have I forgotten something?

import * as THREE from 'three';

import { GLTFLoader } from "three/addons/loaders/GLTFLoader.js";

import WebGPU from 'three/addons/capabilities/WebGPU.js';
import WebGPURenderer from 'three/addons/renderers/webgpu/WebGPURenderer.js';

let camera, scene, renderer;

init();

async function init() {

	if ( WebGPU.isAvailable() === false ) {

		document.body.appendChild( WebGPU.getErrorMessage() );

		throw new Error( 'No WebGPU support' );

	}

	camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 10000 );
	camera.position.copy( new THREE.Vector3( 10, 10, 10 ) );
	camera.lookAt( new THREE.Vector3( 0, 0, 0 ) );

	scene = new THREE.Scene();
	scene.background = new THREE.Color( 0x222222 );

	//

	renderer = new WebGPURenderer( { antialias: true } );
	renderer.setPixelRatio( window.devicePixelRatio );
	renderer.setSize( window.innerWidth, window.innerHeight );
	renderer.setAnimationLoop( animate );
	document.body.appendChild( renderer.domElement );

	//

	const loader = new GLTFLoader();
	loader.load( './RobotExpressive.glb', ( gltf ) => {

		const object = gltf.scene;
		object.scale.set( 1, 1, 1 );
		scene.add( object );

	} );

	//

	const axesHelper = new THREE.AxesHelper( 5 );
	scene.add( axesHelper );

	const size = 100;
	const divisions = 100;
	const gridHelper = new THREE.GridHelper( size, divisions );
	scene.add( gridHelper );

	const hemiLight = new THREE.HemisphereLight(0xffffff, 0x8d8d8d, 3);
	hemiLight.position.set( 0, 20, 0 );
	scene.add( hemiLight );

	const dirLight = new THREE.DirectionalLight(0xffffff, 5);
	dirLight.position.set( 20, 20, 10 );
	dirLight.shadow.mapSize.set( 4096, 4096 );
	scene.add( dirLight );


	window.addEventListener( 'resize', onWindowResize );

}

function onWindowResize() {

	camera.aspect = window.innerWidth / window.innerHeight;
	camera.updateProjectionMatrix();

	renderer.setSize( window.innerWidth, window.innerHeight );

}

function animate() {

	renderer.render( scene, camera );

}

image

@chengxiaowan
Copy link
Author

MaLu.glb.zip
Please take a look at this model file. There will be a TypeError: Cannot read properties of undefined (reading'isInterleavedBufferAttribute ') error # @sunag

@sunag
Copy link
Collaborator

sunag commented Dec 27, 2023

@chengxiaowan fixed here

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants