Hi guys.
so I'm currently having a minor issue here. I generate my luminance map, then attempt to adapt it and then use it for other purposes, such as the bloom pass. But the problem is that theres no visible adaptation for some reason. Someone might find the shader code familiar, well thats because I based it on a sample from MJP (Thanks btw. Great samples you have there.)
Logic in the high level render when rendering & adapting the luminance map, DX11 is my own small wrapper, it should work as intended:
void CE_NAMESPACE::CEPostLuminance::Render(DX11 *pD3D11, float dTime, DX11Resource *p, DX11RenderTarget *pOut)
{
// Set DTIME
Buffer.fTimeDelta = dTime;
// Map Data
pD3D11->BufferConstantMap(m_vBuffers[0]->p, &Buffer);
// Upload the data
SetData(pD3D11);
// Calculate new luminance
{
pD3D11->RTVSet(&m_pLum->pRTV, 1, false);
// Bind Shader
ApplyPost(pD3D11, &m_pPasses[0]);
// Upload Texture
pD3D11->Bind(p, 0);
// Render the quad
pD3D11->Render(3, 0);
// Unbind
pD3D11->Unbind(PS, 0);
}
// Adapt it, no effect
{
pD3D11->RTVSet(&m_pTemp->pRTV, 1, false);
// Bind Shader
ApplyPost(pD3D11, &m_pPasses[1]);
// Upload Texture
pD3D11->Bind(m_pLumLast, 1);
// Upload Texture
pD3D11->Bind(m_pLum, 2);
// Render the quad
pD3D11->Render(3, 0);
}
// Swappy Times!
m_pLumLast = m_pLum;
m_pLum = m_pTemp;
m_pTemp = m_pLumLast;
.... Some more unrelated stuff
The actual shader code for the adaptation: ( Tau: 1.25f )
...
Texture2D<float> lum_old : register(t1);
Texture2D<float> lum : register(t2);
...
float AdaptLuminancePS(VS_Output input) : SV_Target
{
float lastLum = exp(lum_old.Sample(ss, input.Tex));
float currentLum = lum.Sample(ss, input.Tex);
// Adapt the luminance using Pattanaik's technique
float adaptedLum = lastLum + (currentLum - lastLum) * (1 - exp(-TimeDelta * Tau));
return log(adaptedLum);
}
The mistake is most likely obvious but theres no change in the luminance map according to my eyes.
Thank you for your time. I appreciate it.
-MIGI0027