Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

Mesh material array #75

Open
ManishJu opened this issue Mar 3, 2020 · 2 comments
Open

Mesh material array #75

ManishJu opened this issue Mar 3, 2020 · 2 comments

Comments

@ManishJu
Copy link

ManishJu commented Mar 3, 2020

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!

@jaxry
Copy link
Contributor

jaxry commented Mar 4, 2020

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 jaxry changed the title Using array of materials for cube Mesh material array Apr 20, 2020
@bitores
Copy link

bitores commented Dec 6, 2021

Duplicate of #241

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

No branches or pull requests

4 participants