Jump to content
  • Advertisement
Sign in to follow this  

MJP's AutoExposureCS

This topic is 2345 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm looking at this sample where the bloom is created:

void PostProcessor::Bloom(ID3D11ShaderResourceView* input, TempRenderTarget*& bloomTarget)
// Downscale
TempRenderTarget* bloomSrc = GetTempRenderTarget(inputWidth, inputHeight, DXGI_FORMAT_R11G11B10_FLOAT);
PostProcess(bloomThreshold, L"Bloom Threshold");
TempRenderTarget* downscale1 = GetTempRenderTarget(inputWidth / 2, inputHeight / 2, DXGI_FORMAT_R16G16B16A16_FLOAT);
PostProcess(bloomSrc->SRView, downscale1->RTView, scale, L"Bloom Downscale");
bloomSrc->InUse = false;
TempRenderTarget* downscale2 = GetTempRenderTarget(inputWidth / 4, inputHeight / 4, DXGI_FORMAT_R16G16B16A16_FLOAT);
PostProcess(downscale1->SRView, downscale2->RTView, scale, L"Bloom Downscale");
TempRenderTarget* downscale3 = GetTempRenderTarget(inputWidth / 8, inputHeight / 8, DXGI_FORMAT_R16G16B16A16_FLOAT);
PostProcess(downscale2->SRView, downscale3->RTView, scale, L"Bloom Downscale");

How come the format DXGI_FORMAT_R11G11B10_FLOAT is used for the bright texture, but then the precision is increased to DXGI_FORMAT_R16G16B16A16_FLOAT for the downsampling?

Does the bloom texture even need to be HDR? Since it is added into the final tone mapping pass (whose target is a LDR target), it doesn't seem the HDR will do anything extra.

Share this post

Link to post
Share on other sites
I honestly don't remember why I used that format. It probably won't make much of a difference between R11G11B10 and R16G16B16A16.

Depending on how you implement your bloom effect you might want and HDR target so that you don't clip values at 1.0 before you blur it. This way you retain some of the HDR color information when you blur it, rather than always blurring out to white. But again it depends on how you implement it. Bloom is pretty huge hack anyway, so there's no real "right" way to do it.

Share this post

Link to post
Share on other sites
Cool, I was just wondering if there was something else I was missing.

Another question, after the blur, the sample code does an "upscale"

// Blur it
for (UINT_PTR i = 0; i < 4; ++i)
TempRenderTarget* blurTemp = GetTempRenderTarget(inputWidth / 8, inputHeight / 8, DXGI_FORMAT_R16G16B16A16_FLOAT);
PostProcess(downscale3->SRView, blurTemp->RTView, bloomBlurH, L"Horizontal Bloom Blur");
PostProcess(blurTemp->SRView, downscale3->RTView, bloomBlurV, L"Vertical Bloom Blur");
blurTemp->InUse = false;
PostProcess(downscale3->SRView, downscale2->RTView, scale, L"Bloom Upscale");
downscale3->InUse = false;
PostProcess(downscale2->SRView, downscale1->RTView, scale, L"Bloom Upscale");
downscale2->InUse = false;
bloomTarget = downscale1;

I don't understand why this is necessary. I did a 1D case on paper:

Upscaling from 2x2->4x4->8x8 using bilinear filtering


Upscaling from 2x2->8x8 using bilinear filtering

and I got the same result.

So why upscale? Why not just stretch the blurred downscaled bloom texture over the screen in the final tonemap pass and use the blinear filtering when sampling the bloom texture?

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!