Toast Engine
Loading...
Searching...
No Matches
post_process_volume.hpp
Go to the documentation of this file.
1
8
9#pragma once
10#include "volume.hpp"
11
12#include <toast/export.hpp>
14
15namespace toast {
16
32class [[ToastNode, Icon("Aperture")]] TOAST_API PostProcessVolume : public Volume {
33public:
36 PostProcessVolume() { blendDistance(1.0f); }
37
38 ~PostProcessVolume() override = default;
39
41 [[nodiscard]]
42 auto extents() const noexcept -> const glm::vec3& {
43 return m_extents;
44 }
45
46 [[nodiscard]]
47 auto isEnabled() const noexcept -> bool {
48 return m_enabled;
49 }
50
55 [[nodiscard]]
56 auto settings() const -> const renderer::PostProcessSettings&;
57
67 [[nodiscard]]
68 auto influenceAt(const glm::vec3& camera_position) const -> float;
69
73 auto evaluateTarget(const VolumeTarget& target, float weight = 1.0f) -> bool override;
74
75 void resetAccumulators() override;
76
77private:
79 [[nodiscard]]
80 auto closestPointOnBounds(glm::vec3 point) const -> glm::vec3 override;
81
82 void init();
83 void end();
84 void destroy();
85
86 [[Reflect, Name("Enabled")]]
87 bool m_enabled = true;
88
90 [[Reflect, Name("Extents"), Unit("m"), Group("Shape")]] alignas(16) glm::vec3 m_extents = glm::vec3(10.0f);
91
92 [[Reflect, Name("Bloom Threshold"), Range(0.0, 10.0), Group("Bloom")]]
93 float m_bloom_threshold = 1.0f;
94 [[Reflect, Name("Bloom Knee"), Range(0.0, 1.0), Group("Bloom")]]
95 float m_bloom_knee = 0.5f;
96 [[Reflect, Name("Bloom Filter Radius"), Range(0.0, 4.0), Group("Bloom")]]
97 float m_bloom_filter_radius = 1.0f;
98 [[Reflect, Name("Bloom Strength"), Range(0.0, 1.0), Group("Bloom")]]
99 float m_bloom_strength = 0.05f;
100
101 [[Reflect, Name("Exposure"), Range(0.0, 8.0), Group("Tonemap")]]
102 float m_exposure = 1.0f;
104 [[Reflect, Name("Tonemap Curve"), Enum("Reinhard", "ACES"), Group("Tonemap")]]
105 int32_t m_tonemap_mode = 0;
106 [[Reflect, Name("Gamma"), Range(1.0, 3.0), Group("Tonemap")]]
107 float m_gamma = 2.2f;
108 [[Reflect, Name("Contrast"), Range(0.0, 2.0), Group("Tonemap")]]
109 float m_contrast = 1.0f;
110 [[Reflect, Name("Saturation"), Range(0.0, 2.0), Group("Tonemap")]]
111 float m_saturation = 1.0f;
112 [[Reflect, Name("Vignette"), Range(0.0, 1.0), Group("Tonemap")]]
113 float m_vignette = 0.0f;
114 [[Reflect, Name("Film Grain"), Range(0.0, 1.0), Group("Tonemap")]]
115 float m_grain = 0.0f;
116
118 [[Reflect, Name("Auto Exposure"), Group("Auto Exposure")]]
119 bool m_auto_exposure = false;
121 [[Reflect, Name("Min Brightness"), Range(-16.0, 16.0), Group("Auto Exposure")]]
122 float m_auto_exposure_min = -8.0f;
123 [[Reflect, Name("Max Brightness"), Range(-16.0, 16.0), Group("Auto Exposure")]]
124 float m_auto_exposure_max = 4.0f;
126 [[Reflect, Name("Adapt Speed Up"), Range(0.0, 20.0), Group("Auto Exposure")]]
127 float m_adapt_speed_up = 3.0f;
128 [[Reflect, Name("Adapt Speed Down"), Range(0.0, 20.0), Group("Auto Exposure")]]
129 float m_adapt_speed_down = 1.0f;
130
131 [[Reflect, Name("FXAA Contrast Threshold"), Range(0.0, 0.2), Group("FXAA")]]
132 float m_fxaa_contrast_threshold = 0.0312f;
133 [[Reflect, Name("FXAA Relative Threshold"), Range(0.0, 0.5), Group("FXAA")]]
134 float m_fxaa_relative_threshold = 0.125f;
135 [[Reflect, Name("FXAA Subpixel Blending"), Range(0.0, 1.0), Group("FXAA")]]
136 float m_fxaa_subpixel_blending = 0.75f;
137
138 [[Reflect, Name("SSR Intensity"), Range(0.0, 2.0), Group("Screen Space Reflections")]]
139 float m_ssr_intensity = 1.0f;
140 [[Reflect, Name("SSR Max Roughness"), Range(0.0, 1.0), Group("Screen Space Reflections")]]
141 float m_ssr_max_roughness = 0.6f;
142 [[Reflect, Name("SSR Thickness"), Unit("m"), Range(0.01, 5.0), Group("Screen Space Reflections")]]
143 float m_ssr_thickness = 0.5f;
144 [[Reflect, Name("SSR Stride"), Unit("m"), Range(0.01, 1.0), Group("Screen Space Reflections")]]
145 float m_ssr_stride = 0.15f;
146 [[Reflect, Name("SSR Max Steps"), Range(1, 256), Group("Screen Space Reflections")]]
147 int32_t m_ssr_max_steps = 48;
148
149 [[Reflect, Name("AO Radius"), Unit("m"), Range(0.01, 10.0), Group("Ambient Occlusion")]]
150 float m_ssao_radius = 0.5f;
151 [[Reflect, Name("AO Strength"), Range(0.0, 4.0), Group("Ambient Occlusion")]]
152 float m_ssao_strength = 1.0f;
153 [[Reflect, Name("AO Range Cutoff"), Unit("m"), Range(0.01, 10.0), Group("Ambient Occlusion")]]
154 float m_ssao_range_cutoff = 1.0f;
155 [[Reflect, Name("AO Samples"), Range(1, 64), Group("Ambient Occlusion")]]
156 int32_t m_ssao_sample_count = 16;
157
162 mutable renderer::PostProcessSettings m_settings;
163
164 void syncSettings() const;
165
167 float m_influence = 0.0f;
168
169 bool m_registered_proxy = false;
170};
171
172}
A region of the world that grades the post chain while the camera is inside it.
Definition post_process_volume.hpp:32
auto extents() const noexcept -> const glm::vec3 &
Definition post_process_volume.hpp:42
PostProcessVolume()
Definition post_process_volume.hpp:36
Definition volume.hpp:27
Generic cubic volume.