summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorjfons <joan.fonssanchez@gmail.com>2022-04-04 16:10:22 +0200
committerjfons <joan.fonssanchez@gmail.com>2022-06-07 13:14:44 +0200
commitba832d83b2dafcdbb79b93b1e97fd518c12b97bf (patch)
treea105978a20ea3f2ec4edd53691f7664c0562c1d8 /scene
parent36bd26dc75465d0b64441113bc4055b2cd06b516 (diff)
Initial TAA implementation
Initial TAA support based on the implementation in Spartan Engine. Motion vectors are correctly generated for camera and mesh movement, but there is no support for other things like particles or skeleton deformations.
Diffstat (limited to 'scene')
-rw-r--r--scene/main/scene_tree.cpp3
-rw-r--r--scene/main/viewport.cpp17
-rw-r--r--scene/main/viewport.h5
3 files changed, 25 insertions, 0 deletions
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index b695dddf65..14daf2c108 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -1381,6 +1381,9 @@ SceneTree::SceneTree() {
ProjectSettings::get_singleton()->set_custom_property_info("rendering/anti_aliasing/quality/screen_space_aa", PropertyInfo(Variant::INT, "rendering/anti_aliasing/quality/screen_space_aa", PROPERTY_HINT_ENUM, "Disabled (Fastest),FXAA (Fast)"));
root->set_screen_space_aa(Viewport::ScreenSpaceAA(ssaa_mode));
+ const bool use_taa = GLOBAL_DEF("rendering/anti_aliasing/quality/use_taa", false);
+ root->set_use_taa(use_taa);
+
const bool use_debanding = GLOBAL_DEF("rendering/anti_aliasing/quality/use_debanding", false);
root->set_use_debanding(use_debanding);
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 7c7809fd75..772bb2bbd1 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -2897,6 +2897,18 @@ Viewport::ScreenSpaceAA Viewport::get_screen_space_aa() const {
return screen_space_aa;
}
+void Viewport::set_use_taa(bool p_use_taa) {
+ if (use_taa == p_use_taa) {
+ return;
+ }
+ use_taa = p_use_taa;
+ RS::get_singleton()->viewport_set_use_taa(viewport, p_use_taa);
+}
+
+bool Viewport::is_using_taa() const {
+ return use_taa;
+}
+
void Viewport::set_use_debanding(bool p_use_debanding) {
if (use_debanding == p_use_debanding) {
return;
@@ -3632,6 +3644,9 @@ void Viewport::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_screen_space_aa", "screen_space_aa"), &Viewport::set_screen_space_aa);
ClassDB::bind_method(D_METHOD("get_screen_space_aa"), &Viewport::get_screen_space_aa);
+ ClassDB::bind_method(D_METHOD("set_use_taa", "enable"), &Viewport::set_use_taa);
+ ClassDB::bind_method(D_METHOD("is_using_taa"), &Viewport::is_using_taa);
+
ClassDB::bind_method(D_METHOD("set_use_debanding", "enable"), &Viewport::set_use_debanding);
ClassDB::bind_method(D_METHOD("is_using_debanding"), &Viewport::is_using_debanding);
@@ -3760,6 +3775,7 @@ void Viewport::_bind_methods() {
ADD_GROUP("Rendering", "");
ADD_PROPERTY(PropertyInfo(Variant::INT, "msaa", PROPERTY_HINT_ENUM, String::utf8("Disabled (Fastest),2× (Average),4× (Slow),8× (Slowest)")), "set_msaa", "get_msaa");
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::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");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "mesh_lod_threshold", PROPERTY_HINT_RANGE, "0,1024,0.1"), "set_mesh_lod_threshold", "get_mesh_lod_threshold");
@@ -3858,6 +3874,7 @@ void Viewport::_bind_methods() {
BIND_ENUM_CONSTANT(DEBUG_DRAW_CLUSTER_DECALS);
BIND_ENUM_CONSTANT(DEBUG_DRAW_CLUSTER_REFLECTION_PROBES);
BIND_ENUM_CONSTANT(DEBUG_DRAW_OCCLUDERS)
+ BIND_ENUM_CONSTANT(DEBUG_DRAW_MOTION_VECTORS)
BIND_ENUM_CONSTANT(DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST);
BIND_ENUM_CONSTANT(DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR);
diff --git a/scene/main/viewport.h b/scene/main/viewport.h
index 833b302e97..a22a2acf49 100644
--- a/scene/main/viewport.h
+++ b/scene/main/viewport.h
@@ -160,6 +160,7 @@ public:
DEBUG_DRAW_CLUSTER_DECALS,
DEBUG_DRAW_CLUSTER_REFLECTION_PROBES,
DEBUG_DRAW_OCCLUDERS,
+ DEBUG_DRAW_MOTION_VECTORS,
};
enum DefaultCanvasItemTextureFilter {
@@ -291,6 +292,7 @@ private:
MSAA msaa = MSAA_DISABLED;
ScreenSpaceAA screen_space_aa = SCREEN_SPACE_AA_DISABLED;
+ bool use_taa = false;
Scaling3DMode scaling_3d_mode = SCALING_3D_MODE_BILINEAR;
float scaling_3d_scale = 1.0;
@@ -515,6 +517,9 @@ public:
void set_screen_space_aa(ScreenSpaceAA p_screen_space_aa);
ScreenSpaceAA get_screen_space_aa() const;
+ void set_use_taa(bool p_use_taa);
+ bool is_using_taa() const;
+
void set_scaling_3d_mode(Scaling3DMode p_scaling_3d_mode);
Scaling3DMode get_scaling_3d_mode() const;