rasterizer_effects_rd.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637
  1. /*************************************************************************/
  2. /* rasterizer_effects_rd.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /*************************************************************************/
  30. #ifndef RASTERIZER_EFFECTS_RD_H
  31. #define RASTERIZER_EFFECTS_RD_H
  32. #include "core/math/camera_matrix.h"
  33. #include "servers/rendering/rasterizer_rd/render_pipeline_vertex_format_cache_rd.h"
  34. #include "servers/rendering/rasterizer_rd/shaders/bokeh_dof.glsl.gen.h"
  35. #include "servers/rendering/rasterizer_rd/shaders/copy.glsl.gen.h"
  36. #include "servers/rendering/rasterizer_rd/shaders/copy_to_fb.glsl.gen.h"
  37. #include "servers/rendering/rasterizer_rd/shaders/cube_to_dp.glsl.gen.h"
  38. #include "servers/rendering/rasterizer_rd/shaders/cubemap_downsampler.glsl.gen.h"
  39. #include "servers/rendering/rasterizer_rd/shaders/cubemap_filter.glsl.gen.h"
  40. #include "servers/rendering/rasterizer_rd/shaders/cubemap_roughness.glsl.gen.h"
  41. #include "servers/rendering/rasterizer_rd/shaders/luminance_reduce.glsl.gen.h"
  42. #include "servers/rendering/rasterizer_rd/shaders/roughness_limiter.glsl.gen.h"
  43. #include "servers/rendering/rasterizer_rd/shaders/screen_space_reflection.glsl.gen.h"
  44. #include "servers/rendering/rasterizer_rd/shaders/screen_space_reflection_filter.glsl.gen.h"
  45. #include "servers/rendering/rasterizer_rd/shaders/screen_space_reflection_scale.glsl.gen.h"
  46. #include "servers/rendering/rasterizer_rd/shaders/specular_merge.glsl.gen.h"
  47. #include "servers/rendering/rasterizer_rd/shaders/ssao.glsl.gen.h"
  48. #include "servers/rendering/rasterizer_rd/shaders/ssao_blur.glsl.gen.h"
  49. #include "servers/rendering/rasterizer_rd/shaders/ssao_minify.glsl.gen.h"
  50. #include "servers/rendering/rasterizer_rd/shaders/subsurface_scattering.glsl.gen.h"
  51. #include "servers/rendering/rasterizer_rd/shaders/tonemap.glsl.gen.h"
  52. #include "servers/rendering_server.h"
  53. class RasterizerEffectsRD {
  54. enum CopyMode {
  55. COPY_MODE_GAUSSIAN_COPY,
  56. COPY_MODE_GAUSSIAN_COPY_8BIT,
  57. COPY_MODE_GAUSSIAN_GLOW,
  58. COPY_MODE_GAUSSIAN_GLOW_AUTO_EXPOSURE,
  59. COPY_MODE_SIMPLY_COPY,
  60. COPY_MODE_SIMPLY_COPY_8BIT,
  61. COPY_MODE_SIMPLY_COPY_DEPTH,
  62. COPY_MODE_MIPMAP,
  63. COPY_MODE_LINEARIZE_DEPTH,
  64. COPY_MODE_CUBE_TO_PANORAMA,
  65. COPY_MODE_CUBE_ARRAY_TO_PANORAMA,
  66. COPY_MODE_MAX,
  67. };
  68. enum {
  69. COPY_FLAG_HORIZONTAL = (1 << 0),
  70. COPY_FLAG_USE_COPY_SECTION = (1 << 1),
  71. COPY_FLAG_USE_ORTHOGONAL_PROJECTION = (1 << 2),
  72. COPY_FLAG_DOF_NEAR_FIRST_TAP = (1 << 3),
  73. COPY_FLAG_GLOW_FIRST_PASS = (1 << 4),
  74. COPY_FLAG_FLIP_Y = (1 << 5),
  75. COPY_FLAG_FORCE_LUMINANCE = (1 << 6),
  76. COPY_FLAG_ALL_SOURCE = (1 << 7)
  77. };
  78. struct CopyPushConstant {
  79. int32_t section[4];
  80. int32_t target[2];
  81. uint32_t flags;
  82. uint32_t pad;
  83. // Glow.
  84. float glow_strength;
  85. float glow_bloom;
  86. float glow_hdr_threshold;
  87. float glow_hdr_scale;
  88. float glow_exposure;
  89. float glow_white;
  90. float glow_luminance_cap;
  91. float glow_auto_exposure_grey;
  92. // DOF.
  93. float camera_z_far;
  94. float camera_z_near;
  95. uint32_t pad2[2];
  96. };
  97. struct Copy {
  98. CopyPushConstant push_constant;
  99. CopyShaderRD shader;
  100. RID shader_version;
  101. RID pipelines[COPY_MODE_MAX];
  102. } copy;
  103. enum CopyToFBMode {
  104. COPY_TO_FB_COPY,
  105. COPY_TO_FB_COPY_PANORAMA_TO_DP,
  106. COPY_TO_FB_MAX,
  107. };
  108. struct CopyToFbPushConstant {
  109. float section[4];
  110. float pixel_size[2];
  111. uint32_t flip_y;
  112. uint32_t use_section;
  113. uint32_t force_luminance;
  114. uint32_t alpha_to_zero;
  115. uint32_t pad[2];
  116. };
  117. struct CopyToFb {
  118. CopyToFbPushConstant push_constant;
  119. CopyToFbShaderRD shader;
  120. RID shader_version;
  121. RenderPipelineVertexFormatCacheRD pipelines[COPY_TO_FB_MAX];
  122. } copy_to_fb;
  123. struct CubemapRoughnessPushConstant {
  124. uint32_t face_id;
  125. uint32_t sample_count;
  126. float roughness;
  127. uint32_t use_direct_write;
  128. float face_size;
  129. float pad[3];
  130. };
  131. struct CubemapRoughness {
  132. CubemapRoughnessPushConstant push_constant;
  133. CubemapRoughnessShaderRD shader;
  134. RID shader_version;
  135. RID pipeline;
  136. } roughness;
  137. enum TonemapMode {
  138. TONEMAP_MODE_NORMAL,
  139. TONEMAP_MODE_BICUBIC_GLOW_FILTER,
  140. TONEMAP_MODE_MAX
  141. };
  142. struct TonemapPushConstant {
  143. float bcs[3];
  144. uint32_t use_bcs;
  145. uint32_t use_glow;
  146. uint32_t use_auto_exposure;
  147. uint32_t use_color_correction;
  148. uint32_t tonemapper;
  149. uint32_t glow_texture_size[2];
  150. float glow_intensity;
  151. uint32_t glow_level_flags;
  152. uint32_t glow_mode;
  153. float exposure;
  154. float white;
  155. float auto_exposure_grey;
  156. float pixel_size[2];
  157. uint32_t use_fxaa;
  158. uint32_t pad;
  159. };
  160. /* tonemap actually writes to a framebuffer, which is
  161. * better to do using the raster pipeline rather than
  162. * comptute, as that framebuffer might be in different formats
  163. */
  164. struct Tonemap {
  165. TonemapPushConstant push_constant;
  166. TonemapShaderRD shader;
  167. RID shader_version;
  168. RenderPipelineVertexFormatCacheRD pipelines[TONEMAP_MODE_MAX];
  169. } tonemap;
  170. enum LuminanceReduceMode {
  171. LUMINANCE_REDUCE_READ,
  172. LUMINANCE_REDUCE,
  173. LUMINANCE_REDUCE_WRITE,
  174. LUMINANCE_REDUCE_MAX
  175. };
  176. struct LuminanceReducePushConstant {
  177. int32_t source_size[2];
  178. float max_luminance;
  179. float min_luminance;
  180. float exposure_adjust;
  181. float pad[3];
  182. };
  183. struct LuminanceReduce {
  184. LuminanceReducePushConstant push_constant;
  185. LuminanceReduceShaderRD shader;
  186. RID shader_version;
  187. RID pipelines[LUMINANCE_REDUCE_MAX];
  188. } luminance_reduce;
  189. struct CopyToDPPushConstant {
  190. int32_t screen_size[2];
  191. int32_t dest_offset[2];
  192. float bias;
  193. float z_far;
  194. float z_near;
  195. uint32_t z_flip;
  196. };
  197. struct CoptToDP {
  198. CubeToDpShaderRD shader;
  199. RID shader_version;
  200. RID pipeline;
  201. } cube_to_dp;
  202. struct BokehPushConstant {
  203. uint32_t size[2];
  204. float z_far;
  205. float z_near;
  206. uint32_t orthogonal;
  207. float blur_size;
  208. float blur_scale;
  209. uint32_t steps;
  210. uint32_t blur_near_active;
  211. float blur_near_begin;
  212. float blur_near_end;
  213. uint32_t blur_far_active;
  214. float blur_far_begin;
  215. float blur_far_end;
  216. uint32_t second_pass;
  217. uint32_t half_size;
  218. uint32_t use_jitter;
  219. float jitter_seed;
  220. uint32_t pad[2];
  221. };
  222. enum BokehMode {
  223. BOKEH_GEN_BLUR_SIZE,
  224. BOKEH_GEN_BOKEH_BOX,
  225. BOKEH_GEN_BOKEH_HEXAGONAL,
  226. BOKEH_GEN_BOKEH_CIRCULAR,
  227. BOKEH_COMPOSITE,
  228. BOKEH_MAX
  229. };
  230. struct Bokeh {
  231. BokehPushConstant push_constant;
  232. BokehDofShaderRD shader;
  233. RID shader_version;
  234. RID pipelines[BOKEH_MAX];
  235. } bokeh;
  236. enum SSAOMode {
  237. SSAO_MINIFY_FIRST,
  238. SSAO_MINIFY_MIPMAP,
  239. SSAO_GATHER_LOW,
  240. SSAO_GATHER_MEDIUM,
  241. SSAO_GATHER_HIGH,
  242. SSAO_GATHER_ULTRA,
  243. SSAO_GATHER_LOW_HALF,
  244. SSAO_GATHER_MEDIUM_HALF,
  245. SSAO_GATHER_HIGH_HALF,
  246. SSAO_GATHER_ULTRA_HALF,
  247. SSAO_BLUR_PASS,
  248. SSAO_BLUR_PASS_HALF,
  249. SSAO_BLUR_UPSCALE,
  250. SSAO_MAX
  251. };
  252. struct SSAOMinifyPushConstant {
  253. float pixel_size[2];
  254. float z_far;
  255. float z_near;
  256. int32_t source_size[2];
  257. uint32_t orthogonal;
  258. uint32_t pad;
  259. };
  260. struct SSAOGatherPushConstant {
  261. int32_t screen_size[2];
  262. float z_far;
  263. float z_near;
  264. uint32_t orthogonal;
  265. float intensity_div_r6;
  266. float radius;
  267. float bias;
  268. float proj_info[4];
  269. float pixel_size[2];
  270. float proj_scale;
  271. uint32_t pad;
  272. };
  273. struct SSAOBlurPushConstant {
  274. float edge_sharpness;
  275. int32_t filter_scale;
  276. float z_far;
  277. float z_near;
  278. uint32_t orthogonal;
  279. uint32_t pad[3];
  280. int32_t axis[2];
  281. int32_t screen_size[2];
  282. };
  283. struct SSAO {
  284. SSAOMinifyPushConstant minify_push_constant;
  285. SsaoMinifyShaderRD minify_shader;
  286. RID minify_shader_version;
  287. SSAOGatherPushConstant gather_push_constant;
  288. SsaoShaderRD gather_shader;
  289. RID gather_shader_version;
  290. SSAOBlurPushConstant blur_push_constant;
  291. SsaoBlurShaderRD blur_shader;
  292. RID blur_shader_version;
  293. RID pipelines[SSAO_MAX];
  294. } ssao;
  295. struct RoughnessLimiterPushConstant {
  296. int32_t screen_size[2];
  297. float curve;
  298. uint32_t pad;
  299. };
  300. struct RoughnessLimiter {
  301. RoughnessLimiterPushConstant push_constant;
  302. RoughnessLimiterShaderRD shader;
  303. RID shader_version;
  304. RID pipeline;
  305. } roughness_limiter;
  306. struct CubemapDownsamplerPushConstant {
  307. uint32_t face_size;
  308. float pad[3];
  309. };
  310. struct CubemapDownsampler {
  311. CubemapDownsamplerPushConstant push_constant;
  312. CubemapDownsamplerShaderRD shader;
  313. RID shader_version;
  314. RID pipeline;
  315. } cubemap_downsampler;
  316. enum CubemapFilterMode {
  317. FILTER_MODE_HIGH_QUALITY,
  318. FILTER_MODE_LOW_QUALITY,
  319. FILTER_MODE_HIGH_QUALITY_ARRAY,
  320. FILTER_MODE_LOW_QUALITY_ARRAY,
  321. FILTER_MODE_MAX,
  322. };
  323. struct CubemapFilter {
  324. CubemapFilterShaderRD shader;
  325. RID shader_version;
  326. RID pipelines[FILTER_MODE_MAX];
  327. RID uniform_set;
  328. RID image_uniform_set;
  329. RID coefficient_buffer;
  330. bool use_high_quality;
  331. } filter;
  332. struct SkyPushConstant {
  333. float orientation[12];
  334. float proj[4];
  335. float position[3];
  336. float multiplier;
  337. float time;
  338. float pad[3];
  339. };
  340. enum SpecularMergeMode {
  341. SPECULAR_MERGE_ADD,
  342. SPECULAR_MERGE_SSR,
  343. SPECULAR_MERGE_ADDITIVE_ADD,
  344. SPECULAR_MERGE_ADDITIVE_SSR,
  345. SPECULAR_MERGE_MAX
  346. };
  347. /* Specular merge must be done using raster, rather than compute
  348. * because it must continue the existing color buffer
  349. */
  350. struct SpecularMerge {
  351. SpecularMergeShaderRD shader;
  352. RID shader_version;
  353. RenderPipelineVertexFormatCacheRD pipelines[SPECULAR_MERGE_MAX];
  354. } specular_merge;
  355. enum ScreenSpaceReflectionMode {
  356. SCREEN_SPACE_REFLECTION_NORMAL,
  357. SCREEN_SPACE_REFLECTION_ROUGH,
  358. SCREEN_SPACE_REFLECTION_MAX,
  359. };
  360. struct ScreenSpaceReflectionPushConstant {
  361. float proj_info[4];
  362. int32_t screen_size[2];
  363. float camera_z_near;
  364. float camera_z_far;
  365. int32_t num_steps;
  366. float depth_tolerance;
  367. float distance_fade;
  368. float curve_fade_in;
  369. uint32_t orthogonal;
  370. float filter_mipmap_levels;
  371. uint32_t use_half_res;
  372. uint8_t metallic_mask[4];
  373. float projection[16];
  374. };
  375. struct ScreenSpaceReflection {
  376. ScreenSpaceReflectionPushConstant push_constant;
  377. ScreenSpaceReflectionShaderRD shader;
  378. RID shader_version;
  379. RID pipelines[SCREEN_SPACE_REFLECTION_MAX];
  380. } ssr;
  381. struct ScreenSpaceReflectionFilterPushConstant {
  382. float proj_info[4];
  383. uint32_t orthogonal;
  384. float edge_tolerance;
  385. int32_t increment;
  386. uint32_t pad;
  387. int32_t screen_size[2];
  388. uint32_t vertical;
  389. uint32_t steps;
  390. };
  391. enum {
  392. SCREEN_SPACE_REFLECTION_FILTER_HORIZONTAL,
  393. SCREEN_SPACE_REFLECTION_FILTER_VERTICAL,
  394. SCREEN_SPACE_REFLECTION_FILTER_MAX,
  395. };
  396. struct ScreenSpaceReflectionFilter {
  397. ScreenSpaceReflectionFilterPushConstant push_constant;
  398. ScreenSpaceReflectionFilterShaderRD shader;
  399. RID shader_version;
  400. RID pipelines[SCREEN_SPACE_REFLECTION_FILTER_MAX];
  401. } ssr_filter;
  402. struct ScreenSpaceReflectionScalePushConstant {
  403. int32_t screen_size[2];
  404. float camera_z_near;
  405. float camera_z_far;
  406. uint32_t orthogonal;
  407. uint32_t filter;
  408. uint32_t pad[2];
  409. };
  410. struct ScreenSpaceReflectionScale {
  411. ScreenSpaceReflectionScalePushConstant push_constant;
  412. ScreenSpaceReflectionScaleShaderRD shader;
  413. RID shader_version;
  414. RID pipeline;
  415. } ssr_scale;
  416. struct SubSurfaceScatteringPushConstant {
  417. int32_t screen_size[2];
  418. float camera_z_far;
  419. float camera_z_near;
  420. uint32_t vertical;
  421. uint32_t orthogonal;
  422. float unit_size;
  423. float scale;
  424. float depth_scale;
  425. uint32_t pad[3];
  426. };
  427. struct SubSurfaceScattering {
  428. SubSurfaceScatteringPushConstant push_constant;
  429. SubsurfaceScatteringShaderRD shader;
  430. RID shader_version;
  431. RID pipelines[3]; //3 quality levels
  432. } sss;
  433. RID default_sampler;
  434. RID default_mipmap_sampler;
  435. RID index_buffer;
  436. RID index_array;
  437. Map<RID, RID> texture_to_uniform_set_cache;
  438. Map<RID, RID> image_to_uniform_set_cache;
  439. struct TexturePair {
  440. RID texture1;
  441. RID texture2;
  442. _FORCE_INLINE_ bool operator<(const TexturePair &p_pair) const {
  443. if (texture1 == p_pair.texture1) {
  444. return texture2 < p_pair.texture2;
  445. } else {
  446. return texture1 < p_pair.texture1;
  447. }
  448. }
  449. };
  450. Map<RID, RID> texture_to_compute_uniform_set_cache;
  451. Map<TexturePair, RID> texture_pair_to_compute_uniform_set_cache;
  452. Map<TexturePair, RID> image_pair_to_compute_uniform_set_cache;
  453. RID _get_uniform_set_from_image(RID p_texture);
  454. RID _get_uniform_set_from_texture(RID p_texture, bool p_use_mipmaps = false);
  455. RID _get_compute_uniform_set_from_texture(RID p_texture, bool p_use_mipmaps = false);
  456. RID _get_compute_uniform_set_from_texture_pair(RID p_texture, RID p_texture2, bool p_use_mipmaps = false);
  457. RID _get_compute_uniform_set_from_image_pair(RID p_texture, RID p_texture2);
  458. public:
  459. void copy_to_fb_rect(RID p_source_rd_texture, RID p_dest_framebuffer, const Rect2i &p_rect, bool p_flip_y = false, bool p_force_luminance = false, bool p_alpha_to_zero = false);
  460. void copy_to_rect(RID p_source_rd_texture, RID p_dest_texture, const Rect2i &p_rect, bool p_flip_y = false, bool p_force_luminance = false, bool p_all_source = false, bool p_8_bit_dst = false);
  461. void copy_cubemap_to_panorama(RID p_source_cube, RID p_dest_panorama, const Size2i &p_panorama_size, float p_lod, bool p_is_array);
  462. void copy_depth_to_rect(RID p_source_rd_texture, RID p_dest_framebuffer, const Rect2i &p_rect, bool p_flip_y = false);
  463. void copy_depth_to_rect_and_linearize(RID p_source_rd_texture, RID p_dest_texture, const Rect2i &p_rect, bool p_flip_y, float p_z_near, float p_z_far);
  464. void copy_to_atlas_fb(RID p_source_rd_texture, RID p_dest_framebuffer, const Rect2 &p_uv_rect, RD::DrawListID p_draw_list, bool p_flip_y = false, bool p_panorama = false);
  465. void gaussian_blur(RID p_source_rd_texture, RID p_texture, RID p_back_texture, const Rect2i &p_region, bool p_8bit_dst = false);
  466. void gaussian_glow(RID p_source_rd_texture, RID p_texture, RID p_back_texture, const Size2i &p_size, float p_strength = 1.0, bool p_first_pass = false, float p_luminance_cap = 16.0, float p_exposure = 1.0, float p_bloom = 0.0, float p_hdr_bleed_treshold = 1.0, float p_hdr_bleed_scale = 1.0, RID p_auto_exposure = RID(), float p_auto_exposure_grey = 1.0);
  467. void cubemap_roughness(RID p_source_rd_texture, RID p_dest_framebuffer, uint32_t p_face_id, uint32_t p_sample_count, float p_roughness, float p_size);
  468. void make_mipmap(RID p_source_rd_texture, RID p_dest_texture, const Size2i &p_size);
  469. void copy_cubemap_to_dp(RID p_source_rd_texture, RID p_dest_texture, const Rect2i &p_rect, float p_z_near, float p_z_far, float p_bias, bool p_dp_flip);
  470. void luminance_reduction(RID p_source_texture, const Size2i p_source_size, const Vector<RID> p_reduce, RID p_prev_luminance, float p_min_luminance, float p_max_luminance, float p_adjust, bool p_set = false);
  471. void bokeh_dof(RID p_base_texture, RID p_depth_texture, const Size2i &p_base_texture_size, RID p_secondary_texture, RID p_bokeh_texture1, RID p_bokeh_texture2, bool p_dof_far, float p_dof_far_begin, float p_dof_far_size, bool p_dof_near, float p_dof_near_begin, float p_dof_near_size, float p_bokeh_size, RS::DOFBokehShape p_bokeh_shape, RS::DOFBlurQuality p_quality, bool p_use_jitter, float p_cam_znear, float p_cam_zfar, bool p_cam_orthogonal);
  472. struct TonemapSettings {
  473. bool use_glow = false;
  474. enum GlowMode {
  475. GLOW_MODE_ADD,
  476. GLOW_MODE_SCREEN,
  477. GLOW_MODE_SOFTLIGHT,
  478. GLOW_MODE_REPLACE,
  479. GLOW_MODE_MIX
  480. };
  481. GlowMode glow_mode = GLOW_MODE_ADD;
  482. float glow_intensity = 1.0;
  483. uint32_t glow_level_flags = 0;
  484. Vector2i glow_texture_size;
  485. bool glow_use_bicubic_upscale = false;
  486. RID glow_texture;
  487. RS::EnvironmentToneMapper tonemap_mode = RS::ENV_TONE_MAPPER_LINEAR;
  488. float exposure = 1.0;
  489. float white = 1.0;
  490. bool use_auto_exposure = false;
  491. float auto_exposure_grey = 0.5;
  492. RID exposure_texture;
  493. bool use_bcs = false;
  494. float brightness = 1.0;
  495. float contrast = 1.0;
  496. float saturation = 1.0;
  497. bool use_color_correction = false;
  498. RID color_correction_texture;
  499. bool use_fxaa = false;
  500. Vector2i texture_size;
  501. };
  502. void tonemapper(RID p_source_color, RID p_dst_framebuffer, const TonemapSettings &p_settings);
  503. void generate_ssao(RID p_depth_buffer, RID p_normal_buffer, const Size2i &p_depth_buffer_size, RID p_depth_mipmaps_texture, const Vector<RID> &depth_mipmaps, RID p_ao1, bool p_half_size, RID p_ao2, RID p_upscale_buffer, float p_intensity, float p_radius, float p_bias, const CameraMatrix &p_projection, RS::EnvironmentSSAOQuality p_quality, RS::EnvironmentSSAOBlur p_blur, float p_edge_sharpness);
  504. void roughness_limit(RID p_source_normal, RID p_roughness, const Size2i &p_size, float p_curve);
  505. void cubemap_downsample(RID p_source_cubemap, RID p_dest_cubemap, const Size2i &p_size);
  506. void cubemap_filter(RID p_source_cubemap, Vector<RID> p_dest_cubemap, bool p_use_array);
  507. void render_sky(RD::DrawListID p_list, float p_time, RID p_fb, RID p_samplers, RID p_lights, RenderPipelineVertexFormatCacheRD *p_pipeline, RID p_uniform_set, RID p_texture_set, const CameraMatrix &p_camera, const Basis &p_orientation, float p_multiplier, const Vector3 &p_position);
  508. void screen_space_reflection(RID p_diffuse, RID p_normal, RS::EnvironmentSSRRoughnessQuality p_roughness_quality, RID p_roughness, RID p_blur_radius, RID p_blur_radius2, RID p_metallic, const Color &p_metallic_mask, RID p_depth, RID p_scale_depth, RID p_scale_normal, RID p_output, RID p_output_blur, const Size2i &p_screen_size, int p_max_steps, float p_fade_in, float p_fade_out, float p_tolerance, const CameraMatrix &p_camera);
  509. void merge_specular(RID p_dest_framebuffer, RID p_specular, RID p_base, RID p_reflection);
  510. void sub_surface_scattering(RID p_diffuse, RID p_diffuse2, RID p_depth, const CameraMatrix &p_camera, const Size2i &p_screen_size, float p_scale, float p_depth_scale, RS::SubSurfaceScatteringQuality p_quality);
  511. RasterizerEffectsRD();
  512. ~RasterizerEffectsRD();
  513. };
  514. #endif // !RASTERIZER_EFFECTS_RD_H