Skip to content

Commit

Permalink
Fix irradiance generation in MaterialXView (#1647)
Browse files Browse the repository at this point in the history
This changelist fixes a regression to environment irradiance generation in MaterialXView, caused by a change to image caching logic for GLSL rendering in MaterialX 1.38.8.  This fix restores the ability to render environment maps that are missing their pre-generated irradiance data, with irradiance being generated on the fly via spherical harmonics.
  • Loading branch information
jstone-lucasfilm authored Jan 11, 2024
1 parent f004153 commit 8489915
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions source/MaterialXView/Viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,15 +402,15 @@ void Viewer::loadEnvironmentLight()
}

// Look for an irradiance map using an expected filename convention.
mx::ImagePtr envIrradianceMap = _imageHandler->getZeroImage();
mx::ImagePtr envIrradianceMap;
if (!_normalizeEnvironment && !_splitDirectLight)
{
mx::FilePath envIrradiancePath = _envRadianceFilename.getParentPath() / IRRADIANCE_MAP_FOLDER / _envRadianceFilename.getBaseName();
envIrradianceMap = _imageHandler->acquireImage(envIrradiancePath);
}

// If not found, then generate an irradiance map via spherical harmonics.
if (envIrradianceMap == _imageHandler->getZeroImage())
if (!envIrradianceMap || envIrradianceMap->getWidth() == 1)
{
if (_generateReferenceIrradiance)
{
Expand Down

0 comments on commit 8489915

Please sign in to comment.