About lightmap, there is something strange

babylon’s lightmap seem’s very different with other engine.

By default the lightmap and the model’s color are added together to calculate the final color.
The ambient light and IBL both affect the model color but not the lightmap.

So if the IBL intensity (i.e. envirment intensity) is 0, only the lightmap color will be displayed.
I thought lightmap is an additive of the ambient light color would be more reasonable, like threejs dose. The object will be illuminated by the lightmap in black ambient light.


// _____________________________ LightMappping _____________________________________
            finalColor.rgb *= lightmapColor.rgb;
            finalColor.rgb += lightmapColor.rgb;



#if defined( RE_IndirectDiffuse )
		vec4 lightMapTexel = texture2D( lightMap, vUv2 );
		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
		irradiance += lightMapIrradiance;
	#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
		iblIrradiance += getIBLIrradiance( geometry.normal );

Welcome aboard!

cc @sebavan

I think there have been some discussions about lightmaps and how to handle them before, but I can’t remember where…

Changing the default lightmap mode which controls this would break back compat hence why we kept our old additive (Spec + Diffuse) mode as the default.

1 Like