Allow changing mipmap LOD bias when FSR 1.0 scaling is not used
Mipmap LOD bias can be useful to improve the appearance of distant textures without increasing anisotropic filtering (or in situations where anisotropic filtering is not effective). `fsr_mipmap_bias` was renamed to `texture_mipmap_bias` accordingly. The property hint now allows for greater precision as well.
This commit is contained in:
parent
2e05cc3314
commit
e24029edc3
|
@ -1632,13 +1632,13 @@
|
||||||
Sets the number of MSAA samples to use (as a power of two). MSAA is used to reduce aliasing around the edges of polygons. A higher MSAA value results in smoother edges but can be significantly slower on some hardware. See also bilinear scaling 3d [member rendering/scaling_3d/mode] for supersampling, which provides higher quality but is much more expensive.
|
Sets the number of MSAA samples to use (as a power of two). MSAA is used to reduce aliasing around the edges of polygons. A higher MSAA value results in smoother edges but can be significantly slower on some hardware. See also bilinear scaling 3d [member rendering/scaling_3d/mode] for supersampling, which provides higher quality but is much more expensive.
|
||||||
</member>
|
</member>
|
||||||
<member name="rendering/anti_aliasing/quality/screen_space_aa" type="int" setter="" getter="" default="0">
|
<member name="rendering/anti_aliasing/quality/screen_space_aa" type="int" setter="" getter="" default="0">
|
||||||
Sets the screen-space antialiasing mode for the default screen [Viewport]. Screen-space antialiasing works by selectively blurring edges in a post-process shader. It differs from MSAA which takes multiple coverage samples while rendering objects. Screen-space AA methods are typically faster than MSAA and will smooth out specular aliasing, but tend to make scenes appear blurry.
|
Sets the screen-space antialiasing mode for the default screen [Viewport]. Screen-space antialiasing works by selectively blurring edges in a post-process shader. It differs from MSAA which takes multiple coverage samples while rendering objects. Screen-space AA methods are typically faster than MSAA and will smooth out specular aliasing, but tend to make scenes appear blurry. The blurriness can be counteracted to an extent by using a negative mipmap LOD bias ([member rendering/textures/default_filters/texture_mipmap_bias]).
|
||||||
Another way to combat specular aliasing is to enable [member rendering/anti_aliasing/screen_space_roughness_limiter/enabled].
|
Another way to combat specular aliasing is to enable [member rendering/anti_aliasing/screen_space_roughness_limiter/enabled].
|
||||||
</member>
|
</member>
|
||||||
<member name="rendering/anti_aliasing/quality/use_debanding" type="bool" setter="" getter="" default="false">
|
<member name="rendering/anti_aliasing/quality/use_debanding" type="bool" setter="" getter="" default="false">
|
||||||
</member>
|
</member>
|
||||||
<member name="rendering/anti_aliasing/quality/use_taa" type="bool" setter="" getter="" default="false">
|
<member name="rendering/anti_aliasing/quality/use_taa" type="bool" setter="" getter="" default="false">
|
||||||
Enables Temporal Anti-Aliasing for the default screen [Viewport]. TAA works by jittering the camera and accumulating the images of the last rendered frames, motion vector rendering is used to account for camera and object motion.
|
Enables Temporal Anti-Aliasing for the default screen [Viewport]. TAA works by jittering the camera and accumulating the images of the last rendered frames, motion vector rendering is used to account for camera and object motion. Enabling TAA can make the image blurrier, which can be counteracted to an extent by using a negative mipmap LOD bias ([member rendering/textures/default_filters/texture_mipmap_bias]).
|
||||||
[b]Note:[/b] The implementation is not complete yet, some visual instances such as particles and skinned meshes may show artifacts.
|
[b]Note:[/b] The implementation is not complete yet, some visual instances such as particles and skinned meshes may show artifacts.
|
||||||
</member>
|
</member>
|
||||||
<member name="rendering/anti_aliasing/screen_space_roughness_limiter/amount" type="float" setter="" getter="" default="0.25">
|
<member name="rendering/anti_aliasing/screen_space_roughness_limiter/amount" type="float" setter="" getter="" default="0.25">
|
||||||
|
@ -1856,9 +1856,6 @@
|
||||||
<member name="rendering/reflections/sky_reflections/texture_array_reflections.mobile" type="bool" setter="" getter="" default="false">
|
<member name="rendering/reflections/sky_reflections/texture_array_reflections.mobile" type="bool" setter="" getter="" default="false">
|
||||||
Lower-end override for [member rendering/reflections/sky_reflections/texture_array_reflections] on mobile devices, due to performance concerns or driver support.
|
Lower-end override for [member rendering/reflections/sky_reflections/texture_array_reflections] on mobile devices, due to performance concerns or driver support.
|
||||||
</member>
|
</member>
|
||||||
<member name="rendering/scaling_3d/fsr_mipmap_bias" type="float" setter="" getter="" default="0.0">
|
|
||||||
Affects the final texture sharpness by reading from a lower or higher mipmap. Negative values make textures sharper, while positive values make textures blurrier. When using FSR, this value is used to adjust the mipmap bias calculated internally which is based on the selected quality. The formula for this is [code]-log2(1.0 / scale) + mipmap_bias[/code]
|
|
||||||
</member>
|
|
||||||
<member name="rendering/scaling_3d/fsr_sharpness" type="float" setter="" getter="" default="0.2">
|
<member name="rendering/scaling_3d/fsr_sharpness" type="float" setter="" getter="" default="0.2">
|
||||||
Determines how sharp the upscaled image will be when using the FSR upscaling mode. Sharpness halves with every whole number. Values go from 0.0 (sharpest) to 2.0. Values above 2.0 won't make a visible difference.
|
Determines how sharp the upscaled image will be when using the FSR upscaling mode. Sharpness halves with every whole number. Values go from 0.0 (sharpest) to 2.0. Values above 2.0 won't make a visible difference.
|
||||||
</member>
|
</member>
|
||||||
|
@ -1940,6 +1937,11 @@
|
||||||
Sets the maximum number of samples to take when using anisotropic filtering on textures (as a power of two). A higher sample count will result in sharper textures at oblique angles, but is more expensive to compute. A value of [code]0[/code] forcibly disables anisotropic filtering, even on materials where it is enabled.
|
Sets the maximum number of samples to take when using anisotropic filtering on textures (as a power of two). A higher sample count will result in sharper textures at oblique angles, but is more expensive to compute. A value of [code]0[/code] forcibly disables anisotropic filtering, even on materials where it is enabled.
|
||||||
[b]Note:[/b] This property is only read when the project starts. There is currently no way to change this setting at run-time.
|
[b]Note:[/b] This property is only read when the project starts. There is currently no way to change this setting at run-time.
|
||||||
</member>
|
</member>
|
||||||
|
<member name="rendering/textures/default_filters/texture_mipmap_bias" type="float" setter="" getter="" default="0.0">
|
||||||
|
Affects the final texture sharpness by reading from a lower or higher mipmap (also called "texture LOD bias"). Negative values make mipmapped textures sharper but grainier when viewed at a distance, while positive values make mipmapped textures blurrier (even when up close). To get sharper textures at a distance without introducing too much graininess, set this between [code]-0.75[/code] and [code]0.0[/code]. Enabling temporal antialiasing ([member rendering/anti_aliasing/quality/use_taa]) can help reduce the graininess visible when using negative mipmap bias.
|
||||||
|
[b]Note:[/b] When the 3D scaling mode is set to FSR 1.0, this value is used to adjust the automatic mipmap bias which is calculated internally based on the scale factor. The formula for this is [code]-log2(1.0 / scale) + mipmap_bias[/code].
|
||||||
|
[b]Note:[/b] This property is only read when the project starts. To change the mipmap LOD bias at run-time, set [member Viewport.texture_mipmap_bias] instead.
|
||||||
|
</member>
|
||||||
<member name="rendering/textures/default_filters/use_nearest_mipmap_filter" type="bool" setter="" getter="" default="false">
|
<member name="rendering/textures/default_filters/use_nearest_mipmap_filter" type="bool" setter="" getter="" default="false">
|
||||||
If [code]true[/code], uses nearest-neighbor mipmap filtering when using mipmaps (also called "bilinear filtering"), which will result in visible seams appearing between mipmap stages. This may increase performance in mobile as less memory bandwidth is used. If [code]false[/code], linear mipmap filtering (also called "trilinear filtering") is used.
|
If [code]true[/code], uses nearest-neighbor mipmap filtering when using mipmaps (also called "bilinear filtering"), which will result in visible seams appearing between mipmap stages. This may increase performance in mobile as less memory bandwidth is used. If [code]false[/code], linear mipmap filtering (also called "trilinear filtering") is used.
|
||||||
[b]Note:[/b] This property is only read when the project starts. There is currently no way to change this setting at run-time.
|
[b]Note:[/b] This property is only read when the project starts. There is currently no way to change this setting at run-time.
|
||||||
|
|
|
@ -3175,14 +3175,6 @@
|
||||||
If [code]true[/code], rendering of a viewport's environment is disabled.
|
If [code]true[/code], rendering of a viewport's environment is disabled.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="viewport_set_fsr_mipmap_bias">
|
|
||||||
<return type="void" />
|
|
||||||
<argument index="0" name="viewport" type="RID" />
|
|
||||||
<argument index="1" name="mipmap_bias" type="float" />
|
|
||||||
<description>
|
|
||||||
Affects the final texture sharpness by reading from a lower or higher mipmap. Negative values make textures sharper, while positive values make textures blurrier. When using FSR, this value is used to adjust the mipmap bias calculated internally which is based on the selected quality. The formula for this is [code]-log2(1.0 / scale) + mipmap_bias[/code]
|
|
||||||
</description>
|
|
||||||
</method>
|
|
||||||
<method name="viewport_set_fsr_sharpness">
|
<method name="viewport_set_fsr_sharpness">
|
||||||
<return type="void" />
|
<return type="void" />
|
||||||
<argument index="0" name="viewport" type="RID" />
|
<argument index="0" name="viewport" type="RID" />
|
||||||
|
@ -3325,6 +3317,15 @@
|
||||||
<description>
|
<description>
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
|
<method name="viewport_set_texture_mipmap_bias">
|
||||||
|
<return type="void" />
|
||||||
|
<argument index="0" name="viewport" type="RID" />
|
||||||
|
<argument index="1" name="mipmap_bias" type="float" />
|
||||||
|
<description>
|
||||||
|
Affects the final texture sharpness by reading from a lower or higher mipmap (also called "texture LOD bias"). Negative values make mipmapped textures sharper but grainier when viewed at a distance, while positive values make mipmapped textures blurrier (even when up close). To get sharper textures at a distance without introducing too much graininess, set this between [code]-0.75[/code] and [code]0.0[/code]. Enabling temporal antialiasing ([member ProjectSettings.rendering/anti_aliasing/quality/use_taa]) can help reduce the graininess visible when using negative mipmap bias.
|
||||||
|
[b]Note:[/b] When the 3D scaling mode is set to FSR 1.0, this value is used to adjust the automatic mipmap bias which is calculated internally based on the scale factor. The formula for this is [code]-log2(1.0 / scale) + mipmap_bias[/code].
|
||||||
|
</description>
|
||||||
|
</method>
|
||||||
<method name="viewport_set_transparent_background">
|
<method name="viewport_set_transparent_background">
|
||||||
<return type="void" />
|
<return type="void" />
|
||||||
<argument index="0" name="viewport" type="RID" />
|
<argument index="0" name="viewport" type="RID" />
|
||||||
|
|
|
@ -196,10 +196,6 @@
|
||||||
<member name="disable_3d" type="bool" setter="set_disable_3d" getter="is_3d_disabled" default="false">
|
<member name="disable_3d" type="bool" setter="set_disable_3d" getter="is_3d_disabled" default="false">
|
||||||
Disable 3D rendering (but keep 2D rendering).
|
Disable 3D rendering (but keep 2D rendering).
|
||||||
</member>
|
</member>
|
||||||
<member name="fsr_mipmap_bias" type="float" setter="set_fsr_mipmap_bias" getter="get_fsr_mipmap_bias" default="0.0">
|
|
||||||
Affects the final texture sharpness by reading from a lower or higher mipmap when using FSR. Mipmap bias does nothing when FSR is not being used. Negative values make textures sharper, while positive values make textures blurrier. This value is used to adjust the mipmap bias calculated internally which is based on the selected quality. The formula for this is [code]-log2(1.0 / scale) + mipmap_bias[/code]. This updates the rendering server's mipmap bias when called
|
|
||||||
To control this property on the root viewport, set the [member ProjectSettings.rendering/scaling_3d/fsr_mipmap_bias] project setting.
|
|
||||||
</member>
|
|
||||||
<member name="fsr_sharpness" type="float" setter="set_fsr_sharpness" getter="get_fsr_sharpness" default="0.2">
|
<member name="fsr_sharpness" type="float" setter="set_fsr_sharpness" getter="get_fsr_sharpness" default="0.2">
|
||||||
Determines how sharp the upscaled image will be when using the FSR upscaling mode. Sharpness halves with every whole number. Values go from 0.0 (sharpest) to 2.0. Values above 2.0 won't make a visible difference.
|
Determines how sharp the upscaled image will be when using the FSR upscaling mode. Sharpness halves with every whole number. Values go from 0.0 (sharpest) to 2.0. Values above 2.0 won't make a visible difference.
|
||||||
To control this property on the root viewport, set the [member ProjectSettings.rendering/scaling_3d/fsr_sharpness] project setting.
|
To control this property on the root viewport, set the [member ProjectSettings.rendering/scaling_3d/fsr_sharpness] project setting.
|
||||||
|
@ -270,6 +266,11 @@
|
||||||
</member>
|
</member>
|
||||||
<member name="snap_2d_vertices_to_pixel" type="bool" setter="set_snap_2d_vertices_to_pixel" getter="is_snap_2d_vertices_to_pixel_enabled" default="false">
|
<member name="snap_2d_vertices_to_pixel" type="bool" setter="set_snap_2d_vertices_to_pixel" getter="is_snap_2d_vertices_to_pixel_enabled" default="false">
|
||||||
</member>
|
</member>
|
||||||
|
<member name="texture_mipmap_bias" type="float" setter="set_texture_mipmap_bias" getter="get_texture_mipmap_bias" default="0.0">
|
||||||
|
Affects the final texture sharpness by reading from a lower or higher mipmap (also called "texture LOD bias"). Negative values make mipmapped textures sharper but grainier when viewed at a distance, while positive values make mipmapped textures blurrier (even when up close). To get sharper textures at a distance without introducing too much graininess, set this between [code]-0.75[/code] and [code]0.0[/code]. Enabling temporal antialiasing ([member ProjectSettings.rendering/anti_aliasing/quality/use_taa]) can help reduce the graininess visible when using negative mipmap bias.
|
||||||
|
[b]Note:[/b] When the 3D scaling mode is set to FSR 1.0, this value is used to adjust the automatic mipmap bias which is calculated internally based on the scale factor. The formula for this is [code]-log2(1.0 / scale) + mipmap_bias[/code].
|
||||||
|
To control this property on the root viewport, set the [member ProjectSettings.rendering/textures/default_filters/texture_mipmap_bias] project setting.
|
||||||
|
</member>
|
||||||
<member name="transparent_bg" type="bool" setter="set_transparent_background" getter="has_transparent_background" default="false">
|
<member name="transparent_bg" type="bool" setter="set_transparent_background" getter="has_transparent_background" default="false">
|
||||||
If [code]true[/code], the viewport should render its background as transparent.
|
If [code]true[/code], the viewport should render its background as transparent.
|
||||||
</member>
|
</member>
|
||||||
|
|
|
@ -2434,7 +2434,7 @@ RID RasterizerSceneGLES3::render_buffers_create() {
|
||||||
return render_buffers_owner.make_rid(rb);
|
return render_buffers_owner.make_rid(rb);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RasterizerSceneGLES3::render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_internal_width, int p_internal_height, int p_width, int p_height, float p_fsr_sharpness, float p_fsr_mipmap_bias, RS::ViewportMSAA p_msaa, RS::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_taa, bool p_use_debanding, uint32_t p_view_count) {
|
void RasterizerSceneGLES3::render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_internal_width, int p_internal_height, int p_width, int p_height, float p_fsr_sharpness, float p_texture_mipmap_bias, RS::ViewportMSAA p_msaa, RS::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_taa, bool p_use_debanding, uint32_t p_view_count) {
|
||||||
GLES3::TextureStorage *texture_storage = GLES3::TextureStorage::get_singleton();
|
GLES3::TextureStorage *texture_storage = GLES3::TextureStorage::get_singleton();
|
||||||
|
|
||||||
RenderBuffers *rb = render_buffers_owner.get_or_null(p_render_buffers);
|
RenderBuffers *rb = render_buffers_owner.get_or_null(p_render_buffers);
|
||||||
|
|
|
@ -870,7 +870,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
RID render_buffers_create() override;
|
RID render_buffers_create() override;
|
||||||
void render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_internal_width, int p_internal_height, int p_width, int p_height, float p_fsr_sharpness, float p_fsr_mipmap_bias, RS::ViewportMSAA p_msaa, RS::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_taa, bool p_use_debanding, uint32_t p_view_count) override;
|
void render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_internal_width, int p_internal_height, int p_width, int p_height, float p_fsr_sharpness, float p_texture_mipmap_bias, RS::ViewportMSAA p_msaa, RS::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_taa, bool p_use_debanding, uint32_t p_view_count) override;
|
||||||
void gi_set_use_half_resolution(bool p_enable) override;
|
void gi_set_use_half_resolution(bool p_enable) override;
|
||||||
|
|
||||||
void screen_space_roughness_limiter_set_active(bool p_enable, float p_amount, float p_curve) override;
|
void screen_space_roughness_limiter_set_active(bool p_enable, float p_amount, float p_curve) override;
|
||||||
|
|
|
@ -2425,8 +2425,8 @@ void Node3DEditorViewport::_project_settings_changed() {
|
||||||
const float fsr_sharpness = GLOBAL_GET("rendering/scaling_3d/fsr_sharpness");
|
const float fsr_sharpness = GLOBAL_GET("rendering/scaling_3d/fsr_sharpness");
|
||||||
viewport->set_fsr_sharpness(fsr_sharpness);
|
viewport->set_fsr_sharpness(fsr_sharpness);
|
||||||
|
|
||||||
const float fsr_mipmap_bias = GLOBAL_GET("rendering/scaling_3d/fsr_mipmap_bias");
|
const float texture_mipmap_bias = GLOBAL_GET("rendering/textures/default_filters/texture_mipmap_bias");
|
||||||
viewport->set_fsr_mipmap_bias(fsr_mipmap_bias);
|
viewport->set_texture_mipmap_bias(texture_mipmap_bias);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node3DEditorViewport::_notification(int p_what) {
|
void Node3DEditorViewport::_notification(int p_what) {
|
||||||
|
|
|
@ -3631,17 +3631,17 @@ float Viewport::get_fsr_sharpness() const {
|
||||||
return fsr_sharpness;
|
return fsr_sharpness;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewport::set_fsr_mipmap_bias(float p_fsr_mipmap_bias) {
|
void Viewport::set_texture_mipmap_bias(float p_texture_mipmap_bias) {
|
||||||
if (fsr_mipmap_bias == p_fsr_mipmap_bias) {
|
if (texture_mipmap_bias == p_texture_mipmap_bias) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fsr_mipmap_bias = p_fsr_mipmap_bias;
|
texture_mipmap_bias = p_texture_mipmap_bias;
|
||||||
RS::get_singleton()->viewport_set_fsr_mipmap_bias(viewport, p_fsr_mipmap_bias);
|
RS::get_singleton()->viewport_set_texture_mipmap_bias(viewport, p_texture_mipmap_bias);
|
||||||
}
|
}
|
||||||
|
|
||||||
float Viewport::get_fsr_mipmap_bias() const {
|
float Viewport::get_texture_mipmap_bias() const {
|
||||||
return fsr_mipmap_bias;
|
return texture_mipmap_bias;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // _3D_DISABLED
|
#endif // _3D_DISABLED
|
||||||
|
@ -3783,8 +3783,8 @@ void Viewport::_bind_methods() {
|
||||||
ClassDB::bind_method(D_METHOD("set_fsr_sharpness", "fsr_sharpness"), &Viewport::set_fsr_sharpness);
|
ClassDB::bind_method(D_METHOD("set_fsr_sharpness", "fsr_sharpness"), &Viewport::set_fsr_sharpness);
|
||||||
ClassDB::bind_method(D_METHOD("get_fsr_sharpness"), &Viewport::get_fsr_sharpness);
|
ClassDB::bind_method(D_METHOD("get_fsr_sharpness"), &Viewport::get_fsr_sharpness);
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("set_fsr_mipmap_bias", "fsr_mipmap_bias"), &Viewport::set_fsr_mipmap_bias);
|
ClassDB::bind_method(D_METHOD("set_texture_mipmap_bias", "texture_mipmap_bias"), &Viewport::set_texture_mipmap_bias);
|
||||||
ClassDB::bind_method(D_METHOD("get_fsr_mipmap_bias"), &Viewport::get_fsr_mipmap_bias);
|
ClassDB::bind_method(D_METHOD("get_texture_mipmap_bias"), &Viewport::get_texture_mipmap_bias);
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("set_vrs_mode", "mode"), &Viewport::set_vrs_mode);
|
ClassDB::bind_method(D_METHOD("set_vrs_mode", "mode"), &Viewport::set_vrs_mode);
|
||||||
ClassDB::bind_method(D_METHOD("get_vrs_mode"), &Viewport::get_vrs_mode);
|
ClassDB::bind_method(D_METHOD("get_vrs_mode"), &Viewport::get_vrs_mode);
|
||||||
|
@ -3814,7 +3814,7 @@ void Viewport::_bind_methods() {
|
||||||
ADD_GROUP("Scaling 3D", "");
|
ADD_GROUP("Scaling 3D", "");
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "scaling_3d_mode", PROPERTY_HINT_ENUM, "Bilinear (Fastest),FSR 1.0 (Fast)"), "set_scaling_3d_mode", "get_scaling_3d_mode");
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "scaling_3d_mode", PROPERTY_HINT_ENUM, "Bilinear (Fastest),FSR 1.0 (Fast)"), "set_scaling_3d_mode", "get_scaling_3d_mode");
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "scaling_3d_scale", PROPERTY_HINT_RANGE, "0.25,2.0,0.01"), "set_scaling_3d_scale", "get_scaling_3d_scale");
|
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "scaling_3d_scale", PROPERTY_HINT_RANGE, "0.25,2.0,0.01"), "set_scaling_3d_scale", "get_scaling_3d_scale");
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "fsr_mipmap_bias", PROPERTY_HINT_RANGE, "-2,2,0.1"), "set_fsr_mipmap_bias", "get_fsr_mipmap_bias");
|
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "texture_mipmap_bias", PROPERTY_HINT_RANGE, "-2,2,0.001"), "set_texture_mipmap_bias", "get_texture_mipmap_bias");
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "fsr_sharpness", PROPERTY_HINT_RANGE, "0,2,0.1"), "set_fsr_sharpness", "get_fsr_sharpness");
|
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "fsr_sharpness", PROPERTY_HINT_RANGE, "0,2,0.1"), "set_fsr_sharpness", "get_fsr_sharpness");
|
||||||
#endif
|
#endif
|
||||||
ADD_GROUP("Variable Rate Shading", "vrs_");
|
ADD_GROUP("Variable Rate Shading", "vrs_");
|
||||||
|
@ -3988,8 +3988,8 @@ Viewport::Viewport() {
|
||||||
float fsr_sharpness = GLOBAL_GET("rendering/scaling_3d/fsr_sharpness");
|
float fsr_sharpness = GLOBAL_GET("rendering/scaling_3d/fsr_sharpness");
|
||||||
set_fsr_sharpness(fsr_sharpness);
|
set_fsr_sharpness(fsr_sharpness);
|
||||||
|
|
||||||
float fsr_mipmap_bias = GLOBAL_GET("rendering/scaling_3d/fsr_mipmap_bias");
|
float texture_mipmap_bias = GLOBAL_GET("rendering/textures/default_filters/texture_mipmap_bias");
|
||||||
set_fsr_mipmap_bias(fsr_mipmap_bias);
|
set_texture_mipmap_bias(texture_mipmap_bias);
|
||||||
#endif // _3D_DISABLED
|
#endif // _3D_DISABLED
|
||||||
|
|
||||||
set_sdf_oversize(sdf_oversize); // Set to server.
|
set_sdf_oversize(sdf_oversize); // Set to server.
|
||||||
|
|
|
@ -304,7 +304,7 @@ private:
|
||||||
Scaling3DMode scaling_3d_mode = SCALING_3D_MODE_BILINEAR;
|
Scaling3DMode scaling_3d_mode = SCALING_3D_MODE_BILINEAR;
|
||||||
float scaling_3d_scale = 1.0;
|
float scaling_3d_scale = 1.0;
|
||||||
float fsr_sharpness = 0.2f;
|
float fsr_sharpness = 0.2f;
|
||||||
float fsr_mipmap_bias = 0.0f;
|
float texture_mipmap_bias = 0.0f;
|
||||||
bool use_debanding = false;
|
bool use_debanding = false;
|
||||||
float mesh_lod_threshold = 1.0;
|
float mesh_lod_threshold = 1.0;
|
||||||
bool use_occlusion_culling = false;
|
bool use_occlusion_culling = false;
|
||||||
|
@ -540,8 +540,8 @@ public:
|
||||||
void set_fsr_sharpness(float p_fsr_sharpness);
|
void set_fsr_sharpness(float p_fsr_sharpness);
|
||||||
float get_fsr_sharpness() const;
|
float get_fsr_sharpness() const;
|
||||||
|
|
||||||
void set_fsr_mipmap_bias(float p_fsr_mipmap_bias);
|
void set_texture_mipmap_bias(float p_texture_mipmap_bias);
|
||||||
float get_fsr_mipmap_bias() const;
|
float get_texture_mipmap_bias() const;
|
||||||
|
|
||||||
void set_use_debanding(bool p_use_debanding);
|
void set_use_debanding(bool p_use_debanding);
|
||||||
bool is_using_debanding() const;
|
bool is_using_debanding() const;
|
||||||
|
|
|
@ -169,7 +169,7 @@ public:
|
||||||
void set_debug_draw_mode(RS::ViewportDebugDraw p_debug_draw) override {}
|
void set_debug_draw_mode(RS::ViewportDebugDraw p_debug_draw) override {}
|
||||||
|
|
||||||
RID render_buffers_create() override { return RID(); }
|
RID render_buffers_create() override { return RID(); }
|
||||||
void render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_internal_width, int p_internal_height, int p_width, int p_height, float p_fsr_sharpness, float p_fsr_mipmap_bias, RS::ViewportMSAA p_msaa, RS::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_taa, bool p_use_debanding, uint32_t p_view_count) override {}
|
void render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_internal_width, int p_internal_height, int p_width, int p_height, float p_fsr_sharpness, float p_texture_mipmap_bias, RS::ViewportMSAA p_msaa, RS::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_taa, bool p_use_debanding, uint32_t p_view_count) override {}
|
||||||
void gi_set_use_half_resolution(bool p_enable) override {}
|
void gi_set_use_half_resolution(bool p_enable) override {}
|
||||||
|
|
||||||
void screen_space_roughness_limiter_set_active(bool p_enable, float p_amount, float p_curve) override {}
|
void screen_space_roughness_limiter_set_active(bool p_enable, float p_amount, float p_curve) override {}
|
||||||
|
|
|
@ -2743,7 +2743,7 @@ bool RendererSceneRenderRD::_render_buffers_can_be_storage() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RendererSceneRenderRD::render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_internal_width, int p_internal_height, int p_width, int p_height, float p_fsr_sharpness, float p_fsr_mipmap_bias, RS::ViewportMSAA p_msaa, RenderingServer::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_taa, bool p_use_debanding, uint32_t p_view_count) {
|
void RendererSceneRenderRD::render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_internal_width, int p_internal_height, int p_width, int p_height, float p_fsr_sharpness, float p_texture_mipmap_bias, RS::ViewportMSAA p_msaa, RenderingServer::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_taa, bool p_use_debanding, uint32_t p_view_count) {
|
||||||
RendererRD::TextureStorage *texture_storage = RendererRD::TextureStorage::get_singleton();
|
RendererRD::TextureStorage *texture_storage = RendererRD::TextureStorage::get_singleton();
|
||||||
RendererRD::MaterialStorage *material_storage = RendererRD::MaterialStorage::get_singleton();
|
RendererRD::MaterialStorage *material_storage = RendererRD::MaterialStorage::get_singleton();
|
||||||
|
|
||||||
|
@ -2754,11 +2754,9 @@ void RendererSceneRenderRD::render_buffers_configure(RID p_render_buffers, RID p
|
||||||
p_internal_width = p_width;
|
p_internal_width = p_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_width != p_internal_width) {
|
const float texture_mipmap_bias = -log2f(p_width / p_internal_width) + p_texture_mipmap_bias;
|
||||||
float fsr_mipmap_bias = -log2f(p_width / p_internal_width) + p_fsr_mipmap_bias;
|
material_storage->sampler_rd_configure_custom(texture_mipmap_bias);
|
||||||
material_storage->sampler_rd_configure_custom(fsr_mipmap_bias);
|
update_uniform_sets();
|
||||||
update_uniform_sets();
|
|
||||||
}
|
|
||||||
|
|
||||||
RenderBuffers *rb = render_buffers_owner.get_or_null(p_render_buffers);
|
RenderBuffers *rb = render_buffers_owner.get_or_null(p_render_buffers);
|
||||||
|
|
||||||
|
|
|
@ -1166,7 +1166,7 @@ public:
|
||||||
virtual RD::DataFormat _render_buffers_get_color_format();
|
virtual RD::DataFormat _render_buffers_get_color_format();
|
||||||
virtual bool _render_buffers_can_be_storage();
|
virtual bool _render_buffers_can_be_storage();
|
||||||
virtual RID render_buffers_create() override;
|
virtual RID render_buffers_create() override;
|
||||||
virtual void render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_internal_width, int p_internal_height, int p_width, int p_height, float p_fsr_sharpness, float p_fsr_mipmap_bias, RS::ViewportMSAA p_msaa, RS::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_taa, bool p_use_debanding, uint32_t p_view_count) override;
|
virtual void render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_internal_width, int p_internal_height, int p_width, int p_height, float p_fsr_sharpness, float p_texture_mipmap_bias, RS::ViewportMSAA p_msaa, RS::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_taa, bool p_use_debanding, uint32_t p_view_count) override;
|
||||||
virtual void gi_set_use_half_resolution(bool p_enable) override;
|
virtual void gi_set_use_half_resolution(bool p_enable) override;
|
||||||
|
|
||||||
RID render_buffers_get_depth_texture(RID p_render_buffers);
|
RID render_buffers_get_depth_texture(RID p_render_buffers);
|
||||||
|
|
|
@ -194,7 +194,7 @@ public:
|
||||||
|
|
||||||
virtual RID render_buffers_create() = 0;
|
virtual RID render_buffers_create() = 0;
|
||||||
|
|
||||||
virtual void render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_internal_width, int p_internal_height, int p_width, int p_height, float p_fsr_sharpness, float p_fsr_mipmap_bias, RS::ViewportMSAA p_msaa, RS::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_taa, bool p_use_debanding, uint32_t p_view_count) = 0;
|
virtual void render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_internal_width, int p_internal_height, int p_width, int p_height, float p_fsr_sharpness, float p_texture_mipmap_bias, RS::ViewportMSAA p_msaa, RS::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_taa, bool p_use_debanding, uint32_t p_view_count) = 0;
|
||||||
|
|
||||||
virtual void gi_set_use_half_resolution(bool p_enable) = 0;
|
virtual void gi_set_use_half_resolution(bool p_enable) = 0;
|
||||||
|
|
||||||
|
|
|
@ -234,7 +234,7 @@ public:
|
||||||
virtual void set_debug_draw_mode(RS::ViewportDebugDraw p_debug_draw) = 0;
|
virtual void set_debug_draw_mode(RS::ViewportDebugDraw p_debug_draw) = 0;
|
||||||
|
|
||||||
virtual RID render_buffers_create() = 0;
|
virtual RID render_buffers_create() = 0;
|
||||||
virtual void render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_internal_width, int p_internal_height, int p_width, int p_height, float p_fsr_sharpness, float p_fsr_mipmap_bias, RS::ViewportMSAA p_msaa, RS::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_taa, bool p_use_debanding, uint32_t p_view_count) = 0;
|
virtual void render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_internal_width, int p_internal_height, int p_width, int p_height, float p_fsr_sharpness, float p_texture_mipmap_bias, RS::ViewportMSAA p_msaa, RS::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_taa, bool p_use_debanding, uint32_t p_view_count) = 0;
|
||||||
virtual void gi_set_use_half_resolution(bool p_enable) = 0;
|
virtual void gi_set_use_half_resolution(bool p_enable) = 0;
|
||||||
|
|
||||||
virtual void screen_space_roughness_limiter_set_active(bool p_enable, float p_amount, float p_limit) = 0;
|
virtual void screen_space_roughness_limiter_set_active(bool p_enable, float p_amount, float p_limit) = 0;
|
||||||
|
|
|
@ -138,7 +138,7 @@ void RendererViewport::_configure_3d_render_buffers(Viewport *p_viewport) {
|
||||||
|
|
||||||
p_viewport->internal_size = Size2(render_width, render_height);
|
p_viewport->internal_size = Size2(render_width, render_height);
|
||||||
|
|
||||||
RSG::scene->render_buffers_configure(p_viewport->render_buffers, p_viewport->render_target, render_width, render_height, width, height, p_viewport->fsr_sharpness, p_viewport->fsr_mipmap_bias, p_viewport->msaa, p_viewport->screen_space_aa, p_viewport->use_taa, p_viewport->use_debanding, p_viewport->get_view_count());
|
RSG::scene->render_buffers_configure(p_viewport->render_buffers, p_viewport->render_target, render_width, render_height, width, height, p_viewport->fsr_sharpness, p_viewport->texture_mipmap_bias, p_viewport->msaa, p_viewport->screen_space_aa, p_viewport->use_taa, p_viewport->use_debanding, p_viewport->get_view_count());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -746,11 +746,11 @@ void RendererViewport::viewport_set_fsr_sharpness(RID p_viewport, float p_sharpn
|
||||||
_configure_3d_render_buffers(viewport);
|
_configure_3d_render_buffers(viewport);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RendererViewport::viewport_set_fsr_mipmap_bias(RID p_viewport, float p_mipmap_bias) {
|
void RendererViewport::viewport_set_texture_mipmap_bias(RID p_viewport, float p_mipmap_bias) {
|
||||||
Viewport *viewport = viewport_owner.get_or_null(p_viewport);
|
Viewport *viewport = viewport_owner.get_or_null(p_viewport);
|
||||||
ERR_FAIL_COND(!viewport);
|
ERR_FAIL_COND(!viewport);
|
||||||
|
|
||||||
viewport->fsr_mipmap_bias = p_mipmap_bias;
|
viewport->texture_mipmap_bias = p_mipmap_bias;
|
||||||
_configure_3d_render_buffers(viewport);
|
_configure_3d_render_buffers(viewport);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ public:
|
||||||
RS::ViewportScaling3DMode scaling_3d_mode = RenderingServer::VIEWPORT_SCALING_3D_MODE_BILINEAR;
|
RS::ViewportScaling3DMode scaling_3d_mode = RenderingServer::VIEWPORT_SCALING_3D_MODE_BILINEAR;
|
||||||
float scaling_3d_scale = 1.0;
|
float scaling_3d_scale = 1.0;
|
||||||
float fsr_sharpness = 0.2f;
|
float fsr_sharpness = 0.2f;
|
||||||
float fsr_mipmap_bias = 0.0f;
|
float texture_mipmap_bias = 0.0f;
|
||||||
bool fsr_enabled = false;
|
bool fsr_enabled = false;
|
||||||
RS::ViewportUpdateMode update_mode = RenderingServer::VIEWPORT_UPDATE_WHEN_VISIBLE;
|
RS::ViewportUpdateMode update_mode = RenderingServer::VIEWPORT_UPDATE_WHEN_VISIBLE;
|
||||||
RID render_target;
|
RID render_target;
|
||||||
|
@ -229,7 +229,7 @@ public:
|
||||||
void viewport_set_scaling_3d_mode(RID p_viewport, RS::ViewportScaling3DMode p_mode);
|
void viewport_set_scaling_3d_mode(RID p_viewport, RS::ViewportScaling3DMode p_mode);
|
||||||
void viewport_set_scaling_3d_scale(RID p_viewport, float p_scaling_3d_scale);
|
void viewport_set_scaling_3d_scale(RID p_viewport, float p_scaling_3d_scale);
|
||||||
void viewport_set_fsr_sharpness(RID p_viewport, float p_sharpness);
|
void viewport_set_fsr_sharpness(RID p_viewport, float p_sharpness);
|
||||||
void viewport_set_fsr_mipmap_bias(RID p_viewport, float p_mipmap_bias);
|
void viewport_set_texture_mipmap_bias(RID p_viewport, float p_mipmap_bias);
|
||||||
|
|
||||||
void viewport_set_update_mode(RID p_viewport, RS::ViewportUpdateMode p_mode);
|
void viewport_set_update_mode(RID p_viewport, RS::ViewportUpdateMode p_mode);
|
||||||
void viewport_set_vflip(RID p_viewport, bool p_enable);
|
void viewport_set_vflip(RID p_viewport, bool p_enable);
|
||||||
|
|
|
@ -591,7 +591,7 @@ public:
|
||||||
FUNC2(viewport_set_scaling_3d_mode, RID, ViewportScaling3DMode)
|
FUNC2(viewport_set_scaling_3d_mode, RID, ViewportScaling3DMode)
|
||||||
FUNC2(viewport_set_scaling_3d_scale, RID, float)
|
FUNC2(viewport_set_scaling_3d_scale, RID, float)
|
||||||
FUNC2(viewport_set_fsr_sharpness, RID, float)
|
FUNC2(viewport_set_fsr_sharpness, RID, float)
|
||||||
FUNC2(viewport_set_fsr_mipmap_bias, RID, float)
|
FUNC2(viewport_set_texture_mipmap_bias, RID, float)
|
||||||
|
|
||||||
FUNC2(viewport_set_update_mode, RID, ViewportUpdateMode)
|
FUNC2(viewport_set_update_mode, RID, ViewportUpdateMode)
|
||||||
|
|
||||||
|
|
|
@ -2184,7 +2184,7 @@ void RenderingServer::_bind_methods() {
|
||||||
ClassDB::bind_method(D_METHOD("viewport_set_scaling_3d_mode", "viewport", "scaling_3d_mode"), &RenderingServer::viewport_set_scaling_3d_mode);
|
ClassDB::bind_method(D_METHOD("viewport_set_scaling_3d_mode", "viewport", "scaling_3d_mode"), &RenderingServer::viewport_set_scaling_3d_mode);
|
||||||
ClassDB::bind_method(D_METHOD("viewport_set_scaling_3d_scale", "viewport", "scale"), &RenderingServer::viewport_set_scaling_3d_scale);
|
ClassDB::bind_method(D_METHOD("viewport_set_scaling_3d_scale", "viewport", "scale"), &RenderingServer::viewport_set_scaling_3d_scale);
|
||||||
ClassDB::bind_method(D_METHOD("viewport_set_fsr_sharpness", "viewport", "sharpness"), &RenderingServer::viewport_set_fsr_sharpness);
|
ClassDB::bind_method(D_METHOD("viewport_set_fsr_sharpness", "viewport", "sharpness"), &RenderingServer::viewport_set_fsr_sharpness);
|
||||||
ClassDB::bind_method(D_METHOD("viewport_set_fsr_mipmap_bias", "viewport", "mipmap_bias"), &RenderingServer::viewport_set_fsr_mipmap_bias);
|
ClassDB::bind_method(D_METHOD("viewport_set_texture_mipmap_bias", "viewport", "mipmap_bias"), &RenderingServer::viewport_set_texture_mipmap_bias);
|
||||||
ClassDB::bind_method(D_METHOD("viewport_set_update_mode", "viewport", "update_mode"), &RenderingServer::viewport_set_update_mode);
|
ClassDB::bind_method(D_METHOD("viewport_set_update_mode", "viewport", "update_mode"), &RenderingServer::viewport_set_update_mode);
|
||||||
ClassDB::bind_method(D_METHOD("viewport_set_clear_mode", "viewport", "clear_mode"), &RenderingServer::viewport_set_clear_mode);
|
ClassDB::bind_method(D_METHOD("viewport_set_clear_mode", "viewport", "clear_mode"), &RenderingServer::viewport_set_clear_mode);
|
||||||
ClassDB::bind_method(D_METHOD("viewport_get_texture", "viewport"), &RenderingServer::viewport_get_texture);
|
ClassDB::bind_method(D_METHOD("viewport_get_texture", "viewport"), &RenderingServer::viewport_get_texture);
|
||||||
|
@ -2946,7 +2946,7 @@ void RenderingServer::init() {
|
||||||
GLOBAL_DEF("rendering/scaling_3d/mode", 0);
|
GLOBAL_DEF("rendering/scaling_3d/mode", 0);
|
||||||
GLOBAL_DEF("rendering/scaling_3d/scale", 1.0);
|
GLOBAL_DEF("rendering/scaling_3d/scale", 1.0);
|
||||||
GLOBAL_DEF("rendering/scaling_3d/fsr_sharpness", 0.2f);
|
GLOBAL_DEF("rendering/scaling_3d/fsr_sharpness", 0.2f);
|
||||||
GLOBAL_DEF("rendering/scaling_3d/fsr_mipmap_bias", 0.0f);
|
GLOBAL_DEF("rendering/textures/default_filters/texture_mipmap_bias", 0.0f);
|
||||||
ProjectSettings::get_singleton()->set_custom_property_info("rendering/scaling_3d/mode",
|
ProjectSettings::get_singleton()->set_custom_property_info("rendering/scaling_3d/mode",
|
||||||
PropertyInfo(Variant::INT,
|
PropertyInfo(Variant::INT,
|
||||||
"rendering/scaling_3d/mode",
|
"rendering/scaling_3d/mode",
|
||||||
|
@ -2961,10 +2961,10 @@ void RenderingServer::init() {
|
||||||
PropertyInfo(Variant::FLOAT,
|
PropertyInfo(Variant::FLOAT,
|
||||||
"rendering/scaling_3d/fsr_sharpness",
|
"rendering/scaling_3d/fsr_sharpness",
|
||||||
PROPERTY_HINT_RANGE, "0,2,0.1"));
|
PROPERTY_HINT_RANGE, "0,2,0.1"));
|
||||||
ProjectSettings::get_singleton()->set_custom_property_info("rendering/scaling_3d/fsr_mipmap_bias",
|
ProjectSettings::get_singleton()->set_custom_property_info("rendering/textures/default_filters/texture_mipmap_bias",
|
||||||
PropertyInfo(Variant::FLOAT,
|
PropertyInfo(Variant::FLOAT,
|
||||||
"rendering/scaling_3d/fsr_mipmap_bias",
|
"rendering/textures/default_filters/texture_mipmap_bias",
|
||||||
PROPERTY_HINT_RANGE, "-2,2,0.1"));
|
PROPERTY_HINT_RANGE, "-2,2,0.001"));
|
||||||
|
|
||||||
GLOBAL_DEF("rendering/textures/decals/filter", DECAL_FILTER_LINEAR_MIPMAPS);
|
GLOBAL_DEF("rendering/textures/decals/filter", DECAL_FILTER_LINEAR_MIPMAPS);
|
||||||
ProjectSettings::get_singleton()->set_custom_property_info("rendering/textures/decals/filter", PropertyInfo(Variant::INT, "rendering/textures/decals/filter", PROPERTY_HINT_ENUM, "Nearest (Fast),Nearest+Mipmaps,Linear,Linear+Mipmaps,Linear+Mipmaps Anisotropic (Slow)"));
|
ProjectSettings::get_singleton()->set_custom_property_info("rendering/textures/decals/filter", PropertyInfo(Variant::INT, "rendering/textures/decals/filter", PROPERTY_HINT_ENUM, "Nearest (Fast),Nearest+Mipmaps,Linear,Linear+Mipmaps,Linear+Mipmaps Anisotropic (Slow)"));
|
||||||
|
|
|
@ -797,7 +797,7 @@ public:
|
||||||
virtual void viewport_set_scaling_3d_mode(RID p_viewport, ViewportScaling3DMode p_scaling_3d_mode) = 0;
|
virtual void viewport_set_scaling_3d_mode(RID p_viewport, ViewportScaling3DMode p_scaling_3d_mode) = 0;
|
||||||
virtual void viewport_set_scaling_3d_scale(RID p_viewport, float p_scaling_3d_scale) = 0;
|
virtual void viewport_set_scaling_3d_scale(RID p_viewport, float p_scaling_3d_scale) = 0;
|
||||||
virtual void viewport_set_fsr_sharpness(RID p_viewport, float p_fsr_sharpness) = 0;
|
virtual void viewport_set_fsr_sharpness(RID p_viewport, float p_fsr_sharpness) = 0;
|
||||||
virtual void viewport_set_fsr_mipmap_bias(RID p_viewport, float p_fsr_mipmap_bias) = 0;
|
virtual void viewport_set_texture_mipmap_bias(RID p_viewport, float p_texture_mipmap_bias) = 0;
|
||||||
|
|
||||||
enum ViewportUpdateMode {
|
enum ViewportUpdateMode {
|
||||||
VIEWPORT_UPDATE_DISABLED,
|
VIEWPORT_UPDATE_DISABLED,
|
||||||
|
|
Loading…
Reference in New Issue