Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions COPYRIGHT.txt
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,18 @@ Comment: AccessKit
Copyright: 2023, The AccessKit Authors.
License: Expat

Files: servers/rendering/renderer_rd/shaders/smaa_blending.glsl
servers/rendering/renderer_rd/shaders/smaa_weight_calculation.glsl
servers/rendering/renderer_rd/shaders/smaa_edge_detection.glsl
thirdparty/smaa/*
Comment: Subpixel Morphological Antialiasing
Copyright: 2013 Jorge Jimenez (jorge@iryoku.com)
2013 Jose I. Echevarria (joseignacioechevarria@gmail.com)
2013 Belen Masia (bmasia@unizar.es)
2013 Fernando Navarro (fernandn@microsoft.com)
2013 Diego Gutierrez (diegog@unizar.es)
License: Expat

Files: thirdparty/amd-fsr/*
Comment: AMD FidelityFX Super Resolution
Copyright: 2021, Advanced Micro Devices, Inc.
Expand Down
4 changes: 4 additions & 0 deletions doc/classes/ProjectSettings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2703,6 +2703,10 @@
[b]Note:[/b] Screen-space antialiasing is only supported in the Forward+ and Mobile rendering methods, not Compatibility.
[b]Note:[/b] This property is only read when the project starts. To set the screen-space antialiasing mode at runtime, set [member Viewport.screen_space_aa] on the root [Viewport] instead, or use [method RenderingServer.viewport_set_screen_space_aa].
</member>
<member name="rendering/anti_aliasing/quality/smaa_edge_detection_threshold" type="float" setter="" getter="" default="0.05">
Sets the sensitivity to edges when using SMAA for antialiasing. Lower values will catch more edges, at a potentially higher performance cost.
[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 name="rendering/anti_aliasing/quality/use_debanding" type="bool" setter="" getter="" default="false">
If [code]true[/code], uses a fast post-processing filter to make banding significantly less visible in 3D. 2D rendering is [i]not[/i] affected by debanding unless the [member Environment.background_mode] is [constant Environment.BG_CANVAS].
In some cases, debanding may introduce a slightly noticeable dithering pattern. It's recommended to enable debanding only when actually needed since the dithering pattern will make lossless-compressed screenshots larger.
Expand Down
5 changes: 4 additions & 1 deletion doc/classes/RenderingServer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5141,7 +5141,10 @@
<constant name="VIEWPORT_SCREEN_SPACE_AA_FXAA" value="1" enum="ViewportScreenSpaceAA">
Use fast approximate antialiasing. FXAA is a popular screen-space antialiasing method, which is fast but will make the image look blurry, especially at lower resolutions. It can still work relatively well at large resolutions such as 1440p and 4K.
</constant>
<constant name="VIEWPORT_SCREEN_SPACE_AA_MAX" value="2" enum="ViewportScreenSpaceAA">
<constant name="VIEWPORT_SCREEN_SPACE_AA_SMAA" value="2" enum="ViewportScreenSpaceAA">
Use subpixel morphological antialiasing. SMAA may produce clearer results than FXAA, but at a slightly higher performance cost.
</constant>
<constant name="VIEWPORT_SCREEN_SPACE_AA_MAX" value="3" enum="ViewportScreenSpaceAA">
Represents the size of the [enum ViewportScreenSpaceAA] enum.
</constant>
<constant name="VIEWPORT_OCCLUSION_BUILD_QUALITY_LOW" value="0" enum="ViewportOcclusionCullingBuildQuality">
Expand Down
5 changes: 4 additions & 1 deletion doc/classes/Viewport.xml
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,10 @@
<constant name="SCREEN_SPACE_AA_FXAA" value="1" enum="ScreenSpaceAA">
Use fast approximate antialiasing. FXAA is a popular screen-space antialiasing method, which is fast but will make the image look blurry, especially at lower resolutions. It can still work relatively well at large resolutions such as 1440p and 4K.
</constant>
<constant name="SCREEN_SPACE_AA_MAX" value="2" enum="ScreenSpaceAA">
<constant name="SCREEN_SPACE_AA_SMAA" value="2" enum="ScreenSpaceAA">
Use subpixel morphological antialiasing. SMAA may produce clearer results than FXAA, but at a slightly higher performance cost.
</constant>
<constant name="SCREEN_SPACE_AA_MAX" value="3" enum="ScreenSpaceAA">
Represents the size of the [enum ScreenSpaceAA] enum.
</constant>
<constant name="RENDER_INFO_OBJECTS_IN_FRAME" value="0" enum="RenderInfo">
Expand Down
1 change: 1 addition & 0 deletions editor/editor_property_name_processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ EditorPropertyNameProcessor::EditorPropertyNameProcessor() {
capitalize_string_remaps["sdk"] = "SDK";
capitalize_string_remaps["sec"] = "(sec)"; // Unit.
capitalize_string_remaps["signtool"] = "signtool";
capitalize_string_remaps["smaa"] = "SMAA";
capitalize_string_remaps["sms"] = "SMS";
capitalize_string_remaps["srgb"] = "sRGB";
capitalize_string_remaps["ssao"] = "SSAO";
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,5 @@ ignore-words-list = [
"textin",
"thirdparty",
"vai",
"Masia",
]
2 changes: 1 addition & 1 deletion scene/main/scene_tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2060,7 +2060,7 @@ SceneTree::SceneTree() {
const bool use_hdr_2d = GLOBAL_GET("rendering/viewport/hdr_2d");
root->set_use_hdr_2d(use_hdr_2d);

const int ssaa_mode = GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "rendering/anti_aliasing/quality/screen_space_aa", PROPERTY_HINT_ENUM, "Disabled (Fastest),FXAA (Fast)"), 0);
const int ssaa_mode = GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "rendering/anti_aliasing/quality/screen_space_aa", PROPERTY_HINT_ENUM, "Disabled (Fastest),FXAA (Fast),SMAA (Average)"), 0);
root->set_screen_space_aa(Viewport::ScreenSpaceAA(ssaa_mode));

const bool use_taa = GLOBAL_DEF_BASIC("rendering/anti_aliasing/quality/use_taa", false);
Expand Down
3 changes: 2 additions & 1 deletion scene/main/viewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5127,7 +5127,7 @@ void Viewport::_bind_methods() {
ADD_GROUP("Rendering", "");
ADD_PROPERTY(PropertyInfo(Variant::INT, "msaa_2d", PROPERTY_HINT_ENUM, String::utf8("Disabled (Fastest),2× (Average),4× (Slow),8× (Slowest)")), "set_msaa_2d", "get_msaa_2d");
ADD_PROPERTY(PropertyInfo(Variant::INT, "msaa_3d", PROPERTY_HINT_ENUM, String::utf8("Disabled (Fastest),2× (Average),4× (Slow),8× (Slowest)")), "set_msaa_3d", "get_msaa_3d");
ADD_PROPERTY(PropertyInfo(Variant::INT, "screen_space_aa", PROPERTY_HINT_ENUM, "Disabled (Fastest),FXAA (Fast)"), "set_screen_space_aa", "get_screen_space_aa");
ADD_PROPERTY(PropertyInfo(Variant::INT, "screen_space_aa", PROPERTY_HINT_ENUM, "Disabled (Fastest),FXAA (Fast),SMAA (Average)"), "set_screen_space_aa", "get_screen_space_aa");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_taa"), "set_use_taa", "is_using_taa");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_debanding"), "set_use_debanding", "is_using_debanding");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_occlusion_culling"), "set_use_occlusion_culling", "is_using_occlusion_culling");
Expand Down Expand Up @@ -5216,6 +5216,7 @@ void Viewport::_bind_methods() {

BIND_ENUM_CONSTANT(SCREEN_SPACE_AA_DISABLED);
BIND_ENUM_CONSTANT(SCREEN_SPACE_AA_FXAA);
BIND_ENUM_CONSTANT(SCREEN_SPACE_AA_SMAA);
BIND_ENUM_CONSTANT(SCREEN_SPACE_AA_MAX);

BIND_ENUM_CONSTANT(RENDER_INFO_OBJECTS_IN_FRAME);
Expand Down
1 change: 1 addition & 0 deletions scene/main/viewport.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ class Viewport : public Node {
enum ScreenSpaceAA {
SCREEN_SPACE_AA_DISABLED,
SCREEN_SPACE_AA_FXAA,
SCREEN_SPACE_AA_SMAA,
SCREEN_SPACE_AA_MAX
};

Expand Down
40 changes: 40 additions & 0 deletions servers/rendering/renderer_rd/effects/SCsub
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *

import methods

Import("env")

env_effects = env.Clone()
Expand All @@ -15,6 +17,44 @@ thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]

env_effects.Prepend(CPPEXTPATH=[thirdparty_dir])


def areatex_builder(target, source, env):
buffer = methods.get_buffer(str(source[0]))

with methods.generated_wrapper(str(target[0])) as file:
file.write(f"""\
#define AREATEX_WIDTH 160
#define AREATEX_HEIGHT 560
#define AREATEX_PITCH (AREATEX_WIDTH * 2)
#define AREATEX_SIZE (AREATEX_HEIGHT * AREATEX_PITCH)

inline constexpr const unsigned char area_tex_png[] = {{
{methods.format_buffer(buffer, 1)}
}};
""")


env.CommandNoCache("smaa_area_tex.gen.h", "#thirdparty/smaa/AreaTex.png", env.Run(areatex_builder))


def searchtex_builder(target, source, env):
buffer = methods.get_buffer(str(source[0]))

with methods.generated_wrapper(str(target[0])) as file:
file.write(f"""\
#define SEARCHTEX_WIDTH 64
#define SEARCHTEX_HEIGHT 16
#define SEARCHTEX_PITCH SEARCHTEX_WIDTH
#define SEARCHTEX_SIZE (SEARCHTEX_HEIGHT * SEARCHTEX_PITCH)

inline constexpr const unsigned char search_tex_png[] = {{
{methods.format_buffer(buffer, 1)}
}};
""")


env.CommandNoCache("smaa_search_tex.gen.h", "#thirdparty/smaa/SearchTex.png", env.Run(searchtex_builder))

# This flag doesn't actually control anything GCC specific in FSR2. It determines
# if symbols should be exported, which is not required for Godot.
env_effects.Append(CPPDEFINES=["FFX_GCC"])
Expand Down
Loading