Unravel Engine C++ Reference
Loading...
Searching...
No Matches
taa_component.cpp
Go to the documentation of this file.
1#include "taa_component.hpp"
5
8
9namespace unravel
10{
11
13{
14 entt::meta_factory<taa_jitter_mode>{}
15 .type("taa_jitter_mode"_hs)
17 entt::attribute{"name", "taa_jitter_mode"},
18 entt::attribute{"pretty_name", "TAA Jitter Mode"},
19 })
20 .data<taa_jitter_mode::progressive_golden>("progressive_golden"_hs)
22 entt::attribute{"name", "progressive_golden"},
23 entt::attribute{"pretty_name", "Progressive Golden"},
24 })
25 .data<taa_jitter_mode::halton_2_3>("halton_2_3"_hs)
27 entt::attribute{"name", "halton_2_3"},
28 entt::attribute{"pretty_name", "Halton 2,3"},
29 })
30 .data<taa_jitter_mode::r2_low_discrepancy>("r2_low_discrepancy"_hs)
32 entt::attribute{"name", "r2_low_discrepancy"},
33 entt::attribute{"pretty_name", "R2 Low Discrepancy"},
34 })
35 .data<taa_jitter_mode::msaa_2_rotating>("msaa_2_rotating"_hs)
37 entt::attribute{"name", "msaa_2_rotating"},
38 entt::attribute{"pretty_name", "MSAA 2 Rotating"},
39 })
40 .data<taa_jitter_mode::msaa_3_rotating>("msaa_3_rotating"_hs)
42 entt::attribute{"name", "msaa_3_rotating"},
43 entt::attribute{"pretty_name", "MSAA 3 Rotating"},
44 })
45 .data<taa_jitter_mode::msaa_4_rotating>("msaa_4_rotating"_hs)
47 entt::attribute{"name", "msaa_4_rotating"},
48 entt::attribute{"pretty_name", "MSAA 4 Rotating"},
49 });
50}
51
53{
54 entt::meta_factory<taa_pass::settings>{}
55 .type("taa_settings"_hs)
57 entt::attribute{"name", "taa_settings"},
58 entt::attribute{"pretty_name", "Temporal AA Settings"},
59 })
60 .data<&taa_pass::settings::temporal_sample_count>("temporal_sample_count"_hs)
62 entt::attribute{"name", "temporal_sample_count"},
63 entt::attribute{"pretty_name", "Temporal Samples"},
64 entt::attribute{"min", 2},
65 entt::attribute{"max", 16},
66 entt::attribute{"tooltip", "When >1, enables subpixel jitter (full render frame index). Stored count is for UI / future tuning."},
67 })
68 .data<&taa_pass::settings::jitter_mode>("jitter_mode"_hs)
70 entt::attribute{"name", "jitter_mode"},
71 entt::attribute{"pretty_name", "Jitter Sequence"},
72 entt::attribute{"tooltip", "Which subpixel pattern the camera uses for TAA each frame."},
73 })
74 .data<&taa_pass::settings::jitter_amplitude>("jitter_amplitude"_hs)
76 entt::attribute{"name", "jitter_amplitude"},
77 entt::attribute{"pretty_name", "Jitter Amplitude"},
78 entt::attribute{"min", 0.0f},
79 entt::attribute{"max", 1.5f},
80 entt::attribute{"step", 0.05f},
81 entt::attribute{"tooltip", "Scales subpixel camera jitter; lower reduces whole-screen shake (1 = strongest)."},
82 })
83 .data<&taa_pass::settings::jitter_temporal_phase_scale>("jitter_temporal_phase_scale"_hs)
85 entt::attribute{"name", "jitter_temporal_phase_scale"},
86 entt::attribute{"pretty_name", "Jitter Temporal Phase Scale"},
87 entt::attribute{"min", 0.03f},
88 entt::attribute{"max", 1.5f},
89 entt::attribute{"step", 0.05f},
90 entt::attribute{"tooltip", "Golden/Halton/R2 only: lower = smaller per-frame jitter steps, easier history tracking (1 = legacy speed)."},
91 })
92 .data<&taa_pass::settings::history_blend>("history_blend"_hs)
94 entt::attribute{"name", "history_blend"},
95 entt::attribute{"pretty_name", "History blend"},
96 entt::attribute{"min", 0.0f},
97 entt::attribute{"max", 1.0f},
98 entt::attribute{"step", 0.01f},
99 entt::attribute{"tooltip", "Blend toward reprojected history when valid (higher = more stable, more blur)."},
100 })
101 .data<&taa_pass::settings::sharpen>("sharpen"_hs)
103 entt::attribute{"name", "sharpen"},
104 entt::attribute{"pretty_name", "Sharpen"},
105 entt::attribute{"min", 0.0f},
106 entt::attribute{"max", 2.0f},
107 entt::attribute{"step", 0.05f},
108 entt::attribute{"tooltip", "Unsharp response vs current neighborhood (0 = off)."},
109 })
110 .data<&taa_pass::settings::depth_reject_scale>("depth_reject_scale"_hs)
112 entt::attribute{"name", "depth_reject_scale"},
113 entt::attribute{"pretty_name", "Depth Reject Scale"},
114 entt::attribute{"min", 0.01f},
115 entt::attribute{"max", 4.0f},
116 entt::attribute{"step", 0.05f},
117 entt::attribute{"tooltip", "Scales depth disocclusion rejection (higher = stricter)."},
118 })
119 .data<&taa_pass::settings::variance_clip_scale>("variance_clip_scale"_hs)
121 entt::attribute{"name", "variance_clip_scale"},
122 entt::attribute{"pretty_name", "Variance Clip"},
123 entt::attribute{"min", 0.5f},
124 entt::attribute{"max", 2.5f},
125 entt::attribute{"step", 0.05f},
126 entt::attribute{"tooltip", "RGB variance clip width in std-devs (wider = less ghosting, slightly softer)."},
127 });
128}
129
131{
132 try_save(ar, ser20::make_nvp("temporal_sample_count", obj.temporal_sample_count));
133 try_save(ar, ser20::make_nvp("jitter_mode", obj.jitter_mode));
134 try_save(ar, ser20::make_nvp("jitter_amplitude", obj.jitter_amplitude));
135 try_save(ar, ser20::make_nvp("jitter_temporal_phase_scale", obj.jitter_temporal_phase_scale));
136 try_save(ar, ser20::make_nvp("history_blend", obj.history_blend));
137 try_save(ar, ser20::make_nvp("sharpen", obj.sharpen));
138 try_save(ar, ser20::make_nvp("depth_reject_scale", obj.depth_reject_scale));
139 try_save(ar, ser20::make_nvp("variance_clip_scale", obj.variance_clip_scale));
140}
143
145{
146 try_load(ar, ser20::make_nvp("temporal_sample_count", obj.temporal_sample_count));
147 try_load(ar, ser20::make_nvp("jitter_mode", obj.jitter_mode));
148 try_load(ar, ser20::make_nvp("jitter_amplitude", obj.jitter_amplitude));
149 try_load(ar, ser20::make_nvp("jitter_temporal_phase_scale", obj.jitter_temporal_phase_scale));
150 try_load(ar, ser20::make_nvp("history_blend", obj.history_blend));
151 try_load(ar, ser20::make_nvp("sharpen", obj.sharpen));
152 try_load(ar, ser20::make_nvp("depth_reject_scale", obj.depth_reject_scale));
153 try_load(ar, ser20::make_nvp("variance_clip_scale", obj.variance_clip_scale));
154}
157
159{
160 entt::meta_factory<taa_component>{}
161 .type("taa_component"_hs)
163 entt::attribute{"name", "taa_component"},
164 entt::attribute{"category", "RENDERING"},
165 entt::attribute{"pretty_name", "Temporal AA"},
166 })
167 .func<&component_meta<taa_component>::exists>("component_exists"_hs)
168 .func<&component_meta<taa_component>::add>("component_add"_hs)
169 .func<&component_meta<taa_component>::save>("component_save"_hs)
170 .func<&component_meta<taa_component>::load>("component_load"_hs)
171 .func<&component_meta<taa_component>::remove>("component_remove"_hs)
172 .data<&taa_component::enabled>("enabled"_hs)
173 .custom<entt::attributes>(entt::attributes{
174 entt::attribute{"name", "enabled"},
175 entt::attribute{"pretty_name", "Enabled"},
176 entt::attribute{"tooltip", "HDR temporal anti-aliasing (before tonemap); disables FXAA when on"},
177 })
178 .data<&taa_component::settings>("settings"_hs)
180 entt::attribute{"name", "settings"},
181 entt::attribute{"pretty_name", "Settings"},
182 entt::attribute{"flattable", true},
183 });
184}
185
187{
188 try_save(ar, ser20::make_nvp("enabled", obj.enabled));
189 try_save(ar, ser20::make_nvp("settings", obj.settings));
190}
193
195{
196 try_load(ar, ser20::make_nvp("enabled", obj.enabled));
197 try_load(ar, ser20::make_nvp("settings", obj.settings));
198 try_load(ar, ser20::make_nvp("temporal_sample_count", obj.settings.temporal_sample_count));
199 try_load(ar, ser20::make_nvp("history_blend", obj.settings.history_blend));
200 try_load(ar, ser20::make_nvp("sharpen", obj.settings.sharpen));
201 try_load(ar, ser20::make_nvp("depth_reject_scale", obj.settings.depth_reject_scale));
202 try_load(ar, ser20::make_nvp("variance_clip_scale", obj.settings.variance_clip_scale));
203 try_load(ar, ser20::make_nvp("jitter_mode", obj.settings.jitter_mode));
204 try_load(ar, ser20::make_nvp("jitter_amplitude", obj.settings.jitter_amplitude));
205 try_load(ar, ser20::make_nvp("jitter_temporal_phase_scale", obj.settings.jitter_temporal_phase_scale));
206}
209
210} // namespace unravel
Temporal anti-aliasing (HDR, before tonemap). Mutually exclusive with FXAA when enabled.
attributes::value_type attribute
Definition reflection.h:19
std::map< std::string, meta_any > attributes
Definition reflection.h:18
BinaryInputArchive iarchive_binary_t
simd::JSONOutputArchive oarchive_associative_t
BinaryOutputArchive oarchive_binary_t
simd::JSONInputArchive iarchive_associative_t
taa_jitter_mode
Subpixel jitter sequence for temporal AA (see camera::set_aa_data).
Definition camera.h:25
#define REFLECT(cls)
Definition reflection.h:149
#define REFLECT_INLINE(cls)
Definition reflection.h:144
#define SAVE_INSTANTIATE(cls, Archive)
#define LOAD(cls)
auto try_save(Archive &ar, ser20::NameValuePair< T > &&t, const hpp::source_location &loc=hpp::source_location::current()) -> bool
#define LOAD_INSTANTIATE(cls, Archive)
#define SAVE(cls)
#define LOAD_INLINE(cls)
#define SAVE_INLINE(cls)
auto try_load(Archive &ar, ser20::NameValuePair< T > &&t, const hpp::source_location &loc=hpp::source_location::current()) -> bool