Error on defining uniform for PBRCustomMaterial

Hello!
It seems that after the refactoring of PBR fragment shader code the order of #define CUSTOM_FRAGMENT_... blocks inside of it got broken.
For example, now this block:

#define CUSTOM_FRAGMENT_UPDATE_ALBEDO

comes before that block:

#define CUSTOM_FRAGMENT_DEFINITIONS

So since custom uniforms have to be defined in the latter block, while being used in the first block, shader fails to compile with FRAGMENT SHADER ERROR: undeclared identifier error.

Please check Babylon.js Playground for the reference. There’s an error with the latest version of BJS, while with v.4.1.0 everything works fine.

1 Like

At first glance possible fix could be to move the

#define CUSTOM_FRAGMENT_DEFINITIONS

block to the next line after

precision highp float;

but I might be missing something.

pinging @Evgeni_Popov

Thanks for the report, fixed by:

2 Likes

i can confirm that it was fixed in 4.2.0-alpha.19, thanks a lot!