Environment

Inherits: Resource < Reference < Object

Resource for environment nodes (like WorldEnvironment) that define multiple rendering options.

Description

Resource for environment nodes (like WorldEnvironment) that define multiple environment operations (such as background Sky or Color, ambient light, fog, depth-of-field…). These parameters affect the final render of the scene. The order of these operations is:

  • Depth of Field Blur
  • Glow
  • Tonemap (Auto Exposure)
  • Adjustments

These effects will only apply when the Viewport‘s intended usage is “3D” or “3D Without Effects”. This can be configured for the root Viewport with ProjectSettings.rendering/quality/intended_usage/framebuffer_allocation, or for specific Viewports via the Viewport.usage property.

Tutorials

Properties

floatadjustment_brightness1.0
Textureadjustment_color_correction 
floatadjustment_contrast1.0
booladjustment_enabledfalse
floatadjustment_saturation1.0
Colorambient_light_colorColor( 0, 0, 0, 1 )
floatambient_light_energy1.0
floatambient_light_sky_contribution1.0
boolauto_exposure_enabledfalse
floatauto_exposure_max_luma8.0
floatauto_exposure_min_luma0.05
floatauto_exposure_scale0.4
floatauto_exposure_speed0.5
intbackground_camera_feed_id1
intbackground_canvas_max_layer0
Colorbackground_colorColor( 0, 0, 0, 1 )
floatbackground_energy1.0
BGModebackground_mode0
Skybackground_sky 
floatbackground_sky_custom_fov0.0
Basisbackground_sky_orientationBasis( 1, 0, 0, 0, 1, 0, 0, 0, 1 )
Vector3background_sky_rotationVector3( 0, 0, 0 )
Vector3background_sky_rotation_degreesVector3( 0, 0, 0 )
floatdof_blur_far_amount0.1
floatdof_blur_far_distance10.0
booldof_blur_far_enabledfalse
DOFBlurQualitydof_blur_far_quality1
floatdof_blur_far_transition5.0
floatdof_blur_near_amount0.1
floatdof_blur_near_distance2.0
booldof_blur_near_enabledfalse
DOFBlurQualitydof_blur_near_quality1
floatdof_blur_near_transition1.0
Colorfog_colorColor( 0.5, 0.6, 0.7, 1 )
floatfog_depth_begin10.0
floatfog_depth_curve1.0
boolfog_depth_enabledtrue
floatfog_depth_end100.0
boolfog_enabledfalse
floatfog_height_curve1.0
boolfog_height_enabledfalse
floatfog_height_max0.0
floatfog_height_min10.0
floatfog_sun_amount0.0
Colorfog_sun_colorColor( 1, 0.9, 0.7, 1 )
floatfog_transmit_curve1.0
boolfog_transmit_enabledfalse
boolglow_bicubic_upscalefalse
GlowBlendModeglow_blend_mode2
floatglow_bloom0.0
boolglow_enabledfalse
floatglow_hdr_luminance_cap12.0
floatglow_hdr_scale2.0
floatglow_hdr_threshold1.0
floatglow_intensity0.8
boolglow_levels/1false
boolglow_levels/2false
boolglow_levels/3true
boolglow_levels/4false
boolglow_levels/5true
boolglow_levels/6false
boolglow_levels/7false
floatglow_strength1.0
floatss_reflections_depth_tolerance0.2
boolss_reflections_enabledfalse
floatss_reflections_fade_in0.15
floatss_reflections_fade_out2.0
intss_reflections_max_steps64
boolss_reflections_roughnesstrue
floatssao_ao_channel_affect0.0
floatssao_bias0.01
SSAOBlurssao_blur3
Colorssao_colorColor( 0, 0, 0, 1 )
floatssao_edge_sharpness4.0
boolssao_enabledfalse
floatssao_intensity1.0
floatssao_intensity21.0
floatssao_light_affect0.0
SSAOQualityssao_quality1
floatssao_radius1.0
floatssao_radius20.0
floattonemap_exposure1.0
ToneMappertonemap_mode0
floattonemap_white1.0

Methods

boolis_glow_level_enabled ( int idx ) const
voidset_glow_level ( int idx, bool enabled )

Enumerations

enum BGMode:

  • BG_KEEP = 5 —- Keeps on screen every pixel drawn in the background. This is the fastest background mode, but it can only be safely used in fully-interior scenes (no visible sky or sky reflections). If enabled in a scene where the background is visible, “ghost trail” artifacts will be visible when moving the camera.
  • BG_CLEAR_COLOR = 0 —- Clears the background using the clear color defined in ProjectSettings.rendering/environment/default_clear_color.
  • BG_COLOR = 1 —- Clears the background using a custom clear color.
  • BG_SKY = 2 —- Displays a user-defined sky in the background.
  • BG_COLOR_SKY = 3 —- Clears the background using a custom clear color and allows defining a sky for shading and reflection. This mode is slightly faster than BG_SKY and should be preferred in scenes where reflections can be visible, but the sky itself never is (e.g. top-down camera).
  • BG_CANVAS = 4 —- Displays a CanvasLayer in the background.
  • BG_CAMERA_FEED = 6 —- Displays a camera feed in the background.
  • BG_MAX = 7 —- Represents the size of the BGMode enum.

enum GlowBlendMode:

  • GLOW_BLEND_MODE_ADDITIVE = 0 —- Additive glow blending mode. Mostly used for particles, glows (bloom), lens flare, bright sources.
  • GLOW_BLEND_MODE_SCREEN = 1 —- Screen glow blending mode. Increases brightness, used frequently with bloom.
  • GLOW_BLEND_MODE_SOFTLIGHT = 2 —- Soft light glow blending mode. Modifies contrast, exposes shadows and highlights (vivid bloom).
  • GLOW_BLEND_MODE_REPLACE = 3 —- Replace glow blending mode. Replaces all pixels’ color by the glow value. This can be used to simulate a full-screen blur effect by tweaking the glow parameters to match the original image’s brightness.

enum ToneMapper:

  • TONE_MAPPER_LINEAR = 0 —- Linear tonemapper operator. Reads the linear data and passes it on unmodified.
  • TONE_MAPPER_REINHARDT = 1 —- Reinhardt tonemapper operator. Performs a variation on rendered pixels’ colors by this formula: color = color / (1 + color).
  • TONE_MAPPER_FILMIC = 2 —- Filmic tonemapper operator.
  • TONE_MAPPER_ACES = 3 —- Academy Color Encoding System tonemapper operator.

enum DOFBlurQuality:

  • DOF_BLUR_QUALITY_LOW = 0 —- Low depth-of-field blur quality (fastest).
  • DOF_BLUR_QUALITY_MEDIUM = 1 —- Medium depth-of-field blur quality.
  • DOF_BLUR_QUALITY_HIGH = 2 —- High depth-of-field blur quality (slowest).

enum SSAOBlur:

  • SSAO_BLUR_DISABLED = 0 —- No blur for the screen-space ambient occlusion effect (fastest).
  • SSAO_BLUR_1x1 = 1 —- 1×1 blur for the screen-space ambient occlusion effect.
  • SSAO_BLUR_2x2 = 2 —- 2×2 blur for the screen-space ambient occlusion effect.
  • SSAO_BLUR_3x3 = 3 —- 3×3 blur for the screen-space ambient occlusion effect (slowest).

enum SSAOQuality:

  • SSAO_QUALITY_LOW = 0 —- Low quality for the screen-space ambient occlusion effect (fastest).
  • SSAO_QUALITY_MEDIUM = 1 —- Low quality for the screen-space ambient occlusion effect.
  • SSAO_QUALITY_HIGH = 2 —- Low quality for the screen-space ambient occlusion effect (slowest).

Property Descriptions

  • float adjustment_brightness
Default1.0
Setterset_adjustment_brightness(value)
Getterget_adjustment_brightness()

The global brightness value of the rendered scene. Effective only if adjustment_enabled is true.


  • Texture adjustment_color_correction
Setterset_adjustment_color_correction(value)
Getterget_adjustment_color_correction()

Applies the provided Texture resource to affect the global color aspect of the rendered scene. Effective only if adjustment_enabled is true.


  • float adjustment_contrast
Default1.0
Setterset_adjustment_contrast(value)
Getterget_adjustment_contrast()

The global contrast value of the rendered scene (default value is 1). Effective only if adjustment_enabled is true.


  • bool adjustment_enabled
Defaultfalse
Setterset_adjustment_enable(value)
Getteris_adjustment_enabled()

If true, enables the adjustment_* properties provided by this resource. If false, modifications to the adjustment_* properties will have no effect on the rendered scene.


  • float adjustment_saturation
Default1.0
Setterset_adjustment_saturation(value)
Getterget_adjustment_saturation()

The global color saturation value of the rendered scene (default value is 1). Effective only if adjustment_enabled is true.


  • Color ambient_light_color
DefaultColor( 0, 0, 0, 1 )
Setterset_ambient_light_color(value)
Getterget_ambient_light_color()

The ambient light’s Color.


  • float ambient_light_energy
Default1.0
Setterset_ambient_light_energy(value)
Getterget_ambient_light_energy()

The ambient light’s energy. The higher the value, the stronger the light.


  • float ambient_light_sky_contribution
Default1.0
Setterset_ambient_light_sky_contribution(value)
Getterget_ambient_light_sky_contribution()

Defines the amount of light that the sky brings on the scene. A value of 0 means that the sky’s light emission has no effect on the scene illumination, thus all ambient illumination is provided by the ambient light. On the contrary, a value of 1 means that all the light that affects the scene is provided by the sky, thus the ambient light parameter has no effect on the scene.


  • bool auto_exposure_enabled
Defaultfalse
Setterset_tonemap_auto_exposure(value)
Getterget_tonemap_auto_exposure()

If true, enables the tonemapping auto exposure mode of the scene renderer. If true, the renderer will automatically determine the exposure setting to adapt to the scene’s illumination and the observed light.


  • float auto_exposure_max_luma
Default8.0
Setterset_tonemap_auto_exposure_max(value)
Getterget_tonemap_auto_exposure_max()

The maximum luminance value for the auto exposure.


  • float auto_exposure_min_luma
Default0.05
Setterset_tonemap_auto_exposure_min(value)
Getterget_tonemap_auto_exposure_min()

The minimum luminance value for the auto exposure.


  • float auto_exposure_scale
Default0.4
Setterset_tonemap_auto_exposure_grey(value)
Getterget_tonemap_auto_exposure_grey()

The scale of the auto exposure effect. Affects the intensity of auto exposure.


  • float auto_exposure_speed
Default0.5
Setterset_tonemap_auto_exposure_speed(value)
Getterget_tonemap_auto_exposure_speed()

The speed of the auto exposure effect. Affects the time needed for the camera to perform auto exposure.


  • int background_camera_feed_id
Default1
Setterset_camera_feed_id(value)
Getterget_camera_feed_id()

The ID of the camera feed to show in the background.


  • int background_canvas_max_layer
Default0
Setterset_canvas_max_layer(value)
Getterget_canvas_max_layer()

The maximum layer ID to display. Only effective when using the BG_CANVAS background mode.


DefaultColor( 0, 0, 0, 1 )
Setterset_bg_color(value)
Getterget_bg_color()

The Color displayed for clear areas of the scene. Only effective when using the BG_COLOR or BG_COLOR_SKY background modes).


Default1.0
Setterset_bg_energy(value)
Getterget_bg_energy()

The power of the light emitted by the background.


Default0
Setterset_background(value)
Getterget_background()

The background mode. See BGMode for possible values.


  • Sky background_sky
Setterset_sky(value)
Getterget_sky()

The Sky resource defined as background.


  • float background_sky_custom_fov
Default0.0
Setterset_sky_custom_fov(value)
Getterget_sky_custom_fov()

The Sky resource’s custom field of view.


  • Basis background_sky_orientation
DefaultBasis( 1, 0, 0, 0, 1, 0, 0, 0, 1 )
Setterset_sky_orientation(value)
Getterget_sky_orientation()

The Sky resource’s rotation expressed as a Basis.


DefaultVector3( 0, 0, 0 )
Setterset_sky_rotation(value)
Getterget_sky_rotation()

The Sky resource’s rotation expressed as Euler angles in radians.


  • Vector3 background_sky_rotation_degrees
DefaultVector3( 0, 0, 0 )
Setterset_sky_rotation_degrees(value)
Getterget_sky_rotation_degrees()

The Sky resource’s rotation expressed as Euler angles in degrees.


  • float dof_blur_far_amount
Default0.1
Setterset_dof_blur_far_amount(value)
Getterget_dof_blur_far_amount()

The amount of far blur for the depth-of-field effect.


  • float dof_blur_far_distance
Default10.0
Setterset_dof_blur_far_distance(value)
Getterget_dof_blur_far_distance()

The distance from the camera where the far blur effect affects the rendering.


  • bool dof_blur_far_enabled
Defaultfalse
Setterset_dof_blur_far_enabled(value)
Getteris_dof_blur_far_enabled()

If true, enables the depth-of-field far blur effect.


Default1
Setterset_dof_blur_far_quality(value)
Getterget_dof_blur_far_quality()

The depth-of-field far blur’s quality. Higher values can mitigate the visible banding effect seen at higher strengths, but are much slower.


  • float dof_blur_far_transition
Default5.0
Setterset_dof_blur_far_transition(value)
Getterget_dof_blur_far_transition()

The length of the transition between the no-blur area and far blur.


  • float dof_blur_near_amount
Default0.1
Setterset_dof_blur_near_amount(value)
Getterget_dof_blur_near_amount()

The amount of near blur for the depth-of-field effect.


  • float dof_blur_near_distance
Default2.0
Setterset_dof_blur_near_distance(value)
Getterget_dof_blur_near_distance()

Distance from the camera where the near blur effect affects the rendering.


  • bool dof_blur_near_enabled
Defaultfalse
Setterset_dof_blur_near_enabled(value)
Getteris_dof_blur_near_enabled()

If true, enables the depth-of-field near blur effect.


Default1
Setterset_dof_blur_near_quality(value)
Getterget_dof_blur_near_quality()

The depth-of-field near blur’s quality. Higher values can mitigate the visible banding effect seen at higher strengths, but are much slower.


  • float dof_blur_near_transition
Default1.0
Setterset_dof_blur_near_transition(value)
Getterget_dof_blur_near_transition()

The length of the transition between the near blur and no-blur area.


DefaultColor( 0.5, 0.6, 0.7, 1 )
Setterset_fog_color(value)
Getterget_fog_color()

The fog’s Color.


Default10.0
Setterset_fog_depth_begin(value)
Getterget_fog_depth_begin()

The fog’s depth starting distance from the camera.


Default1.0
Setterset_fog_depth_curve(value)
Getterget_fog_depth_curve()

The fog depth’s intensity curve. A number of presets are available in the Inspector by right-clicking the curve.


  • bool fog_depth_enabled
Defaulttrue
Setterset_fog_depth_enabled(value)
Getteris_fog_depth_enabled()

If true, the depth fog effect is enabled. When enabled, fog will appear in the distance (relative to the camera).


Default100.0
Setterset_fog_depth_end(value)
Getterget_fog_depth_end()

The fog’s depth end distance from the camera. If this value is set to 0, it will be equal to the current camera’s Camera.far value.


Defaultfalse
Setterset_fog_enabled(value)
Getteris_fog_enabled()

If true, fog effects are enabled. fog_height_enabled and/or fog_depth_enabled must be set to true to actually display fog.


Default1.0
Setterset_fog_height_curve(value)
Getterget_fog_height_curve()

The height fog’s intensity. A number of presets are available in the Inspector by right-clicking the curve.


  • bool fog_height_enabled
Defaultfalse
Setterset_fog_height_enabled(value)
Getteris_fog_height_enabled()

If true, the height fog effect is enabled. When enabled, fog will appear in a defined height range, regardless of the distance from the camera. This can be used to simulate “deep water” effects with a lower performance cost compared to a dedicated shader.


Default0.0
Setterset_fog_height_max(value)
Getterget_fog_height_max()

The Y coordinate where the height fog will be the most intense. If this value is greater than fog_height_min, fog will be displayed from bottom to top. Otherwise, it will be displayed from top to bottom.


Default10.0
Setterset_fog_height_min(value)
Getterget_fog_height_min()

The Y coordinate where the height fog will be the least intense. If this value is greater than fog_height_max, fog will be displayed from top to bottom. Otherwise, it will be displayed from bottom to top.


Default0.0
Setterset_fog_sun_amount(value)
Getterget_fog_sun_amount()

The intensity of the depth fog color transition when looking towards the sun. The sun’s direction is determined automatically using the DirectionalLight node in the scene.


