1 | //************************************ bs::framework - Copyright 2018 Marko Pintera **************************************// |
2 | //*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********// |
3 | #pragma once |
4 | |
5 | #include "BsCorePrerequisites.h" |
6 | #include "Reflection/BsIReflectable.h" |
7 | #include "Math/BsVector3.h" |
8 | #include "Image/BsColor.h" |
9 | #include <cfloat> |
10 | |
11 | namespace bs |
12 | { |
13 | /** @addtogroup Renderer |
14 | * @{ |
15 | */ |
16 | |
17 | /** Settings that control automatic exposure (eye adaptation) post-process. */ |
18 | struct BS_CORE_EXPORT BS_SCRIPT_EXPORT(m:Rendering) AutoExposureSettings : public IReflectable |
19 | { |
20 | BS_SCRIPT_EXPORT() |
21 | AutoExposureSettings() = default; |
22 | |
23 | /** |
24 | * Determines minimum luminance value in the eye adaptation histogram. The histogram is used for calculating the |
25 | * average brightness of the scene. Any luminance value below this value will not be included in the histogram and |
26 | * ignored in scene brightness calculations. In log2 units (-8 = 1/256). In the range [-16, 0]. |
27 | */ |
28 | BS_SCRIPT_EXPORT(range:[-16,0],slider) |
29 | float histogramLog2Min = -8.0f; |
30 | |
31 | /** |
32 | * Determines maximum luminance value in the eye adaptation histogram. The histogram is used for calculating the |
33 | * average brightness of the scene. Any luminance value above this value will not be included in the histogram and |
34 | * ignored in scene brightness calculations. In log2 units (4 = 16). In the range [0, 16]. |
35 | */ |
36 | BS_SCRIPT_EXPORT(range:[0,16],slider) |
37 | float histogramLog2Max = 4.0f; |
38 | |
39 | /** |
40 | * Percentage below which to ignore values in the eye adaptation histogram. The histogram is used for calculating |
41 | * the average brightness of the scene. Total luminance in the histogram will be summed up and multiplied by this |
42 | * value to calculate minimal luminance. Luminance values below the minimal luminance will be ignored and not used |
43 | * in scene brightness calculations. This allows you to remove outliers on the lower end of the histogram (for |
44 | * example a few very dark pixels in an otherwise bright image). In range [0.0f, 1.0f]. |
45 | */ |
46 | BS_SCRIPT_EXPORT(range:[0,1],slider) |
47 | float histogramPctLow = 0.8f; |
48 | |
49 | /** |
50 | * Percentage above which to ignore values in the eye adaptation histogram. The histogram is used for calculating |
51 | * the average brightness of the scene. Total luminance in the histogram will be summed up and multiplied by this |
52 | * value to calculate maximum luminance. Luminance values above the maximum luminance will be ignored and not used |
53 | * in scene brightness calculations. This allows you to remove outliers on the high end of the histogram (for |
54 | * example a few very bright pixels). In range [0.0f, 1.0f]. |
55 | */ |
56 | BS_SCRIPT_EXPORT(range:[0,1],slider) |
57 | float histogramPctHigh = 0.985f; |
58 | |
59 | /** |
60 | * Clamps the minimum eye adaptation scale to this value. This allows you to limit eye adaptation so that exposure |
61 | * is never too high (for example when in a very dark room you probably do not want the exposure to be so high that |
62 | * everything is still visible). In range [0.0f, 10.0f]. |
63 | */ |
64 | BS_SCRIPT_EXPORT(range:[0,10],slider) |
65 | float minEyeAdaptation = 0.003f; |
66 | |
67 | /** |
68 | * Clamps the maximum eye adaptation scale to this value. This allows you to limit eye adaptation so that exposure |
69 | * is never too low (for example when looking at a very bright light source you probably don't want the exposure to |
70 | * be so low that the rest of the scene is all white (overexposed). In range [0.0f, 10.0f]. |
71 | */ |
72 | BS_SCRIPT_EXPORT(range:[0,10],slider) |
73 | float maxEyeAdaptation = 2.0f; |
74 | |
75 | /** |
76 | * Determines how quickly does the eye adaptation adjust to larger values. This affects how quickly does the |
77 | * automatic exposure changes when the scene brightness increases. In range [0.01f, 20.0f]. |
78 | */ |
79 | BS_SCRIPT_EXPORT(range:[0.01,20],slider) |
80 | float eyeAdaptationSpeedUp = 3.0f; |
81 | |
82 | /** |
83 | * Determines how quickly does the eye adaptation adjust to smaller values. This affects how quickly does the |
84 | * automatic exposure changes when the scene brightness decreases. In range [0.01f, 20.0f]. |
85 | */ |
86 | BS_SCRIPT_EXPORT(range:[0.01,20],slider) |
87 | float eyeAdaptationSpeedDown = 3.0f; |
88 | |
89 | /************************************************************************/ |
90 | /* RTTI */ |
91 | /************************************************************************/ |
92 | |
93 | /** Enumerates all the fields in the type and executes the specified processor action for each field. */ |
94 | template<class P> |
95 | void rttiEnumFields(P processor); |
96 | public: |
97 | friend class AutoExposureSettingsRTTI; |
98 | static RTTITypeBase* getRTTIStatic(); |
99 | RTTITypeBase* getRTTI() const override; |
100 | }; |
101 | |
102 | /** Settings that control tonemap post-process. */ |
103 | struct BS_CORE_EXPORT BS_SCRIPT_EXPORT(m:Rendering) TonemappingSettings : public IReflectable |
104 | { |
105 | BS_SCRIPT_EXPORT() |
106 | TonemappingSettings() = default; |
107 | |
108 | /** |
109 | * Controls the shoulder (upper non-linear) section of the filmic curve used for tonemapping. Mostly affects bright |
110 | * areas of the image and allows you to reduce over-exposure. |
111 | */ |
112 | BS_SCRIPT_EXPORT() |
113 | float filmicCurveShoulderStrength = 0.15f; |
114 | |
115 | /** |
116 | * Controls the linear (middle) section of the filmic curve used for tonemapping. Mostly affects mid-range areas of |
117 | * the image. |
118 | */ |
119 | BS_SCRIPT_EXPORT() |
120 | float filmicCurveLinearStrength = 0.5f; |
121 | |
122 | /** |
123 | * Controls the linear (middle) section of the filmic curve used for tonemapping. Mostly affects mid-range areas of |
124 | * the image and allows you to control how quickly does the curve climb. |
125 | */ |
126 | BS_SCRIPT_EXPORT() |
127 | float filmicCurveLinearAngle = 0.1f; |
128 | |
129 | /** |
130 | * Controls the toe (lower non-linear) section of the filmic curve used for tonemapping. Mostly affects dark areas |
131 | * of the image and allows you to reduce under-exposure. |
132 | */ |
133 | BS_SCRIPT_EXPORT() |
134 | float filmicCurveToeStrength = 0.2f; |
135 | |
136 | /** Controls the toe (lower non-linear) section of the filmic curve. used for tonemapping. Affects low-range. */ |
137 | BS_SCRIPT_EXPORT() |
138 | float filmicCurveToeNumerator = 0.02f; |
139 | |
140 | /** Controls the toe (lower non-linear) section of the filmic curve used for tonemapping. Affects low-range. */ |
141 | BS_SCRIPT_EXPORT() |
142 | float filmicCurveToeDenominator = 0.3f; |
143 | |
144 | /** Controls the white point of the filmic curve used for tonemapping. Affects the entire curve. */ |
145 | BS_SCRIPT_EXPORT() |
146 | float filmicCurveLinearWhitePoint = 11.2f; |
147 | |
148 | /************************************************************************/ |
149 | /* RTTI */ |
150 | /************************************************************************/ |
151 | |
152 | /** Enumerates all the fields in the type and executes the specified processor action for each field. */ |
153 | template<class P> |
154 | void rttiEnumFields(P processor); |
155 | public: |
156 | friend class TonemappingSettingsRTTI; |
157 | static RTTITypeBase* getRTTIStatic(); |
158 | RTTITypeBase* getRTTI() const override; |
159 | }; |
160 | |
161 | /** Settings that control white balance post-process. */ |
162 | struct BS_CORE_EXPORT BS_SCRIPT_EXPORT(m:Rendering) WhiteBalanceSettings : public IReflectable |
163 | { |
164 | BS_SCRIPT_EXPORT() |
165 | WhiteBalanceSettings() = default; |
166 | |
167 | /** |
168 | * Temperature used for white balancing, in Kelvins. |
169 | * |
170 | * Moves along the Planckian locus. In range [1500.0f, 15000.0f]. |
171 | */ |
172 | BS_SCRIPT_EXPORT(range:[1500,15000],slider) |
173 | float temperature = 6500.0f; |
174 | |
175 | /** |
176 | * Additional tint to be applied during white balancing. Can be used to further tweak the white balancing effect by |
177 | * modifying the tint of the light. The tint is chosen on the Planckian locus isothermal, depending on the light |
178 | * temperature specified by #temperature. |
179 | * |
180 | * In range [-1.0f, 1.0f]. |
181 | */ |
182 | BS_SCRIPT_EXPORT(range:[-1,1],slider) |
183 | float tint = 0.0f; |
184 | |
185 | /************************************************************************/ |
186 | /* RTTI */ |
187 | /************************************************************************/ |
188 | |
189 | /** Enumerates all the fields in the type and executes the specified processor action for each field. */ |
190 | template<class P> |
191 | void rttiEnumFields(P processor); |
192 | public: |
193 | friend class WhiteBalanceSettingsRTTI; |
194 | static RTTITypeBase* getRTTIStatic(); |
195 | RTTITypeBase* getRTTI() const override; |
196 | }; |
197 | |
198 | /** Settings that control color grading post-process. */ |
199 | struct BS_CORE_EXPORT BS_SCRIPT_EXPORT() ColorGradingSettings : public IReflectable |
200 | { |
201 | ColorGradingSettings() = default; |
202 | |
203 | /** |
204 | * Saturation to be applied during color grading. Larger values increase vibrancy of the image. |
205 | * In range [0.0f, 2.0f]. |
206 | */ |
207 | BS_SCRIPT_EXPORT() |
208 | Vector3 saturation = Vector3::ONE; |
209 | |
210 | /** |
211 | * Contrast to be applied during color grading. Larger values increase difference between light and dark areas of |
212 | * the image. In range [0.0f, 2.0f]. |
213 | */ |
214 | BS_SCRIPT_EXPORT() |
215 | Vector3 contrast = Vector3::ONE; |
216 | |
217 | /** |
218 | * Gain to be applied during color grading. Simply increases all color values by an equal scale. |
219 | * In range [0.0f, 2.0f]. |
220 | */ |
221 | BS_SCRIPT_EXPORT() |
222 | Vector3 gain = Vector3::ONE; |
223 | |
224 | /** |
225 | * Gain to be applied during color grading. Simply offsets all color values by an equal amount. |
226 | * In range [-1.0f, 1.0f]. |
227 | */ |
228 | BS_SCRIPT_EXPORT() |
229 | Vector3 offset = Vector3::ZERO; |
230 | |
231 | /************************************************************************/ |
232 | /* RTTI */ |
233 | /************************************************************************/ |
234 | |
235 | /** Enumerates all the fields in the type and executes the specified processor action for each field. */ |
236 | template<class P> |
237 | void rttiEnumFields(P processor); |
238 | public: |
239 | friend class ColorGradingSettingsRTTI; |
240 | static RTTITypeBase* getRTTIStatic(); |
241 | RTTITypeBase* getRTTI() const override; |
242 | }; |
243 | |
244 | /** Settings that control screen space ambient occlusion. */ |
245 | struct BS_CORE_EXPORT BS_SCRIPT_EXPORT(m:Rendering) AmbientOcclusionSettings : public IReflectable |
246 | { |
247 | BS_SCRIPT_EXPORT() |
248 | AmbientOcclusionSettings() = default; |
249 | |
250 | /** Enables or disabled the screen space ambient occlusion effect. */ |
251 | BS_SCRIPT_EXPORT() |
252 | bool enabled = true; |
253 | |
254 | /** |
255 | * Radius (in world space, in meters) over which occluders are searched for. Smaller radius ensures better sampling |
256 | * precision but can miss occluders. Larger radius ensures far away occluders are considered but can yield lower |
257 | * quality or noise because of low sampling precision. Usually best to keep at around a meter, valid range |
258 | * is roughly [0.05, 5.0]. |
259 | */ |
260 | BS_SCRIPT_EXPORT(range:[0.05,5],slider) |
261 | float radius = 1.5f; |
262 | |
263 | /** |
264 | * Bias used to reduce false occlusion artifacts. Higher values reduce the amount of artifacts but will cause |
265 | * details to be lost in areas where occlusion isn't high. Value is in millimeters. Usually best to keep at a few |
266 | * dozen millimeters, valid range is roughly [0, 200]. |
267 | */ |
268 | BS_SCRIPT_EXPORT(range:[0,200],slider) |
269 | float bias = 1.0f; |
270 | |
271 | /** |
272 | * Distance (in view space, in meters) after which AO starts fading out. The fade process will happen over the |
273 | * range as specified by @p fadeRange. |
274 | */ |
275 | BS_SCRIPT_EXPORT() |
276 | float fadeDistance = 500.0f; |
277 | |
278 | /** |
279 | * Range (in view space, in meters) in which AO fades out from 100% to 0%. AO starts fading out after the distance |
280 | * specified in @p fadeDistance. |
281 | */ |
282 | BS_SCRIPT_EXPORT() |
283 | float fadeRange = 50.0f; |
284 | |
285 | /** |
286 | * Linearly scales the intensity of the AO effect. Values less than 1 make the AO effect less pronounced, and vice |
287 | * versa. Valid range is roughly [0.2, 2]. |
288 | */ |
289 | BS_SCRIPT_EXPORT(range:[0.2,2],slider) |
290 | float intensity = 1.0f; |
291 | |
292 | /** |
293 | * Controls how quickly does the AO darkening effect increase with higher occlusion percent. This is a non-linear |
294 | * control and will cause the darkening to ramp up exponentially. Valid range is roughly [1, 4], where 1 means no |
295 | * extra darkening will occur. |
296 | */ |
297 | BS_SCRIPT_EXPORT(range:[1,4],slider) |
298 | float power = 4.0f; |
299 | |
300 | /** |
301 | * Quality level of generated ambient occlusion. In range [0, 4]. Higher levels yield higher quality AO at the cost |
302 | * of performance. |
303 | */ |
304 | BS_SCRIPT_EXPORT(range:[0,4],slider) |
305 | UINT32 quality = 3; |
306 | |
307 | /************************************************************************/ |
308 | /* RTTI */ |
309 | /************************************************************************/ |
310 | |
311 | /** Enumerates all the fields in the type and executes the specified processor action for each field. */ |
312 | template<class P> |
313 | void rttiEnumFields(P processor); |
314 | public: |
315 | friend class AmbientOcclusionSettingsRTTI; |
316 | static RTTITypeBase* getRTTIStatic(); |
317 | RTTITypeBase* getRTTI() const override; |
318 | }; |
319 | |
320 | /** Settings that control the depth-of-field effect. */ |
321 | struct BS_CORE_EXPORT BS_SCRIPT_EXPORT() DepthOfFieldSettings : public IReflectable |
322 | { |
323 | BS_SCRIPT_EXPORT() |
324 | DepthOfFieldSettings() = default; |
325 | |
326 | /** Enables or disables the depth of field effect. */ |
327 | BS_SCRIPT_EXPORT() |
328 | bool enabled = false; |
329 | |
330 | /** |
331 | * Distance from the camera at which the focal plane is located in. Objects at this distance will be fully in focus. |
332 | */ |
333 | BS_SCRIPT_EXPORT() |
334 | float focalDistance = 0.75f; |
335 | |
336 | /** |
337 | * Range within which the objects remain fully in focus. This range is applied relative to the focal distance. |
338 | * Only relevant if Gaussian depth of field is used as other methods don't use a constant in-focus range. |
339 | */ |
340 | BS_SCRIPT_EXPORT() |
341 | float focalRange = 0.75f; |
342 | |
343 | /** |
344 | * Determines the size of the range within which objects transition from focused to fully unfocused, at the near |
345 | * plane. Only relevant for Gaussian depth of field. |
346 | */ |
347 | BS_SCRIPT_EXPORT() |
348 | float nearTransitionRange = 0.25f; |
349 | |
350 | /** |
351 | * Determines the size of the range within which objects transition from focused to fully unfocused, at the far |
352 | * plane. Only relevant for Gaussian depth of field. |
353 | */ |
354 | BS_SCRIPT_EXPORT() |
355 | float farTransitionRange = 0.25f; |
356 | |
357 | /** |
358 | * Determines the amount of blur to apply to fully unfocused objects that are closer to camera than the in-focus |
359 | * zone. Set to zero to disable near-field blur. Only relevant for Gaussian depth of field. |
360 | */ |
361 | BS_SCRIPT_EXPORT() |
362 | float nearBlurAmount = 0.02f; |
363 | |
364 | /** |
365 | * Determines the amount of blur to apply to fully unfocused objects that are farther away from camera than the |
366 | * in-focus zone. Set to zero to disable far-field blur. Only relevant for Gaussian depth of field. |
367 | */ |
368 | BS_SCRIPT_EXPORT() |
369 | float farBlurAmount = 0.02f; |
370 | |
371 | /************************************************************************/ |
372 | /* RTTI */ |
373 | /************************************************************************/ |
374 | |
375 | /** Enumerates all the fields in the type and executes the specified processor action for each field. */ |
376 | template<class P> |
377 | void rttiEnumFields(P processor); |
378 | public: |
379 | friend class DepthOfFieldSettingsRTTI; |
380 | static RTTITypeBase* getRTTIStatic(); |
381 | RTTITypeBase* getRTTI() const override; |
382 | }; |
383 | |
384 | /** |
385 | * Settings that control the screen space reflections effect. Screen space reflections provide high quality mirror-like |
386 | * reflections at low performance cost. They should be used together with reflection probes as the effects complement |
387 | * each other. As the name implies, the reflections are only limited to geometry drawn on the screen and the system will |
388 | * fall back to refl. probes when screen space data is unavailable. Similarly the system will fall back to refl. probes |
389 | * for rougher (more glossy rather than mirror-like) surfaces. Those surfaces require a higher number of samples to |
390 | * achieve the glossy look, so we instead fall back to refl. probes which are pre-filtered and can be quickly sampled. |
391 | */ |
392 | struct BS_CORE_EXPORT BS_SCRIPT_EXPORT(m:Rendering) ScreenSpaceReflectionsSettings : public IReflectable |
393 | { |
394 | BS_SCRIPT_EXPORT() |
395 | ScreenSpaceReflectionsSettings() = default; |
396 | |
397 | /** Enables or disables the SSR effect. */ |
398 | BS_SCRIPT_EXPORT() |
399 | bool enabled = true; |
400 | |
401 | /** |
402 | * Quality of the SSR effect. Higher values cast more sample rays, and march those rays are lower increments for |
403 | * better precision. This results in higher quality, as well as a higher performance requirement. Valid range is |
404 | * [0, 4], default is 2. |
405 | */ |
406 | BS_SCRIPT_EXPORT(range:[0,4],slider) |
407 | UINT32 quality = 2; |
408 | |
409 | /** Intensity of the screen space reflections. Valid range is [0, 1]. Default is 1 (100%). */ |
410 | BS_SCRIPT_EXPORT(range:[0,1],slider) |
411 | float intensity = 1.0f; |
412 | |
413 | /** |
414 | * Roughness at which screen space reflections start fading out and become replaced with refl. probes. Valid range |
415 | * is [0, 1]. Default is 0.8. |
416 | */ |
417 | BS_SCRIPT_EXPORT(range:[0,1],slider) |
418 | float maxRoughness = 0.8f; |
419 | |
420 | /************************************************************************/ |
421 | /* RTTI */ |
422 | /************************************************************************/ |
423 | |
424 | /** Enumerates all the fields in the type and executes the specified processor action for each field. */ |
425 | template<class P> |
426 | void rttiEnumFields(P processor); |
427 | public: |
428 | friend class ScreenSpaceReflectionsRTTI; |
429 | static RTTITypeBase* getRTTIStatic(); |
430 | RTTITypeBase* getRTTI() const override; |
431 | }; |
432 | |
433 | /** Settings that control the bloom effect. Bloom adds an extra highlight to bright areas of the scene. */ |
434 | struct BS_CORE_EXPORT BS_SCRIPT_EXPORT(m:Rendering) BloomSettings : public IReflectable |
435 | { |
436 | BS_SCRIPT_EXPORT() |
437 | BloomSettings() = default; |
438 | |
439 | /** Enables or disables the bloom effect. */ |
440 | BS_SCRIPT_EXPORT() |
441 | bool enabled = false; |
442 | |
443 | /** |
444 | * Quality of the bloom effect. Higher values will use higher resolution texture for calculating bloom, at the cost |
445 | * of lower performance. Valid range is [0, 3], default is 2. |
446 | */ |
447 | BS_SCRIPT_EXPORT() |
448 | UINT32 quality = 2; |
449 | |
450 | /** |
451 | * Determines the minimal threshold of pixel luminance to be included in the bloom calculations. Any pixel with |
452 | * luminance below this value will be ignored for the purposes of bloom. The value represents luminance after |
453 | * it is scaled by exposure. Set to zero or negative to disable the threshold and include all pixels in the |
454 | * calculations. |
455 | */ |
456 | BS_SCRIPT_EXPORT() |
457 | float threshold = 1.0f; |
458 | |
459 | /** |
460 | * Determines the intensity of the bloom effect. Ideally should be in [0, 4] range but higher values are allowed. |
461 | */ |
462 | BS_SCRIPT_EXPORT() |
463 | float intensity = 0.5f; |
464 | |
465 | /** Tint color to apply to the bloom highlight. A pure white means the bloom inherits the underlying scene color. */ |
466 | BS_SCRIPT_EXPORT() |
467 | Color tint = Color::White; |
468 | |
469 | /************************************************************************/ |
470 | /* RTTI */ |
471 | /************************************************************************/ |
472 | |
473 | /** Enumerates all the fields in the type and executes the specified processor action for each field. */ |
474 | template<class P> |
475 | void rttiEnumFields(P processor); |
476 | public: |
477 | friend class BloomSettingsRTTI; |
478 | static RTTITypeBase* getRTTIStatic(); |
479 | RTTITypeBase* getRTTI() const override; |
480 | }; |
481 | |
482 | /** Various options that control shadow rendering for a specific view. */ |
483 | struct BS_CORE_EXPORT BS_SCRIPT_EXPORT(m:Rendering) ShadowSettings : public IReflectable |
484 | { |
485 | BS_SCRIPT_EXPORT() |
486 | ShadowSettings() = default; |
487 | |
488 | /** |
489 | * Maximum distance that directional light shadows are allowed to render at. Decreasing the distance can yield |
490 | * higher quality shadows nearer to the viewer, as the shadow map resolution isn't being used up on far away |
491 | * portions of the scene. In world units (meters). |
492 | */ |
493 | BS_SCRIPT_EXPORT() |
494 | float directionalShadowDistance = 250.0f; |
495 | |
496 | /** |
497 | * Number of cascades to use for directional shadows. Higher number of cascades increases shadow quality as each |
498 | * individual cascade has less area to cover, but can significantly increase performance cost, as well as a minor |
499 | * increase in memory cost. Valid range is roughly [1, 6]. |
500 | */ |
501 | BS_SCRIPT_EXPORT(range:[1,6],slider) |
502 | UINT32 numCascades = 4; |
503 | |
504 | /** |
505 | * Allows you to control how are directional shadow cascades distributed. Value of 1 means the cascades will be |
506 | * linearly split, each cascade taking up the same amount of space. Value of 2 means each subsequent split will be |
507 | * twice the size of the previous one (meaning cascades closer to the viewer cover a smaller area, and therefore |
508 | * yield higher resolution shadows). Higher values increase the size disparity between near and far cascades at |
509 | * an exponential rate. Valid range is roughly [1, 4]. |
510 | */ |
511 | BS_SCRIPT_EXPORT(range:[1,4],slider) |
512 | float cascadeDistributionExponent = 3.0f; |
513 | |
514 | /** |
515 | * Determines the number of samples used for percentage closer shadow map filtering. Higher values yield higher |
516 | * quality shadows, at the cost of performance. Valid range is [1, 4]. |
517 | */ |
518 | BS_SCRIPT_EXPORT(range:[1,4],slider) |
519 | UINT32 shadowFilteringQuality = 4; |
520 | |
521 | /************************************************************************/ |
522 | /* RTTI */ |
523 | /************************************************************************/ |
524 | |
525 | /** Enumerates all the fields in the type and executes the specified processor action for each field. */ |
526 | template<class P> |
527 | void rttiEnumFields(P processor); |
528 | public: |
529 | friend class ShadowSettingsRTTI; |
530 | static RTTITypeBase* getRTTIStatic(); |
531 | RTTITypeBase* getRTTI() const override; |
532 | }; |
533 | |
534 | /** Settings that control rendering for a specific camera (view). */ |
535 | struct BS_CORE_EXPORT BS_SCRIPT_EXPORT(m:Rendering) RenderSettings : public IReflectable |
536 | { |
537 | BS_SCRIPT_EXPORT() |
538 | RenderSettings() = default; |
539 | virtual ~RenderSettings() = default; |
540 | |
541 | /** |
542 | * Determines should automatic exposure be applied to the HDR image. When turned on the average scene brightness |
543 | * will be calculated and used to automatically expose the image to the optimal range. Use the parameters provided |
544 | * by autoExposure to customize the automatic exposure effect. You may also use exposureScale to |
545 | * manually adjust the automatic exposure. When automatic exposure is turned off you can use exposureScale to |
546 | * manually set the exposure. |
547 | */ |
548 | BS_SCRIPT_EXPORT() |
549 | bool enableAutoExposure = true; |
550 | |
551 | /** |
552 | * Parameters used for customizing automatic scene exposure. |
553 | * |
554 | * @see enableAutoExposure |
555 | */ |
556 | BS_SCRIPT_EXPORT() |
557 | AutoExposureSettings autoExposure; |
558 | |
559 | /** |
560 | * Determines should the image be tonemapped. Tonemapping converts an HDR image into LDR image by applying |
561 | * a filmic curve to the image, simulating the effect of film cameras. Filmic curve improves image quality by |
562 | * tapering off lows and highs, preventing under- and over-exposure. This is useful if an image contains both |
563 | * very dark and very bright areas, in which case the global exposure parameter would leave some areas either over- |
564 | * or under-exposed. Use #tonemapping to customize how tonemapping performed. |
565 | * |
566 | * If this is disabled, then color grading and white balancing will not be enabled either. Only relevant for HDR |
567 | * images. |
568 | */ |
569 | BS_SCRIPT_EXPORT() |
570 | bool enableTonemapping = true; |
571 | |
572 | /** |
573 | * Parameters used for customizing tonemapping. |
574 | * |
575 | * @see enableTonemapping |
576 | */ |
577 | BS_SCRIPT_EXPORT() |
578 | TonemappingSettings tonemapping; |
579 | |
580 | /** |
581 | * Parameters used for customizing white balancing. White balancing converts a scene illuminated by a light of the |
582 | * specified temperature into a scene illuminated by a standard D65 illuminant (average midday light) in order to |
583 | * simulate the effects of chromatic adaptation of the human visual system. |
584 | */ |
585 | BS_SCRIPT_EXPORT() |
586 | WhiteBalanceSettings whiteBalance; |
587 | |
588 | /** Parameters used for customizing color grading. */ |
589 | BS_SCRIPT_EXPORT() |
590 | ColorGradingSettings colorGrading; |
591 | |
592 | /** Parameters used for customizing the depth of field effect. */ |
593 | BS_SCRIPT_EXPORT() |
594 | DepthOfFieldSettings depthOfField; |
595 | |
596 | /** Parameters used for customizing screen space ambient occlusion. */ |
597 | BS_SCRIPT_EXPORT() |
598 | AmbientOcclusionSettings ambientOcclusion; |
599 | |
600 | /** Parameters used for customizing screen space reflections. */ |
601 | BS_SCRIPT_EXPORT() |
602 | ScreenSpaceReflectionsSettings screenSpaceReflections; |
603 | |
604 | /** Parameters used for customizing the bloom effect. */ |
605 | BS_SCRIPT_EXPORT() |
606 | BloomSettings bloom; |
607 | |
608 | /** Enables the fast approximate anti-aliasing effect. */ |
609 | BS_SCRIPT_EXPORT() |
610 | bool enableFXAA = true; |
611 | |
612 | /** |
613 | * Log2 value to scale the eye adaptation by (for example 2^0 = 1). Smaller values yield darker image, while larger |
614 | * yield brighter image. Allows you to customize exposure manually, applied on top of eye adaptation exposure (if |
615 | * enabled). In range [-8, 8]. |
616 | */ |
617 | BS_SCRIPT_EXPORT(range:[-8,8],slider) |
618 | float exposureScale = 1.25f; |
619 | |
620 | /** |
621 | * Gamma value to adjust the image for. Larger values result in a brighter image. When tonemapping is turned |
622 | * on the best gamma curve for the output device is chosen automatically and this value can by used to merely tweak |
623 | * that curve. If tonemapping is turned off this is the exact value of the gamma curve that will be applied. |
624 | */ |
625 | BS_SCRIPT_EXPORT(range:[1,3],slider) |
626 | float gamma = 2.2f; |
627 | |
628 | /** |
629 | * High dynamic range allows light intensity to be more correctly recorded when rendering by allowing for a larger |
630 | * range of values. The stored light is then converted into visible color range using exposure and a tone mapping |
631 | * operator. |
632 | */ |
633 | BS_SCRIPT_EXPORT() |
634 | bool enableHDR = true; |
635 | |
636 | /** |
637 | * Determines if scene objects will be lit by lights. If disabled everything will be rendered using their albedo |
638 | * texture with no lighting applied. |
639 | */ |
640 | BS_SCRIPT_EXPORT() |
641 | bool enableLighting = true; |
642 | |
643 | /** Determines if shadows cast by lights should be rendered. Only relevant if lighting is turned on. */ |
644 | BS_SCRIPT_EXPORT() |
645 | bool enableShadows = true; |
646 | |
647 | /** Parameters used for customizing shadow rendering. */ |
648 | BS_SCRIPT_EXPORT() |
649 | ShadowSettings shadowSettings; |
650 | |
651 | /** Determines if indirect lighting (e.g. from light probes or the sky) is rendered. */ |
652 | BS_SCRIPT_EXPORT() |
653 | bool enableIndirectLighting = true; |
654 | |
655 | /** |
656 | * Signals the renderer to only render overlays (like GUI), and not scene objects. Such rendering doesn't require |
657 | * depth buffer or multi-sampled render targets and will not render any scene objects. This can improve performance |
658 | * and memory usage for overlay-only views. |
659 | */ |
660 | BS_SCRIPT_EXPORT() |
661 | bool overlayOnly = false; |
662 | |
663 | /** |
664 | * If enabled the camera will use the skybox for rendering the background. A skybox has to be present in the scene. |
665 | * When disabled the camera will use the clear color for rendering the background. |
666 | */ |
667 | BS_SCRIPT_EXPORT() |
668 | bool enableSkybox = true; |
669 | |
670 | /** |
671 | * The absolute base cull-distance for objects rendered through this camera in world units. Objects will use this |
672 | * distance and apply their own factor to it to determine whether they should be visible. |
673 | */ |
674 | BS_SCRIPT_EXPORT() |
675 | float cullDistance = FLT_MAX; |
676 | |
677 | /************************************************************************/ |
678 | /* RTTI */ |
679 | /************************************************************************/ |
680 | |
681 | /** Enumerates all the fields in the type and executes the specified processor action for each field. */ |
682 | template<class P> |
683 | void rttiEnumFields(P processor); |
684 | |
685 | public: |
686 | friend class RenderSettingsRTTI; |
687 | static RTTITypeBase* getRTTIStatic(); |
688 | RTTITypeBase* getRTTI() const override; |
689 | }; |
690 | |
691 | /** @} */ |
692 | } |
693 | |