Path: blob/master/servers/rendering/renderer_scene_render.cpp
10277 views
/**************************************************************************/1/* renderer_scene_render.cpp */2/**************************************************************************/3/* This file is part of: */4/* GODOT ENGINE */5/* https://godotengine.org */6/**************************************************************************/7/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */8/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */9/* */10/* Permission is hereby granted, free of charge, to any person obtaining */11/* a copy of this software and associated documentation files (the */12/* "Software"), to deal in the Software without restriction, including */13/* without limitation the rights to use, copy, modify, merge, publish, */14/* distribute, sublicense, and/or sell copies of the Software, and to */15/* permit persons to whom the Software is furnished to do so, subject to */16/* the following conditions: */17/* */18/* The above copyright notice and this permission notice shall be */19/* included in all copies or substantial portions of the Software. */20/* */21/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */22/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */23/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */24/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */25/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */26/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */27/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */28/**************************************************************************/2930#include "renderer_scene_render.h"3132/////////////////////////////////////////////////////////////////////////////33// CameraData3435void RendererSceneRender::CameraData::set_camera(const Transform3D p_transform, const Projection p_projection, bool p_is_orthogonal, bool p_is_frustum, bool p_vaspect, const Vector2 &p_taa_jitter, float p_taa_frame_count, const uint32_t p_visible_layers) {36view_count = 1;37is_orthogonal = p_is_orthogonal;38is_frustum = p_is_frustum;39vaspect = p_vaspect;4041main_transform = p_transform;42main_projection = p_projection;4344visible_layers = p_visible_layers;45view_offset[0] = Transform3D();46view_projection[0] = p_projection;47taa_jitter = p_taa_jitter;48taa_frame_count = p_taa_frame_count;49}5051void RendererSceneRender::CameraData::set_multiview_camera(uint32_t p_view_count, const Transform3D *p_transforms, const Projection *p_projections, bool p_is_orthogonal, bool p_is_frustum, bool p_vaspect) {52ERR_FAIL_COND_MSG(p_view_count != 2, "Incorrect view count for stereoscopic view");5354visible_layers = 0xFFFFFFFF;55view_count = p_view_count;56is_orthogonal = p_is_orthogonal;57is_frustum = p_is_frustum;58vaspect = p_vaspect;59Vector<Plane> planes[2];6061/////////////////////////////////////////////////////////////////////////////62// Figure out our center transform6364// 1. obtain our planes65for (uint32_t v = 0; v < view_count; v++) {66planes[v] = p_projections[v].get_projection_planes(p_transforms[v]);67}6869// 2. average and normalize plane normals to obtain z vector, cross them to obtain y vector, and from there the x vector for combined camera basis.70Vector3 n0 = planes[0][Projection::PLANE_LEFT].normal;71Vector3 n1 = planes[1][Projection::PLANE_RIGHT].normal;72Vector3 z = (n0 + n1).normalized();73Vector3 y = n0.cross(n1).normalized();74Vector3 x = y.cross(z).normalized();75y = z.cross(x).normalized();76main_transform.basis.set_columns(x, y, z);7778// 3. create a horizon plane with one of the eyes and the up vector as normal.79Plane horizon(y, p_transforms[0].origin);8081// 4. Intersect horizon, left and right to obtain the combined camera origin.82ERR_FAIL_COND_MSG(83!horizon.intersect_3(planes[0][Projection::PLANE_LEFT], planes[1][Projection::PLANE_RIGHT], &main_transform.origin), "Can't determine camera origin");8485// handy to have the inverse of the transform we just build86Transform3D main_transform_inv = main_transform.inverse();8788// 5. figure out far plane, this could use some improvement, we may have our far plane too close like this, not sure if this matters89Vector3 far_center = (planes[0][Projection::PLANE_FAR].get_center() + planes[1][Projection::PLANE_FAR].get_center()) * 0.5;90Plane far_plane = Plane(-z, far_center);9192/////////////////////////////////////////////////////////////////////////////93// Figure out our top/bottom planes9495// 6. Intersect far and left planes with top planes from both eyes, save the point with highest y as top_left.96Vector3 top_left, other;97ERR_FAIL_COND_MSG(98!far_plane.intersect_3(planes[0][Projection::PLANE_LEFT], planes[0][Projection::PLANE_TOP], &top_left), "Can't determine left camera far/left/top vector");99ERR_FAIL_COND_MSG(100!far_plane.intersect_3(planes[1][Projection::PLANE_LEFT], planes[1][Projection::PLANE_TOP], &other), "Can't determine right camera far/left/top vector");101if (y.dot(top_left) < y.dot(other)) {102top_left = other;103}104105// 7. Intersect far and left planes with bottom planes from both eyes, save the point with lowest y as bottom_left.106Vector3 bottom_left;107ERR_FAIL_COND_MSG(108!far_plane.intersect_3(planes[0][Projection::PLANE_LEFT], planes[0][Projection::PLANE_BOTTOM], &bottom_left), "Can't determine left camera far/left/bottom vector");109ERR_FAIL_COND_MSG(110!far_plane.intersect_3(planes[1][Projection::PLANE_LEFT], planes[1][Projection::PLANE_BOTTOM], &other), "Can't determine right camera far/left/bottom vector");111if (y.dot(other) < y.dot(bottom_left)) {112bottom_left = other;113}114115// 8. Intersect far and right planes with top planes from both eyes, save the point with highest y as top_right.116Vector3 top_right;117ERR_FAIL_COND_MSG(118!far_plane.intersect_3(planes[0][Projection::PLANE_RIGHT], planes[0][Projection::PLANE_TOP], &top_right), "Can't determine left camera far/right/top vector");119ERR_FAIL_COND_MSG(120!far_plane.intersect_3(planes[1][Projection::PLANE_RIGHT], planes[1][Projection::PLANE_TOP], &other), "Can't determine right camera far/right/top vector");121if (y.dot(top_right) < y.dot(other)) {122top_right = other;123}124125// 9. Intersect far and right planes with bottom planes from both eyes, save the point with lowest y as bottom_right.126Vector3 bottom_right;127ERR_FAIL_COND_MSG(128!far_plane.intersect_3(planes[0][Projection::PLANE_RIGHT], planes[0][Projection::PLANE_BOTTOM], &bottom_right), "Can't determine left camera far/right/bottom vector");129ERR_FAIL_COND_MSG(130!far_plane.intersect_3(planes[1][Projection::PLANE_RIGHT], planes[1][Projection::PLANE_BOTTOM], &other), "Can't determine right camera far/right/bottom vector");131if (y.dot(other) < y.dot(bottom_right)) {132bottom_right = other;133}134135// 10. Create top plane with these points: camera origin, top_left, top_right136Plane top(main_transform.origin, top_left, top_right);137138// 11. Create bottom plane with these points: camera origin, bottom_left, bottom_right139Plane bottom(main_transform.origin, bottom_left, bottom_right);140141/////////////////////////////////////////////////////////////////////////////142// Figure out our near plane points143144// 12. Create a near plane using -camera z and the eye further along in that axis.145Plane near_plane;146Vector3 neg_z = -z;147if (neg_z.dot(p_transforms[1].origin) < neg_z.dot(p_transforms[0].origin)) {148near_plane = Plane(neg_z, p_transforms[0].origin);149} else {150near_plane = Plane(neg_z, p_transforms[1].origin);151}152153// 13. Intersect near plane with bottm/left planes, to obtain min_vec then top/right to obtain max_vec154Vector3 min_vec;155ERR_FAIL_COND_MSG(156!near_plane.intersect_3(bottom, planes[0][Projection::PLANE_LEFT], &min_vec), "Can't determine left camera near/left/bottom vector");157ERR_FAIL_COND_MSG(158!near_plane.intersect_3(bottom, planes[1][Projection::PLANE_LEFT], &other), "Can't determine right camera near/left/bottom vector");159if (x.dot(other) < x.dot(min_vec)) {160min_vec = other;161}162163Vector3 max_vec;164ERR_FAIL_COND_MSG(165!near_plane.intersect_3(top, planes[0][Projection::PLANE_RIGHT], &max_vec), "Can't determine left camera near/right/top vector");166ERR_FAIL_COND_MSG(167!near_plane.intersect_3(top, planes[1][Projection::PLANE_RIGHT], &other), "Can't determine right camera near/right/top vector");168if (x.dot(max_vec) < x.dot(other)) {169max_vec = other;170}171172// 14. transform these points by the inverse camera to obtain local_min_vec and local_max_vec173Vector3 local_min_vec = main_transform_inv.xform(min_vec);174Vector3 local_max_vec = main_transform_inv.xform(max_vec);175176// 15. get x and y from these to obtain left, top, right bottom for the frustum. Get the distance from near plane to camera origin to obtain near, and the distance from the far plane to the camera origin to obtain far.177float z_near = -near_plane.distance_to(main_transform.origin);178float z_far = -far_plane.distance_to(main_transform.origin);179180// 16. Use this to build the combined camera matrix.181main_projection.set_frustum(local_min_vec.x, local_max_vec.x, local_min_vec.y, local_max_vec.y, z_near, z_far);182183/////////////////////////////////////////////////////////////////////////////184// 3. Copy our view data185for (uint32_t v = 0; v < view_count; v++) {186view_offset[v] = main_transform_inv * p_transforms[v];187view_projection[v] = p_projections[v] * Projection(view_offset[v].inverse());188}189}190191/* Compositor effect API */192193RID RendererSceneRender::compositor_effect_allocate() {194return compositor_storage.compositor_effect_allocate();195}196197void RendererSceneRender::compositor_effect_initialize(RID p_rid) {198compositor_storage.compositor_effect_initialize(p_rid);199}200201void RendererSceneRender::compositor_effect_free(RID p_rid) {202compositor_storage.compositor_effect_free(p_rid);203}204205bool RendererSceneRender::is_compositor_effect(RID p_effect) const {206return compositor_storage.is_compositor_effect(p_effect);207}208209void RendererSceneRender::compositor_effect_set_enabled(RID p_effect, bool p_enabled) {210compositor_storage.compositor_effect_set_enabled(p_effect, p_enabled);211}212213void RendererSceneRender::compositor_effect_set_callback(RID p_effect, RS::CompositorEffectCallbackType p_callback_type, const Callable &p_callback) {214compositor_storage.compositor_effect_set_callback(p_effect, p_callback_type, p_callback);215}216217void RendererSceneRender::compositor_effect_set_flag(RID p_effect, RS::CompositorEffectFlags p_flag, bool p_set) {218compositor_storage.compositor_effect_set_flag(p_effect, p_flag, p_set);219}220221/* Compositor API */222223RID RendererSceneRender::compositor_allocate() {224return compositor_storage.compositor_allocate();225}226227void RendererSceneRender::compositor_initialize(RID p_rid) {228compositor_storage.compositor_initialize(p_rid);229}230231void RendererSceneRender::compositor_free(RID p_rid) {232compositor_storage.compositor_free(p_rid);233}234235bool RendererSceneRender::is_compositor(RID p_rid) const {236return compositor_storage.is_compositor(p_rid);237}238239void RendererSceneRender::compositor_set_compositor_effects(RID p_compositor, const TypedArray<RID> &p_effects) {240Vector<RID> rids;241for (int i = 0; i < p_effects.size(); i++) {242RID rid = p_effects[i];243rids.push_back(rid);244}245246compositor_storage.compositor_set_compositor_effects(p_compositor, rids);247}248249/* Environment API */250251RID RendererSceneRender::environment_allocate() {252return environment_storage.environment_allocate();253}254255void RendererSceneRender::environment_initialize(RID p_rid) {256environment_storage.environment_initialize(p_rid);257}258259void RendererSceneRender::environment_free(RID p_rid) {260environment_storage.environment_free(p_rid);261}262263bool RendererSceneRender::is_environment(RID p_rid) const {264return environment_storage.is_environment(p_rid);265}266267// background268269void RendererSceneRender::environment_set_background(RID p_env, RS::EnvironmentBG p_bg) {270environment_storage.environment_set_background(p_env, p_bg);271}272273void RendererSceneRender::environment_set_sky(RID p_env, RID p_sky) {274environment_storage.environment_set_sky(p_env, p_sky);275}276277void RendererSceneRender::environment_set_sky_custom_fov(RID p_env, float p_scale) {278environment_storage.environment_set_sky_custom_fov(p_env, p_scale);279}280281void RendererSceneRender::environment_set_sky_orientation(RID p_env, const Basis &p_orientation) {282environment_storage.environment_set_sky_orientation(p_env, p_orientation);283}284285void RendererSceneRender::environment_set_bg_color(RID p_env, const Color &p_color) {286environment_storage.environment_set_bg_color(p_env, p_color);287}288289void RendererSceneRender::environment_set_bg_energy(RID p_env, float p_multiplier, float p_exposure_value) {290environment_storage.environment_set_bg_energy(p_env, p_multiplier, p_exposure_value);291}292293void RendererSceneRender::environment_set_canvas_max_layer(RID p_env, int p_max_layer) {294environment_storage.environment_set_canvas_max_layer(p_env, p_max_layer);295}296297void RendererSceneRender::environment_set_ambient_light(RID p_env, const Color &p_color, RS::EnvironmentAmbientSource p_ambient, float p_energy, float p_sky_contribution, RS::EnvironmentReflectionSource p_reflection_source) {298environment_storage.environment_set_ambient_light(p_env, p_color, p_ambient, p_energy, p_sky_contribution, p_reflection_source);299}300301RS::EnvironmentBG RendererSceneRender::environment_get_background(RID p_env) const {302return environment_storage.environment_get_background(p_env);303}304305RID RendererSceneRender::environment_get_sky(RID p_env) const {306return environment_storage.environment_get_sky(p_env);307}308309float RendererSceneRender::environment_get_sky_custom_fov(RID p_env) const {310return environment_storage.environment_get_sky_custom_fov(p_env);311}312313Basis RendererSceneRender::environment_get_sky_orientation(RID p_env) const {314return environment_storage.environment_get_sky_orientation(p_env);315}316317Color RendererSceneRender::environment_get_bg_color(RID p_env) const {318return environment_storage.environment_get_bg_color(p_env);319}320321float RendererSceneRender::environment_get_bg_energy_multiplier(RID p_env) const {322return environment_storage.environment_get_bg_energy_multiplier(p_env);323}324325float RendererSceneRender::environment_get_bg_intensity(RID p_env) const {326return environment_storage.environment_get_bg_intensity(p_env);327}328329int RendererSceneRender::environment_get_canvas_max_layer(RID p_env) const {330return environment_storage.environment_get_canvas_max_layer(p_env);331}332333RS::EnvironmentAmbientSource RendererSceneRender::environment_get_ambient_source(RID p_env) const {334return environment_storage.environment_get_ambient_source(p_env);335}336337Color RendererSceneRender::environment_get_ambient_light(RID p_env) const {338return environment_storage.environment_get_ambient_light(p_env);339}340341float RendererSceneRender::environment_get_ambient_light_energy(RID p_env) const {342return environment_storage.environment_get_ambient_light_energy(p_env);343}344345float RendererSceneRender::environment_get_ambient_sky_contribution(RID p_env) const {346return environment_storage.environment_get_ambient_sky_contribution(p_env);347}348349RS::EnvironmentReflectionSource RendererSceneRender::environment_get_reflection_source(RID p_env) const {350return environment_storage.environment_get_reflection_source(p_env);351}352353void RendererSceneRender::environment_set_camera_feed_id(RID p_env, int p_camera_feed_id) {354environment_storage.environment_set_camera_feed_id(p_env, p_camera_feed_id);355}356357int RendererSceneRender::environment_get_camera_feed_id(RID p_env) const {358return environment_storage.environment_get_camera_feed_id(p_env);359}360361// Tonemap362363void RendererSceneRender::environment_set_tonemap(RID p_env, RS::EnvironmentToneMapper p_tone_mapper, float p_exposure, float p_white) {364environment_storage.environment_set_tonemap(p_env, p_tone_mapper, p_exposure, p_white);365}366367RS::EnvironmentToneMapper RendererSceneRender::environment_get_tone_mapper(RID p_env) const {368return environment_storage.environment_get_tone_mapper(p_env);369}370371float RendererSceneRender::environment_get_exposure(RID p_env) const {372return environment_storage.environment_get_exposure(p_env);373}374375float RendererSceneRender::environment_get_white(RID p_env) const {376return environment_storage.environment_get_white(p_env);377}378379// Fog380381void RendererSceneRender::environment_set_fog(RID p_env, bool p_enable, const Color &p_light_color, float p_light_energy, float p_sun_scatter, float p_density, float p_height, float p_height_density, float p_aerial_perspective, float p_sky_affect, RS::EnvironmentFogMode p_mode) {382environment_storage.environment_set_fog(p_env, p_enable, p_light_color, p_light_energy, p_sun_scatter, p_density, p_height, p_height_density, p_aerial_perspective, p_sky_affect, p_mode);383}384385bool RendererSceneRender::environment_get_fog_enabled(RID p_env) const {386return environment_storage.environment_get_fog_enabled(p_env);387}388389RS::EnvironmentFogMode RendererSceneRender::environment_get_fog_mode(RID p_env) const {390return environment_storage.environment_get_fog_mode(p_env);391}392393Color RendererSceneRender::environment_get_fog_light_color(RID p_env) const {394return environment_storage.environment_get_fog_light_color(p_env);395}396397float RendererSceneRender::environment_get_fog_light_energy(RID p_env) const {398return environment_storage.environment_get_fog_light_energy(p_env);399}400401float RendererSceneRender::environment_get_fog_sun_scatter(RID p_env) const {402return environment_storage.environment_get_fog_sun_scatter(p_env);403}404405float RendererSceneRender::environment_get_fog_density(RID p_env) const {406return environment_storage.environment_get_fog_density(p_env);407}408409float RendererSceneRender::environment_get_fog_sky_affect(RID p_env) const {410return environment_storage.environment_get_fog_sky_affect(p_env);411}412413float RendererSceneRender::environment_get_fog_height(RID p_env) const {414return environment_storage.environment_get_fog_height(p_env);415}416417float RendererSceneRender::environment_get_fog_height_density(RID p_env) const {418return environment_storage.environment_get_fog_height_density(p_env);419}420421float RendererSceneRender::environment_get_fog_aerial_perspective(RID p_env) const {422return environment_storage.environment_get_fog_aerial_perspective(p_env);423}424425// Depth Fog426427void RendererSceneRender::environment_set_fog_depth(RID p_env, float p_curve, float p_begin, float p_end) {428environment_storage.environment_set_fog_depth(p_env, p_curve, p_begin, p_end);429}430431float RendererSceneRender::environment_get_fog_depth_curve(RID p_env) const {432return environment_storage.environment_get_fog_depth_curve(p_env);433}434435float RendererSceneRender::environment_get_fog_depth_begin(RID p_env) const {436return environment_storage.environment_get_fog_depth_begin(p_env);437}438439float RendererSceneRender::environment_get_fog_depth_end(RID p_env) const {440return environment_storage.environment_get_fog_depth_end(p_env);441}442443// Volumetric Fog444445void RendererSceneRender::environment_set_volumetric_fog(RID p_env, bool p_enable, float p_density, const Color &p_albedo, const Color &p_emission, float p_emission_energy, float p_anisotropy, float p_length, float p_detail_spread, float p_gi_inject, bool p_temporal_reprojection, float p_temporal_reprojection_amount, float p_ambient_inject, float p_sky_affect) {446environment_storage.environment_set_volumetric_fog(p_env, p_enable, p_density, p_albedo, p_emission, p_emission_energy, p_anisotropy, p_length, p_detail_spread, p_gi_inject, p_temporal_reprojection, p_temporal_reprojection_amount, p_ambient_inject, p_sky_affect);447}448449bool RendererSceneRender::environment_get_volumetric_fog_enabled(RID p_env) const {450return environment_storage.environment_get_volumetric_fog_enabled(p_env);451}452453float RendererSceneRender::environment_get_volumetric_fog_density(RID p_env) const {454return environment_storage.environment_get_volumetric_fog_density(p_env);455}456457Color RendererSceneRender::environment_get_volumetric_fog_scattering(RID p_env) const {458return environment_storage.environment_get_volumetric_fog_scattering(p_env);459}460461Color RendererSceneRender::environment_get_volumetric_fog_emission(RID p_env) const {462return environment_storage.environment_get_volumetric_fog_emission(p_env);463}464465float RendererSceneRender::environment_get_volumetric_fog_emission_energy(RID p_env) const {466return environment_storage.environment_get_volumetric_fog_emission_energy(p_env);467}468469float RendererSceneRender::environment_get_volumetric_fog_anisotropy(RID p_env) const {470return environment_storage.environment_get_volumetric_fog_anisotropy(p_env);471}472473float RendererSceneRender::environment_get_volumetric_fog_length(RID p_env) const {474return environment_storage.environment_get_volumetric_fog_length(p_env);475}476477float RendererSceneRender::environment_get_volumetric_fog_detail_spread(RID p_env) const {478return environment_storage.environment_get_volumetric_fog_detail_spread(p_env);479}480481float RendererSceneRender::environment_get_volumetric_fog_gi_inject(RID p_env) const {482return environment_storage.environment_get_volumetric_fog_gi_inject(p_env);483}484485float RendererSceneRender::environment_get_volumetric_fog_sky_affect(RID p_env) const {486return environment_storage.environment_get_volumetric_fog_sky_affect(p_env);487}488489bool RendererSceneRender::environment_get_volumetric_fog_temporal_reprojection(RID p_env) const {490return environment_storage.environment_get_volumetric_fog_temporal_reprojection(p_env);491}492493float RendererSceneRender::environment_get_volumetric_fog_temporal_reprojection_amount(RID p_env) const {494return environment_storage.environment_get_volumetric_fog_temporal_reprojection_amount(p_env);495}496497float RendererSceneRender::environment_get_volumetric_fog_ambient_inject(RID p_env) const {498return environment_storage.environment_get_volumetric_fog_ambient_inject(p_env);499}500501// GLOW502503void RendererSceneRender::environment_set_glow(RID p_env, bool p_enable, Vector<float> p_levels, float p_intensity, float p_strength, float p_mix, float p_bloom_threshold, RS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap, float p_glow_map_strength, RID p_glow_map) {504environment_storage.environment_set_glow(p_env, p_enable, p_levels, p_intensity, p_strength, p_mix, p_bloom_threshold, p_blend_mode, p_hdr_bleed_threshold, p_hdr_bleed_scale, p_hdr_luminance_cap, p_glow_map_strength, p_glow_map);505}506507bool RendererSceneRender::environment_get_glow_enabled(RID p_env) const {508return environment_storage.environment_get_glow_enabled(p_env);509}510511Vector<float> RendererSceneRender::environment_get_glow_levels(RID p_env) const {512return environment_storage.environment_get_glow_levels(p_env);513}514515float RendererSceneRender::environment_get_glow_intensity(RID p_env) const {516return environment_storage.environment_get_glow_intensity(p_env);517}518519float RendererSceneRender::environment_get_glow_strength(RID p_env) const {520return environment_storage.environment_get_glow_strength(p_env);521}522523float RendererSceneRender::environment_get_glow_bloom(RID p_env) const {524return environment_storage.environment_get_glow_bloom(p_env);525}526527float RendererSceneRender::environment_get_glow_mix(RID p_env) const {528return environment_storage.environment_get_glow_mix(p_env);529}530531RS::EnvironmentGlowBlendMode RendererSceneRender::environment_get_glow_blend_mode(RID p_env) const {532return environment_storage.environment_get_glow_blend_mode(p_env);533}534535float RendererSceneRender::environment_get_glow_hdr_bleed_threshold(RID p_env) const {536return environment_storage.environment_get_glow_hdr_bleed_threshold(p_env);537}538539float RendererSceneRender::environment_get_glow_hdr_luminance_cap(RID p_env) const {540return environment_storage.environment_get_glow_hdr_luminance_cap(p_env);541}542543float RendererSceneRender::environment_get_glow_hdr_bleed_scale(RID p_env) const {544return environment_storage.environment_get_glow_hdr_bleed_scale(p_env);545}546547float RendererSceneRender::environment_get_glow_map_strength(RID p_env) const {548return environment_storage.environment_get_glow_map_strength(p_env);549}550551RID RendererSceneRender::environment_get_glow_map(RID p_env) const {552return environment_storage.environment_get_glow_map(p_env);553}554555// SSR556557void RendererSceneRender::environment_set_ssr(RID p_env, bool p_enable, int p_max_steps, float p_fade_int, float p_fade_out, float p_depth_tolerance) {558environment_storage.environment_set_ssr(p_env, p_enable, p_max_steps, p_fade_int, p_fade_out, p_depth_tolerance);559}560561bool RendererSceneRender::environment_get_ssr_enabled(RID p_env) const {562return environment_storage.environment_get_ssr_enabled(p_env);563}564565int RendererSceneRender::environment_get_ssr_max_steps(RID p_env) const {566return environment_storage.environment_get_ssr_max_steps(p_env);567}568569float RendererSceneRender::environment_get_ssr_fade_in(RID p_env) const {570return environment_storage.environment_get_ssr_fade_in(p_env);571}572573float RendererSceneRender::environment_get_ssr_fade_out(RID p_env) const {574return environment_storage.environment_get_ssr_fade_out(p_env);575}576577float RendererSceneRender::environment_get_ssr_depth_tolerance(RID p_env) const {578return environment_storage.environment_get_ssr_depth_tolerance(p_env);579}580581// SSAO582583void RendererSceneRender::environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_power, float p_detail, float p_horizon, float p_sharpness, float p_light_affect, float p_ao_channel_affect) {584environment_storage.environment_set_ssao(p_env, p_enable, p_radius, p_intensity, p_power, p_detail, p_horizon, p_sharpness, p_light_affect, p_ao_channel_affect);585}586587bool RendererSceneRender::environment_get_ssao_enabled(RID p_env) const {588return environment_storage.environment_get_ssao_enabled(p_env);589}590591float RendererSceneRender::environment_get_ssao_radius(RID p_env) const {592return environment_storage.environment_get_ssao_radius(p_env);593}594595float RendererSceneRender::environment_get_ssao_intensity(RID p_env) const {596return environment_storage.environment_get_ssao_intensity(p_env);597}598599float RendererSceneRender::environment_get_ssao_power(RID p_env) const {600return environment_storage.environment_get_ssao_power(p_env);601}602603float RendererSceneRender::environment_get_ssao_detail(RID p_env) const {604return environment_storage.environment_get_ssao_detail(p_env);605}606607float RendererSceneRender::environment_get_ssao_horizon(RID p_env) const {608return environment_storage.environment_get_ssao_horizon(p_env);609}610611float RendererSceneRender::environment_get_ssao_sharpness(RID p_env) const {612return environment_storage.environment_get_ssao_sharpness(p_env);613}614615float RendererSceneRender::environment_get_ssao_direct_light_affect(RID p_env) const {616return environment_storage.environment_get_ssao_direct_light_affect(p_env);617}618619float RendererSceneRender::environment_get_ssao_ao_channel_affect(RID p_env) const {620return environment_storage.environment_get_ssao_ao_channel_affect(p_env);621}622623// SSIL624625void RendererSceneRender::environment_set_ssil(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_sharpness, float p_normal_rejection) {626environment_storage.environment_set_ssil(p_env, p_enable, p_radius, p_intensity, p_sharpness, p_normal_rejection);627}628629bool RendererSceneRender::environment_get_ssil_enabled(RID p_env) const {630return environment_storage.environment_get_ssil_enabled(p_env);631}632633float RendererSceneRender::environment_get_ssil_radius(RID p_env) const {634return environment_storage.environment_get_ssil_radius(p_env);635}636637float RendererSceneRender::environment_get_ssil_intensity(RID p_env) const {638return environment_storage.environment_get_ssil_intensity(p_env);639}640641float RendererSceneRender::environment_get_ssil_sharpness(RID p_env) const {642return environment_storage.environment_get_ssil_sharpness(p_env);643}644645float RendererSceneRender::environment_get_ssil_normal_rejection(RID p_env) const {646return environment_storage.environment_get_ssil_normal_rejection(p_env);647}648649// SDFGI650651void RendererSceneRender::environment_set_sdfgi(RID p_env, bool p_enable, int p_cascades, float p_min_cell_size, RS::EnvironmentSDFGIYScale p_y_scale, bool p_use_occlusion, float p_bounce_feedback, bool p_read_sky, float p_energy, float p_normal_bias, float p_probe_bias) {652environment_storage.environment_set_sdfgi(p_env, p_enable, p_cascades, p_min_cell_size, p_y_scale, p_use_occlusion, p_bounce_feedback, p_read_sky, p_energy, p_normal_bias, p_probe_bias);653}654655bool RendererSceneRender::environment_get_sdfgi_enabled(RID p_env) const {656return environment_storage.environment_get_sdfgi_enabled(p_env);657}658659int RendererSceneRender::environment_get_sdfgi_cascades(RID p_env) const {660return environment_storage.environment_get_sdfgi_cascades(p_env);661}662663float RendererSceneRender::environment_get_sdfgi_min_cell_size(RID p_env) const {664return environment_storage.environment_get_sdfgi_min_cell_size(p_env);665}666667bool RendererSceneRender::environment_get_sdfgi_use_occlusion(RID p_env) const {668return environment_storage.environment_get_sdfgi_use_occlusion(p_env);669}670671float RendererSceneRender::environment_get_sdfgi_bounce_feedback(RID p_env) const {672return environment_storage.environment_get_sdfgi_bounce_feedback(p_env);673}674675bool RendererSceneRender::environment_get_sdfgi_read_sky_light(RID p_env) const {676return environment_storage.environment_get_sdfgi_read_sky_light(p_env);677}678679float RendererSceneRender::environment_get_sdfgi_energy(RID p_env) const {680return environment_storage.environment_get_sdfgi_energy(p_env);681}682683float RendererSceneRender::environment_get_sdfgi_normal_bias(RID p_env) const {684return environment_storage.environment_get_sdfgi_normal_bias(p_env);685}686687float RendererSceneRender::environment_get_sdfgi_probe_bias(RID p_env) const {688return environment_storage.environment_get_sdfgi_probe_bias(p_env);689}690691RS::EnvironmentSDFGIYScale RendererSceneRender::environment_get_sdfgi_y_scale(RID p_env) const {692return environment_storage.environment_get_sdfgi_y_scale(p_env);693}694695// Adjustments696697void RendererSceneRender::environment_set_adjustment(RID p_env, bool p_enable, float p_brightness, float p_contrast, float p_saturation, bool p_use_1d_color_correction, RID p_color_correction) {698environment_storage.environment_set_adjustment(p_env, p_enable, p_brightness, p_contrast, p_saturation, p_use_1d_color_correction, p_color_correction);699}700701bool RendererSceneRender::environment_get_adjustments_enabled(RID p_env) const {702return environment_storage.environment_get_adjustments_enabled(p_env);703}704705float RendererSceneRender::environment_get_adjustments_brightness(RID p_env) const {706return environment_storage.environment_get_adjustments_brightness(p_env);707}708709float RendererSceneRender::environment_get_adjustments_contrast(RID p_env) const {710return environment_storage.environment_get_adjustments_contrast(p_env);711}712713float RendererSceneRender::environment_get_adjustments_saturation(RID p_env) const {714return environment_storage.environment_get_adjustments_saturation(p_env);715}716717bool RendererSceneRender::environment_get_use_1d_color_correction(RID p_env) const {718return environment_storage.environment_get_use_1d_color_correction(p_env);719}720721RID RendererSceneRender::environment_get_color_correction(RID p_env) const {722return environment_storage.environment_get_color_correction(p_env);723}724725726