Closed DennisSmolek closed 2 years ago
The <Base />
layer is more of a <Color />
layer. It provides a nice solid color. This is useful to, for example, darken a given material. You could do:
<Base color="black" alpha={0.3} />
Or fi you want to give something a specific tint.
Maybe we should rename <Base />
to <Color />
<Base color="black" alpha={0.3} />
Maybe we should rename
<Base />
to<Color />
I REALLY like the concept of a Color and agree that Base would be one, but the concept of it being a "base" is important
Many layers (Noise, displacement, etc) require a base color to be set and it's often something people mess up and get confused/frustrated when the stack doesn't seem to be "working"
One method is to require that a ColorLayer
(or one that satisfies the requirement) be present somewhere in the stack, order being irrelevant.
<LayerMaterial>
<Nosie />
<Color value="red" mode="multiply" />
<Texture />
</LayerMaterial>
A 100% opaque Color will block the alpha values of subsequent color layers like Gradient
<LayerMaterial>
<Color value="red" />
<Texture />
<Gradient type=”circular” colors={[rgba(0,0,0,100), rgba(0,0,0,0)] />
</LayerMaterial>
So if one is present and not otherwise called, the base should be ignored
But I think the biggest things are
if people forget to define it defauting to the most likely need keeps the stack safe:
<LayerMaterial>
<!-- baseline <Color value="black" /> -->
<Texture />
</LayerMaterial>
Keeps things cleaner when doing simple colors:
const [baseColor, setBaseColor] = useState('#32A0CF');
<LayerMaterial color={baseColor}>
<Texture mode="screen" />
</LayerMaterial>
Yeah that sounds good to me. Having a color prop on the layer material itself could be the "base" color. And we could rename <Base />
to <Color />
Like this:
<LayerMaterial color="lightblue"> 👈 Base color
<Noise mode="screen" />
<Color color="red" mode="multiply" /> 👈 Give the noise red tint
</LayerMaterial>
Addressed in 1.1.0
The base can only be called once and at the origin
becomes:
Similar to how R3f handles
camera
. Now base only has 3 arguments and only 1 will regularly be set, but if they had a specific requirement or need and really wanted they still could still do:R3F Canvas & Camera: