|
49 | 49 | #include "ScreenSpaceReflection.hpp"
|
50 | 50 | #include "ScreenSpaceAmbientOcclusion.hpp"
|
51 | 51 | #include "TemporalAntiAliasing.hpp"
|
| 52 | +#include "ToneMapping.hpp" |
52 | 53 |
|
53 | 54 | #include "imgui.h"
|
54 | 55 | #include "ImGuiUtils.hpp"
|
@@ -424,12 +425,12 @@ void USDViewer::LoadStage()
|
424 | 425 |
|
425 | 426 | UpdateCamera();
|
426 | 427 |
|
427 |
| - m_PostProcessParams = {}; |
428 |
| - m_PostProcessParams.ToneMappingMode = TONE_MAPPING_MODE_UNCHARTED2; |
429 |
| - m_PostProcessParams.ConvertOutputToSRGB = m_ConvertPSOutputToGamma; |
430 |
| - m_PostProcessParams.EnableTAA = true; |
431 |
| - m_PostProcessParams.EnableBloom = true; |
432 |
| - m_PostProcessParams.SSAO.EffectRadius = std::min(SceneExtent * 0.1f, 5.f); |
| 428 | + m_PostProcessParams = {}; |
| 429 | + m_PostProcessParams.ToneMapping.iToneMappingMode = TONE_MAPPING_MODE_UNCHARTED2; |
| 430 | + m_PostProcessParams.ConvertOutputToSRGB = m_ConvertPSOutputToGamma; |
| 431 | + m_PostProcessParams.EnableTAA = true; |
| 432 | + m_PostProcessParams.EnableBloom = true; |
| 433 | + m_PostProcessParams.SSAO.EffectRadius = std::min(SceneExtent * 0.1f, 5.f); |
433 | 434 |
|
434 | 435 | const float GridScale = 1.f / std::pow(10.f, std::floor(std::log10(std::max(SceneExtent, 0.01f))));
|
435 | 436 | m_PostProcessParams.Grid.GridScale = float4{GridScale};
|
@@ -907,37 +908,17 @@ void USDViewer::UpdateUI()
|
907 | 908 |
|
908 | 909 | if (ImGui::TreeNode("Tone mapping"))
|
909 | 910 | {
|
910 |
| - { |
911 |
| - std::array<const char*, 10> ToneMappingMode; |
912 |
| - ToneMappingMode[TONE_MAPPING_MODE_NONE] = "None"; |
913 |
| - ToneMappingMode[TONE_MAPPING_MODE_EXP] = "Exp"; |
914 |
| - ToneMappingMode[TONE_MAPPING_MODE_REINHARD] = "Reinhard"; |
915 |
| - ToneMappingMode[TONE_MAPPING_MODE_REINHARD_MOD] = "Reinhard Mod"; |
916 |
| - ToneMappingMode[TONE_MAPPING_MODE_UNCHARTED2] = "Uncharted 2"; |
917 |
| - ToneMappingMode[TONE_MAPPING_FILMIC_ALU] = "Filmic ALU"; |
918 |
| - ToneMappingMode[TONE_MAPPING_LOGARITHMIC] = "Logarithmic"; |
919 |
| - ToneMappingMode[TONE_MAPPING_ADAPTIVE_LOG] = "Adaptive log"; |
920 |
| - ToneMappingMode[TONE_MAPPING_AGX] = "AgX"; |
921 |
| - ToneMappingMode[TONE_MAPPING_AGX_PUNCHY] = "AgX Punchy"; |
922 |
| - if (ImGui::Combo("Tone Mapping Mode", &m_PostProcessParams.ToneMappingMode, ToneMappingMode.data(), static_cast<int>(ToneMappingMode.size()))) |
923 |
| - UpdatePostProcessParams = true; |
924 |
| - } |
925 |
| - |
926 |
| - if (ImGui::SliderFloat("Average log lum", &m_PostProcessParams.AverageLogLum, 0.01f, 10.0f)) |
927 |
| - UpdatePostProcessParams = true; |
928 |
| - if (ImGui::SliderFloat("Middle gray", &m_PostProcessParams.MiddleGray, 0.01f, 1.0f)) |
929 |
| - UpdatePostProcessParams = true; |
930 |
| - if (ImGui::SliderFloat("White point", &m_PostProcessParams.WhitePoint, 0.1f, 20.0f)) |
| 911 | + if (ToneMappingUpdateUI(m_PostProcessParams.ToneMapping, &m_PostProcessParams.AverageLogLum)) |
931 | 912 | UpdatePostProcessParams = true;
|
932 | 913 |
|
| 914 | + ImGui::Spacing(); |
933 | 915 | if (ImGui::Button("Reset"))
|
934 | 916 | {
|
935 | 917 | static constexpr USD::HnPostProcessTaskParams DefaultParams;
|
936 |
| - m_PostProcessParams.ToneMappingMode = TONE_MAPPING_MODE_UNCHARTED2; |
937 |
| - m_PostProcessParams.AverageLogLum = DefaultParams.AverageLogLum; |
938 |
| - m_PostProcessParams.MiddleGray = DefaultParams.MiddleGray; |
939 |
| - m_PostProcessParams.WhitePoint = DefaultParams.WhitePoint; |
940 |
| - UpdatePostProcessParams = true; |
| 918 | + |
| 919 | + m_PostProcessParams.ToneMapping = DefaultParams.ToneMapping; |
| 920 | + m_PostProcessParams.AverageLogLum = DefaultParams.AverageLogLum; |
| 921 | + UpdatePostProcessParams = true; |
941 | 922 | }
|
942 | 923 |
|
943 | 924 | ImGui::TreePop();
|
|
0 commit comments