Skip to content
This repository has been archived by the owner on Apr 5, 2023. It is now read-only.

LayerMaterials: With Base baked in, transparency should be the default and can be deterministic #9

Closed
DennisSmolek opened this issue Feb 12, 2022 · 2 comments

Comments

@DennisSmolek
Copy link

If we bake in the base as mentioned in #8 there's no need to call transparent. You still could I guess, just to be 100% sure or if you planned on adjusting the other values later.

But if you place a color in base:

 <LayerMaterial>
    <Base color="#603295" />
</LaterMaterial>

or by #8 :

<LayerMaterial color="#603295">

There's no alpha set so it is 100% opaque

where this becomes confusing is actually on the inverse:

 <LayerMaterial>
    <Base color="#603295" alpha=".5" />
</LaterMaterial>

You would think that layer is 50% see through (opaque) but it's not...

Transparent maps to the material, while base and alpha map to the material color map..

I have NO IDEA what this would do..

//simplified from @Fasani Blob experiment
<mesh>
  <sphereGeometry args={[0.8, 128, 128]} />
  <LayerMaterial>
    <Base color="#603295" />
          {...}
  </LayerMaterial>
</mesh>
<mesh ref={glow} scale={0.6} visible={showGlow}>
    <circleGeometry args={[2, 16]} />
    <LayerMaterial depthWrite={false} side={THREE.FrontSide} blending={THREE.AdditiveBlending}>
        {...}
    </LayerMaterial>
</mesh>

In that instance the user accidentally left of the transparent value on glow. Now, because the blending mode isnt the default we know we're supposed to be transparent..

TLDR: based on input props we can assume the intended transparency value

Transparency on meshStandardMaterial in Three.js doscs

@FarazzShaikh
Copy link
Member

If I understand correctly, you mean to say, we should set the transparent flag on the material if any alpha other than 1 is used in any of the layers?

Yep we could do that

@FarazzShaikh
Copy link
Member

Addressed in 1.1.0

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

No branches or pull requests

2 participants