What Happened to CUSTOM_FRAGMENT_UPDATE_ALBEDO

What happened to CUSTOM_FRAGMENT_UPDATE_ALBEDO … i dont see that in PBR shader code…

Yo @Deltakosh… Can you shed some light here ???

Also missing:

CUSTOM_FRAGMENT_UPDATE_METALLICROUGHNESS

CUSTOM_FRAGMENT_UPDATE_MICROSURFACE

CUSTOM_FRAGMENT_BEFORE_FOG

This breaks the PBRCustomMaterial

Did someone go in a remove these #define blocks ???

I can find them in the preview https://raw.githubusercontent.com/BabylonJS/Babylon.js/master/dist/preview%20release/babylon.max.js
with ctrl + f, so it’s still there for sure
but it’s all being split up and moved around compared to 4.1 stable, maybe related to node material?

They are missing from latest preview release pbr.fragment.fx (There should be 10 CUSTOM Fragment defines… there are only 6 now)

https://raw.githubusercontent.com/BabylonJS/Babylon.js/master/src/Shaders/pbr.fragment.fx

Seems moved around for node material

CUSTOM_FRAGMENT_UPDATE_ALBEDO
Babylon.js/pbrBlockAlbedoOpacity.fx at master · BabylonJS/Babylon.js · GitHub

CUSTOM_FRAGMENT_UPDATE_METALLICROUGHNESS
CUSTOM_FRAGMENT_UPDATE_MICROSURFACE
Babylon.js/pbrBlockReflectivity.fx at master · BabylonJS/Babylon.js · GitHub

and CUSTOM_FRAGMENT_BEFORE_FOG should be in default.fragment
Babylon.js/default.fragment.fx at master · BabylonJS/Babylon.js · GitHub

There has been a big refactoring of the PBR shader code to split it into functions to be able to implement the NME PBR blocks as well as to ease future PBR improvements (and also for the sanity of the developpers who had to deal with a big chunk of linear code previously, as everything was held in pbr.fragment.fx).

All the custom defines are still there, but possibly in one of those news functions, meaning some variables may not be available to you at this point: you only have access to the variables defined inside the function or to the parameters passed to the function.

This can be a breaking change depending on your use of the custom defines, but unfortunately the pbr shader code (and all the internal shader code in Babylon) is not guaranteed to stay backward compatible as it will evolve according to the needs. Of course, we try as much as possible to avoid such breaking changes whenever possible, but sometimes it is not possible.

Hopefully, the PBR support in the NME will help to get around some of these problems!

1 Like

Having said that, the 4 defines moved to other functions/files are not accessible from the PBR custom material, going to have a look at that…

Will be fixed after this PR is live:

1 Like

Yo @Evgeni_Popov… thanks for the help bro…

I just don’t see how the fixes above will help… do I still have the custom fragment defines for update Albedo ???

Yes, as said above all defines are still existing, but 4 of them are dispatched in other files than pbr.fragment.fx. The PR will make those defines local to pbr.fragment.fx and so available to PBRCustomMaterial.

Thanks for clearing that up for me :blush: