In the PBR material, the lightmap color is simply either added or multiplied (if lightmap is used as shadow map) to the final color output.
For best results, your lightmap color should be in linear space, so the final output color of the PBRMaterial should also be in linear space but the PBRMetallicRoughness.lighting
output is in gamma space.
To work in linear space, instead of using PBRMetallicRoughness.lighting
you should add up all the individual outputs of the PBRMetallicRoughness
block (from AmbientClr
to refraction
- you can omit some if you don’t use the corresponding feature - for eg, you don’t need to sum with the sheen
outputs if you don’t use sheen) and use the result to add or multiply with your linear lightmap color. You can convert the final result to gamma space by using the Convert to gamma space switch of the FragmentOutput
block.