ray-tracing-renderer icon indicating copy to clipboard operation
ray-tracing-renderer copied to clipboard

Mesh material array

Open ManishJu opened this issue 4 years ago • 2 comments

For a cube I am currently using an array of MeshStandardMaterial and feeding it to the box mesh like this:


       const matBFront = new THREE.MeshStandardMaterial({
       ....
       });
       const matBLeft = new THREE.MeshStandardMaterial({
       ....
       });
        ...
        ...
        ....
   const matBox = [
           matBLeft,
           matBRight,
           matBBottom,
           matBTop,
           matBFront,
           matBBack
       ];

       const boxObject =  new THREE.Mesh(geomBComplete, matBox);

This works in threejs but not when the raytracing renderer is turned on. The object just disappears. What is the best way to approach this problem ? Thanks!

ManishJu avatar Mar 03 '20 10:03 ManishJu

The ray tracing renderer only expects a single material for each mesh. I didn't even know an array of materials was possible in Three.js!

https://threejs.org/docs/#api/en/objects/Mesh I'm looking at the documentation here and I see it can accepts an array. But what does an array of materials do exactly?

jaxry avatar Mar 04 '20 01:03 jaxry

Duplicate of #241

bitores avatar Dec 06 '21 13:12 bitores