rasterizer_effects_rd.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624
  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_MAX,
  65. };
  66. enum {
  67. COPY_FLAG_HORIZONTAL = (1 << 0),
  68. COPY_FLAG_USE_COPY_SECTION = (1 << 1),
  69. COPY_FLAG_USE_ORTHOGONAL_PROJECTION = (1 << 2),
  70. COPY_FLAG_DOF_NEAR_FIRST_TAP = (1 << 3),
  71. COPY_FLAG_GLOW_FIRST_PASS = (1 << 4),
  72. COPY_FLAG_FLIP_Y = (1 << 5),
  73. COPY_FLAG_FORCE_LUMINANCE = (1 << 6),
  74. COPY_FLAG_ALL_SOURCE = (1 << 7)
  75. };
  76. struct CopyPushConstant {
  77. int32_t section[4];
  78. int32_t target[2];
  79. uint32_t flags;
  80. uint32_t pad;
  81. // Glow.
  82. float glow_strength;
  83. float glow_bloom;
  84. float glow_hdr_threshold;
  85. float glow_hdr_scale;
  86. float glow_exposure;
  87. float glow_white;
  88. float glow_luminance_cap;
  89. float glow_auto_exposure_grey;
  90. // DOF.
  91. float camera_z_far;
  92. float camera_z_near;
  93. uint32_t pad2[2];
  94. };
  95. struct Copy {
  96. CopyPushConstant push_constant;
  97. CopyShaderRD shader;
  98. RID shader_version;
  99. RID pipelines[COPY_MODE_MAX];
  100. } copy;
  101. struct CopyToFbPushConstant {
  102. float section[4];
  103. float pixel_size[2];
  104. uint32_t flip_y;
  105. uint32_t use_section;
  106. uint32_t force_luminance;
  107. uint32_t pad[3];
  108. };
  109. struct CopyToFb {
  110. CopyToFbPushConstant push_constant;
  111. CopyToFbShaderRD shader;
  112. RID shader_version;
  113. RenderPipelineVertexFormatCacheRD pipeline;
  114. } copy_to_fb;
  115. struct CubemapRoughnessPushConstant {
  116. uint32_t face_id;
  117. uint32_t sample_count;
  118. float roughness;
  119. uint32_t use_direct_write;
  120. float face_size;
  121. float pad[3];
  122. };
  123. struct CubemapRoughness {
  124. CubemapRoughnessPushConstant push_constant;
  125. CubemapRoughnessShaderRD shader;
  126. RID shader_version;
  127. RID pipeline;
  128. } roughness;
  129. enum TonemapMode {
  130. TONEMAP_MODE_NORMAL,
  131. TONEMAP_MODE_BICUBIC_GLOW_FILTER,
  132. TONEMAP_MODE_MAX
  133. };
  134. struct TonemapPushConstant {
  135. float bcs[3];
  136. uint32_t use_bcs;
  137. uint32_t use_glow;
  138. uint32_t use_auto_exposure;
  139. uint32_t use_color_correction;
  140. uint32_t tonemapper;
  141. uint32_t glow_texture_size[2];
  142. float glow_intensity;
  143. uint32_t glow_level_flags;
  144. uint32_t glow_mode;
  145. float exposure;
  146. float white;
  147. float auto_exposure_grey;
  148. float pixel_size[2];
  149. uint32_t use_fxaa;
  150. uint32_t pad;
  151. };
  152. /* tonemap actually writes to a framebuffer, which is
  153. * better to do using the raster pipeline rather than
  154. * comptute, as that framebuffer might be in different formats
  155. */
  156. struct Tonemap {
  157. TonemapPushConstant push_constant;
  158. TonemapShaderRD shader;
  159. RID shader_version;
  160. RenderPipelineVertexFormatCacheRD pipelines[TONEMAP_MODE_MAX];
  161. } tonemap;
  162. enum LuminanceReduceMode {
  163. LUMINANCE_REDUCE_READ,
  164. LUMINANCE_REDUCE,
  165. LUMINANCE_REDUCE_WRITE,
  166. LUMINANCE_REDUCE_MAX
  167. };
  168. struct LuminanceReducePushConstant {
  169. int32_t source_size[2];
  170. float max_luminance;
  171. float min_luminance;
  172. float exposure_adjust;
  173. float pad[3];
  174. };
  175. struct LuminanceReduce {
  176. LuminanceReducePushConstant push_constant;
  177. LuminanceReduceShaderRD shader;
  178. RID shader_version;
  179. RID pipelines[LUMINANCE_REDUCE_MAX];
  180. } luminance_reduce;
  181. struct CopyToDPPushConstant {
  182. int32_t screen_size[2];
  183. int32_t dest_offset[2];
  184. float bias;
  185. float z_far;
  186. float z_near;
  187. uint32_t z_flip;
  188. };
  189. struct CoptToDP {
  190. CubeToDpShaderRD shader;
  191. RID shader_version;
  192. RID pipeline;
  193. } cube_to_dp;
  194. struct BokehPushConstant {
  195. uint32_t size[2];
  196. float z_far;
  197. float z_near;
  198. uint32_t orthogonal;
  199. float blur_size;
  200. float blur_scale;
  201. uint32_t steps;
  202. uint32_t blur_near_active;
  203. float blur_near_begin;
  204. float blur_near_end;
  205. uint32_t blur_far_active;
  206. float blur_far_begin;
  207. float blur_far_end;
  208. uint32_t second_pass;
  209. uint32_t half_size;
  210. uint32_t use_jitter;
  211. float jitter_seed;
  212. uint32_t pad[2];
  213. };
  214. enum BokehMode {
  215. BOKEH_GEN_BLUR_SIZE,
  216. BOKEH_GEN_BOKEH_BOX,
  217. BOKEH_GEN_BOKEH_HEXAGONAL,
  218. BOKEH_GEN_BOKEH_CIRCULAR,
  219. BOKEH_COMPOSITE,
  220. BOKEH_MAX
  221. };
  222. struct Bokeh {
  223. BokehPushConstant push_constant;
  224. BokehDofShaderRD shader;
  225. RID shader_version;
  226. RID pipelines[BOKEH_MAX];
  227. } bokeh;
  228. enum SSAOMode {
  229. SSAO_MINIFY_FIRST,
  230. SSAO_MINIFY_MIPMAP,
  231. SSAO_GATHER_LOW,
  232. SSAO_GATHER_MEDIUM,
  233. SSAO_GATHER_HIGH,
  234. SSAO_GATHER_ULTRA,
  235. SSAO_GATHER_LOW_HALF,
  236. SSAO_GATHER_MEDIUM_HALF,
  237. SSAO_GATHER_HIGH_HALF,
  238. SSAO_GATHER_ULTRA_HALF,
  239. SSAO_BLUR_PASS,
  240. SSAO_BLUR_PASS_HALF,
  241. SSAO_BLUR_UPSCALE,
  242. SSAO_MAX
  243. };
  244. struct SSAOMinifyPushConstant {
  245. float pixel_size[2];
  246. float z_far;
  247. float z_near;
  248. int32_t source_size[2];
  249. uint32_t orthogonal;
  250. uint32_t pad;
  251. };
  252. struct SSAOGatherPushConstant {
  253. int32_t screen_size[2];
  254. float z_far;
  255. float z_near;
  256. uint32_t orthogonal;
  257. float intensity_div_r6;
  258. float radius;
  259. float bias;
  260. float proj_info[4];
  261. float pixel_size[2];
  262. float proj_scale;
  263. uint32_t pad;
  264. };
  265. struct SSAOBlurPushConstant {
  266. float edge_sharpness;
  267. int32_t filter_scale;
  268. float z_far;
  269. float z_near;
  270. uint32_t orthogonal;
  271. uint32_t pad[3];
  272. int32_t axis[2];
  273. int32_t screen_size[2];
  274. };
  275. struct SSAO {
  276. SSAOMinifyPushConstant minify_push_constant;
  277. SsaoMinifyShaderRD minify_shader;
  278. RID minify_shader_version;
  279. SSAOGatherPushConstant gather_push_constant;
  280. SsaoShaderRD gather_shader;
  281. RID gather_shader_version;
  282. SSAOBlurPushConstant blur_push_constant;
  283. SsaoBlurShaderRD blur_shader;
  284. RID blur_shader_version;
  285. RID pipelines[SSAO_MAX];
  286. } ssao;
  287. struct RoughnessLimiterPushConstant {
  288. int32_t screen_size[2];
  289. float curve;
  290. uint32_t pad;
  291. };
  292. struct RoughnessLimiter {
  293. RoughnessLimiterPushConstant push_constant;
  294. RoughnessLimiterShaderRD shader;
  295. RID shader_version;
  296. RID pipeline;
  297. } roughness_limiter;
  298. struct CubemapDownsamplerPushConstant {
  299. uint32_t face_size;
  300. float pad[3];
  301. };
  302. struct CubemapDownsampler {
  303. CubemapDownsamplerPushConstant push_constant;
  304. CubemapDownsamplerShaderRD shader;
  305. RID shader_version;
  306. RID pipeline;
  307. } cubemap_downsampler;
  308. enum CubemapFilterMode {
  309. FILTER_MODE_HIGH_QUALITY,
  310. FILTER_MODE_LOW_QUALITY,
  311. FILTER_MODE_HIGH_QUALITY_ARRAY,
  312. FILTER_MODE_LOW_QUALITY_ARRAY,
  313. FILTER_MODE_MAX,
  314. };
  315. struct CubemapFilter {
  316. CubemapFilterShaderRD shader;
  317. RID shader_version;
  318. RID pipelines[FILTER_MODE_MAX];
  319. RID uniform_set;
  320. RID image_uniform_set;
  321. RID coefficient_buffer;
  322. bool use_high_quality;
  323. } filter;
  324. struct SkyPushConstant {
  325. float orientation[12];
  326. float proj[4];
  327. float position[3];
  328. float multiplier;
  329. float time;
  330. float pad[3];
  331. };
  332. enum SpecularMergeMode {
  333. SPECULAR_MERGE_ADD,
  334. SPECULAR_MERGE_SSR,
  335. SPECULAR_MERGE_ADDITIVE_ADD,
  336. SPECULAR_MERGE_ADDITIVE_SSR,
  337. SPECULAR_MERGE_MAX
  338. };
  339. /* Specular merge must be done using raster, rather than compute
  340. * because it must continue the existing color buffer
  341. */
  342. struct SpecularMerge {
  343. SpecularMergeShaderRD shader;
  344. RID shader_version;
  345. RenderPipelineVertexFormatCacheRD pipelines[SPECULAR_MERGE_MAX];
  346. } specular_merge;
  347. enum ScreenSpaceReflectionMode {
  348. SCREEN_SPACE_REFLECTION_NORMAL,
  349. SCREEN_SPACE_REFLECTION_ROUGH,
  350. SCREEN_SPACE_REFLECTION_MAX,
  351. };
  352. struct ScreenSpaceReflectionPushConstant {
  353. float proj_info[4];
  354. int32_t screen_size[2];
  355. float camera_z_near;
  356. float camera_z_far;
  357. int32_t num_steps;
  358. float depth_tolerance;
  359. float distance_fade;
  360. float curve_fade_in;
  361. uint32_t orthogonal;
  362. float filter_mipmap_levels;
  363. uint32_t use_half_res;
  364. uint8_t metallic_mask[4];
  365. float projection[16];
  366. };
  367. struct ScreenSpaceReflection {
  368. ScreenSpaceReflectionPushConstant push_constant;
  369. ScreenSpaceReflectionShaderRD shader;
  370. RID shader_version;
  371. RID pipelines[SCREEN_SPACE_REFLECTION_MAX];
  372. } ssr;
  373. struct ScreenSpaceReflectionFilterPushConstant {
  374. float proj_info[4];
  375. uint32_t orthogonal;
  376. float edge_tolerance;
  377. int32_t increment;
  378. uint32_t pad;
  379. int32_t screen_size[2];
  380. uint32_t vertical;
  381. uint32_t steps;
  382. };
  383. enum {
  384. SCREEN_SPACE_REFLECTION_FILTER_HORIZONTAL,
  385. SCREEN_SPACE_REFLECTION_FILTER_VERTICAL,
  386. SCREEN_SPACE_REFLECTION_FILTER_MAX,
  387. };
  388. struct ScreenSpaceReflectionFilter {
  389. ScreenSpaceReflectionFilterPushConstant push_constant;
  390. ScreenSpaceReflectionFilterShaderRD shader;
  391. RID shader_version;
  392. RID pipelines[SCREEN_SPACE_REFLECTION_FILTER_MAX];
  393. } ssr_filter;
  394. struct ScreenSpaceReflectionScalePushConstant {
  395. int32_t screen_size[2];
  396. float camera_z_near;
  397. float camera_z_far;
  398. uint32_t orthogonal;
  399. uint32_t filter;
  400. uint32_t pad[2];
  401. };
  402. struct ScreenSpaceReflectionScale {
  403. ScreenSpaceReflectionScalePushConstant push_constant;
  404. ScreenSpaceReflectionScaleShaderRD shader;
  405. RID shader_version;
  406. RID pipeline;
  407. } ssr_scale;
  408. struct SubSurfaceScatteringPushConstant {
  409. int32_t screen_size[2];
  410. float camera_z_far;
  411. float camera_z_near;
  412. uint32_t vertical;
  413. uint32_t orthogonal;
  414. float unit_size;
  415. float scale;
  416. float depth_scale;
  417. uint32_t pad[3];
  418. };
  419. struct SubSurfaceScattering {
  420. SubSurfaceScatteringPushConstant push_constant;
  421. SubsurfaceScatteringShaderRD shader;
  422. RID shader_version;
  423. RID pipelines[3]; //3 quality levels
  424. } sss;
  425. RID default_sampler;
  426. RID default_mipmap_sampler;
  427. RID index_buffer;
  428. RID index_array;
  429. Map<RID, RID> texture_to_uniform_set_cache;
  430. Map<RID, RID> image_to_uniform_set_cache;
  431. struct TexturePair {
  432. RID texture1;
  433. RID texture2;
  434. _FORCE_INLINE_ bool operator<(const TexturePair &p_pair) const {
  435. if (texture1 == p_pair.texture1) {
  436. return texture2 < p_pair.texture2;
  437. } else {
  438. return texture1 < p_pair.texture1;
  439. }
  440. }
  441. };
  442. Map<RID, RID> texture_to_compute_uniform_set_cache;
  443. Map<TexturePair, RID> texture_pair_to_compute_uniform_set_cache;
  444. Map<TexturePair, RID> image_pair_to_compute_uniform_set_cache;
  445. RID _get_uniform_set_from_image(RID p_texture);
  446. RID _get_uniform_set_from_texture(RID p_texture, bool p_use_mipmaps = false);
  447. RID _get_compute_uniform_set_from_texture(RID p_texture, bool p_use_mipmaps = false);
  448. RID _get_compute_uniform_set_from_texture_pair(RID p_texture, RID p_texture2, bool p_use_mipmaps = false);
  449. RID _get_compute_uniform_set_from_image_pair(RID p_texture, RID p_texture2);
  450. public:
  451. 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);
  452. 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);
  453. void copy_depth_to_rect(RID p_source_rd_texture, RID p_dest_framebuffer, const Rect2i &p_rect, bool p_flip_y = false);
  454. 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);
  455. void gaussian_blur(RID p_source_rd_texture, RID p_texture, RID p_back_texture, const Rect2i &p_region, bool p_8bit_dst = false);
  456. 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);
  457. 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);
  458. void make_mipmap(RID p_source_rd_texture, RID p_dest_texture, const Size2i &p_size);
  459. 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);
  460. 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);
  461. 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);
  462. struct TonemapSettings {
  463. bool use_glow = false;
  464. enum GlowMode {
  465. GLOW_MODE_ADD,
  466. GLOW_MODE_SCREEN,
  467. GLOW_MODE_SOFTLIGHT,
  468. GLOW_MODE_REPLACE,
  469. GLOW_MODE_MIX
  470. };
  471. GlowMode glow_mode = GLOW_MODE_ADD;
  472. float glow_intensity = 1.0;
  473. uint32_t glow_level_flags = 0;
  474. Vector2i glow_texture_size;
  475. bool glow_use_bicubic_upscale = false;
  476. RID glow_texture;
  477. RS::EnvironmentToneMapper tonemap_mode = RS::ENV_TONE_MAPPER_LINEAR;
  478. float exposure = 1.0;
  479. float white = 1.0;
  480. bool use_auto_exposure = false;
  481. float auto_exposure_grey = 0.5;
  482. RID exposure_texture;
  483. bool use_bcs = false;
  484. float brightness = 1.0;
  485. float contrast = 1.0;
  486. float saturation = 1.0;
  487. bool use_color_correction = false;
  488. RID color_correction_texture;
  489. bool use_fxaa = false;
  490. Vector2i texture_size;
  491. };
  492. void tonemapper(RID p_source_color, RID p_dst_framebuffer, const TonemapSettings &p_settings);
  493. 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);
  494. void roughness_limit(RID p_source_normal, RID p_roughness, const Size2i &p_size, float p_curve);
  495. void cubemap_downsample(RID p_source_cubemap, RID p_dest_cubemap, const Size2i &p_size);
  496. void cubemap_filter(RID p_source_cubemap, Vector<RID> p_dest_cubemap, bool p_use_array);
  497. 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);
  498. 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);
  499. void merge_specular(RID p_dest_framebuffer, RID p_specular, RID p_base, RID p_reflection);
  500. 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);
  501. RasterizerEffectsRD();
  502. ~RasterizerEffectsRD();
  503. };
  504. #endif // !RASTERIZER_EFFECTS_RD_H