GPUOpen-LibrariesAndSDKs / FidelityFX-SDK

The main repository for the FidelityFX SDK.
Other
835 stars 80 forks source link

Understanding the FSR 3 exposure #60

Open StudenteChamp2 opened 5 months ago

StudenteChamp2 commented 5 months ago

I am integrating FSR3 support in our software: https://gpuopen.com/fidelityfx-super-resolution-3/

The documentation says an exposure should be provided when evaluating super sampling, but it is set to nullptr. What is the meaning of that exposure? Is it a 2D texture that should contain the tone mapping exposure?

Exposure

Thanks for helping!

VeganPower commented 5 months ago

The exposure is a 1x1 float texture with a scale value. The scale value represent a factor to expose the image. If you pass null you should set the flag FFX_FSR3_ENABLE_AUTO_EXPOSURE. In this case the exposure is computed internally.

If you take a capture you will notice that the internal exposure texture is actually a 1x1 float2 texture. The red channel is the exposure factor, and the green channel is the log of the average luminosity used to compute the exposure.

Hope this help.

StudenteChamp2 commented 4 months ago

Hello Vegan,

Thank you very much for helping. You say "The green channel is the log of the average luminosity used to compute the exposure.". Where did you get that information?

VeganPower commented 4 months ago

From this line of code here: https://github.com/GPUOpen-LibrariesAndSDKs/FidelityFX-SDK/blob/release-FSR3-3.0.4/sdk/include/FidelityFX/gpu/fsr3upscaler/ffx_fsr3upscaler_compute_luminance_pyramid.h#L55

Here the log of the texture is computed, the reduction does the average of the logs, and in line 85 the shader store the current average on the green channel. Also is a very common technique to compute the luminosity.