mrdoob / three.js

JavaScript 3D Library.
https://threejs.org/
MIT License
102.01k stars 35.33k forks source link

webgpu can't use multiple materials in a cube #29504

Closed Justnormalguy closed 6 days ago

Justnormalguy commented 6 days ago

Description

I try the examples in https://threejs.org/manual/#en/textures,but when I replace three.moudle.js to three.webgpu,js ,it doesn't woke. It looks like just like this: wrong

when I use three.moudle.js it looks correct. :-) _

Reproduction steps

1.copy the code from https://threejs.org/manual/#en/textures 2.replace three form three.moudle.js to three.webgpu,js 3.replace the image

Code

const scene = new THREE.Scene();

const boxWidth = 1; const boxHeight = 1; const boxDepth = 1; const geometry = new THREE.BoxGeometry(boxWidth, boxHeight, boxDepth);

const cubes = []; // just an array we can use to rotate the cubes const loader = new THREE.TextureLoader();

const materials = [ new THREE.MeshBasicMaterial({ map: loadColorTexture('xxx.jpg') }), new THREE.MeshBasicMaterial({ map: loadColorTexture('xxx.jpg') }), new THREE.MeshBasicMaterial({ map: loadColorTexture('xxx.jpg') }), new THREE.MeshBasicMaterial({ map: loadColorTexture('xxx.jpg') }), new THREE.MeshBasicMaterial({ map: loadColorTexture('xxx.jpg') }), new THREE.MeshBasicMaterial({ map: loadColorTexture('xxx.jpg') }), ]; const cube = new THREE.Mesh(geometry, materials); scene.add(cube);

Live example

Screenshots

No response

Version

r168

Device

No response

Browser

No response

OS

No response

Mugen87 commented 6 days ago

This should be fixed via #29278. Do you mind giving the current dev version a try?

Justnormalguy commented 6 days ago

Certainly, I'd be happy to have a try.