DefaultColor( 1, 0.9, 0.7, 1 )
Setterset_fog_sun_color(value)
Getterget_fog_sun_color()

The depth fog’s Color when looking towards the sun.


  • float fog_transmit_curve
Default1.0
Setterset_fog_transmit_curve(value)
Getterget_fog_transmit_curve()

The intensity of the fog light transmittance effect. Amount of light that the fog transmits.


  • bool fog_transmit_enabled
Defaultfalse
Setterset_fog_transmit_enabled(value)
Getteris_fog_transmit_enabled()

Enables fog’s light transmission effect. If true, light will be more visible in the fog to simulate light scattering as in real life.


  • bool glow_bicubic_upscale
Defaultfalse
Setterset_glow_bicubic_upscale(value)
Getteris_glow_bicubic_upscale_enabled()

Smooths out the blockiness created by sampling higher levels, at the cost of performance.

Note: When using the GLES2 renderer, this is only available if the GPU supports the GL_EXT_gpu_shader4 extension.


Default2
Setterset_glow_blend_mode(value)
Getterget_glow_blend_mode()

The glow blending mode.


Default0.0
Setterset_glow_bloom(value)
Getterget_glow_bloom()

The bloom’s intensity. If set to a value higher than 0, this will make glow visible in areas darker than the glow_hdr_threshold.


Defaultfalse
Setterset_glow_enabled(value)
Getteris_glow_enabled()

If true, the glow effect is enabled.


  • float glow_hdr_luminance_cap
Default12.0
Setterset_glow_hdr_luminance_cap(value)
Getterget_glow_hdr_luminance_cap()

The higher threshold of the HDR glow. Areas brighter than this threshold will be clamped for the purposes of the glow effect.


Default2.0
Setterset_glow_hdr_bleed_scale(value)
Getterget_glow_hdr_bleed_scale()

The bleed scale of the HDR glow.


  • float glow_hdr_threshold
Default1.0
Setterset_glow_hdr_bleed_threshold(value)
Getterget_glow_hdr_bleed_threshold()

The lower threshold of the HDR glow. When using the GLES2 renderer (which doesn’t support HDR), this needs to be below 1.0 for glow to be visible. A value of 0.9 works well in this case.


Default0.8
Setterset_glow_intensity(value)
Getterget_glow_intensity()

The glow intensity. When using the GLES2 renderer, this should be increased to 1.5 to compensate for the lack of HDR rendering.


Defaultfalse
Setterset_glow_level(value)
Getteris_glow_level_enabled()

If true, the 1st level of glow is enabled. This is the most “local” level (least blurry).


Defaultfalse
Setterset_glow_level(value)
Getteris_glow_level_enabled()

If true, the 2th level of glow is enabled.


Defaulttrue
Setterset_glow_level(value)
Getteris_glow_level_enabled()

If true, the 3th level of glow is enabled.


Defaultfalse
Setterset_glow_level(value)
Getteris_glow_level_enabled()

If true, the 4th level of glow is enabled.


Defaulttrue
Setterset_glow_level(value)
Getteris_glow_level_enabled()

If true, the 5th level of glow is enabled.


Defaultfalse
Setterset_glow_level(value)
Getteris_glow_level_enabled()

If true, the 6th level of glow is enabled.


Defaultfalse
Setterset_glow_level(value)
Getteris_glow_level_enabled()

If true, the 7th level of glow is enabled. This is the most “global” level (blurriest).


Default1.0
Setterset_glow_strength(value)
Getterget_glow_strength()

The glow strength. When using the GLES2 renderer, this should be increased to 1.3 to compensate for the lack of HDR rendering.


  • float ss_reflections_depth_tolerance
Default0.2
Setterset_ssr_depth_tolerance(value)
Getterget_ssr_depth_tolerance()

The depth tolerance for screen-space reflections.


  • bool ss_reflections_enabled
Defaultfalse
Setterset_ssr_enabled(value)
Getteris_ssr_enabled()

If true, screen-space reflections are enabled. Screen-space reflections are more accurate than reflections from GIProbes or ReflectionProbes, but are slower and can’t reflect surfaces occluded by others.


  • float ss_reflections_fade_in
Default0.15
Setterset_ssr_fade_in(value)
Getterget_ssr_fade_in()

