Hello everyone, hopefully someone can enlighten me as to why this doesn’t work.
I want to color a surface based on it’s local, varying height.
To simplify - half way up the height at any point, I want to switch from the base color to the next color. Seems so simple!
So in the code below, how to I get the height of the surface so I can provide it to the HEIGHT_OF_THE_SURFACE?
const firstMix = step(HEIGHT_OF_THE_SURFACE_HERE.mul(0.5), positionLocal.y);
Tried passing it as an attribute of the surface geometry.
float(heightAttr).mul(0.5) Nope
Tried getting it from the position array. Nope.
But if I just use the actual number (18, for example) Bingo!
Some tiny clue would possibly save my sanity at this point.
Thanks
B
redMat.colorNode = Fn(() => {
const colorOut = bandColor(0).toVar();
// change at height 3 This works!!!
// const firstMix = step(float(6.0).mul(0.5), positionLocal.y);
// This in no way works. Changes the whole surface to bandColor(1)
const firstMix = step(positionLocal.y.mul(0.5), positionLocal.y);
colorOut.assign( firstMix.mix(colorOut, bandColor(1).toVar() ));
return colorOut;
})();











