NodeMaterial Gradient generated code bug

Hi

When playing with the Gradient Node I found a bug during its generation.

I prepared PG to illustrate this:

Here we load a snippet as material for the ground and when we inspect the NodeMaterial the gradient looks fine:

But when I generate the code with the “generated code” button and then try to use it, the gradient has its initial black and white colors and after that pushed red and yellow colors again:

https://playground.babylonjs.com/#HV3BL7#1

That makes gradients slightly diferent:

One is more orange the other one is more yellow.

The solution to this is to set:

Gradient.colorSteps = [];

Right after GradientBlock creation in generated code. It’s commented out in my PG but you can test it that it’s working.

In my use case, the impact of initial colors in gradient is much more visible and I was fighting with it for a while before I figure out what is happening. It was fine in NME but not in my project once I generated the code and put it in.

Regards
Peter

Adding @Evgeni_Popov to the thread :slight_smile:

Will be fixed by:

Awesome, I ll create a nightly with all this tomorrow :slight_smile:

@sebavan @Evgeni_Popov You guys are awesome :slight_smile:

1 Like