The fade-in distance for screen-space reflections. Affects the area from the reflected material to the screen-space reflection).


  • float ss_reflections_fade_out
Default2.0
Setterset_ssr_fade_out(value)
Getterget_ssr_fade_out()

The fade-out distance for screen-space reflections. Affects the area from the screen-space reflection to the “global” reflection.


  • int ss_reflections_max_steps
Default64
Setterset_ssr_max_steps(value)
Getterget_ssr_max_steps()

The maximum number of steps for screen-space reflections. Higher values are slower.


  • bool ss_reflections_roughness
Defaulttrue
Setterset_ssr_rough(value)
Getteris_ssr_rough()

If true, screen-space reflections will take the material roughness into account.


  • float ssao_ao_channel_affect
Default0.0
Setterset_ssao_ao_channel_affect(value)
Getterget_ssao_ao_channel_affect()

The screen-space ambient occlusion intensity on materials that have an AO texture defined. Values higher than 0 will make the SSAO effect visible in areas darkened by AO textures.


Default0.01
Setterset_ssao_bias(value)
Getterget_ssao_bias()

The screen-space ambient occlusion bias. This should be kept high enough to prevent “smooth” curves from being affected by ambient occlusion.


Default3
Setterset_ssao_blur(value)
Getterget_ssao_blur()

The screen-space ambient occlusion blur quality. See SSAOBlur for possible values.


DefaultColor( 0, 0, 0, 1 )
Setterset_ssao_color(value)
Getterget_ssao_color()

The screen-space ambient occlusion color.


  • float ssao_edge_sharpness
Default4.0
Setterset_ssao_edge_sharpness(value)
Getterget_ssao_edge_sharpness()

The screen-space ambient occlusion edge sharpness.


Defaultfalse
Setterset_ssao_enabled(value)
Getteris_ssao_enabled()

If true, the screen-space ambient occlusion effect is enabled. This darkens objects’ corners and cavities to simulate ambient light not reaching the entire object as in real life. This works well for small, dynamic objects, but baked lighting or ambient occlusion textures will do a better job at displaying ambient occlusion on large static objects. This is a costly effect and should be disabled first when running into performance issues.


Default1.0
Setterset_ssao_intensity(value)
Getterget_ssao_intensity()

The primary screen-space ambient occlusion intensity. See also ssao_radius.


Default1.0
Setterset_ssao_intensity2(value)
Getterget_ssao_intensity2()

The secondary screen-space ambient occlusion intensity. See also ssao_radius2.


Default0.0
Setterset_ssao_direct_light_affect(value)
Getterget_ssao_direct_light_affect()

The screen-space ambient occlusion intensity in direct light. In real life, ambient occlusion only applies to indirect light, which means its effects can’t be seen in direct light. Values higher than 0 will make the SSAO effect visible in direct light.


Default1
Setterset_ssao_quality(value)
Getterget_ssao_quality()

The screen-space ambient occlusion quality. Higher qualities will make better use of small objects for ambient occlusion, but are slower.


Default1.0
Setterset_ssao_radius(value)
Getterget_ssao_radius()

The primary screen-space ambient occlusion radius.


Default0.0
Setterset_ssao_radius2(value)
Getterget_ssao_radius2()

The secondary screen-space ambient occlusion radius. If set to a value higher than 0, enables the secondary screen-space ambient occlusion effect which can be used to improve the effect’s appearance (at the cost of performance).


Default1.0
Setterset_tonemap_exposure(value)
Getterget_tonemap_exposure()

The default exposure used for tonemapping.


Default0
Setterset_tonemapper(value)
Getterget_tonemapper()

The tonemapping mode to use. Tonemapping is the process that “converts” HDR values to be suitable for rendering on a LDR display. (Godot doesn’t support rendering on HDR displays yet.)


Default1.0
Setterset_tonemap_white(value)
Getterget_tonemap_white()

The white reference value for tonemapping. Only effective if the tonemap_mode isn’t set to TONE_MAPPER_LINEAR.

Method Descriptions

  • bool is_glow_level_enabled ( int idx ) const

Returns true if the glow level idx is specified, false otherwise.


  • void set_glow_level ( int idx, bool enabled )

Enables or disables the glow level at index idx. Each level relies on the previous level. This means that enabling higher glow levels will slow down the glow effect rendering, even if previous levels aren’t enabled.