Expose RenderingServer GI half resolution setter method

This is required for projects to be able to change the
GI half-resolution setting at run-time.
This commit is contained in:
Hugo Locurcio 2021-12-22 19:38:48 +01:00
parent 650b77340d
commit bf339842a5
No known key found for this signature in database
GPG Key ID: 39E8F8BE30B0A49C
3 changed files with 13 additions and 0 deletions

View File

@ -1675,6 +1675,8 @@
<member name="rendering/gles2/compatibility/enable_high_float.Android" type="bool" setter="" getter="" default="false"> <member name="rendering/gles2/compatibility/enable_high_float.Android" type="bool" setter="" getter="" default="false">
</member> </member>
<member name="rendering/global_illumination/gi/use_half_resolution" type="bool" setter="" getter="" default="false"> <member name="rendering/global_illumination/gi/use_half_resolution" type="bool" setter="" getter="" default="false">
If [code]true[/code], renders [VoxelGI] and SDFGI ([member Environment.sdfgi_enabled]) buffers at halved resolution (e.g. 960×540 when the viewport size is 1920×1080). This improves performance significantly when VoxelGI or SDFGI is enabled, at the cost of artifacts that may be visible on polygon edges. The loss in quality becomes less noticeable as the viewport resolution increases. [LightmapGI] rendering is not affected by this setting.
[b]Note:[/b] This property is only read when the project starts. To set half-resolution GI at run-time, call [method RenderingServer.gi_set_use_half_resolution] instead.
</member> </member>
<member name="rendering/global_illumination/sdfgi/frames_to_converge" type="int" setter="" getter="" default="4"> <member name="rendering/global_illumination/sdfgi/frames_to_converge" type="int" setter="" getter="" default="4">
</member> </member>

View File

@ -1245,6 +1245,13 @@
Returns the id of a white texture. Creates one if none exists. Returns the id of a white texture. Creates one if none exists.
</description> </description>
</method> </method>
<method name="gi_set_use_half_resolution">
<return type="void" />
<argument index="0" name="half_resolution" type="bool" />
<description>
If [code]half_resolution[/code] is [code]true[/code], renders [VoxelGI] and SDFGI ([member Environment.sdfgi_enabled]) buffers at halved resolution (e.g. 960×540 when the viewport size is 1920×1080). This improves performance significantly when VoxelGI or SDFGI is enabled, at the cost of artifacts that may be visible on polygon edges. The loss in quality becomes less noticeable as the viewport resolution increases. [LightmapGI] rendering is not affected by this setting. See also [member ProjectSettings.rendering/global_illumination/gi/use_half_resolution].
</description>
</method>
<method name="global_variable_add"> <method name="global_variable_add">
<return type="void" /> <return type="void" />
<argument index="0" name="name" type="StringName" /> <argument index="0" name="name" type="StringName" />

View File

@ -1999,6 +1999,10 @@ void RenderingServer::_bind_methods() {
BIND_ENUM_CONSTANT(DECAL_FILTER_LINEAR_MIPMAPS); BIND_ENUM_CONSTANT(DECAL_FILTER_LINEAR_MIPMAPS);
BIND_ENUM_CONSTANT(DECAL_FILTER_LINEAR_MIPMAPS_ANISOTROPIC); BIND_ENUM_CONSTANT(DECAL_FILTER_LINEAR_MIPMAPS_ANISOTROPIC);
/* GI API (affects VoxelGI and SDFGI) */
ClassDB::bind_method(D_METHOD("gi_set_use_half_resolution", "half_resolution"), &RenderingServer::gi_set_use_half_resolution);
/* VOXEL GI API */ /* VOXEL GI API */
ClassDB::bind_method(D_METHOD("voxel_gi_create"), &RenderingServer::voxel_gi_create); ClassDB::bind_method(D_METHOD("voxel_gi_create"), &RenderingServer::voxel_gi_create);