Shader not updated?

Hi,

I am trying to write my own ShaderMaterial. The first time it succeeds. However, when I try to modify the shader code at runtime and overwrite the material of my mesh, it does not change anything! That’s a problem because I want to be able to update shader code at runtime.

In this playground, you see what I mean: https://www.babylonjs-playground.com/#59M6SR#1

Click on the textured box, and the texture on the box should now be sampled by a totally different UV factor (just a demo, I really need to change the shader for a different reason!).

Can you help me make the shader update?

Cheers
Matthias

Hey! and welcome!

Because you are using the same shader the system does not update its cache
So you need to call engine.releaseEffects() to clean the cache:

https://www.babylonjs-playground.com/#59M6SR#2

Hey, Deltakosh, nice to meet you.

Thanks for answering the question, now it works!

By the way: When I click on your version of the playground, the box is initially white whereas in my version, it has a texture. How come?

it is because of your UV right?