summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/gui/rich_text_label.cpp9
-rw-r--r--scene/resources/material.cpp5
2 files changed, 9 insertions, 5 deletions
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index e8a908c30e..2800ab0442 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -1432,10 +1432,11 @@ void RichTextLabel::_notification(int p_what) {
}
} break;
case NOTIFICATION_INTERNAL_PROCESS: {
- float dt = get_process_delta_time();
-
- _update_fx(main, dt);
- update();
+ if (is_visible_in_tree()) {
+ float dt = get_process_delta_time();
+ _update_fx(main, dt);
+ update();
+ }
}
}
}
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp
index 86c7bda2b3..75dd417f7f 100644
--- a/scene/resources/material.cpp
+++ b/scene/resources/material.cpp
@@ -1032,7 +1032,10 @@ void BaseMaterial3D::_update_shader() {
if (features[FEATURE_REFRACTION]) {
if (features[FEATURE_NORMAL_MAPPING]) {
- code += "\tvec3 ref_normal = normalize( mix(NORMAL,TANGENT * NORMAL_MAP.x + BINORMAL * NORMAL_MAP.y + NORMAL * NORMAL_MAP.z,NORMAL_MAP_DEPTH) );\n";
+ code += "\tvec3 unpacked_normal = NORMAL_MAP;\n";
+ code += "\tunpacked_normal.xy = unpacked_normal.xy * 2.0 - 1.0;\n";
+ code += "\tunpacked_normal.z = sqrt(max(0.0, 1.0 - dot(unpacked_normal.xy, unpacked_normal.xy)));\n";
+ code += "\tvec3 ref_normal = normalize( mix(NORMAL,TANGENT * unpacked_normal.x + BINORMAL * unpacked_normal.y + NORMAL * unpacked_normal.z,NORMAL_MAP_DEPTH) );\n";
} else {
code += "\tvec3 ref_normal = NORMAL;\n";
}