summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2024-04-25 20:26:32 +0200
committerHugo Locurcio <hugo.locurcio@hugo.pro>2024-05-08 17:13:14 +0200
commite52c9cd9f13f9e8d3be93d1de051a143c632e3e1 (patch)
tree4497c1386e2da0c30b115690e90af37f3aecf7ae
parent2042420bd7f43bb834316d7ca4631ab2fcfcc820 (diff)
downloadredot-engine-e52c9cd9f13f9e8d3be93d1de051a143c632e3e1.tar.gz
Tweak appearance of 3D editor gizmo icons
- Use alpha scissor to resolve transparency sorting issues with gizmo icons relative to other transparent materials in the scene. This also makes gizmos visible in `screen_texture`, which means gizmos can now be seen through refractive materials. Lastly, this reduces the amount of artifacts visible around gizmo outlines (although they are still present at times). - Make icons darker when not selected to be less intrusive (and easier to distinguish when selected).
-rw-r--r--editor/plugins/node_3d_editor_gizmos.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/editor/plugins/node_3d_editor_gizmos.cpp b/editor/plugins/node_3d_editor_gizmos.cpp
index 3f86d30368..de56767929 100644
--- a/editor/plugins/node_3d_editor_gizmos.cpp
+++ b/editor/plugins/node_3d_editor_gizmos.cpp
@@ -912,7 +912,9 @@ void EditorNode3DGizmoPlugin::create_icon_material(const String &p_name, const R
Color color = instantiated ? instantiated_color : p_albedo;
if (!selected) {
- color.a *= 0.85;
+ color.r *= 0.6;
+ color.g *= 0.6;
+ color.b *= 0.6;
}
icon->set_albedo(color);
@@ -921,9 +923,8 @@ void EditorNode3DGizmoPlugin::create_icon_material(const String &p_name, const R
icon->set_flag(StandardMaterial3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
icon->set_flag(StandardMaterial3D::FLAG_SRGB_VERTEX_COLOR, true);
icon->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true);
- icon->set_cull_mode(StandardMaterial3D::CULL_DISABLED);
- icon->set_depth_draw_mode(StandardMaterial3D::DEPTH_DRAW_DISABLED);
- icon->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA);
+ icon->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA_SCISSOR);
+ icon->set_alpha_scissor_threshold(0.1);
icon->set_texture(StandardMaterial3D::TEXTURE_ALBEDO, p_texture);
icon->set_flag(StandardMaterial3D::FLAG_FIXED_SIZE, true);
icon->set_billboard_mode(StandardMaterial3D::BILLBOARD_ENABLED);