mirror of
https://github.com/Relintai/pandemonium_engine_minimal.git
synced 2024-12-21 16:56:50 +01:00
Removed the 3d environment api.
This commit is contained in:
parent
f166dec796
commit
0174bfa0fb
@ -1,385 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="Environment3D" inherits="Resource" version="4.2">
|
||||
<brief_description>
|
||||
Resource for environment nodes (like [WorldEnvironment3D]) that define multiple rendering options.
|
||||
</brief_description>
|
||||
<description>
|
||||
Resource for environment nodes (like [WorldEnvironment3D]) 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
|
||||
If the target [Viewport] is set to "2D Without Sampling", all post-processing effects will be unavailable. With "3D Without Effects", the following options will be unavailable:
|
||||
- Ssao
|
||||
- Ss Reflections
|
||||
This can be configured for the root Viewport with [member ProjectSettings.rendering/quality/intended_usage/framebuffer_allocation], or for specific Viewports via the [member Viewport.usage] property.
|
||||
Note that [member ProjectSettings.rendering/quality/intended_usage/framebuffer_allocation] has a mobile platform override to use "3D Without Effects" by default. It improves the performance on mobile devices, but at the same time affects the screen display on mobile devices.
|
||||
</description>
|
||||
<tutorials>
|
||||
<link title="Environment3D and post-processing">$DOCS_URL/tutorials/3d/environment_and_post_processing.md</link>
|
||||
<link title="Light transport in game engines">$DOCS_URL/tutorials/3d/high_dynamic_range.md</link>
|
||||
<link title="3D Material Testers Demo">https://godotengine.org/asset-library/asset/123</link>
|
||||
<link title="2D HDR Demo">https://godotengine.org/asset-library/asset/110</link>
|
||||
<link title="Third Person Shooter Demo">https://godotengine.org/asset-library/asset/678</link>
|
||||
</tutorials>
|
||||
<methods>
|
||||
<method name="is_glow_level_enabled" qualifiers="const">
|
||||
<return type="bool" />
|
||||
<argument index="0" name="idx" type="int" />
|
||||
<description>
|
||||
Returns [code]true[/code] if the glow level [code]idx[/code] is specified, [code]false[/code] otherwise.
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_glow_level">
|
||||
<return type="void" />
|
||||
<argument index="0" name="idx" type="int" />
|
||||
<argument index="1" name="enabled" type="bool" />
|
||||
<description>
|
||||
Enables or disables the glow level at index [code]idx[/code]. 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.
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
<members>
|
||||
<member name="adjustment_brightness" type="float" setter="set_adjustment_brightness" getter="get_adjustment_brightness" default="1.0">
|
||||
The global brightness value of the rendered scene. Effective only if [code]adjustment_enabled[/code] is [code]true[/code].
|
||||
</member>
|
||||
<member name="adjustment_color_correction" type="Texture" setter="set_adjustment_color_correction" getter="get_adjustment_color_correction">
|
||||
Applies the provided [Texture] resource to affect the global color aspect of the rendered scene. Effective only if [code]adjustment_enabled[/code] is [code]true[/code].
|
||||
</member>
|
||||
<member name="adjustment_contrast" type="float" setter="set_adjustment_contrast" getter="get_adjustment_contrast" default="1.0">
|
||||
The global contrast value of the rendered scene (default value is 1). Effective only if [code]adjustment_enabled[/code] is [code]true[/code].
|
||||
</member>
|
||||
<member name="adjustment_enabled" type="bool" setter="set_adjustment_enable" getter="is_adjustment_enabled" default="false">
|
||||
If [code]true[/code], enables the [code]adjustment_*[/code] properties provided by this resource. If [code]false[/code], modifications to the [code]adjustment_*[/code] properties will have no effect on the rendered scene.
|
||||
</member>
|
||||
<member name="adjustment_saturation" type="float" setter="set_adjustment_saturation" getter="get_adjustment_saturation" default="1.0">
|
||||
The global color saturation value of the rendered scene (default value is 1). Effective only if [code]adjustment_enabled[/code] is [code]true[/code].
|
||||
</member>
|
||||
<member name="ambient_light_color" type="Color" setter="set_ambient_light_color" getter="get_ambient_light_color" default="Color( 0, 0, 0, 1 )">
|
||||
The ambient light's [Color].
|
||||
</member>
|
||||
<member name="ambient_light_energy" type="float" setter="set_ambient_light_energy" getter="get_ambient_light_energy" default="1.0">
|
||||
The ambient light's energy. The higher the value, the stronger the light.
|
||||
</member>
|
||||
<member name="ambient_light_sky_contribution" type="float" setter="set_ambient_light_sky_contribution" getter="get_ambient_light_sky_contribution" default="1.0">
|
||||
Defines the amount of light that the sky brings on the scene. A value of [code]0.0[/code] 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 [code]1.0[/code] means that [i]all[/i] the light that affects the scene is provided by the sky, thus the ambient light parameter has no effect on the scene.
|
||||
[b]Note:[/b] [member ambient_light_sky_contribution] is internally clamped between [code]0.0[/code] and [code]1.0[/code] (inclusive).
|
||||
</member>
|
||||
<member name="auto_exposure_enabled" type="bool" setter="set_tonemap_auto_exposure" getter="get_tonemap_auto_exposure" default="false">
|
||||
If [code]true[/code], enables the tonemapping auto exposure mode of the scene renderer. If [code]true[/code], the renderer will automatically determine the exposure setting to adapt to the scene's illumination and the observed light.
|
||||
</member>
|
||||
<member name="auto_exposure_max_luma" type="float" setter="set_tonemap_auto_exposure_max" getter="get_tonemap_auto_exposure_max" default="8.0">
|
||||
The maximum luminance value for the auto exposure.
|
||||
</member>
|
||||
<member name="auto_exposure_min_luma" type="float" setter="set_tonemap_auto_exposure_min" getter="get_tonemap_auto_exposure_min" default="0.05">
|
||||
The minimum luminance value for the auto exposure.
|
||||
</member>
|
||||
<member name="auto_exposure_scale" type="float" setter="set_tonemap_auto_exposure_grey" getter="get_tonemap_auto_exposure_grey" default="0.4">
|
||||
The scale of the auto exposure effect. Affects the intensity of auto exposure.
|
||||
</member>
|
||||
<member name="auto_exposure_speed" type="float" setter="set_tonemap_auto_exposure_speed" getter="get_tonemap_auto_exposure_speed" default="0.5">
|
||||
The speed of the auto exposure effect. Affects the time needed for the camera to perform auto exposure.
|
||||
</member>
|
||||
<member name="background_canvas_max_layer" type="int" setter="set_canvas_max_layer" getter="get_canvas_max_layer" default="0">
|
||||
The maximum layer ID to display. Only effective when using the [constant BG_CANVAS] background mode.
|
||||
</member>
|
||||
<member name="background_color" type="Color" setter="set_bg_color" getter="get_bg_color" default="Color( 0, 0, 0, 1 )">
|
||||
The [Color] displayed for clear areas of the scene. Only effective when using the [constant BG_COLOR] or [constant BG_COLOR_SKY] background modes).
|
||||
</member>
|
||||
<member name="background_energy" type="float" setter="set_bg_energy" getter="get_bg_energy" default="1.0">
|
||||
The power of the light emitted by the background. This affects the sky brightness, the ambient light (if [member ambient_light_sky_contribution] is greater than [code]0.0[/code]) and specular light from the sky.
|
||||
</member>
|
||||
<member name="background_mode" type="int" setter="set_background" getter="get_background" enum="Environment3D.BGMode" default="0">
|
||||
The background mode. See [enum BGMode] for possible values.
|
||||
</member>
|
||||
<member name="background_sky" type="Sky" setter="set_sky" getter="get_sky">
|
||||
The [Sky] resource defined as background.
|
||||
</member>
|
||||
<member name="background_sky_custom_fov" type="float" setter="set_sky_custom_fov" getter="get_sky_custom_fov" default="0.0">
|
||||
The [Sky] resource's custom field of view.
|
||||
</member>
|
||||
<member name="background_sky_orientation" type="Basis" setter="set_sky_orientation" getter="get_sky_orientation" default="Basis( 1, 0, 0, 0, 1, 0, 0, 0, 1 )">
|
||||
The [Sky] resource's rotation expressed as a [Basis].
|
||||
</member>
|
||||
<member name="background_sky_rotation" type="Vector3" setter="set_sky_rotation" getter="get_sky_rotation" default="Vector3( 0, 0, 0 )">
|
||||
The [Sky] resource's rotation expressed as Euler angles in radians.
|
||||
</member>
|
||||
<member name="background_sky_rotation_degrees" type="Vector3" setter="set_sky_rotation_degrees" getter="get_sky_rotation_degrees" default="Vector3( 0, 0, 0 )">
|
||||
The [Sky] resource's rotation expressed as Euler angles in degrees.
|
||||
</member>
|
||||
<member name="dof_blur_far_amount" type="float" setter="set_dof_blur_far_amount" getter="get_dof_blur_far_amount" default="0.1">
|
||||
The amount of far blur for the depth-of-field effect.
|
||||
</member>
|
||||
<member name="dof_blur_far_distance" type="float" setter="set_dof_blur_far_distance" getter="get_dof_blur_far_distance" default="10.0">
|
||||
The distance from the camera where the far blur effect affects the rendering.
|
||||
</member>
|
||||
<member name="dof_blur_far_enabled" type="bool" setter="set_dof_blur_far_enabled" getter="is_dof_blur_far_enabled" default="false">
|
||||
If [code]true[/code], enables the depth-of-field far blur effect.
|
||||
</member>
|
||||
<member name="dof_blur_far_quality" type="int" setter="set_dof_blur_far_quality" getter="get_dof_blur_far_quality" enum="Environment3D.DOFBlurQuality" default="1">
|
||||
The depth-of-field far blur's quality. Higher values can mitigate the visible banding effect seen at higher strengths, but are much slower.
|
||||
</member>
|
||||
<member name="dof_blur_far_transition" type="float" setter="set_dof_blur_far_transition" getter="get_dof_blur_far_transition" default="5.0">
|
||||
The length of the transition between the no-blur area and far blur.
|
||||
</member>
|
||||
<member name="dof_blur_near_amount" type="float" setter="set_dof_blur_near_amount" getter="get_dof_blur_near_amount" default="0.1">
|
||||
The amount of near blur for the depth-of-field effect.
|
||||
</member>
|
||||
<member name="dof_blur_near_distance" type="float" setter="set_dof_blur_near_distance" getter="get_dof_blur_near_distance" default="2.0">
|
||||
Distance from the camera where the near blur effect affects the rendering.
|
||||
</member>
|
||||
<member name="dof_blur_near_enabled" type="bool" setter="set_dof_blur_near_enabled" getter="is_dof_blur_near_enabled" default="false">
|
||||
If [code]true[/code], enables the depth-of-field near blur effect.
|
||||
</member>
|
||||
<member name="dof_blur_near_quality" type="int" setter="set_dof_blur_near_quality" getter="get_dof_blur_near_quality" enum="Environment3D.DOFBlurQuality" default="1">
|
||||
The depth-of-field near blur's quality. Higher values can mitigate the visible banding effect seen at higher strengths, but are much slower.
|
||||
</member>
|
||||
<member name="dof_blur_near_transition" type="float" setter="set_dof_blur_near_transition" getter="get_dof_blur_near_transition" default="1.0">
|
||||
The length of the transition between the near blur and no-blur area.
|
||||
</member>
|
||||
<member name="fog_color" type="Color" setter="set_fog_color" getter="get_fog_color" default="Color( 0.5, 0.6, 0.7, 1 )">
|
||||
The fog's [Color].
|
||||
</member>
|
||||
<member name="fog_depth_begin" type="float" setter="set_fog_depth_begin" getter="get_fog_depth_begin" default="10.0">
|
||||
The fog's depth starting distance from the camera.
|
||||
</member>
|
||||
<member name="fog_depth_curve" type="float" setter="set_fog_depth_curve" getter="get_fog_depth_curve" default="1.0">
|
||||
The fog depth's intensity curve. A number of presets are available in the [b]Inspector[/b] by right-clicking the curve.
|
||||
</member>
|
||||
<member name="fog_depth_enabled" type="bool" setter="set_fog_depth_enabled" getter="is_fog_depth_enabled" default="true">
|
||||
If [code]true[/code], the depth fog effect is enabled. When enabled, fog will appear in the distance (relative to the camera).
|
||||
</member>
|
||||
<member name="fog_depth_end" type="float" setter="set_fog_depth_end" getter="get_fog_depth_end" default="100.0">
|
||||
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 [member Camera.far] value.
|
||||
</member>
|
||||
<member name="fog_enabled" type="bool" setter="set_fog_enabled" getter="is_fog_enabled" default="false">
|
||||
If [code]true[/code], fog effects are enabled. [member fog_height_enabled] and/or [member fog_depth_enabled] must be set to [code]true[/code] to actually display fog.
|
||||
</member>
|
||||
<member name="fog_height_curve" type="float" setter="set_fog_height_curve" getter="get_fog_height_curve" default="1.0">
|
||||
The height fog's intensity. A number of presets are available in the [b]Inspector[/b] by right-clicking the curve.
|
||||
</member>
|
||||
<member name="fog_height_enabled" type="bool" setter="set_fog_height_enabled" getter="is_fog_height_enabled" default="false">
|
||||
If [code]true[/code], 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.
|
||||
</member>
|
||||
<member name="fog_height_max" type="float" setter="set_fog_height_max" getter="get_fog_height_max" default="0.0">
|
||||
The Y coordinate where the height fog will be the most intense. If this value is greater than [member fog_height_min], fog will be displayed from bottom to top. Otherwise, it will be displayed from top to bottom.
|
||||
</member>
|
||||
<member name="fog_height_min" type="float" setter="set_fog_height_min" getter="get_fog_height_min" default="10.0">
|
||||
The Y coordinate where the height fog will be the least intense. If this value is greater than [member fog_height_max], fog will be displayed from top to bottom. Otherwise, it will be displayed from bottom to top.
|
||||
</member>
|
||||
<member name="fog_sun_amount" type="float" setter="set_fog_sun_amount" getter="get_fog_sun_amount" default="0.0">
|
||||
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.
|
||||
</member>
|
||||
<member name="fog_sun_color" type="Color" setter="set_fog_sun_color" getter="get_fog_sun_color" default="Color( 1, 0.9, 0.7, 1 )">
|
||||
The depth fog's [Color] when looking towards the sun.
|
||||
</member>
|
||||
<member name="fog_transmit_curve" type="float" setter="set_fog_transmit_curve" getter="get_fog_transmit_curve" default="1.0">
|
||||
The intensity of the fog light transmittance effect. Amount of light that the fog transmits.
|
||||
</member>
|
||||
<member name="fog_transmit_enabled" type="bool" setter="set_fog_transmit_enabled" getter="is_fog_transmit_enabled" default="false">
|
||||
Enables fog's light transmission effect. If [code]true[/code], light will be more visible in the fog to simulate light scattering as in real life.
|
||||
</member>
|
||||
<member name="glow_bicubic_upscale" type="bool" setter="set_glow_bicubic_upscale" getter="is_glow_bicubic_upscale_enabled" default="false">
|
||||
Smooths out the blockiness created by sampling higher levels, at the cost of performance.
|
||||
[b]Note:[/b] When using the GLES2 renderer, this is only available if the GPU supports the [code]GL_EXT_gpu_shader4[/code] extension.
|
||||
</member>
|
||||
<member name="glow_blend_mode" type="int" setter="set_glow_blend_mode" getter="get_glow_blend_mode" enum="Environment3D.GlowBlendMode" default="2">
|
||||
The glow blending mode.
|
||||
</member>
|
||||
<member name="glow_bloom" type="float" setter="set_glow_bloom" getter="get_glow_bloom" default="0.0">
|
||||
The bloom's intensity. If set to a value higher than [code]0[/code], this will make glow visible in areas darker than the [member glow_hdr_threshold].
|
||||
</member>
|
||||
<member name="glow_enabled" type="bool" setter="set_glow_enabled" getter="is_glow_enabled" default="false">
|
||||
If [code]true[/code], the glow effect is enabled.
|
||||
[b]Note:[/b] Only effective if [member ProjectSettings.rendering/quality/intended_usage/framebuffer_allocation] is [b]3D[/b] ([i]not[/i] [b]3D Without Effects[/b]). On mobile, [member ProjectSettings.rendering/quality/intended_usage/framebuffer_allocation] defaults to [b]3D Without Effects[/b] by default, so its [code].mobile[/code] override needs to be changed to [b]3D[/b].
|
||||
[b]Note:[/b] When using GLES3 on mobile, HDR rendering is disabled by default for performance reasons. This means glow will only be visible if [member glow_hdr_threshold] is decreased below [code]1.0[/code] or if [member glow_bloom] is increased above [code]0.0[/code]. Also consider increasing [member glow_intensity] to [code]1.5[/code]. If you want glow to behave on mobile like it does on desktop (at a performance cost), enable [member ProjectSettings.rendering/quality/depth/hdr]'s [code].mobile[/code] override.
|
||||
</member>
|
||||
<member name="glow_hdr_luminance_cap" type="float" setter="set_glow_hdr_luminance_cap" getter="get_glow_hdr_luminance_cap" default="12.0">
|
||||
The higher threshold of the HDR glow. Areas brighter than this threshold will be clamped for the purposes of the glow effect.
|
||||
</member>
|
||||
<member name="glow_hdr_scale" type="float" setter="set_glow_hdr_bleed_scale" getter="get_glow_hdr_bleed_scale" default="2.0">
|
||||
The bleed scale of the HDR glow.
|
||||
</member>
|
||||
<member name="glow_hdr_threshold" type="float" setter="set_glow_hdr_bleed_threshold" getter="get_glow_hdr_bleed_threshold" default="1.0">
|
||||
The lower threshold of the HDR glow. When using the GLES2 renderer (which doesn't support HDR), this needs to be below [code]1.0[/code] for glow to be visible. A value of [code]0.9[/code] works well in this case.
|
||||
</member>
|
||||
<member name="glow_high_quality" type="bool" setter="set_glow_high_quality" getter="is_glow_high_quality_enabled" default="false">
|
||||
Takes more samples during downsample pass of glow. This ensures that single pixels are captured by glow which makes the glow look smoother and more stable during movement. However, it is very expensive and makes the glow post process take twice as long.
|
||||
</member>
|
||||
<member name="glow_intensity" type="float" setter="set_glow_intensity" getter="get_glow_intensity" default="0.8">
|
||||
The glow intensity. When using the GLES2 renderer, this should be increased to 1.5 to compensate for the lack of HDR rendering.
|
||||
</member>
|
||||
<member name="glow_levels/1" type="bool" setter="set_glow_level" getter="is_glow_level_enabled" default="false">
|
||||
If [code]true[/code], the 1st level of glow is enabled. This is the most "local" level (least blurry).
|
||||
</member>
|
||||
<member name="glow_levels/2" type="bool" setter="set_glow_level" getter="is_glow_level_enabled" default="false">
|
||||
If [code]true[/code], the 2th level of glow is enabled.
|
||||
</member>
|
||||
<member name="glow_levels/3" type="bool" setter="set_glow_level" getter="is_glow_level_enabled" default="true">
|
||||
If [code]true[/code], the 3th level of glow is enabled.
|
||||
</member>
|
||||
<member name="glow_levels/4" type="bool" setter="set_glow_level" getter="is_glow_level_enabled" default="false">
|
||||
If [code]true[/code], the 4th level of glow is enabled.
|
||||
</member>
|
||||
<member name="glow_levels/5" type="bool" setter="set_glow_level" getter="is_glow_level_enabled" default="true">
|
||||
If [code]true[/code], the 5th level of glow is enabled.
|
||||
</member>
|
||||
<member name="glow_levels/6" type="bool" setter="set_glow_level" getter="is_glow_level_enabled" default="false">
|
||||
If [code]true[/code], the 6th level of glow is enabled.
|
||||
</member>
|
||||
<member name="glow_levels/7" type="bool" setter="set_glow_level" getter="is_glow_level_enabled" default="false">
|
||||
If [code]true[/code], the 7th level of glow is enabled. This is the most "global" level (blurriest).
|
||||
</member>
|
||||
<member name="glow_strength" type="float" setter="set_glow_strength" getter="get_glow_strength" default="1.0">
|
||||
The glow strength. When using the GLES2 renderer, this should be increased to 1.3 to compensate for the lack of HDR rendering.
|
||||
</member>
|
||||
<member name="ss_reflections_depth_tolerance" type="float" setter="set_ssr_depth_tolerance" getter="get_ssr_depth_tolerance" default="0.2">
|
||||
The depth tolerance for screen-space reflections.
|
||||
</member>
|
||||
<member name="ss_reflections_enabled" type="bool" setter="set_ssr_enabled" getter="is_ssr_enabled" default="false">
|
||||
If [code]true[/code], screen-space reflections are enabled. Screen-space reflections are more accurate than reflections from [GIProbe]s or [ReflectionProbe]s, but are slower and can't reflect surfaces occluded by others.
|
||||
</member>
|
||||
<member name="ss_reflections_fade_in" type="float" setter="set_ssr_fade_in" getter="get_ssr_fade_in" default="0.15">
|
||||
The fade-in distance for screen-space reflections. Affects the area from the reflected material to the screen-space reflection).
|
||||
</member>
|
||||
<member name="ss_reflections_fade_out" type="float" setter="set_ssr_fade_out" getter="get_ssr_fade_out" default="2.0">
|
||||
The fade-out distance for screen-space reflections. Affects the area from the screen-space reflection to the "global" reflection.
|
||||
</member>
|
||||
<member name="ss_reflections_max_steps" type="int" setter="set_ssr_max_steps" getter="get_ssr_max_steps" default="64">
|
||||
The maximum number of steps for screen-space reflections. Higher values are slower.
|
||||
</member>
|
||||
<member name="ss_reflections_roughness" type="bool" setter="set_ssr_rough" getter="is_ssr_rough" default="true">
|
||||
If [code]true[/code], screen-space reflections will take the material roughness into account.
|
||||
</member>
|
||||
<member name="ssao_ao_channel_affect" type="float" setter="set_ssao_ao_channel_affect" getter="get_ssao_ao_channel_affect" default="0.0">
|
||||
The screen-space ambient occlusion intensity on materials that have an AO texture defined. Values higher than [code]0[/code] will make the SSAO effect visible in areas darkened by AO textures.
|
||||
</member>
|
||||
<member name="ssao_bias" type="float" setter="set_ssao_bias" getter="get_ssao_bias" default="0.01">
|
||||
The screen-space ambient occlusion bias. This should be kept high enough to prevent "smooth" curves from being affected by ambient occlusion.
|
||||
</member>
|
||||
<member name="ssao_blur" type="int" setter="set_ssao_blur" getter="get_ssao_blur" enum="Environment3D.SSAOBlur" default="3">
|
||||
The screen-space ambient occlusion blur quality. See [enum SSAOBlur] for possible values.
|
||||
</member>
|
||||
<member name="ssao_color" type="Color" setter="set_ssao_color" getter="get_ssao_color" default="Color( 0, 0, 0, 1 )">
|
||||
The screen-space ambient occlusion color.
|
||||
</member>
|
||||
<member name="ssao_edge_sharpness" type="float" setter="set_ssao_edge_sharpness" getter="get_ssao_edge_sharpness" default="4.0">
|
||||
The screen-space ambient occlusion edge sharpness.
|
||||
</member>
|
||||
<member name="ssao_enabled" type="bool" setter="set_ssao_enabled" getter="is_ssao_enabled" default="false">
|
||||
If [code]true[/code], 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.
|
||||
</member>
|
||||
<member name="ssao_intensity" type="float" setter="set_ssao_intensity" getter="get_ssao_intensity" default="1.0">
|
||||
The primary screen-space ambient occlusion intensity. See also [member ssao_radius].
|
||||
</member>
|
||||
<member name="ssao_intensity2" type="float" setter="set_ssao_intensity2" getter="get_ssao_intensity2" default="1.0">
|
||||
The secondary screen-space ambient occlusion intensity. See also [member ssao_radius2].
|
||||
</member>
|
||||
<member name="ssao_light_affect" type="float" setter="set_ssao_direct_light_affect" getter="get_ssao_direct_light_affect" default="0.0">
|
||||
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 [code]0[/code] will make the SSAO effect visible in direct light.
|
||||
</member>
|
||||
<member name="ssao_quality" type="int" setter="set_ssao_quality" getter="get_ssao_quality" enum="Environment3D.SSAOQuality" default="1">
|
||||
The screen-space ambient occlusion quality. Higher qualities will make better use of small objects for ambient occlusion, but are slower.
|
||||
</member>
|
||||
<member name="ssao_radius" type="float" setter="set_ssao_radius" getter="get_ssao_radius" default="1.0">
|
||||
The primary screen-space ambient occlusion radius.
|
||||
</member>
|
||||
<member name="ssao_radius2" type="float" setter="set_ssao_radius2" getter="get_ssao_radius2" default="0.0">
|
||||
The secondary screen-space ambient occlusion radius. If set to a value higher than [code]0[/code], enables the secondary screen-space ambient occlusion effect which can be used to improve the effect's appearance (at the cost of performance).
|
||||
</member>
|
||||
<member name="tonemap_exposure" type="float" setter="set_tonemap_exposure" getter="get_tonemap_exposure" default="1.0">
|
||||
The default exposure used for tonemapping.
|
||||
</member>
|
||||
<member name="tonemap_mode" type="int" setter="set_tonemapper" getter="get_tonemapper" enum="Environment3D.ToneMapper" default="0">
|
||||
The tonemapping mode to use. Tonemapping is the process that "converts" HDR values to be suitable for rendering on a SDR display. (Godot doesn't support rendering on HDR displays yet.)
|
||||
</member>
|
||||
<member name="tonemap_white" type="float" setter="set_tonemap_white" getter="get_tonemap_white" default="1.0">
|
||||
The white reference value for tonemapping. Only effective if the [member tonemap_mode] isn't set to [constant TONE_MAPPER_LINEAR].
|
||||
</member>
|
||||
</members>
|
||||
<constants>
|
||||
<constant name="BG_KEEP" value="5" enum="BGMode">
|
||||
Keeps on screen every pixel drawn in the background. Only select this mode if you really need to keep the old data. On modern GPUs it will generally not be faster than clearing the background, and can be significantly slower, particularly on mobile.
|
||||
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.
|
||||
</constant>
|
||||
<constant name="BG_CLEAR_COLOR" value="0" enum="BGMode">
|
||||
Clears the background using the clear color defined in [member ProjectSettings.rendering/environment/default_clear_color].
|
||||
</constant>
|
||||
<constant name="BG_COLOR" value="1" enum="BGMode">
|
||||
Clears the background using a custom clear color.
|
||||
</constant>
|
||||
<constant name="BG_SKY" value="2" enum="BGMode">
|
||||
Displays a user-defined sky in the background.
|
||||
</constant>
|
||||
<constant name="BG_COLOR_SKY" value="3" enum="BGMode">
|
||||
Clears the background using a custom clear color and allows defining a sky for shading and reflection. This mode is slightly faster than [constant BG_SKY] and should be preferred in scenes where reflections can be visible, but the sky itself never is (e.g. top-down camera).
|
||||
</constant>
|
||||
<constant name="BG_CANVAS" value="4" enum="BGMode">
|
||||
Displays a [CanvasLayer] in the background.
|
||||
</constant>
|
||||
<constant name="BG_CAMERA_FEED" value="6" enum="BGMode">
|
||||
Displays a camera feed in the background.
|
||||
</constant>
|
||||
<constant name="BG_MAX" value="7" enum="BGMode">
|
||||
Represents the size of the [enum BGMode] enum.
|
||||
</constant>
|
||||
<constant name="GLOW_BLEND_MODE_ADDITIVE" value="0" enum="GlowBlendMode">
|
||||
Additive glow blending mode. Mostly used for particles, glows (bloom), lens flare, bright sources.
|
||||
</constant>
|
||||
<constant name="GLOW_BLEND_MODE_SCREEN" value="1" enum="GlowBlendMode">
|
||||
Screen glow blending mode. Increases brightness, used frequently with bloom.
|
||||
</constant>
|
||||
<constant name="GLOW_BLEND_MODE_SOFTLIGHT" value="2" enum="GlowBlendMode">
|
||||
Soft light glow blending mode. Modifies contrast, exposes shadows and highlights (vivid bloom).
|
||||
</constant>
|
||||
<constant name="GLOW_BLEND_MODE_REPLACE" value="3" enum="GlowBlendMode">
|
||||
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.
|
||||
</constant>
|
||||
<constant name="TONE_MAPPER_LINEAR" value="0" enum="ToneMapper">
|
||||
Linear tonemapper operator. Reads the linear data and passes it on unmodified. This can cause bright lighting to look blown out, with noticeable clipping in the output colors.
|
||||
</constant>
|
||||
<constant name="TONE_MAPPER_REINHARDT" value="1" enum="ToneMapper">
|
||||
Reinhardt tonemapper operator. Performs a variation on rendered pixels' colors by this formula: [code]color = color / (1 + color)[/code]. This avoids clipping bright highlights, but the resulting image can look a bit dull.
|
||||
</constant>
|
||||
<constant name="TONE_MAPPER_FILMIC" value="2" enum="ToneMapper">
|
||||
Filmic tonemapper operator. This avoids clipping bright highlights, with a resulting image that usually looks more vivid than [constant TONE_MAPPER_REINHARDT].
|
||||
</constant>
|
||||
<constant name="TONE_MAPPER_ACES" value="3" enum="ToneMapper">
|
||||
Use the legacy Godot version of the Academy Color Encoding System tonemapper. Unlike [constant TONE_MAPPER_ACES_FITTED], this version of ACES does not handle bright lighting in a physically accurate way. ACES typically has a more contrasted output compared to [constant TONE_MAPPER_REINHARDT] and [constant TONE_MAPPER_FILMIC].
|
||||
[b]Note:[/b] This tonemapping operator will be removed in Godot 4.0 in favor of the more accurate [constant TONE_MAPPER_ACES_FITTED].
|
||||
</constant>
|
||||
<constant name="TONE_MAPPER_ACES_FITTED" value="4" enum="ToneMapper">
|
||||
Use the Academy Color Encoding System tonemapper. ACES is slightly more expensive than other options, but it handles bright lighting in a more realistic fashion by desaturating it as it becomes brighter. ACES typically has a more contrasted output compared to [constant TONE_MAPPER_REINHARDT] and [constant TONE_MAPPER_FILMIC].
|
||||
</constant>
|
||||
<constant name="DOF_BLUR_QUALITY_LOW" value="0" enum="DOFBlurQuality">
|
||||
Low depth-of-field blur quality (fastest).
|
||||
</constant>
|
||||
<constant name="DOF_BLUR_QUALITY_MEDIUM" value="1" enum="DOFBlurQuality">
|
||||
Medium depth-of-field blur quality.
|
||||
</constant>
|
||||
<constant name="DOF_BLUR_QUALITY_HIGH" value="2" enum="DOFBlurQuality">
|
||||
High depth-of-field blur quality (slowest).
|
||||
</constant>
|
||||
<constant name="SSAO_BLUR_DISABLED" value="0" enum="SSAOBlur">
|
||||
No blur for the screen-space ambient occlusion effect (fastest).
|
||||
</constant>
|
||||
<constant name="SSAO_BLUR_1x1" value="1" enum="SSAOBlur">
|
||||
1×1 blur for the screen-space ambient occlusion effect.
|
||||
</constant>
|
||||
<constant name="SSAO_BLUR_2x2" value="2" enum="SSAOBlur">
|
||||
2×2 blur for the screen-space ambient occlusion effect.
|
||||
</constant>
|
||||
<constant name="SSAO_BLUR_3x3" value="3" enum="SSAOBlur">
|
||||
3×3 blur for the screen-space ambient occlusion effect (slowest).
|
||||
</constant>
|
||||
<constant name="SSAO_QUALITY_LOW" value="0" enum="SSAOQuality">
|
||||
Low quality for the screen-space ambient occlusion effect (fastest).
|
||||
</constant>
|
||||
<constant name="SSAO_QUALITY_MEDIUM" value="1" enum="SSAOQuality">
|
||||
Low quality for the screen-space ambient occlusion effect.
|
||||
</constant>
|
||||
<constant name="SSAO_QUALITY_HIGH" value="2" enum="SSAOQuality">
|
||||
Low quality for the screen-space ambient occlusion effect (slowest).
|
||||
</constant>
|
||||
</constants>
|
||||
</class>
|
@ -48,40 +48,6 @@ public:
|
||||
int get_directional_light_shadow_size(RID p_light_intance) { return 0; }
|
||||
void set_directional_shadow_count(int p_count) {}
|
||||
|
||||
/* ENVIRONMENT API */
|
||||
|
||||
RID environment_create() { return RID(); }
|
||||
|
||||
void environment_set_background(RID p_env, RS::Environment3DBG p_bg) {}
|
||||
void environment_set_sky(RID p_env, RID p_sky) {}
|
||||
void environment_set_sky_custom_fov(RID p_env, float p_scale) {}
|
||||
void environment_set_sky_orientation(RID p_env, const Basis &p_orientation) {}
|
||||
void environment_set_bg_color(RID p_env, const Color &p_color) {}
|
||||
void environment_set_bg_energy(RID p_env, float p_energy) {}
|
||||
void environment_set_canvas_max_layer(RID p_env, int p_max_layer) {}
|
||||
void environment_set_ambient_light(RID p_env, const Color &p_color, float p_energy = 1.0, float p_sky_contribution = 0.0) {}
|
||||
|
||||
void environment_set_dof_blur_near(RID p_env, bool p_enable, float p_distance, float p_transition, float p_far_amount, RS::Environment3DDOFBlurQuality p_quality) {}
|
||||
void environment_set_dof_blur_far(RID p_env, bool p_enable, float p_distance, float p_transition, float p_far_amount, RS::Environment3DDOFBlurQuality p_quality) {}
|
||||
void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_bloom_threshold, RS::Environment3DGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap, bool p_bicubic_upscale, bool p_high_quality) {}
|
||||
|
||||
void environment_set_fog(RID p_env, bool p_enable, float p_begin, float p_end, RID p_gradient_texture) {}
|
||||
|
||||
void 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, bool p_roughness) {}
|
||||
void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, float p_ao_channel_affect, const Color &p_color, RS::Environment3DSSAOQuality p_quality, RS::Environment3DSSAOBlur p_blur, float p_bilateral_sharpness) {}
|
||||
|
||||
void environment_set_tonemap(RID p_env, RS::Environment3DToneMapper p_tone_mapper, float p_exposure, float p_white, bool p_auto_exposure, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_scale) {}
|
||||
|
||||
void environment_set_adjustment(RID p_env, bool p_enable, float p_brightness, float p_contrast, float p_saturation, RID p_ramp) {}
|
||||
|
||||
void environment_set_fog(RID p_env, bool p_enable, const Color &p_color, const Color &p_sun_color, float p_sun_amount) {}
|
||||
void environment_set_fog_depth(RID p_env, bool p_enable, float p_depth_begin, float p_depth_end, float p_depth_curve, bool p_transmit, float p_transmit_curve) {}
|
||||
void environment_set_fog_height(RID p_env, bool p_enable, float p_min_height, float p_max_height, float p_height_curve) {}
|
||||
|
||||
bool is_environment(RID p_env) { return false; }
|
||||
RS::Environment3DBG environment_get_background(RID p_env) { return RS::ENV_BG_KEEP; }
|
||||
int environment_get_canvas_max_layer(RID p_env) { return 0; }
|
||||
|
||||
RID light_instance_create(RID p_light) { return RID(); }
|
||||
void light_instance_set_transform(RID p_light_instance, const Transform &p_transform) {}
|
||||
void light_instance_set_shadow_transform(RID p_light_instance, const Projection &p_projection, const Transform &p_transform, float p_far, float p_split, int p_pass, float p_bias_scale = 1.0) {}
|
||||
|
@ -30,11 +30,11 @@
|
||||
|
||||
#include "rasterizer_scene_gles2.h"
|
||||
|
||||
#include "core/config/project_settings.h"
|
||||
#include "core/containers/vmap.h"
|
||||
#include "core/math/math_funcs.h"
|
||||
#include "core/math/transform.h"
|
||||
#include "core/os/os.h"
|
||||
#include "core/config/project_settings.h"
|
||||
#include "core/containers/vmap.h"
|
||||
#include "rasterizer_canvas_gles2.h"
|
||||
#include "servers/rendering/rendering_server_raster.h"
|
||||
|
||||
@ -736,190 +736,6 @@ bool RasterizerSceneGLES2::reflection_probe_instance_postprocess_step(RID p_inst
|
||||
return true;
|
||||
}
|
||||
|
||||
/* ENVIRONMENT API */
|
||||
|
||||
RID RasterizerSceneGLES2::environment_create() {
|
||||
Environment3D *env = memnew(Environment3D);
|
||||
|
||||
return environment_owner.make_rid(env);
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES2::environment_set_background(RID p_env, RS::Environment3DBG p_bg) {
|
||||
Environment3D *env = environment_owner.getornull(p_env);
|
||||
ERR_FAIL_COND(!env);
|
||||
env->bg_mode = p_bg;
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES2::environment_set_sky(RID p_env, RID p_sky) {
|
||||
Environment3D *env = environment_owner.getornull(p_env);
|
||||
ERR_FAIL_COND(!env);
|
||||
|
||||
env->sky = p_sky;
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES2::environment_set_sky_custom_fov(RID p_env, float p_scale) {
|
||||
Environment3D *env = environment_owner.getornull(p_env);
|
||||
ERR_FAIL_COND(!env);
|
||||
|
||||
env->sky_custom_fov = p_scale;
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES2::environment_set_sky_orientation(RID p_env, const Basis &p_orientation) {
|
||||
Environment3D *env = environment_owner.getornull(p_env);
|
||||
ERR_FAIL_COND(!env);
|
||||
|
||||
env->sky_orientation = p_orientation;
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES2::environment_set_bg_color(RID p_env, const Color &p_color) {
|
||||
Environment3D *env = environment_owner.getornull(p_env);
|
||||
ERR_FAIL_COND(!env);
|
||||
|
||||
env->bg_color = p_color;
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES2::environment_set_bg_energy(RID p_env, float p_energy) {
|
||||
Environment3D *env = environment_owner.getornull(p_env);
|
||||
ERR_FAIL_COND(!env);
|
||||
|
||||
env->bg_energy = p_energy;
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES2::environment_set_canvas_max_layer(RID p_env, int p_max_layer) {
|
||||
Environment3D *env = environment_owner.getornull(p_env);
|
||||
ERR_FAIL_COND(!env);
|
||||
|
||||
env->canvas_max_layer = p_max_layer;
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES2::environment_set_ambient_light(RID p_env, const Color &p_color, float p_energy, float p_sky_contribution) {
|
||||
Environment3D *env = environment_owner.getornull(p_env);
|
||||
ERR_FAIL_COND(!env);
|
||||
|
||||
env->ambient_color = p_color;
|
||||
env->ambient_energy = p_energy;
|
||||
env->ambient_sky_contribution = p_sky_contribution;
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES2::environment_set_dof_blur_far(RID p_env, bool p_enable, float p_distance, float p_transition, float p_amount, RS::Environment3DDOFBlurQuality p_quality) {
|
||||
Environment3D *env = environment_owner.getornull(p_env);
|
||||
ERR_FAIL_COND(!env);
|
||||
|
||||
env->dof_blur_far_enabled = p_enable;
|
||||
env->dof_blur_far_distance = p_distance;
|
||||
env->dof_blur_far_transition = p_transition;
|
||||
env->dof_blur_far_amount = p_amount;
|
||||
env->dof_blur_far_quality = p_quality;
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES2::environment_set_dof_blur_near(RID p_env, bool p_enable, float p_distance, float p_transition, float p_amount, RS::Environment3DDOFBlurQuality p_quality) {
|
||||
Environment3D *env = environment_owner.getornull(p_env);
|
||||
ERR_FAIL_COND(!env);
|
||||
|
||||
env->dof_blur_near_enabled = p_enable;
|
||||
env->dof_blur_near_distance = p_distance;
|
||||
env->dof_blur_near_transition = p_transition;
|
||||
env->dof_blur_near_amount = p_amount;
|
||||
env->dof_blur_near_quality = p_quality;
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES2::environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_bloom_threshold, RS::Environment3DGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap, bool p_bicubic_upscale, bool p_high_quality) {
|
||||
Environment3D *env = environment_owner.getornull(p_env);
|
||||
ERR_FAIL_COND(!env);
|
||||
|
||||
env->glow_enabled = p_enable;
|
||||
env->glow_levels = p_level_flags;
|
||||
env->glow_intensity = p_intensity;
|
||||
env->glow_strength = p_strength;
|
||||
env->glow_bloom = p_bloom_threshold;
|
||||
env->glow_blend_mode = p_blend_mode;
|
||||
env->glow_hdr_bleed_threshold = p_hdr_bleed_threshold;
|
||||
env->glow_hdr_bleed_scale = p_hdr_bleed_scale;
|
||||
env->glow_hdr_luminance_cap = p_hdr_luminance_cap;
|
||||
env->glow_bicubic_upscale = p_bicubic_upscale;
|
||||
env->glow_high_quality = p_high_quality;
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES2::environment_set_fog(RID p_env, bool p_enable, float p_begin, float p_end, RID p_gradient_texture) {
|
||||
Environment3D *env = environment_owner.getornull(p_env);
|
||||
ERR_FAIL_COND(!env);
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES2::environment_set_ssr(RID p_env, bool p_enable, int p_max_steps, float p_fade_in, float p_fade_out, float p_depth_tolerance, bool p_roughness) {
|
||||
Environment3D *env = environment_owner.getornull(p_env);
|
||||
ERR_FAIL_COND(!env);
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES2::environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, float p_ao_channel_affect, const Color &p_color, RS::Environment3DSSAOQuality p_quality, RenderingServer::Environment3DSSAOBlur p_blur, float p_bilateral_sharpness) {
|
||||
Environment3D *env = environment_owner.getornull(p_env);
|
||||
ERR_FAIL_COND(!env);
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES2::environment_set_tonemap(RID p_env, RS::Environment3DToneMapper p_tone_mapper, float p_exposure, float p_white, bool p_auto_exposure, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_scale) {
|
||||
Environment3D *env = environment_owner.getornull(p_env);
|
||||
ERR_FAIL_COND(!env);
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES2::environment_set_adjustment(RID p_env, bool p_enable, float p_brightness, float p_contrast, float p_saturation, RID p_ramp) {
|
||||
Environment3D *env = environment_owner.getornull(p_env);
|
||||
ERR_FAIL_COND(!env);
|
||||
|
||||
env->adjustments_enabled = p_enable;
|
||||
env->adjustments_brightness = p_brightness;
|
||||
env->adjustments_contrast = p_contrast;
|
||||
env->adjustments_saturation = p_saturation;
|
||||
env->color_correction = p_ramp;
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES2::environment_set_fog(RID p_env, bool p_enable, const Color &p_color, const Color &p_sun_color, float p_sun_amount) {
|
||||
Environment3D *env = environment_owner.getornull(p_env);
|
||||
ERR_FAIL_COND(!env);
|
||||
|
||||
env->fog_enabled = p_enable;
|
||||
env->fog_color = p_color;
|
||||
env->fog_sun_color = p_sun_color;
|
||||
env->fog_sun_amount = p_sun_amount;
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES2::environment_set_fog_depth(RID p_env, bool p_enable, float p_depth_begin, float p_depth_end, float p_depth_curve, bool p_transmit, float p_transmit_curve) {
|
||||
Environment3D *env = environment_owner.getornull(p_env);
|
||||
ERR_FAIL_COND(!env);
|
||||
|
||||
env->fog_depth_enabled = p_enable;
|
||||
env->fog_depth_begin = p_depth_begin;
|
||||
env->fog_depth_end = p_depth_end;
|
||||
env->fog_depth_curve = p_depth_curve;
|
||||
env->fog_transmit_enabled = p_transmit;
|
||||
env->fog_transmit_curve = p_transmit_curve;
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES2::environment_set_fog_height(RID p_env, bool p_enable, float p_min_height, float p_max_height, float p_height_curve) {
|
||||
Environment3D *env = environment_owner.getornull(p_env);
|
||||
ERR_FAIL_COND(!env);
|
||||
|
||||
env->fog_height_enabled = p_enable;
|
||||
env->fog_height_min = p_min_height;
|
||||
env->fog_height_max = p_max_height;
|
||||
env->fog_height_curve = p_height_curve;
|
||||
}
|
||||
bool RasterizerSceneGLES2::is_environment(RID p_env) {
|
||||
return environment_owner.owns(p_env);
|
||||
}
|
||||
|
||||
RS::Environment3DBG RasterizerSceneGLES2::environment_get_background(RID p_env) {
|
||||
const Environment3D *env = environment_owner.getornull(p_env);
|
||||
ERR_FAIL_COND_V(!env, RS::ENV_BG_MAX);
|
||||
|
||||
return env->bg_mode;
|
||||
}
|
||||
|
||||
int RasterizerSceneGLES2::environment_get_canvas_max_layer(RID p_env) {
|
||||
const Environment3D *env = environment_owner.getornull(p_env);
|
||||
ERR_FAIL_COND_V(!env, -1);
|
||||
|
||||
return env->canvas_max_layer;
|
||||
}
|
||||
|
||||
RID RasterizerSceneGLES2::light_instance_create(RID p_light) {
|
||||
LightInstance *light_instance = memnew(LightInstance);
|
||||
|
||||
@ -2013,7 +1829,7 @@ void RasterizerSceneGLES2::_setup_light(LightInstance *light, ShadowAtlas *shado
|
||||
uint32_t width = light->directional_rect.size.x;
|
||||
uint32_t height = light->directional_rect.size.y;
|
||||
|
||||
if (light_ptr->directional_shadow_mode == RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_3_SPLITS ||
|
||||
if (light_ptr->directional_shadow_mode == RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_3_SPLITS ||
|
||||
light_ptr->directional_shadow_mode == RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS) {
|
||||
width /= 2;
|
||||
height /= 2;
|
||||
@ -2184,7 +2000,7 @@ void RasterizerSceneGLES2::_setup_light(LightInstance *light, ShadowAtlas *shado
|
||||
}
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES2::_setup_refprobes(ReflectionProbeInstance *p_refprobe1, ReflectionProbeInstance *p_refprobe2, const Transform &p_view_transform, Environment3D *p_env) {
|
||||
void RasterizerSceneGLES2::_setup_refprobes(ReflectionProbeInstance *p_refprobe1, ReflectionProbeInstance *p_refprobe2, const Transform &p_view_transform) {
|
||||
if (p_refprobe1) {
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::REFPROBE1_USE_BOX_PROJECT, p_refprobe1->probe_ptr->box_projection);
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::REFPROBE1_BOX_EXTENTS, p_refprobe1->probe_ptr->extents);
|
||||
@ -2196,9 +2012,6 @@ void RasterizerSceneGLES2::_setup_refprobes(ReflectionProbeInstance *p_refprobe1
|
||||
if (p_refprobe1->probe_ptr->interior) {
|
||||
ambient = p_refprobe1->probe_ptr->interior_ambient * p_refprobe1->probe_ptr->interior_ambient_energy;
|
||||
ambient.a = p_refprobe1->probe_ptr->interior_ambient_probe_contrib;
|
||||
} else if (p_env) {
|
||||
ambient = p_env->ambient_color * p_env->ambient_energy;
|
||||
ambient.a = p_env->ambient_sky_contribution;
|
||||
}
|
||||
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::REFPROBE1_AMBIENT, ambient);
|
||||
@ -2219,9 +2032,6 @@ void RasterizerSceneGLES2::_setup_refprobes(ReflectionProbeInstance *p_refprobe1
|
||||
if (p_refprobe2->probe_ptr->interior) {
|
||||
ambient = p_refprobe2->probe_ptr->interior_ambient * p_refprobe2->probe_ptr->interior_ambient_energy;
|
||||
ambient.a = p_refprobe2->probe_ptr->interior_ambient_probe_contrib;
|
||||
} else if (p_env) {
|
||||
ambient = p_env->ambient_color * p_env->ambient_energy;
|
||||
ambient.a = p_env->ambient_sky_contribution;
|
||||
}
|
||||
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::REFPROBE2_AMBIENT, ambient);
|
||||
@ -2232,7 +2042,7 @@ void RasterizerSceneGLES2::_setup_refprobes(ReflectionProbeInstance *p_refprobe1
|
||||
}
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES2::_render_render_list(RenderList::Element **p_elements, int p_element_count, const Transform &p_view_transform, const Projection &p_projection, const int p_eye, RID p_shadow_atlas, Environment3D *p_env, GLuint p_base_env, float p_shadow_bias, float p_shadow_normal_bias, bool p_reverse_cull, bool p_alpha_pass, bool p_shadow) {
|
||||
void RasterizerSceneGLES2::_render_render_list(RenderList::Element **p_elements, int p_element_count, const Transform &p_view_transform, const Projection &p_projection, const int p_eye, RID p_shadow_atlas, float p_shadow_bias, float p_shadow_normal_bias, bool p_reverse_cull, bool p_alpha_pass, bool p_shadow) {
|
||||
ShadowAtlas *shadow_atlas = shadow_atlas_owner.getornull(p_shadow_atlas);
|
||||
|
||||
Vector2 viewport_size = state.viewport_size;
|
||||
@ -2240,12 +2050,6 @@ void RasterizerSceneGLES2::_render_render_list(RenderList::Element **p_elements,
|
||||
Vector2 screen_pixel_size = state.screen_pixel_size;
|
||||
|
||||
bool use_radiance_map = false;
|
||||
if (!p_shadow && p_base_env) {
|
||||
WRAPPED_GL_ACTIVE_TEXTURE(GL_TEXTURE0 + storage->config.max_texture_image_units - 2);
|
||||
glBindTexture(GL_TEXTURE_CUBE_MAP, p_base_env);
|
||||
use_radiance_map = true;
|
||||
state.scene_shader.set_conditional(SceneShaderGLES2::USE_RADIANCE_MAP, true); //since prev unshaded is false, this needs to be true if exists
|
||||
}
|
||||
|
||||
bool prev_unshaded = false;
|
||||
bool prev_instancing = false;
|
||||
@ -2280,18 +2084,7 @@ void RasterizerSceneGLES2::_render_render_list(RenderList::Element **p_elements,
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
|
||||
float fog_max_distance = 0;
|
||||
bool using_fog = false;
|
||||
if (p_env && !p_shadow && p_env->fog_enabled && (p_env->fog_depth_enabled || p_env->fog_height_enabled)) {
|
||||
state.scene_shader.set_conditional(SceneShaderGLES2::FOG_DEPTH_ENABLED, p_env->fog_depth_enabled);
|
||||
state.scene_shader.set_conditional(SceneShaderGLES2::FOG_HEIGHT_ENABLED, p_env->fog_height_enabled);
|
||||
if (p_env->fog_depth_end > 0) {
|
||||
fog_max_distance = p_env->fog_depth_end;
|
||||
} else {
|
||||
fog_max_distance = p_projection.get_z_far();
|
||||
}
|
||||
using_fog = true;
|
||||
}
|
||||
|
||||
storage->info.render.draw_call_count += p_element_count;
|
||||
|
||||
@ -2307,7 +2100,6 @@ void RasterizerSceneGLES2::_render_render_list(RenderList::Element **p_elements,
|
||||
ReflectionProbeInstance *refprobe_1 = nullptr;
|
||||
ReflectionProbeInstance *refprobe_2 = nullptr;
|
||||
bool rebind_light = false;
|
||||
bool rebind_reflection = false;
|
||||
|
||||
if (!p_shadow && material->shader) {
|
||||
bool unshaded = material->shader->spatial.unshaded;
|
||||
@ -2429,7 +2221,6 @@ void RasterizerSceneGLES2::_render_render_list(RenderList::Element **p_elements,
|
||||
glBindTexture(GL_TEXTURE_CUBE_MAP, refprobe_2->cubemap);
|
||||
}
|
||||
rebind = true;
|
||||
rebind_reflection = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2504,57 +2295,18 @@ void RasterizerSceneGLES2::_render_render_list(RenderList::Element **p_elements,
|
||||
}
|
||||
} else {
|
||||
if (use_radiance_map) {
|
||||
if (p_env) {
|
||||
Transform sky_orientation(p_env->sky_orientation, Vector3(0.0, 0.0, 0.0));
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::RADIANCE_INVERSE_XFORM, sky_orientation.affine_inverse() * p_view_transform);
|
||||
} else {
|
||||
// would be a bit weird if we don't have this...
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::RADIANCE_INVERSE_XFORM, p_view_transform);
|
||||
}
|
||||
// would be a bit weird if we don't have this...
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::RADIANCE_INVERSE_XFORM, p_view_transform);
|
||||
}
|
||||
|
||||
if (p_env) {
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::BG_ENERGY, p_env->bg_energy);
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::BG_COLOR, p_env->bg_color);
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::AMBIENT_SKY_CONTRIBUTION, p_env->ambient_sky_contribution);
|
||||
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::AMBIENT_COLOR, p_env->ambient_color);
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::AMBIENT_ENERGY, p_env->ambient_energy);
|
||||
|
||||
} else {
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::BG_ENERGY, 1.0);
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::BG_COLOR, state.default_bg);
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::AMBIENT_SKY_CONTRIBUTION, 1.0);
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::AMBIENT_COLOR, state.default_ambient);
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::AMBIENT_ENERGY, 1.0);
|
||||
}
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::BG_ENERGY, 1.0);
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::BG_COLOR, state.default_bg);
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::AMBIENT_SKY_CONTRIBUTION, 1.0);
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::AMBIENT_COLOR, state.default_ambient);
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::AMBIENT_ENERGY, 1.0);
|
||||
|
||||
//rebind all these
|
||||
rebind_light = true;
|
||||
rebind_reflection = true;
|
||||
|
||||
if (using_fog) {
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::FOG_COLOR_BASE, p_env->fog_color);
|
||||
Color sun_color_amount = p_env->fog_sun_color;
|
||||
sun_color_amount.a = p_env->fog_sun_amount;
|
||||
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::FOG_SUN_COLOR_AMOUNT, sun_color_amount);
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::FOG_TRANSMIT_ENABLED, p_env->fog_transmit_enabled);
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::FOG_TRANSMIT_CURVE, p_env->fog_transmit_curve);
|
||||
|
||||
if (p_env->fog_depth_enabled) {
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::FOG_DEPTH_BEGIN, p_env->fog_depth_begin);
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::FOG_DEPTH_CURVE, p_env->fog_depth_curve);
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::FOG_MAX_DISTANCE, fog_max_distance);
|
||||
}
|
||||
|
||||
if (p_env->fog_height_enabled) {
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::FOG_HEIGHT_MIN, p_env->fog_height_min);
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::FOG_HEIGHT_MAX, p_env->fog_height_max);
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::FOG_HEIGHT_MAX, p_env->fog_height_max);
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::FOG_HEIGHT_CURVE, p_env->fog_height_curve);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::CAMERA_MATRIX, p_view_transform);
|
||||
@ -2574,10 +2326,6 @@ void RasterizerSceneGLES2::_render_render_list(RenderList::Element **p_elements,
|
||||
_setup_light(light, shadow_atlas, p_view_transform, accum_pass);
|
||||
}
|
||||
|
||||
if (rebind_reflection && (refprobe_1 || refprobe_2)) {
|
||||
_setup_refprobes(refprobe_1, refprobe_2, p_view_transform, p_env);
|
||||
}
|
||||
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::WORLD_TRANSFORM, e->instance->transform);
|
||||
|
||||
_render_geometry(e);
|
||||
@ -2612,7 +2360,7 @@ void RasterizerSceneGLES2::_render_render_list(RenderList::Element **p_elements,
|
||||
state.scene_shader.set_conditional(SceneShaderGLES2::USE_DEPTH_PREPASS, false);
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES2::_post_process(Environment3D *env, const Projection &p_cam_projection) {
|
||||
void RasterizerSceneGLES2::_post_process(const Projection &p_cam_projection) {
|
||||
//copy to front buffer
|
||||
|
||||
glDepthMask(GL_FALSE);
|
||||
@ -2623,13 +2371,7 @@ void RasterizerSceneGLES2::_post_process(Environment3D *env, const Projection &p
|
||||
glColorMask(1, 1, 1, 1);
|
||||
|
||||
//no post process on small or render targets without an env
|
||||
bool use_post_process = env && storage->frame.current_rt->width >= 4 && storage->frame.current_rt->height >= 4;
|
||||
use_post_process = use_post_process && storage->frame.current_rt->mip_maps_allocated;
|
||||
|
||||
if (env) {
|
||||
use_post_process = use_post_process && (env->adjustments_enabled || env->glow_enabled || env->dof_blur_far_enabled || env->dof_blur_near_enabled);
|
||||
}
|
||||
use_post_process = use_post_process || storage->frame.current_rt->use_fxaa;
|
||||
bool use_post_process = false;
|
||||
|
||||
// If using multisample buffer, resolve to post_process_effect buffer or to front buffer
|
||||
if (storage->frame.current_rt && storage->frame.current_rt->multisample_active) {
|
||||
@ -2685,357 +2427,12 @@ void RasterizerSceneGLES2::_post_process(Environment3D *env, const Projection &p
|
||||
//3) Bloom (Glow) //only on desktop
|
||||
//4) Adjustments
|
||||
|
||||
// DOF Blur
|
||||
|
||||
if (env && env->dof_blur_far_enabled) {
|
||||
int vp_h = storage->frame.current_rt->height;
|
||||
int vp_w = storage->frame.current_rt->width;
|
||||
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::USE_ORTHOGONAL_PROJECTION, p_cam_projection.is_orthogonal());
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_FAR_BLUR, true);
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_QUALITY_LOW, env->dof_blur_far_quality == RS::ENV_DOF_BLUR_QUALITY_LOW);
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_QUALITY_MEDIUM, env->dof_blur_far_quality == RS::ENV_DOF_BLUR_QUALITY_MEDIUM);
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_QUALITY_HIGH, env->dof_blur_far_quality == RS::ENV_DOF_BLUR_QUALITY_HIGH);
|
||||
|
||||
state.effect_blur_shader.bind();
|
||||
int qsteps[3] = { 4, 10, 20 };
|
||||
|
||||
float radius = (env->dof_blur_far_amount * env->dof_blur_far_amount) / qsteps[env->dof_blur_far_quality];
|
||||
|
||||
state.effect_blur_shader.set_uniform(EffectBlurShaderGLES2::DOF_BEGIN, env->dof_blur_far_distance);
|
||||
state.effect_blur_shader.set_uniform(EffectBlurShaderGLES2::DOF_END, env->dof_blur_far_distance + env->dof_blur_far_transition);
|
||||
state.effect_blur_shader.set_uniform(EffectBlurShaderGLES2::DOF_DIR, Vector2(1, 0));
|
||||
state.effect_blur_shader.set_uniform(EffectBlurShaderGLES2::DOF_RADIUS, radius);
|
||||
state.effect_blur_shader.set_uniform(EffectBlurShaderGLES2::PIXEL_SIZE, Vector2(1.0 / vp_w, 1.0 / vp_h));
|
||||
state.effect_blur_shader.set_uniform(EffectBlurShaderGLES2::CAMERA_Z_NEAR, p_cam_projection.get_z_near());
|
||||
state.effect_blur_shader.set_uniform(EffectBlurShaderGLES2::CAMERA_Z_FAR, p_cam_projection.get_z_far());
|
||||
|
||||
WRAPPED_GL_ACTIVE_TEXTURE(GL_TEXTURE1);
|
||||
glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->depth);
|
||||
|
||||
WRAPPED_GL_ACTIVE_TEXTURE(GL_TEXTURE0);
|
||||
|
||||
if (storage->frame.current_rt->mip_maps[0].color) {
|
||||
glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->mip_maps[0].color);
|
||||
} else {
|
||||
glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->mip_maps[0].sizes[0].color);
|
||||
}
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, storage->frame.current_rt->fbo); //copy to front first
|
||||
|
||||
storage->_copy_screen();
|
||||
|
||||
WRAPPED_GL_ACTIVE_TEXTURE(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->color);
|
||||
state.effect_blur_shader.set_uniform(EffectBlurShaderGLES2::DOF_DIR, Vector2(0, 1));
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, storage->frame.current_rt->mip_maps[0].sizes[0].fbo); // copy to base level
|
||||
storage->_copy_screen();
|
||||
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_FAR_BLUR, false);
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_QUALITY_LOW, false);
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_QUALITY_MEDIUM, false);
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_QUALITY_HIGH, false);
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::USE_ORTHOGONAL_PROJECTION, false);
|
||||
}
|
||||
|
||||
if (env && env->dof_blur_near_enabled) {
|
||||
//convert texture to RGBA format if not already
|
||||
if (!storage->frame.current_rt->used_dof_blur_near) {
|
||||
WRAPPED_GL_ACTIVE_TEXTURE(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->color);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, storage->frame.current_rt->width, storage->frame.current_rt->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
|
||||
}
|
||||
|
||||
int vp_h = storage->frame.current_rt->height;
|
||||
int vp_w = storage->frame.current_rt->width;
|
||||
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::USE_ORTHOGONAL_PROJECTION, p_cam_projection.is_orthogonal());
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_NEAR_BLUR, true);
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_NEAR_FIRST_TAP, true);
|
||||
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_QUALITY_LOW, env->dof_blur_near_quality == RS::ENV_DOF_BLUR_QUALITY_LOW);
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_QUALITY_MEDIUM, env->dof_blur_near_quality == RS::ENV_DOF_BLUR_QUALITY_MEDIUM);
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_QUALITY_HIGH, env->dof_blur_near_quality == RS::ENV_DOF_BLUR_QUALITY_HIGH);
|
||||
|
||||
state.effect_blur_shader.bind();
|
||||
int qsteps[3] = { 4, 10, 20 };
|
||||
|
||||
float radius = (env->dof_blur_near_amount * env->dof_blur_near_amount) / qsteps[env->dof_blur_near_quality];
|
||||
|
||||
state.effect_blur_shader.set_uniform(EffectBlurShaderGLES2::DOF_BEGIN, env->dof_blur_near_distance);
|
||||
state.effect_blur_shader.set_uniform(EffectBlurShaderGLES2::DOF_END, env->dof_blur_near_distance - env->dof_blur_near_transition);
|
||||
state.effect_blur_shader.set_uniform(EffectBlurShaderGLES2::DOF_DIR, Vector2(1, 0));
|
||||
state.effect_blur_shader.set_uniform(EffectBlurShaderGLES2::DOF_RADIUS, radius);
|
||||
state.effect_blur_shader.set_uniform(EffectBlurShaderGLES2::PIXEL_SIZE, Vector2(1.0 / vp_w, 1.0 / vp_h));
|
||||
state.effect_blur_shader.set_uniform(EffectBlurShaderGLES2::CAMERA_Z_NEAR, p_cam_projection.get_z_near());
|
||||
state.effect_blur_shader.set_uniform(EffectBlurShaderGLES2::CAMERA_Z_FAR, p_cam_projection.get_z_far());
|
||||
|
||||
WRAPPED_GL_ACTIVE_TEXTURE(GL_TEXTURE1);
|
||||
glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->depth);
|
||||
|
||||
WRAPPED_GL_ACTIVE_TEXTURE(GL_TEXTURE0);
|
||||
if (storage->frame.current_rt->mip_maps[0].color) {
|
||||
glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->mip_maps[0].color);
|
||||
} else {
|
||||
glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->mip_maps[0].sizes[0].color);
|
||||
}
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, storage->frame.current_rt->fbo); //copy to front first
|
||||
|
||||
storage->_copy_screen();
|
||||
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_NEAR_FIRST_TAP, false);
|
||||
state.effect_blur_shader.bind();
|
||||
|
||||
state.effect_blur_shader.set_uniform(EffectBlurShaderGLES2::DOF_BEGIN, env->dof_blur_near_distance);
|
||||
state.effect_blur_shader.set_uniform(EffectBlurShaderGLES2::DOF_END, env->dof_blur_near_distance - env->dof_blur_near_transition);
|
||||
state.effect_blur_shader.set_uniform(EffectBlurShaderGLES2::DOF_DIR, Vector2(0, 1));
|
||||
state.effect_blur_shader.set_uniform(EffectBlurShaderGLES2::DOF_RADIUS, radius);
|
||||
state.effect_blur_shader.set_uniform(EffectBlurShaderGLES2::PIXEL_SIZE, Vector2(1.0 / vp_w, 1.0 / vp_h));
|
||||
state.effect_blur_shader.set_uniform(EffectBlurShaderGLES2::CAMERA_Z_NEAR, p_cam_projection.get_z_near());
|
||||
state.effect_blur_shader.set_uniform(EffectBlurShaderGLES2::CAMERA_Z_FAR, p_cam_projection.get_z_far());
|
||||
|
||||
WRAPPED_GL_ACTIVE_TEXTURE(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->color);
|
||||
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, storage->frame.current_rt->mip_maps[0].sizes[0].fbo); // copy to base level
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendEquation(GL_FUNC_ADD);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
storage->_copy_screen();
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_NEAR_BLUR, false);
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_NEAR_FIRST_TAP, false);
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_QUALITY_LOW, false);
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_QUALITY_MEDIUM, false);
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_QUALITY_HIGH, false);
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::USE_ORTHOGONAL_PROJECTION, false);
|
||||
storage->frame.current_rt->used_dof_blur_near = true;
|
||||
}
|
||||
|
||||
if (env && (env->dof_blur_near_enabled || env->dof_blur_far_enabled)) {
|
||||
//these needed to disable filtering, reenamble
|
||||
WRAPPED_GL_ACTIVE_TEXTURE(GL_TEXTURE0);
|
||||
if (storage->frame.current_rt->mip_maps[0].color) {
|
||||
glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->mip_maps[0].color);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
|
||||
} else {
|
||||
glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->mip_maps[0].sizes[0].color);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
}
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
}
|
||||
|
||||
//glow
|
||||
|
||||
int max_glow_level = -1;
|
||||
int glow_mask = 0;
|
||||
|
||||
if (env && env->glow_enabled) {
|
||||
for (int i = 0; i < RS::MAX_GLOW_LEVELS; i++) {
|
||||
if (env->glow_levels & (1 << i)) {
|
||||
if (i >= storage->frame.current_rt->mip_maps[1].sizes.size()) {
|
||||
max_glow_level = storage->frame.current_rt->mip_maps[1].sizes.size() - 1;
|
||||
glow_mask |= 1 << max_glow_level;
|
||||
|
||||
} else {
|
||||
max_glow_level = i;
|
||||
glow_mask |= (1 << i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If max_texture_image_units is 8, our max glow level is 5, which allows 6 layers of glow
|
||||
max_glow_level = MIN(max_glow_level, storage->config.max_texture_image_units - 3);
|
||||
|
||||
for (int i = 0; i < (max_glow_level + 1); i++) {
|
||||
int vp_w = storage->frame.current_rt->mip_maps[1].sizes[i].width;
|
||||
int vp_h = storage->frame.current_rt->mip_maps[1].sizes[i].height;
|
||||
glViewport(0, 0, vp_w, vp_h);
|
||||
//horizontal pass
|
||||
if (i == 0) {
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::GLOW_FIRST_PASS, true);
|
||||
}
|
||||
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::GLOW_GAUSSIAN_HORIZONTAL, true);
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::USE_GLOW_HIGH_QUALITY, env->glow_high_quality);
|
||||
state.effect_blur_shader.bind();
|
||||
state.effect_blur_shader.set_uniform(EffectBlurShaderGLES2::PIXEL_SIZE, Vector2(1.0 / vp_w, 1.0 / vp_h));
|
||||
state.effect_blur_shader.set_uniform(EffectBlurShaderGLES2::LOD, storage->frame.current_rt->mip_maps[0].color ? float(i) : 0.0);
|
||||
state.effect_blur_shader.set_uniform(EffectBlurShaderGLES2::GLOW_STRENGTH, env->glow_strength);
|
||||
state.effect_blur_shader.set_uniform(EffectBlurShaderGLES2::LUMINANCE_CAP, env->glow_hdr_luminance_cap);
|
||||
|
||||
WRAPPED_GL_ACTIVE_TEXTURE(GL_TEXTURE0);
|
||||
|
||||
if (storage->frame.current_rt->mip_maps[0].color) {
|
||||
glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->mip_maps[0].color);
|
||||
} else {
|
||||
glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->mip_maps[0].sizes[i].color);
|
||||
}
|
||||
|
||||
if (i == 0) {
|
||||
state.effect_blur_shader.set_uniform(EffectBlurShaderGLES2::GLOW_BLOOM, env->glow_bloom);
|
||||
state.effect_blur_shader.set_uniform(EffectBlurShaderGLES2::GLOW_HDR_THRESHOLD, env->glow_hdr_bleed_threshold);
|
||||
state.effect_blur_shader.set_uniform(EffectBlurShaderGLES2::GLOW_HDR_SCALE, env->glow_hdr_bleed_scale);
|
||||
}
|
||||
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, storage->frame.current_rt->mip_maps[1].sizes[i].fbo);
|
||||
storage->_copy_screen();
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::GLOW_GAUSSIAN_HORIZONTAL, false);
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::GLOW_FIRST_PASS, false);
|
||||
|
||||
//vertical pass
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::GLOW_GAUSSIAN_VERTICAL, true);
|
||||
state.effect_blur_shader.bind();
|
||||
state.effect_blur_shader.set_uniform(EffectBlurShaderGLES2::PIXEL_SIZE, Vector2(1.0 / vp_w, 1.0 / vp_h));
|
||||
state.effect_blur_shader.set_uniform(EffectBlurShaderGLES2::LOD, storage->frame.current_rt->mip_maps[0].color ? float(i) : 0.0);
|
||||
state.effect_blur_shader.set_uniform(EffectBlurShaderGLES2::GLOW_STRENGTH, env->glow_strength);
|
||||
WRAPPED_GL_ACTIVE_TEXTURE(GL_TEXTURE0);
|
||||
|
||||
if (storage->frame.current_rt->mip_maps[0].color) {
|
||||
glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->mip_maps[1].color);
|
||||
} else {
|
||||
glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->mip_maps[1].sizes[i].color);
|
||||
}
|
||||
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, storage->frame.current_rt->mip_maps[0].sizes[i + 1].fbo); //next level, since mipmaps[0] starts one level bigger
|
||||
storage->_copy_screen();
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::GLOW_GAUSSIAN_VERTICAL, false);
|
||||
}
|
||||
|
||||
glViewport(0, 0, storage->frame.current_rt->width, storage->frame.current_rt->height);
|
||||
}
|
||||
|
||||
if (storage->frame.current_rt->external.fbo != 0) {
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, storage->frame.current_rt->external.fbo);
|
||||
} else {
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, storage->frame.current_rt->fbo);
|
||||
}
|
||||
|
||||
WRAPPED_GL_ACTIVE_TEXTURE(GL_TEXTURE0);
|
||||
if (storage->frame.current_rt->mip_maps[0].color) {
|
||||
glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->mip_maps[0].color);
|
||||
} else {
|
||||
glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->mip_maps[0].sizes[0].color);
|
||||
}
|
||||
|
||||
state.tonemap_shader.set_conditional(TonemapShaderGLES2::USE_FXAA, storage->frame.current_rt->use_fxaa);
|
||||
|
||||
if (env) {
|
||||
state.tonemap_shader.set_conditional(TonemapShaderGLES2::USE_GLOW_FILTER_BICUBIC, env->glow_bicubic_upscale);
|
||||
|
||||
if (max_glow_level >= 0) {
|
||||
if (storage->frame.current_rt->mip_maps[0].color) {
|
||||
for (int i = 0; i < (max_glow_level + 1); i++) {
|
||||
if (glow_mask & (1 << i)) {
|
||||
if (i == 0) {
|
||||
state.tonemap_shader.set_conditional(TonemapShaderGLES2::USE_GLOW_LEVEL1, true);
|
||||
}
|
||||
if (i == 1) {
|
||||
state.tonemap_shader.set_conditional(TonemapShaderGLES2::USE_GLOW_LEVEL2, true);
|
||||
}
|
||||
if (i == 2) {
|
||||
state.tonemap_shader.set_conditional(TonemapShaderGLES2::USE_GLOW_LEVEL3, true);
|
||||
}
|
||||
if (i == 3) {
|
||||
state.tonemap_shader.set_conditional(TonemapShaderGLES2::USE_GLOW_LEVEL4, true);
|
||||
}
|
||||
if (i == 4) {
|
||||
state.tonemap_shader.set_conditional(TonemapShaderGLES2::USE_GLOW_LEVEL5, true);
|
||||
}
|
||||
if (i == 5) {
|
||||
state.tonemap_shader.set_conditional(TonemapShaderGLES2::USE_GLOW_LEVEL6, true);
|
||||
}
|
||||
if (i == 6) {
|
||||
state.tonemap_shader.set_conditional(TonemapShaderGLES2::USE_GLOW_LEVEL7, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
WRAPPED_GL_ACTIVE_TEXTURE(GL_TEXTURE2);
|
||||
glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->mip_maps[0].color);
|
||||
} else {
|
||||
state.tonemap_shader.set_conditional(TonemapShaderGLES2::USE_MULTI_TEXTURE_GLOW, true);
|
||||
int active_glow_level = 0;
|
||||
for (int i = 0; i < (max_glow_level + 1); i++) {
|
||||
if (glow_mask & (1 << i)) {
|
||||
active_glow_level++;
|
||||
WRAPPED_GL_ACTIVE_TEXTURE(GL_TEXTURE1 + active_glow_level);
|
||||
glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->mip_maps[0].sizes[i + 1].color);
|
||||
if (active_glow_level == 1) {
|
||||
state.tonemap_shader.set_conditional(TonemapShaderGLES2::USE_GLOW_LEVEL1, true);
|
||||
}
|
||||
if (active_glow_level == 2) {
|
||||
state.tonemap_shader.set_conditional(TonemapShaderGLES2::USE_GLOW_LEVEL2, true);
|
||||
}
|
||||
if (active_glow_level == 3) {
|
||||
state.tonemap_shader.set_conditional(TonemapShaderGLES2::USE_GLOW_LEVEL3, true);
|
||||
}
|
||||
if (active_glow_level == 4) {
|
||||
state.tonemap_shader.set_conditional(TonemapShaderGLES2::USE_GLOW_LEVEL4, true);
|
||||
}
|
||||
if (active_glow_level == 5) {
|
||||
state.tonemap_shader.set_conditional(TonemapShaderGLES2::USE_GLOW_LEVEL5, true);
|
||||
}
|
||||
if (active_glow_level == 6) {
|
||||
state.tonemap_shader.set_conditional(TonemapShaderGLES2::USE_GLOW_LEVEL6, true);
|
||||
}
|
||||
if (active_glow_level == 7) {
|
||||
state.tonemap_shader.set_conditional(TonemapShaderGLES2::USE_GLOW_LEVEL7, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
state.tonemap_shader.set_conditional(TonemapShaderGLES2::USE_GLOW_SCREEN, env->glow_blend_mode == RS::GLOW_BLEND_MODE_SCREEN);
|
||||
state.tonemap_shader.set_conditional(TonemapShaderGLES2::USE_GLOW_SOFTLIGHT, env->glow_blend_mode == RS::GLOW_BLEND_MODE_SOFTLIGHT);
|
||||
state.tonemap_shader.set_conditional(TonemapShaderGLES2::USE_GLOW_REPLACE, env->glow_blend_mode == RS::GLOW_BLEND_MODE_REPLACE);
|
||||
}
|
||||
}
|
||||
|
||||
//Adjustments
|
||||
if (env && env->adjustments_enabled) {
|
||||
state.tonemap_shader.set_conditional(TonemapShaderGLES2::USE_BCS, true);
|
||||
RasterizerStorageGLES2::Texture *tex = storage->texture_owner.getornull(env->color_correction);
|
||||
if (tex) {
|
||||
state.tonemap_shader.set_conditional(TonemapShaderGLES2::USE_COLOR_CORRECTION, true);
|
||||
WRAPPED_GL_ACTIVE_TEXTURE(GL_TEXTURE1);
|
||||
glBindTexture(tex->target, tex->tex_id);
|
||||
}
|
||||
}
|
||||
|
||||
state.tonemap_shader.set_conditional(TonemapShaderGLES2::DISABLE_ALPHA, !storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]);
|
||||
state.tonemap_shader.bind();
|
||||
if (env) {
|
||||
if (max_glow_level >= 0) {
|
||||
state.tonemap_shader.set_uniform(TonemapShaderGLES2::GLOW_INTENSITY, env->glow_intensity);
|
||||
int ss[2] = {
|
||||
storage->frame.current_rt->width,
|
||||
storage->frame.current_rt->height,
|
||||
};
|
||||
glUniform2iv(state.tonemap_shader.get_uniform(TonemapShaderGLES2::GLOW_TEXTURE_SIZE), 1, ss);
|
||||
}
|
||||
|
||||
if (env->adjustments_enabled) {
|
||||
state.tonemap_shader.set_uniform(TonemapShaderGLES2::BCS, Vector3(env->adjustments_brightness, env->adjustments_contrast, env->adjustments_saturation));
|
||||
}
|
||||
}
|
||||
|
||||
if (storage->frame.current_rt->use_fxaa) {
|
||||
state.tonemap_shader.set_uniform(TonemapShaderGLES2::PIXEL_SIZE, Vector2(1.0 / storage->frame.current_rt->width, 1.0 / storage->frame.current_rt->height));
|
||||
@ -3068,7 +2465,6 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
|
||||
storage->info.render.object_count += p_cull_count;
|
||||
|
||||
GLuint current_fb = 0;
|
||||
Environment3D *env = nullptr;
|
||||
|
||||
int viewport_width, viewport_height;
|
||||
int viewport_x = 0;
|
||||
@ -3086,10 +2482,6 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
|
||||
ERR_FAIL_COND(!probe);
|
||||
state.render_no_shadows = !probe->probe_ptr->enable_shadows;
|
||||
|
||||
if (!probe->probe_ptr->interior) { //use env only if not interior
|
||||
env = environment_owner.getornull(p_environment);
|
||||
}
|
||||
|
||||
current_fb = probe->fbo[p_reflection_probe_pass];
|
||||
|
||||
viewport_width = probe->probe_ptr->resolution;
|
||||
@ -3106,7 +2498,6 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
|
||||
} else {
|
||||
current_fb = storage->frame.current_rt->fbo;
|
||||
}
|
||||
env = environment_owner.getornull(p_environment);
|
||||
|
||||
viewport_width = storage->frame.current_rt->width;
|
||||
viewport_height = storage->frame.current_rt->height;
|
||||
@ -3151,28 +2542,6 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
|
||||
index++;
|
||||
}
|
||||
|
||||
// for fog transmission, we want some kind of consistent ordering of lights
|
||||
// add any more conditions here in which we need consistent light ordering
|
||||
// (perhaps we always should have it, but don't know yet)
|
||||
if (env && env->fog_transmit_enabled) {
|
||||
struct _LightSort {
|
||||
bool operator()(LightInstance *A, LightInstance *B) const {
|
||||
return A->light_counter > B->light_counter;
|
||||
}
|
||||
};
|
||||
|
||||
int num_lights_to_sort = render_light_instance_count - render_directional_lights;
|
||||
|
||||
if (num_lights_to_sort) {
|
||||
SortArray<LightInstance *, _LightSort> sorter;
|
||||
sorter.sort(&render_light_instances[render_directional_lights], num_lights_to_sort);
|
||||
// rejig indices
|
||||
for (int i = render_directional_lights; i < render_light_instance_count; i++) {
|
||||
render_light_instances[i]->light_index = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
render_light_instances = nullptr;
|
||||
render_directional_lights = 0;
|
||||
@ -3195,12 +2564,6 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
|
||||
reflection_probe_count = 0;
|
||||
}
|
||||
|
||||
if (env && env->bg_mode == RS::ENV_BG_CANVAS) {
|
||||
// If using canvas background, copy 2d to screen copy texture
|
||||
// TODO: When GLES2 renders to current_rt->mip_maps[], this copy will no longer be needed
|
||||
_copy_texture_to_buffer(storage->frame.current_rt->color, storage->frame.current_rt->copy_screen_effect.fbo);
|
||||
}
|
||||
|
||||
// render list stuff
|
||||
|
||||
render_list.clear();
|
||||
@ -3229,33 +2592,10 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
|
||||
if (storage->frame.current_rt && storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) {
|
||||
clear_color = Color(0, 0, 0, 0);
|
||||
storage->frame.clear_request = false;
|
||||
} else if (!env || env->bg_mode == RS::ENV_BG_CLEAR_COLOR) {
|
||||
if (storage->frame.clear_request) {
|
||||
clear_color = storage->frame.clear_request_color;
|
||||
storage->frame.clear_request = false;
|
||||
}
|
||||
} else if (env->bg_mode == RS::ENV_BG_CANVAS || env->bg_mode == RS::ENV_BG_COLOR || env->bg_mode == RS::ENV_BG_COLOR_SKY) {
|
||||
clear_color = env->bg_color;
|
||||
storage->frame.clear_request = false;
|
||||
} else if (env->bg_mode == RS::ENV_BG_CAMERA_FEED) {
|
||||
storage->frame.clear_request = false;
|
||||
} else {
|
||||
storage->frame.clear_request = false;
|
||||
}
|
||||
|
||||
if (!env || env->bg_mode != RS::ENV_BG_KEEP) {
|
||||
if (storage->frame.current_rt && storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_KEEP_3D_LINEAR]) {
|
||||
// convert to linear here
|
||||
Color linear_color = clear_color.to_linear();
|
||||
glClearColor(linear_color.r, linear_color.g, linear_color.b, linear_color.a);
|
||||
|
||||
// leave clear_color in sRGB as most of the render pipeline remains in sRGB color space until writing out to frag_color
|
||||
} else {
|
||||
glClearColor(clear_color.r, clear_color.g, clear_color.b, clear_color.a);
|
||||
}
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
}
|
||||
|
||||
state.default_ambient = Color(clear_color.r, clear_color.g, clear_color.b, 1.0);
|
||||
state.default_bg = Color(clear_color.r, clear_color.g, clear_color.b, 1.0);
|
||||
|
||||
@ -3269,22 +2609,7 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
// render sky
|
||||
GLuint env_radiance_tex = 0;
|
||||
if (env) {
|
||||
switch (env->bg_mode) {
|
||||
case RS::ENV_BG_COLOR_SKY: {
|
||||
} break;
|
||||
case RS::ENV_BG_CANVAS: {
|
||||
// use screen copy as background
|
||||
_copy_texture_to_buffer(storage->frame.current_rt->copy_screen_effect.color, current_fb);
|
||||
} break;
|
||||
default: {
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
if (probe_interior) {
|
||||
env_radiance_tex = 0; //do not use radiance texture on interiors
|
||||
state.default_ambient = Color(0, 0, 0, 1); //black as default ambient for interior
|
||||
state.default_bg = Color(0, 0, 0, 1); //black as default background for interior
|
||||
}
|
||||
@ -3298,7 +2623,7 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
|
||||
|
||||
// render opaque things first
|
||||
render_list.sort_by_key(false);
|
||||
_render_render_list(render_list.elements, render_list.element_count, cam_transform, p_cam_projection, p_eye, p_shadow_atlas, env, env_radiance_tex, 0.0, 0.0, reverse_cull, false, false);
|
||||
_render_render_list(render_list.elements, render_list.element_count, cam_transform, p_cam_projection, p_eye, p_shadow_atlas, 0.0, 0.0, reverse_cull, false, false);
|
||||
|
||||
if (storage->frame.current_rt && state.used_screen_texture) {
|
||||
//copy screen texture
|
||||
@ -3344,7 +2669,7 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
|
||||
|
||||
render_list.sort_by_reverse_depth_and_priority(true);
|
||||
|
||||
_render_render_list(&render_list.elements[render_list.max_elements - render_list.alpha_element_count], render_list.alpha_element_count, cam_transform, p_cam_projection, p_eye, p_shadow_atlas, env, env_radiance_tex, 0.0, 0.0, reverse_cull, true, false);
|
||||
_render_render_list(&render_list.elements[render_list.max_elements - render_list.alpha_element_count], render_list.alpha_element_count, cam_transform, p_cam_projection, p_eye, p_shadow_atlas, 0.0, 0.0, reverse_cull, true, false);
|
||||
|
||||
if (p_reflection_probe.is_valid()) {
|
||||
// Rendering to a probe so no need for post_processing
|
||||
@ -3352,7 +2677,7 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
|
||||
}
|
||||
|
||||
//post process
|
||||
_post_process(env, p_cam_projection);
|
||||
_post_process(p_cam_projection);
|
||||
|
||||
//#define GLES2_SHADOW_ATLAS_DEBUG_VIEW
|
||||
|
||||
@ -3462,8 +2787,7 @@ void RasterizerSceneGLES2::render_shadow(RID p_light, RID p_shadow_atlas, int p_
|
||||
width = light_instance->directional_rect.size.width;
|
||||
height = light_instance->directional_rect.size.height;
|
||||
|
||||
if (light->directional_shadow_mode == RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_3_SPLITS
|
||||
|| light->directional_shadow_mode == RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS) {
|
||||
if (light->directional_shadow_mode == RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_3_SPLITS || light->directional_shadow_mode == RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS) {
|
||||
width /= 2;
|
||||
height /= 2;
|
||||
|
||||
@ -3615,7 +2939,7 @@ void RasterizerSceneGLES2::render_shadow(RID p_light, RID p_shadow_atlas, int p_
|
||||
state.scene_shader.set_conditional(SceneShaderGLES2::RENDER_DEPTH, true);
|
||||
state.scene_shader.set_conditional(SceneShaderGLES2::OUTPUT_LINEAR, false); // just in case, should be false already
|
||||
|
||||
_render_render_list(render_list.elements, render_list.element_count, light_transform, light_projection, 0, RID(), nullptr, 0, bias, normal_bias, flip_facing, false, true);
|
||||
_render_render_list(render_list.elements, render_list.element_count, light_transform, light_projection, 0, RID(), bias, normal_bias, flip_facing, false, true);
|
||||
|
||||
state.scene_shader.set_conditional(SceneShaderGLES2::RENDER_DEPTH, false);
|
||||
state.scene_shader.set_conditional(SceneShaderGLES2::RENDER_DEPTH_DUAL_PARABOLOID, false);
|
||||
@ -3721,12 +3045,6 @@ bool RasterizerSceneGLES2::free(RID p_rid) {
|
||||
reflection_probe_instance_owner.free(p_rid);
|
||||
memdelete(reflection_instance);
|
||||
|
||||
} else if (environment_owner.owns(p_rid)) {
|
||||
Environment3D *environment = environment_owner.get(p_rid);
|
||||
|
||||
environment_owner.free(p_rid);
|
||||
memdelete(environment);
|
||||
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -350,156 +350,6 @@ public:
|
||||
virtual bool reflection_probe_instance_begin_render(RID p_instance, RID p_reflection_atlas);
|
||||
virtual bool reflection_probe_instance_postprocess_step(RID p_instance);
|
||||
|
||||
/* ENVIRONMENT API */
|
||||
|
||||
struct Environment3D : public RID_Data {
|
||||
RS::Environment3DBG bg_mode;
|
||||
|
||||
RID sky;
|
||||
float sky_custom_fov;
|
||||
Basis sky_orientation;
|
||||
|
||||
Color bg_color;
|
||||
float bg_energy;
|
||||
float sky_ambient;
|
||||
|
||||
Color ambient_color;
|
||||
float ambient_energy;
|
||||
float ambient_sky_contribution;
|
||||
|
||||
int canvas_max_layer;
|
||||
|
||||
bool glow_enabled;
|
||||
int glow_levels;
|
||||
float glow_intensity;
|
||||
float glow_strength;
|
||||
float glow_bloom;
|
||||
RS::Environment3DGlowBlendMode glow_blend_mode;
|
||||
float glow_hdr_bleed_threshold;
|
||||
float glow_hdr_bleed_scale;
|
||||
float glow_hdr_luminance_cap;
|
||||
bool glow_bicubic_upscale;
|
||||
bool glow_high_quality;
|
||||
|
||||
bool dof_blur_far_enabled;
|
||||
float dof_blur_far_distance;
|
||||
float dof_blur_far_transition;
|
||||
float dof_blur_far_amount;
|
||||
RS::Environment3DDOFBlurQuality dof_blur_far_quality;
|
||||
|
||||
bool dof_blur_near_enabled;
|
||||
float dof_blur_near_distance;
|
||||
float dof_blur_near_transition;
|
||||
float dof_blur_near_amount;
|
||||
RS::Environment3DDOFBlurQuality dof_blur_near_quality;
|
||||
|
||||
bool adjustments_enabled;
|
||||
float adjustments_brightness;
|
||||
float adjustments_contrast;
|
||||
float adjustments_saturation;
|
||||
RID color_correction;
|
||||
|
||||
bool fog_enabled;
|
||||
Color fog_color;
|
||||
Color fog_sun_color;
|
||||
float fog_sun_amount;
|
||||
|
||||
bool fog_depth_enabled;
|
||||
float fog_depth_begin;
|
||||
float fog_depth_end;
|
||||
float fog_depth_curve;
|
||||
bool fog_transmit_enabled;
|
||||
float fog_transmit_curve;
|
||||
bool fog_height_enabled;
|
||||
float fog_height_min;
|
||||
float fog_height_max;
|
||||
float fog_height_curve;
|
||||
|
||||
Environment3D() :
|
||||
bg_mode(RS::ENV_BG_CLEAR_COLOR),
|
||||
sky_custom_fov(0.0),
|
||||
bg_energy(1.0),
|
||||
sky_ambient(0),
|
||||
ambient_energy(1.0),
|
||||
ambient_sky_contribution(0.0),
|
||||
canvas_max_layer(0),
|
||||
glow_enabled(false),
|
||||
glow_levels((1 << 2) | (1 << 4)),
|
||||
glow_intensity(0.8),
|
||||
glow_strength(1.0),
|
||||
glow_bloom(0.0),
|
||||
glow_blend_mode(RS::GLOW_BLEND_MODE_SOFTLIGHT),
|
||||
glow_hdr_bleed_threshold(1.0),
|
||||
glow_hdr_bleed_scale(2.0),
|
||||
glow_hdr_luminance_cap(12.0),
|
||||
glow_bicubic_upscale(false),
|
||||
glow_high_quality(false),
|
||||
dof_blur_far_enabled(false),
|
||||
dof_blur_far_distance(10),
|
||||
dof_blur_far_transition(5),
|
||||
dof_blur_far_amount(0.1),
|
||||
dof_blur_far_quality(RS::ENV_DOF_BLUR_QUALITY_MEDIUM),
|
||||
dof_blur_near_enabled(false),
|
||||
dof_blur_near_distance(2),
|
||||
dof_blur_near_transition(1),
|
||||
dof_blur_near_amount(0.1),
|
||||
dof_blur_near_quality(RS::ENV_DOF_BLUR_QUALITY_MEDIUM),
|
||||
adjustments_enabled(false),
|
||||
adjustments_brightness(1.0),
|
||||
adjustments_contrast(1.0),
|
||||
adjustments_saturation(1.0),
|
||||
fog_enabled(false),
|
||||
fog_color(Color(0.5, 0.5, 0.5)),
|
||||
fog_sun_color(Color(0.8, 0.8, 0.0)),
|
||||
fog_sun_amount(0),
|
||||
fog_depth_enabled(true),
|
||||
fog_depth_begin(10),
|
||||
fog_depth_end(0),
|
||||
fog_depth_curve(1),
|
||||
fog_transmit_enabled(true),
|
||||
fog_transmit_curve(1),
|
||||
fog_height_enabled(false),
|
||||
fog_height_min(10),
|
||||
fog_height_max(0),
|
||||
fog_height_curve(1) {
|
||||
}
|
||||
};
|
||||
|
||||
mutable RID_Owner<Environment3D> environment_owner;
|
||||
|
||||
virtual RID environment_create();
|
||||
|
||||
virtual void environment_set_background(RID p_env, RS::Environment3DBG p_bg);
|
||||
virtual void environment_set_sky(RID p_env, RID p_sky);
|
||||
virtual void environment_set_sky_custom_fov(RID p_env, float p_scale);
|
||||
virtual void environment_set_sky_orientation(RID p_env, const Basis &p_orientation);
|
||||
virtual void environment_set_bg_color(RID p_env, const Color &p_color);
|
||||
virtual void environment_set_bg_energy(RID p_env, float p_energy);
|
||||
virtual void environment_set_canvas_max_layer(RID p_env, int p_max_layer);
|
||||
virtual void environment_set_ambient_light(RID p_env, const Color &p_color, float p_energy = 1.0, float p_sky_contribution = 0.0);
|
||||
|
||||
virtual void environment_set_dof_blur_near(RID p_env, bool p_enable, float p_distance, float p_transition, float p_amount, RS::Environment3DDOFBlurQuality p_quality);
|
||||
virtual void environment_set_dof_blur_far(RID p_env, bool p_enable, float p_distance, float p_transition, float p_amount, RS::Environment3DDOFBlurQuality p_quality);
|
||||
|
||||
virtual void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_bloom_threshold, RS::Environment3DGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap, bool p_bicubic_upscale, bool p_high_quality);
|
||||
virtual void environment_set_fog(RID p_env, bool p_enable, float p_begin, float p_end, RID p_gradient_texture);
|
||||
|
||||
virtual void environment_set_ssr(RID p_env, bool p_enable, int p_max_steps, float p_fade_in, float p_fade_out, float p_depth_tolerance, bool p_roughness);
|
||||
virtual void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, float p_ao_channel_affect, const Color &p_color, RS::Environment3DSSAOQuality p_quality, RS::Environment3DSSAOBlur p_blur, float p_bilateral_sharpness);
|
||||
|
||||
virtual void environment_set_tonemap(RID p_env, RS::Environment3DToneMapper p_tone_mapper, float p_exposure, float p_white, bool p_auto_exposure, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_scale);
|
||||
|
||||
virtual void environment_set_adjustment(RID p_env, bool p_enable, float p_brightness, float p_contrast, float p_saturation, RID p_ramp);
|
||||
|
||||
virtual void environment_set_fog(RID p_env, bool p_enable, const Color &p_color, const Color &p_sun_color, float p_sun_amount);
|
||||
virtual void environment_set_fog_depth(RID p_env, bool p_enable, float p_depth_begin, float p_depth_end, float p_depth_curve, bool p_transmit, float p_transmit_curve);
|
||||
virtual void environment_set_fog_height(RID p_env, bool p_enable, float p_min_height, float p_max_height, float p_height_curve);
|
||||
|
||||
virtual bool is_environment(RID p_env);
|
||||
|
||||
virtual RS::Environment3DBG environment_get_background(RID p_env);
|
||||
virtual int environment_get_canvas_max_layer(RID p_env);
|
||||
|
||||
/* LIGHT INSTANCE */
|
||||
|
||||
struct LightInstance : public RID_Data {
|
||||
@ -734,8 +584,6 @@ public:
|
||||
const Projection &p_projection,
|
||||
const int p_eye,
|
||||
RID p_shadow_atlas,
|
||||
Environment3D *p_env,
|
||||
GLuint p_base_env,
|
||||
float p_shadow_bias,
|
||||
float p_shadow_normal_bias,
|
||||
bool p_reverse_cull,
|
||||
@ -747,10 +595,10 @@ public:
|
||||
_FORCE_INLINE_ void _setup_geometry(RenderList::Element *p_element, RasterizerStorageGLES2::Skeleton *p_skeleton);
|
||||
_FORCE_INLINE_ void _setup_light_type(LightInstance *p_light, ShadowAtlas *shadow_atlas);
|
||||
_FORCE_INLINE_ void _setup_light(LightInstance *p_light, ShadowAtlas *shadow_atlas, const Transform &p_view_transform, bool accum_pass);
|
||||
_FORCE_INLINE_ void _setup_refprobes(ReflectionProbeInstance *p_refprobe1, ReflectionProbeInstance *p_refprobe2, const Transform &p_view_transform, Environment3D *p_env);
|
||||
_FORCE_INLINE_ void _setup_refprobes(ReflectionProbeInstance *p_refprobe1, ReflectionProbeInstance *p_refprobe2, const Transform &p_view_transform);
|
||||
_FORCE_INLINE_ void _render_geometry(RenderList::Element *p_element);
|
||||
|
||||
void _post_process(Environment3D *env, const Projection &p_cam_projection);
|
||||
void _post_process(const Projection &p_cam_projection);
|
||||
|
||||
virtual void render_scene(const Transform &p_cam_transform, const Projection &p_cam_projection, const int p_eye, bool p_cam_ortogonal, InstanceBase **p_cull_result, int p_cull_count, RID *p_light_cull_result, int p_light_cull_count, RID *p_reflection_probe_cull_result, int p_reflection_probe_cull_count, RID p_environment, RID p_shadow_atlas, RID p_reflection_atlas, RID p_reflection_probe, int p_reflection_probe_pass);
|
||||
virtual void render_shadow(RID p_light, RID p_shadow_atlas, int p_pass, InstanceBase **p_cull_result, int p_cull_count);
|
||||
|
@ -48,39 +48,6 @@ public:
|
||||
virtual int get_directional_light_shadow_size(RID p_light_intance) = 0;
|
||||
virtual void set_directional_shadow_count(int p_count) = 0;
|
||||
|
||||
/* ENVIRONMENT API */
|
||||
|
||||
virtual RID environment_create() = 0;
|
||||
|
||||
virtual void environment_set_background(RID p_env, RS::Environment3DBG p_bg) = 0;
|
||||
virtual void environment_set_sky(RID p_env, RID p_sky) = 0;
|
||||
virtual void environment_set_sky_custom_fov(RID p_env, float p_scale) = 0;
|
||||
virtual void environment_set_sky_orientation(RID p_env, const Basis &p_orientation) = 0;
|
||||
virtual void environment_set_bg_color(RID p_env, const Color &p_color) = 0;
|
||||
virtual void environment_set_bg_energy(RID p_env, float p_energy) = 0;
|
||||
virtual void environment_set_canvas_max_layer(RID p_env, int p_max_layer) = 0;
|
||||
virtual void environment_set_ambient_light(RID p_env, const Color &p_color, float p_energy = 1.0, float p_sky_contribution = 0.0) = 0;
|
||||
|
||||
virtual void environment_set_dof_blur_near(RID p_env, bool p_enable, float p_distance, float p_transition, float p_far_amount, RS::Environment3DDOFBlurQuality p_quality) = 0;
|
||||
virtual void environment_set_dof_blur_far(RID p_env, bool p_enable, float p_distance, float p_transition, float p_far_amount, RS::Environment3DDOFBlurQuality p_quality) = 0;
|
||||
virtual void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_bloom_threshold, RS::Environment3DGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap, bool p_bicubic_upscale, bool p_high_quality) = 0;
|
||||
virtual void environment_set_fog(RID p_env, bool p_enable, float p_begin, float p_end, RID p_gradient_texture) = 0;
|
||||
|
||||
virtual void 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, bool p_roughness) = 0;
|
||||
virtual void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, float p_ao_channel_affect, const Color &p_color, RS::Environment3DSSAOQuality p_quality, RS::Environment3DSSAOBlur p_blur, float p_bilateral_sharpness) = 0;
|
||||
|
||||
virtual void environment_set_tonemap(RID p_env, RS::Environment3DToneMapper p_tone_mapper, float p_exposure, float p_white, bool p_auto_exposure, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_scale) = 0;
|
||||
|
||||
virtual void environment_set_adjustment(RID p_env, bool p_enable, float p_brightness, float p_contrast, float p_saturation, RID p_ramp) = 0;
|
||||
|
||||
virtual void environment_set_fog(RID p_env, bool p_enable, const Color &p_color, const Color &p_sun_color, float p_sun_amount) = 0;
|
||||
virtual void environment_set_fog_depth(RID p_env, bool p_enable, float p_depth_begin, float p_depth_end, float p_depth_curve, bool p_transmit, float p_transmit_curve) = 0;
|
||||
virtual void environment_set_fog_height(RID p_env, bool p_enable, float p_min_height, float p_max_height, float p_height_curve) = 0;
|
||||
|
||||
virtual bool is_environment(RID p_env) = 0;
|
||||
virtual RS::Environment3DBG environment_get_background(RID p_env) = 0;
|
||||
virtual int environment_get_canvas_max_layer(RID p_env) = 0;
|
||||
|
||||
struct InstanceBase : RID_Data {
|
||||
RS::InstanceType base_type;
|
||||
RID base;
|
||||
|
@ -422,35 +422,6 @@ public:
|
||||
|
||||
/* ENVIRONMENT API */
|
||||
|
||||
#undef BINDBASE
|
||||
//from now on, calls forwarded to this singleton
|
||||
#define BINDBASE RSG::scene_render
|
||||
|
||||
BIND0R(RID, environment_create)
|
||||
|
||||
BIND2(environment_set_background, RID, Environment3DBG)
|
||||
BIND2(environment_set_sky, RID, RID)
|
||||
BIND2(environment_set_sky_custom_fov, RID, float)
|
||||
BIND2(environment_set_sky_orientation, RID, const Basis &)
|
||||
BIND2(environment_set_bg_color, RID, const Color &)
|
||||
BIND2(environment_set_bg_energy, RID, float)
|
||||
BIND2(environment_set_canvas_max_layer, RID, int)
|
||||
BIND4(environment_set_ambient_light, RID, const Color &, float, float)
|
||||
BIND7(environment_set_ssr, RID, bool, int, float, float, float, bool)
|
||||
BIND13(environment_set_ssao, RID, bool, float, float, float, float, float, float, float, const Color &, Environment3DSSAOQuality, Environment3DSSAOBlur, float)
|
||||
|
||||
BIND6(environment_set_dof_blur_near, RID, bool, float, float, float, Environment3DDOFBlurQuality)
|
||||
BIND6(environment_set_dof_blur_far, RID, bool, float, float, float, Environment3DDOFBlurQuality)
|
||||
BIND12(environment_set_glow, RID, bool, int, float, float, float, Environment3DGlowBlendMode, float, float, float, bool, bool)
|
||||
|
||||
BIND9(environment_set_tonemap, RID, Environment3DToneMapper, float, float, bool, float, float, float, float)
|
||||
|
||||
BIND6(environment_set_adjustment, RID, bool, float, float, float, RID)
|
||||
|
||||
BIND5(environment_set_fog, RID, bool, const Color &, const Color &, float)
|
||||
BIND7(environment_set_fog_depth, RID, bool, float, float, float, bool, float)
|
||||
BIND5(environment_set_fog_height, RID, bool, float, float, float)
|
||||
|
||||
#undef BINDBASE
|
||||
#define BINDBASE RSG::scene
|
||||
|
||||
|
@ -74,16 +74,6 @@ void RenderingServerViewport::_draw_viewport(Viewport *p_viewport) {
|
||||
bool scenario_draw_canvas_bg = false; //draw canvas, or some layer of it, as BG for 3D instead of in front
|
||||
int scenario_canvas_max_layer = 0;
|
||||
|
||||
if (!p_viewport->hide_canvas && !p_viewport->disable_environment && RSG::scene->scenario_owner.owns(p_viewport->scenario)) {
|
||||
RenderingServerScene::Scenario *scenario = RSG::scene->scenario_owner.get(p_viewport->scenario);
|
||||
ERR_FAIL_COND(!scenario);
|
||||
if (RSG::scene_render->is_environment(scenario->environment)) {
|
||||
scenario_draw_canvas_bg = RSG::scene_render->environment_get_background(scenario->environment) == RS::ENV_BG_CANVAS;
|
||||
|
||||
scenario_canvas_max_layer = RSG::scene_render->environment_get_canvas_max_layer(scenario->environment);
|
||||
}
|
||||
}
|
||||
|
||||
bool can_draw_3d = !p_viewport->disable_3d && !p_viewport->disable_3d_by_usage && RSG::scene->camera_owner.owns(p_viewport->camera);
|
||||
|
||||
if (p_viewport->clear_mode != RS::VIEWPORT_CLEAR_NEVER) {
|
||||
|
@ -153,7 +153,6 @@ void RenderingServerWrapMT::finish() {
|
||||
reflection_probe_free_cached_ids();
|
||||
camera_free_cached_ids();
|
||||
viewport_free_cached_ids();
|
||||
environment_free_cached_ids();
|
||||
scenario_free_cached_ids();
|
||||
instance_free_cached_ids();
|
||||
canvas_free_cached_ids();
|
||||
|
@ -342,33 +342,6 @@ public:
|
||||
|
||||
FUNC2(viewport_set_debug_draw, RID, ViewportDebugDraw)
|
||||
|
||||
/* ENVIRONMENT API */
|
||||
|
||||
FUNCRID(environment)
|
||||
|
||||
FUNC2(environment_set_background, RID, Environment3DBG)
|
||||
FUNC2(environment_set_sky, RID, RID)
|
||||
FUNC2(environment_set_sky_custom_fov, RID, float)
|
||||
FUNC2(environment_set_sky_orientation, RID, const Basis &)
|
||||
FUNC2(environment_set_bg_color, RID, const Color &)
|
||||
FUNC2(environment_set_bg_energy, RID, float)
|
||||
FUNC2(environment_set_canvas_max_layer, RID, int)
|
||||
FUNC4(environment_set_ambient_light, RID, const Color &, float, float)
|
||||
FUNC7(environment_set_ssr, RID, bool, int, float, float, float, bool)
|
||||
FUNC13(environment_set_ssao, RID, bool, float, float, float, float, float, float, float, const Color &, Environment3DSSAOQuality, Environment3DSSAOBlur, float)
|
||||
|
||||
FUNC6(environment_set_dof_blur_near, RID, bool, float, float, float, Environment3DDOFBlurQuality)
|
||||
FUNC6(environment_set_dof_blur_far, RID, bool, float, float, float, Environment3DDOFBlurQuality)
|
||||
FUNC12(environment_set_glow, RID, bool, int, float, float, float, Environment3DGlowBlendMode, float, float, float, bool, bool)
|
||||
|
||||
FUNC9(environment_set_tonemap, RID, Environment3DToneMapper, float, float, bool, float, float, float, float)
|
||||
|
||||
FUNC6(environment_set_adjustment, RID, bool, float, float, float, RID)
|
||||
|
||||
FUNC5(environment_set_fog, RID, bool, const Color &, const Color &, float)
|
||||
FUNC7(environment_set_fog_depth, RID, bool, float, float, float, bool, float)
|
||||
FUNC5(environment_set_fog_height, RID, bool, float, float, float)
|
||||
|
||||
/* SCENARIO API */
|
||||
|
||||
FUNCRID(scenario)
|
||||
|
@ -2036,28 +2036,6 @@ void RenderingServer::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("viewport_get_render_info", "viewport", "info"), &RenderingServer::viewport_get_render_info);
|
||||
ClassDB::bind_method(D_METHOD("viewport_set_debug_draw", "viewport", "draw"), &RenderingServer::viewport_set_debug_draw);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("environment_create"), &RenderingServer::environment_create);
|
||||
ClassDB::bind_method(D_METHOD("environment_set_background", "env", "bg"), &RenderingServer::environment_set_background);
|
||||
ClassDB::bind_method(D_METHOD("environment_set_sky", "env", "sky"), &RenderingServer::environment_set_sky);
|
||||
ClassDB::bind_method(D_METHOD("environment_set_sky_custom_fov", "env", "scale"), &RenderingServer::environment_set_sky_custom_fov);
|
||||
ClassDB::bind_method(D_METHOD("environment_set_sky_orientation", "env", "orientation"), &RenderingServer::environment_set_sky_orientation);
|
||||
ClassDB::bind_method(D_METHOD("environment_set_bg_color", "env", "color"), &RenderingServer::environment_set_bg_color);
|
||||
ClassDB::bind_method(D_METHOD("environment_set_bg_energy", "env", "energy"), &RenderingServer::environment_set_bg_energy);
|
||||
ClassDB::bind_method(D_METHOD("environment_set_canvas_max_layer", "env", "max_layer"), &RenderingServer::environment_set_canvas_max_layer);
|
||||
ClassDB::bind_method(D_METHOD("environment_set_ambient_light", "env", "color", "energy", "sky_contibution"), &RenderingServer::environment_set_ambient_light, DEFVAL(1.0), DEFVAL(0.0));
|
||||
ClassDB::bind_method(D_METHOD("environment_set_dof_blur_near", "env", "enable", "distance", "transition", "far_amount", "quality"), &RenderingServer::environment_set_dof_blur_near);
|
||||
ClassDB::bind_method(D_METHOD("environment_set_dof_blur_far", "env", "enable", "distance", "transition", "far_amount", "quality"), &RenderingServer::environment_set_dof_blur_far);
|
||||
ClassDB::bind_method(D_METHOD("environment_set_glow", "env", "enable", "level_flags", "intensity", "strength", "bloom_threshold", "blend_mode", "hdr_bleed_threshold", "hdr_bleed_scale", "hdr_luminance_cap", "bicubic_upscale", "high_quality"), &RenderingServer::environment_set_glow);
|
||||
ClassDB::bind_method(D_METHOD("environment_set_tonemap", "env", "tone_mapper", "exposure", "white", "auto_exposure", "min_luminance", "max_luminance", "auto_exp_speed", "auto_exp_grey"), &RenderingServer::environment_set_tonemap);
|
||||
ClassDB::bind_method(D_METHOD("environment_set_adjustment", "env", "enable", "brightness", "contrast", "saturation", "ramp"), &RenderingServer::environment_set_adjustment);
|
||||
ClassDB::bind_method(D_METHOD("environment_set_ssr", "env", "enable", "max_steps", "fade_in", "fade_out", "depth_tolerance", "roughness"), &RenderingServer::environment_set_ssr);
|
||||
ClassDB::bind_method(D_METHOD("environment_set_ssao", "env", "enable", "radius", "intensity", "radius2", "intensity2", "bias", "light_affect", "ao_channel_affect", "color", "quality", "blur", "bilateral_sharpness"), &RenderingServer::environment_set_ssao);
|
||||
ClassDB::bind_method(D_METHOD("environment_set_fog", "env", "enable", "color", "sun_color", "sun_amount"), &RenderingServer::environment_set_fog);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("environment_set_fog_depth", "env", "enable", "depth_begin", "depth_end", "depth_curve", "transmit", "transmit_curve"), &RenderingServer::environment_set_fog_depth);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("environment_set_fog_height", "env", "enable", "min_height", "max_height", "height_curve"), &RenderingServer::environment_set_fog_height);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("scenario_create"), &RenderingServer::scenario_create);
|
||||
ClassDB::bind_method(D_METHOD("scenario_set_debug", "scenario", "debug_mode"), &RenderingServer::scenario_set_debug);
|
||||
ClassDB::bind_method(D_METHOD("scenario_set_environment", "scenario", "environment"), &RenderingServer::scenario_set_environment);
|
||||
@ -2432,37 +2410,6 @@ void RenderingServer::_bind_methods() {
|
||||
BIND_ENUM_CONSTANT(REFLECTION_PROBE_UPDATE_ONCE);
|
||||
BIND_ENUM_CONSTANT(REFLECTION_PROBE_UPDATE_ALWAYS);
|
||||
|
||||
BIND_ENUM_CONSTANT(ENV_BG_CLEAR_COLOR);
|
||||
BIND_ENUM_CONSTANT(ENV_BG_COLOR);
|
||||
BIND_ENUM_CONSTANT(ENV_BG_COLOR_SKY);
|
||||
BIND_ENUM_CONSTANT(ENV_BG_CANVAS);
|
||||
BIND_ENUM_CONSTANT(ENV_BG_KEEP);
|
||||
BIND_ENUM_CONSTANT(ENV_BG_MAX);
|
||||
|
||||
BIND_ENUM_CONSTANT(ENV_DOF_BLUR_QUALITY_LOW);
|
||||
BIND_ENUM_CONSTANT(ENV_DOF_BLUR_QUALITY_MEDIUM);
|
||||
BIND_ENUM_CONSTANT(ENV_DOF_BLUR_QUALITY_HIGH);
|
||||
|
||||
BIND_ENUM_CONSTANT(GLOW_BLEND_MODE_ADDITIVE);
|
||||
BIND_ENUM_CONSTANT(GLOW_BLEND_MODE_SCREEN);
|
||||
BIND_ENUM_CONSTANT(GLOW_BLEND_MODE_SOFTLIGHT);
|
||||
BIND_ENUM_CONSTANT(GLOW_BLEND_MODE_REPLACE);
|
||||
|
||||
BIND_ENUM_CONSTANT(ENV_TONE_MAPPER_LINEAR);
|
||||
BIND_ENUM_CONSTANT(ENV_TONE_MAPPER_REINHARD);
|
||||
BIND_ENUM_CONSTANT(ENV_TONE_MAPPER_FILMIC);
|
||||
BIND_ENUM_CONSTANT(ENV_TONE_MAPPER_ACES);
|
||||
BIND_ENUM_CONSTANT(ENV_TONE_MAPPER_ACES_FITTED);
|
||||
|
||||
BIND_ENUM_CONSTANT(ENV_SSAO_QUALITY_LOW);
|
||||
BIND_ENUM_CONSTANT(ENV_SSAO_QUALITY_MEDIUM);
|
||||
BIND_ENUM_CONSTANT(ENV_SSAO_QUALITY_HIGH);
|
||||
|
||||
BIND_ENUM_CONSTANT(ENV_SSAO_BLUR_DISABLED);
|
||||
BIND_ENUM_CONSTANT(ENV_SSAO_BLUR_1x1);
|
||||
BIND_ENUM_CONSTANT(ENV_SSAO_BLUR_2x2);
|
||||
BIND_ENUM_CONSTANT(ENV_SSAO_BLUR_3x3);
|
||||
|
||||
BIND_ENUM_CONSTANT(CHANGED_PRIORITY_ANY);
|
||||
BIND_ENUM_CONSTANT(CHANGED_PRIORITY_LOW);
|
||||
BIND_ENUM_CONSTANT(CHANGED_PRIORITY_HIGH);
|
||||
|
@ -640,83 +640,6 @@ public:
|
||||
|
||||
virtual void viewport_set_debug_draw(RID p_viewport, ViewportDebugDraw p_draw) = 0;
|
||||
|
||||
/* ENVIRONMENT API */
|
||||
|
||||
virtual RID environment_create() = 0;
|
||||
|
||||
enum Environment3DBG {
|
||||
|
||||
ENV_BG_CLEAR_COLOR,
|
||||
ENV_BG_COLOR,
|
||||
ENV_BG_COLOR_SKY,
|
||||
ENV_BG_CANVAS,
|
||||
ENV_BG_KEEP,
|
||||
ENV_BG_CAMERA_FEED,
|
||||
ENV_BG_MAX
|
||||
};
|
||||
|
||||
virtual void environment_set_background(RID p_env, Environment3DBG p_bg) = 0;
|
||||
virtual void environment_set_sky(RID p_env, RID p_sky) = 0;
|
||||
virtual void environment_set_sky_custom_fov(RID p_env, float p_scale) = 0;
|
||||
virtual void environment_set_sky_orientation(RID p_env, const Basis &p_orientation) = 0;
|
||||
virtual void environment_set_bg_color(RID p_env, const Color &p_color) = 0;
|
||||
virtual void environment_set_bg_energy(RID p_env, float p_energy) = 0;
|
||||
virtual void environment_set_canvas_max_layer(RID p_env, int p_max_layer) = 0;
|
||||
virtual void environment_set_ambient_light(RID p_env, const Color &p_color, float p_energy = 1.0, float p_sky_contribution = 0.0) = 0;
|
||||
|
||||
//set default SSAO options
|
||||
//set default SSR options
|
||||
//set default SSSSS options
|
||||
|
||||
enum Environment3DDOFBlurQuality {
|
||||
ENV_DOF_BLUR_QUALITY_LOW,
|
||||
ENV_DOF_BLUR_QUALITY_MEDIUM,
|
||||
ENV_DOF_BLUR_QUALITY_HIGH,
|
||||
};
|
||||
|
||||
virtual void environment_set_dof_blur_near(RID p_env, bool p_enable, float p_distance, float p_transition, float p_far_amount, Environment3DDOFBlurQuality p_quality) = 0;
|
||||
virtual void environment_set_dof_blur_far(RID p_env, bool p_enable, float p_distance, float p_transition, float p_far_amount, Environment3DDOFBlurQuality p_quality) = 0;
|
||||
|
||||
enum Environment3DGlowBlendMode {
|
||||
GLOW_BLEND_MODE_ADDITIVE,
|
||||
GLOW_BLEND_MODE_SCREEN,
|
||||
GLOW_BLEND_MODE_SOFTLIGHT,
|
||||
GLOW_BLEND_MODE_REPLACE,
|
||||
};
|
||||
virtual void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_bloom_threshold, Environment3DGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap, bool p_bicubic_upscale, bool p_high_quality) = 0;
|
||||
|
||||
enum Environment3DToneMapper {
|
||||
ENV_TONE_MAPPER_LINEAR,
|
||||
ENV_TONE_MAPPER_REINHARD,
|
||||
ENV_TONE_MAPPER_FILMIC,
|
||||
ENV_TONE_MAPPER_ACES,
|
||||
ENV_TONE_MAPPER_ACES_FITTED
|
||||
};
|
||||
|
||||
virtual void environment_set_tonemap(RID p_env, Environment3DToneMapper p_tone_mapper, float p_exposure, float p_white, bool p_auto_exposure, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_grey) = 0;
|
||||
virtual void environment_set_adjustment(RID p_env, bool p_enable, float p_brightness, float p_contrast, float p_saturation, RID p_ramp) = 0;
|
||||
|
||||
virtual void environment_set_ssr(RID p_env, bool p_enable, int p_max_steps, float p_fade_in, float p_fade_out, float p_depth_tolerance, bool p_roughness) = 0;
|
||||
|
||||
enum Environment3DSSAOQuality {
|
||||
ENV_SSAO_QUALITY_LOW,
|
||||
ENV_SSAO_QUALITY_MEDIUM,
|
||||
ENV_SSAO_QUALITY_HIGH,
|
||||
};
|
||||
|
||||
enum Environment3DSSAOBlur {
|
||||
ENV_SSAO_BLUR_DISABLED,
|
||||
ENV_SSAO_BLUR_1x1,
|
||||
ENV_SSAO_BLUR_2x2,
|
||||
ENV_SSAO_BLUR_3x3,
|
||||
};
|
||||
|
||||
virtual void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, float p_ao_channel_affect, const Color &p_color, Environment3DSSAOQuality p_quality, Environment3DSSAOBlur p_blur, float p_bilateral_sharpness) = 0;
|
||||
|
||||
virtual void environment_set_fog(RID p_env, bool p_enable, const Color &p_color, const Color &p_sun_color, float p_sun_amount) = 0;
|
||||
virtual void environment_set_fog_depth(RID p_env, bool p_enable, float p_depth_begin, float p_depth_end, float p_depth_curve, bool p_transmit, float p_transmit_curve) = 0;
|
||||
virtual void environment_set_fog_height(RID p_env, bool p_enable, float p_min_height, float p_max_height, float p_height_curve) = 0;
|
||||
|
||||
/* INTERPOLATION API */
|
||||
|
||||
virtual void set_physics_interpolation_enabled(bool p_enabled) = 0;
|
||||
@ -1079,12 +1002,6 @@ VARIANT_ENUM_CAST(RenderingServer::LightOmniShadowDetail);
|
||||
VARIANT_ENUM_CAST(RenderingServer::LightDirectionalShadowMode);
|
||||
VARIANT_ENUM_CAST(RenderingServer::LightDirectionalShadowDepthRangeMode);
|
||||
VARIANT_ENUM_CAST(RenderingServer::ReflectionProbeUpdateMode);
|
||||
VARIANT_ENUM_CAST(RenderingServer::Environment3DBG);
|
||||
VARIANT_ENUM_CAST(RenderingServer::Environment3DDOFBlurQuality);
|
||||
VARIANT_ENUM_CAST(RenderingServer::Environment3DGlowBlendMode);
|
||||
VARIANT_ENUM_CAST(RenderingServer::Environment3DToneMapper);
|
||||
VARIANT_ENUM_CAST(RenderingServer::Environment3DSSAOQuality);
|
||||
VARIANT_ENUM_CAST(RenderingServer::Environment3DSSAOBlur);
|
||||
VARIANT_ENUM_CAST(RenderingServer::InstanceFlags);
|
||||
VARIANT_ENUM_CAST(RenderingServer::ShadowCastingSetting);
|
||||
VARIANT_ENUM_CAST(RenderingServer::TextureType);
|
||||
|
Loading…
Reference in New Issue
Block a user