Glow Layer Shader Include

You can use the customEmissiveTextureSelector of the glow layer to change the emissive texture on a per mesh basis:

Implementing shadows in a custom shader material would be a bit involved, you would need to reimplement a lot of things done in the current pbr material (you can have a look to the shader code in https://github.com/BabylonJS/Babylon.js/tree/master/src/Shaders/ShadersInclude).

But:

You can use a PBRCustomMaterial to leverage the existing PBR material and add custom code inside of it, or for even more freedom you can use the NME to create your material.

[EDIT]
Regarding shadows, I forgot you can use the new (in 4.2 ) ShadowDepthWrapper class to quickly support shadows in custom shaders!

[/EDIT]

2 Likes