Skip to content

Commit 6ec0c52

Browse files
authored
Fix using lightmap and emissive map together (#1047)
Signed-off-by: Ian Chen <ichen@openrobotics.org>
1 parent 3ba2f1e commit 6ec0c52

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

ogre2/src/Ogre2Material.cc

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -753,22 +753,17 @@ void Ogre2Material::SetLightMap(const std::string &_name,
753753
this->dataPtr->lightMapData = _img;
754754
this->lightMapUvSet = _uvSet;
755755

756-
// in gz-rendering5 + ogre 2.1, we reserved detail map 0 for light map
757-
// and set a blend mode (PBSM_BLEND_OVERLAY AND PBSM_BLEND_MULTIPLY2X
758-
// produces better results) to blend with base albedo map. However, this
759-
// creates unwanted red highlights with ogre 2.2. So switching to use the
760-
// emissive map slot and calling setUseEmissiveAsLightmap(true)
761-
// Ogre::PbsTextureTypes type = Ogre::PBSM_DETAIL0;
762-
// this->ogreDatablock->setDetailMapBlendMode(0, Ogre::PBSM_BLEND_OVERLAY);
763-
Ogre::PbsTextureTypes type = Ogre::PBSM_EMISSIVE;
756+
// Apply lightmap by using the detail map slot to store the lightmap texture
757+
// and blending it with the diffuse map.
758+
Ogre::PbsTextureTypes type = Ogre::PBSM_DETAIL0;
759+
this->ogreDatablock->setDetailMapBlendMode(0, Ogre::PBSM_BLEND_OVERLAY);
764760

765761
// lightmap usually uses a different tex coord set
766762
if (_img == nullptr)
767763
this->SetTextureMapImpl(this->lightMapName, type);
768764
else
769765
this->SetTextureMapDataImpl(this->lightMapName, _img, type);
770766
this->ogreDatablock->setTextureUvSource(type, this->lightMapUvSet);
771-
this->ogreDatablock->setUseEmissiveAsLightmap(true);
772767
}
773768

774769
//////////////////////////////////////////////////

0 commit comments

Comments
 (0)