17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-30 06:10:28 +01:00

Add a white balance to the tonemapping

This commit is contained in:
2026-10-27 01:40:19 +01:00
parent 82d3842495
commit ac0b4e5f15
13 changed files with 122 additions and 6 deletions

View File

@@ -132,6 +132,11 @@ glm::vec4 opengl46_exposure::tonemap_params(std::size_t const Bloomlevels) const
return gfx::exposure_settings::tonemap_params(Bloomlevels);
}
glm::vec3 opengl46_exposure::white_balance() const
{
return gfx::exposure_settings::white_balance();
}
std::string opengl46_exposure::info_times()
{
std::string text;

View File

@@ -60,6 +60,8 @@ class opengl46_exposure
opengl_texture *bloom(bloom_chain &Chain, opengl_texture &Image, gl::stream_ubo &Modelubo, gl::model_ubs &Model);
// parameters of the tonemapping (postfx_tonemapping.frag), with bloom from a chain of Bloomlevels levels (0: none)
glm::vec4 tonemap_params(std::size_t const Bloomlevels) const;
// gains of the white balance of the tonemapping (gfx.postfx.whitebalance*), 0 when off
glm::vec3 white_balance() const;
// lines for the gpu times of the debug panel
std::string info_times();
// controls of the debug window

View File

@@ -2055,7 +2055,7 @@ if (!Global.gfx_skippipeline)
}
model_ubs.param[0] = m_exposure.tonemap_params(bloomlevels);
// the dither goes to the last pass before the window: the chromatic aberration, when it follows
model_ubs.param[1] = glm::vec4{Global.gfx_postfx_chromaticaberration_enabled ? 0.f : 1.f, 0.f, 0.f, 0.f};
model_ubs.param[1] = glm::vec4{Global.gfx_postfx_chromaticaberration_enabled ? 0.f : 1.f, m_exposure.white_balance()};
model_ubo->update(model_ubs);
std::vector<opengl_texture *> tonemapinput{vp.main2_tex.get()};
if (bloomtexture != nullptr)
@@ -5864,8 +5864,9 @@ bool opengl46_renderer::Render_Preview(TAnimModel *Instance, int const Size, int
glViewport(0, 0, targetsize, targetsize);
if (!Global.gfx_shadergamma)
glEnable(GL_FRAMEBUFFER_SRGB);
// no bloom, no automatic exposure
// no bloom, no automatic exposure, no white balance
model_ubs.param[0] = glm::vec4{0.f, 0.f, 1.f, 0.f};
model_ubs.param[1].y = 0.f;
model_ubo->update(model_ubs);
m_pfx_tonemapping->apply(*m_preview.hdr_tex, m_preview.ldr_fb.get());
if (!Global.gfx_shadergamma)