Unravel Engine C++ Reference
Loading...
Searching...
No Matches
auto_exposure_component.h
Go to the documentation of this file.
1#pragma once
2
3#include <base/basetypes.hpp>
6#include <cmath>
7
8namespace unravel
9{
10
11class auto_exposure_component : public component_crtp<auto_exposure_component>
12{
13public:
14 bool enabled = true;
16
20 float contribution,
21 bool is_first)
22 {
23 if(is_first)
24 {
25 result = from;
26 return;
27 }
28 result.min_ev = std::lerp(result.min_ev, from.min_ev, contribution);
29 result.max_ev = std::lerp(result.max_ev, from.max_ev, contribution);
30 result.compensation = std::lerp(result.compensation, from.compensation, contribution);
33 result.low_percentile = std::lerp(result.low_percentile, from.low_percentile, contribution);
34 result.high_percentile = std::lerp(result.high_percentile, from.high_percentile, contribution);
35 result.metering_area = std::lerp(result.metering_area, from.metering_area, contribution);
36 // Metering mode is discrete and cannot be interpolated; the dominant volume wins.
37 if(contribution >= 0.5f)
38 {
39 result.metering_mode = from.metering_mode;
40 }
41 }
42};
43
44} // namespace unravel
static void merge_into(auto_exposure_pass::settings &result, const auto_exposure_pass::settings &from, float contribution, bool is_first)
Merges this component's settings into result. For first contribution, copies; otherwise lerps.
float high_percentile
Upper fraction kept before excluding the brightest (weighted) pixels.
float low_percentile
Fraction of the darkest (weighted) pixels excluded from the average.
exposure_metering_mode metering_mode
How pixels are spatially weighted when metering scene luminance.
float adaptation_speed_down
Time constant in seconds for the exposure to DECREASE (scene getting brighter).
float compensation
Exposure bias in EV stops applied on top of the metered result (+1 = 2x brighter).
CRTP (Curiously Recurring Template Pattern) base structure for components.
float contribution