Switch Material with Fade Effect

How can I change the complete material of a mesh with a new material and have a fade effect?

Similar in this video: YouTube

Except I don’t want to just replace the diffuse texture.

Babylon.js Playground :yum:

Nice. Thank you.
And how can i change a complete material (PBRMaterial) and not just a diffuse texture? =)

In the example above I’m using a custom material not pbr.
I think for pbr it depends how many properties need to be changed.

If the materials have same textures then for the other properties I think we can do almost same like in the previous example. https://www.babylonjs-playground.com/#410HFB#1

If the materials are totally different then I’m not sure that it is so simple.
A solution can be to clone the mesh, hide the clone and aply the second material on it. And apply a fade effect on both meshes, hide the original and show the clone in the same time.
It is not tested, but at this hour I have no ideea.

But let’s wait a little bit, I think that better ideas will come :slight_smile:

1 Like

I love your shader!! is it possible to apply the same fading result to a Skybox_MODE material with cubemap ?? it would be AMAZING !!