App that worked for months (using NME materials) suddenly hangs with shader errors

Hi!

I have a product configurator built with babylon and React. It’s been deployed live months ago and worked flawlessly. Sometime in the last few days something happened and now it hangs with fragment shader errors. The browser points me to the following line:

o.logFunc && o.logFunc("BJS - " + r); (which I now realize is only the logging function…)

And it says the error is in line 217 or 218 in the fragment shader code:

vec3 perturbNormalBase(mat3 cotangentFrame,vec3 normal,float scale)

We are using custom materials made with the node editor so my guess is that something there is at fault, but like I said, it worked normally on all platforms for months up until trying it today. So I guess something must have changed in the last update.

You can find the configurator here:

Now our client’s configurator is dead in the water so I would beyond grateful for any help I can get here ASAP.

Hello! What version of Babylon are you using? Tagging @Evgeni_Popov here to take a look as he’s our shader expert

This one loads babylon from CDN so the latest, thus whatever changed between the last two builds I guess broke this.

First of all you should NEVER have a production project pointing to our live version CDN
You must point to a stable number that you have tested and validated:
babylonjs - Libraries - cdnjs - The #1 free and open source CDN built to make life easier for developers

So I guess the most urgent for you is to publish an update of your site pointing to a working version

Then do you mind sharing a PG with the actual problem so we can help debugging?

Just elaborating a bit on this, the latest CDN is updated weekly, and through we try our best to validate the changes aren’t breaking anything (we have a testing infrastructure that runs on every PR), sometimes things will slip by undetected in the tests, especially in more specific cases, so in production, it’s safer to point at a constant version and validate before updating.

I think 99% that the problem comes from :

because there’s a flying “;” between the end of one function and the start of the next.

I think only the latest versions 6.12.1 and 6.12.0 have this problem, so if you take any version before or equal to 6.11.2, it should be fine.

If possible, @Hrvoje_Cop, can you share your code, even privately? We did a number of tests with this PR and everything was fine, but we seem to have missed something ([EDIT] There’s also the option that the problem does not come from this PR)…

1 Like

Despite being apparently able to make a fully featured configurator app, this app was my very first contact with JS ever, let alone babylon and react. So a very, very noob mistake on my part. Damn… I really should have thought of that. :face_with_symbols_over_mouth:

I can find the babylon.js with the appropriate version (in our case one that I know works is 5.32.1).
Can I use the loaders module from:
https://cdn.jsdelivr.net/npm/babylonjs-loaders@5.32.1/babylonjs.loaders.min.js

Or is there a more recommended source?

I’ve just tested loading the appropriate version from these two links and everything works properly.
So all that’s necessary to fix this is to replace these two lines on all the pages, not the worst thing ever thankfully, we don’t have to rebuild or anything. Thanks for the quick answers guys, much appreciated.

The problem is not in my code though, it comes from the node materials I’m using, which I just confirmed by trying to load one in the node editor, and getting the very same error. You can find an example here:

Tested this as well just now, and yes, 6.11.2 works as well.

Great, thanks for the repro in the NME!

The problem will be fixed by:

2 Likes