Changing mesh color from bottom up

I want to create a loader animation. I want to create a box mesh (maybe sphere mesh later) which would change color depending on how much has been loaded.
So let’s say I have a box that is 5x5x5 segments and there is 20% of data loaded. I want to color bottom row segments (on all faces) in red and top 4 rows in gray.
How can I achieve this?
I was thinking about stacking 5 box meshes together and updating their color, which would work, but what about sphere or any other more complex object? Is there a dynamic and universal way?

I’m using r127

Hi ! Does it have to be transparent or wireframe ? Otherwise you could just draw on a canvas texture like in this example. It would work for spheres or any kind of mesh with UV mapping.

Maybe this example will be helpful: Color bottom x% of a BoxGeometry using faces - #3 by prisoner849

1 Like

This is exactly what I needed! Thanks!

@felixmariotto thanks for your help too!

1 Like