Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion Components/Hlms/Pbs/src/OgreHlmsPbs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1848,7 +1848,21 @@ namespace Ogre

const RenderSystemCapabilities *capabilities = mRenderSystem->getCapabilities();
setProperty( kNoTid, PbsProperty::HwGammaRead, capabilities->hasCapability( RSC_HW_GAMMA ) );
setProperty( kNoTid, PbsProperty::HwGammaWrite, 1 );
{
// Honour non-sRGB colour targets: without hardware gamma on write the
// shader must gamma-encode the linear lighting result itself (the
// !hw_gamma_write template path), otherwise PBS output lands raw in a
// UNORM target and displays crushed/dark.
bool hwGammaWrite = true;
const RenderPassDescriptor *colourPassDesc = mRenderSystem->getCurrentPassDescriptor();
if( colourPassDesc && colourPassDesc->getNumColourEntries() > 0u &&
colourPassDesc->mColour[0].texture )
{
hwGammaWrite =
PixelFormatGpuUtils::isSRgb( colourPassDesc->mColour[0].texture->getPixelFormat() );
}
setProperty( kNoTid, PbsProperty::HwGammaWrite, hwGammaWrite ? 1 : 0 );
}
retVal.setProperties = mT[kNoTid].setProperties;

CamerasInProgress cameras = sceneManager->getCamerasInProgress();
Expand Down
Loading