Using MixMaterial with PBR & Lightmaps

Hi, I would like to know how I could use the MixMaterial (MixMaterial - Babylon.js Documentation) with PBR and also add lightmaps. After having trials with the mixmaterial it does not seem I can use it with PBR settings and add lightmaps to it. Are they any alternative solutions to my issue ?

Hey unfortunately MixMaterial (which is a material) cannot be used with PBR (which is also a material). The MixMaterial is designed to mix several diffuse textures but not to interact with another material

Hey @Deltakosh, thanks for the clarifications! Is there a way to mix several albedo textures with PBR materials ? Just trying to get myself in the right direction!

You could try to use the nodeMaterial to mix your albedo textures.

Totally the right answer here

Here are examples recreating the PBR:

You can hack them to mix multiple albedo textures

Thanks again for your help @_Flomotion & @Deltakosh. I am almost there!

I have recreated the mix material with PBR via the node material editor.

However, the material does not work once imported in the BabylonJS playground. The material appears black. I have played with the different settings/nodes for a while now - I can only make it work when I remove the PBR block (ColorMerger connected straight to Fragment Output).

(Note, I am using the ColorMerger to convert ReplaceColor RGB to RGBA - it is yet the only way I have found. It might be the issue ? )

That’s strange indeed. I tried to load the material from the PG using
BABYLON.NodeMaterial.ParseFromSnippetAsync(“NMMGW3#1”, scene).then((nodeMaterial) => {
sphere.material = nodeMaterial;
but same result. Let’s hope @Deltakosh can do his magic…

1 Like

Pinging @Evgeni_Popov to see if this could come to not setting the env texture?

You need some lights in your scene:

You can also use an environment texture, but you must use the Reflection block in the NME for that to work:


My mistake, I did not see you created a point light, but the default intensity (1) is way too low for PBR to see something.