Node Material Post Processes flashing replace colour at initialisation

Hi guys,

I have this Pokemon style gradient shader, it fades the screen according to a gradient texture. Here is the NME, you can slide the “cutoff” float to see the shader in action. Babylon.js Node Material Editor

My issue is, in engine, when I load the NME file, it flashes what ever my color3 is, even though it shouldn’t show anything as the texture and cutoff is at its 0th position.

Here it is in engine

(press the play button to see it flash red)
It should not flash red and doesn’t do this in the NME

Is this an issue with my nodes or is there an issue in-engine?

Just bumping this. Want to make sure other people notice my issue or if I need to reword my question better?

Hmmm might be something with the shader compilation? @Evgeni_Popov

This is due to the texture not being ready on the first frames. I am trying to find a way to
“wait” for them in the loading but nothing great at the moment.

1 Like

Thanks for the hint!

Here’s a way to do it:


I added an option to ensure texture readyness while parsing in NME Fix texture not ready when parsing NME by sebavan · Pull Request #14270 · BabylonJS/Babylon.js · GitHub


So this has fixed my issue on the playground.

But on my local, I use NodeMaterial.Parse() not ParseFromSnippetAsync().

Can we also have the waitForTextureReady on the Parse too? Sorry for not saying I use parse, I only use the snippet server for ease of sharing.

Thanks for the quick turnaround however!

Unfortunately parse is not async and it would be a pretty big breaking change.

However in your code, I guess you could do something similar so I extracted the function as a helper of the material Add textures ready helper by sebavan · Pull Request #14276 · BabylonJS/Babylon.js · GitHub


Sorry for not closing this. The last PR mentioned fixed the issue!

If anyone wants code for it feel free to ask in this thread.

1 Like