Standard Materials / Texture Maps and Lightmaps

Hi,

I am looking for some help getting the best out of materials in babylon in order to make them look as close to the texture colours. Where I am at:
1 - Scene created in Blender and UV unwrapped
2 - Baked lightmaps (currently to each meshes for ease but this might be combined later for performance)
3 - Exported glb with no textures.
4 - Loaded glb into Babylon and assigned lightmaps.
5 - Set up HDR as environment map
6 - Set up scene to take standard materials and added a Albedo texture (from quixel megascans) in as the Ambient texture.

This is how it is currently looks:

In order to get the colour of the floor to come through I’ve had to bump up the diffuse and ambient and levels and turn the lightmap level right down otherwise it washes out the colour.

I am wondering if there is a better way to retain the colour of the texture? Any help would be much appreciated as I am relatively new to Arch Vis and Babylon.

Thanks

Hello and welcome to the Babylon community! I’ll tag our render gods @Evgeni_Popov and @PatrickRyan

@Si_Gal, welcome to the Babylon.js community! I am looking at your render and your listed steps and I have a question based on what I am seeing. Right at the baseboard, I see a glow which appears to be global illumination bouncing off the floor plane. It seems as though your light maps were baked with the room using a white material. Is this correct?

If this is true, when you assign your lightmaps, are you using them as lightmaps or as shadowmaps? It you are using the texture as a lightmap, the bright values in your texture will be added to the material color of your mesh. If the texture is used as a shadowmap, the texture will be multiplied with your material color so nothing in white in the texture will affect the render. If you add your floor texture after the bake and the floor in the lightmap is bright, it will wash out the floor. If you use it as a shadowmap, it will darken the floor in the shadow areas only.

If you can share a sample in a playground, we can dig in more without making assumptions. Hope something I said here gives you an idea, but please feel free to ping back with more questions or a PG.

1 Like

Thanks Patrick, this is super helpful and makes total sense. You have assumed correctly regarding the lightmap baking however the glow is just where we have set the item to be pickable and have added the highlight so that someone knows what has been selected.

The reason for doing the bake this way is because the room is going to become a product configurator and we want to be able to change the materials on each of the nodes without having to bake each material.

Do you think this is the right direction or do you think we should bake out each material with the light over the top?

Cheers

@Si_Gal, thank you for the explanation on the glow. It did look a bit wrong to be just GI bounce, so I was just taking a wild guess. Your approach makes complete sense from product configurator perspective. You will want to use your lightmap bakes only as shadow maps as using a lightmap baked from a neutral base will make an added texture potentially look wrong based on the color and specular properties of the new material.

If you were to bake each texture with light information, you would need to bake every permutation of materials as the bounce color from any one material would influence the ones around it, so this would quickly get untenable. Future expansion would also be difficult as you would not be able to reuse tiling textures on new meshes without new bakes.

The one thing you will want to experiment with is the best color to use as a base to bake out your shadow maps. You want to make sure that the areas light hits are white in your shadow map and that the transitions between areas of light and shadow are accurate to how the material would behave in reality. Also pay attention to Ambient Occlusion bakes from your mesh as these will reinforce your shadow maps to prevent light from “leaking” into recesses in your mesh. This becomes most problematic with IBL since meshes don’t self shadow and require a good AO map to prevent light from IBL falling into areas it shouldn’t.

Hope this helps!

1 Like

This is great thank you. We will begin experimenting with the suggestions you’ve made and we have started to get some better results.

Thanks

1 Like