Changing opacity of a mesh without using opacityMapOffset

I’m hoping someone can steer me in the right direction:
Is there a way to change the opacity of a model’s meshes from fully opaque to fully transparent by a sequential transition that moves from one end of a model to the other changing the opacity of its mesh instances vertex row by vertex row?

I’m aware of the method that uses UV opacity map(s) and this code:

this.material.opacityMapOffset = this.material.opacityMapOffset.add(tmp);

Unfortunately, this map offset approach doesn’t work because the model has multiple mesh instances and UV maps that are not continuous from one end of the model to the other.

Any help is appreciated.

Hi @PilotMind and welcome,

I think an approach to this would be to use vertex colors. You could paint in your modelling app the vertices a gradually darker (or lighter) color.

Then in a custom pixel shader use that colors to gradually set the pixel opacity based on a custom time uniform.

1 Like

Thank you @Leonidas. This sounds like an excellent approach to pursue. Much appreciated!