Skip to content

How can I share a material among different objects? #2790

Answered by mileshiroo
mileshiroo asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks so much for the help.

I figured out what the issue was. I'm creating custom materials using the three-custom-shader-material package, and the components are usually returned like this:

        <CustomShaderMaterial
            baseMaterial={THREE.MeshStandardMaterial}
            vertexShader={vert}
            fog={false}
            fragmentShader={frag}
            ref={ref}

            uniforms={{
                 time: { value: 0 },
                 noiseScaleBase: { value: 2739 },
                 fogColBase: { value: new THREE.Color('#e0e2c1') },
                 useNoise: { value: true }
             }}
        />

I found that if I created a shared material using a forwar…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@FarazzShaikh
Comment options

Answer selected by mileshiroo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #2788 on March 04, 2023 06:11.