From fcbf7011cc0e2aca269f085cb77ca251f147d4f2 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Wed, 27 Sep 2023 00:45:57 +0200 Subject: [PATCH] Make 3D editor gizmos and debug shapes ignore fog This makes them easier to see in their intended colors in scenes with fog. --- editor/import/scene_import_settings.cpp | 2 ++ .../gizmos/lightmap_gi_gizmo_plugin.cpp | 1 + .../plugins/gizmos/marker_3d_gizmo_plugin.cpp | 1 + .../navigation_obstacle_3d_editor_plugin.cpp | 2 ++ editor/plugins/node_3d_editor_gizmos.cpp | 3 +++ editor/plugins/node_3d_editor_plugin.cpp | 26 ++++++++++++------- editor/plugins/polygon_3d_editor_plugin.cpp | 2 ++ editor/plugins/skeleton_3d_editor_plugin.cpp | 23 +++++++++++----- .../gridmap/editor/grid_map_editor_plugin.cpp | 4 +++ scene/3d/mesh_instance_3d.cpp | 1 + scene/3d/ray_cast_3d.cpp | 1 + scene/3d/shape_cast_3d.cpp | 1 + scene/3d/voxelizer.cpp | 1 + scene/main/scene_tree.cpp | 3 +++ servers/navigation_server_3d.cpp | 14 ++++++++++ 15 files changed, 68 insertions(+), 17 deletions(-) diff --git a/editor/import/scene_import_settings.cpp b/editor/import/scene_import_settings.cpp index c4e1261a9c27..2ef5e89bf740 100644 --- a/editor/import/scene_import_settings.cpp +++ b/editor/import/scene_import_settings.cpp @@ -1556,6 +1556,7 @@ SceneImportSettings::SceneImportSettings() { Ref selection_mat; selection_mat.instantiate(); selection_mat->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED); + selection_mat->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true); selection_mat->set_albedo(Color(1, 0.8, 1.0)); Ref st; @@ -1597,6 +1598,7 @@ SceneImportSettings::SceneImportSettings() { { collider_mat.instantiate(); collider_mat->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED); + collider_mat->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true); collider_mat->set_albedo(Color(0.5, 0.5, 1.0)); } diff --git a/editor/plugins/gizmos/lightmap_gi_gizmo_plugin.cpp b/editor/plugins/gizmos/lightmap_gi_gizmo_plugin.cpp index b860f5c0ee49..74e6e818c610 100644 --- a/editor/plugins/gizmos/lightmap_gi_gizmo_plugin.cpp +++ b/editor/plugins/gizmos/lightmap_gi_gizmo_plugin.cpp @@ -47,6 +47,7 @@ LightmapGIGizmoPlugin::LightmapGIGizmoPlugin() { mat->set_cull_mode(StandardMaterial3D::CULL_DISABLED); mat->set_flag(StandardMaterial3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true); mat->set_flag(StandardMaterial3D::FLAG_SRGB_VERTEX_COLOR, false); + mat->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true); add_material("lightmap_probe_material", mat); diff --git a/editor/plugins/gizmos/marker_3d_gizmo_plugin.cpp b/editor/plugins/gizmos/marker_3d_gizmo_plugin.cpp index fa2c95d8db69..39ae020d53a6 100644 --- a/editor/plugins/gizmos/marker_3d_gizmo_plugin.cpp +++ b/editor/plugins/gizmos/marker_3d_gizmo_plugin.cpp @@ -85,6 +85,7 @@ Marker3DGizmoPlugin::Marker3DGizmoPlugin() { mat->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED); mat->set_flag(StandardMaterial3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true); mat->set_flag(StandardMaterial3D::FLAG_SRGB_VERTEX_COLOR, true); + mat->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true); mat->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA); Array d; diff --git a/editor/plugins/navigation_obstacle_3d_editor_plugin.cpp b/editor/plugins/navigation_obstacle_3d_editor_plugin.cpp index 4f5bc67c1bb5..9747ef4d4879 100644 --- a/editor/plugins/navigation_obstacle_3d_editor_plugin.cpp +++ b/editor/plugins/navigation_obstacle_3d_editor_plugin.cpp @@ -546,6 +546,7 @@ NavigationObstacle3DEditor::NavigationObstacle3DEditor() { line_material->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA); line_material->set_flag(StandardMaterial3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true); line_material->set_flag(StandardMaterial3D::FLAG_SRGB_VERTEX_COLOR, true); + line_material->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true); line_material->set_albedo(Color(1, 1, 1)); handle_material = Ref(memnew(StandardMaterial3D)); @@ -554,6 +555,7 @@ NavigationObstacle3DEditor::NavigationObstacle3DEditor() { handle_material->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA); handle_material->set_flag(StandardMaterial3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true); handle_material->set_flag(StandardMaterial3D::FLAG_SRGB_VERTEX_COLOR, true); + handle_material->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true); Ref handle = EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("Editor3DHandle"), EditorStringName(EditorIcons)); handle_material->set_point_size(handle->get_width()); handle_material->set_texture(StandardMaterial3D::TEXTURE_ALBEDO, handle); diff --git a/editor/plugins/node_3d_editor_gizmos.cpp b/editor/plugins/node_3d_editor_gizmos.cpp index 0d3000a318c8..3bd786c04f93 100644 --- a/editor/plugins/node_3d_editor_gizmos.cpp +++ b/editor/plugins/node_3d_editor_gizmos.cpp @@ -876,6 +876,7 @@ void EditorNode3DGizmoPlugin::create_material(const String &p_name, const Color material->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA); material->set_render_priority(StandardMaterial3D::RENDER_PRIORITY_MIN + 1); material->set_cull_mode(StandardMaterial3D::CULL_DISABLED); + material->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true); if (p_use_vertex_color) { material->set_flag(StandardMaterial3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true); @@ -918,6 +919,7 @@ void EditorNode3DGizmoPlugin::create_icon_material(const String &p_name, const R icon->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED); 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); @@ -947,6 +949,7 @@ void EditorNode3DGizmoPlugin::create_handle_material(const String &p_name, bool handle_material->set_albedo(Color(1, 1, 1)); handle_material->set_flag(StandardMaterial3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true); handle_material->set_flag(StandardMaterial3D::FLAG_SRGB_VERTEX_COLOR, true); + handle_material->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true); handle_material->set_on_top_of_alpha(); if (p_billboard) { handle_material->set_billboard_mode(StandardMaterial3D::BILLBOARD_ENABLED); diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 2eae48da97b3..d94ca9414a7b 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -5832,6 +5832,7 @@ void Node3DEditor::_generate_selection_boxes() { Ref mat = memnew(StandardMaterial3D); mat->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED); + mat->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true); const Color selection_box_color = EDITOR_GET("editors/3d/selection_box_color"); mat->set_albedo(selection_box_color); mat->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA); @@ -5840,6 +5841,7 @@ void Node3DEditor::_generate_selection_boxes() { Ref mat_xray = memnew(StandardMaterial3D); mat_xray->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED); + mat_xray->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true); mat_xray->set_flag(StandardMaterial3D::FLAG_DISABLE_DEPTH_TEST, true); mat_xray->set_albedo(selection_box_color * Color(1, 1, 1, 0.15)); mat_xray->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA); @@ -6484,6 +6486,7 @@ void Node3DEditor::_init_indicators() { indicator_mat->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED); indicator_mat->set_flag(StandardMaterial3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true); indicator_mat->set_flag(StandardMaterial3D::FLAG_SRGB_VERTEX_COLOR, true); + indicator_mat->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true); indicator_mat->set_transparency(StandardMaterial3D::Transparency::TRANSPARENCY_ALPHA_DEPTH_PRE_PASS); Vector origin_colors; @@ -6541,7 +6544,7 @@ void Node3DEditor::_init_indicators() { shader_type spatial; -render_mode unshaded; +render_mode unshaded, fog_disabled; uniform bool orthogonal; uniform float grid_size; @@ -6638,6 +6641,7 @@ void fragment() { Ref mat = memnew(StandardMaterial3D); mat->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED); + mat->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true); mat->set_on_top_of_alpha(); mat->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA); mat->set_albedo(col); @@ -6722,6 +6726,7 @@ void fragment() { Ref plane_mat = memnew(StandardMaterial3D); plane_mat->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED); + plane_mat->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true); plane_mat->set_on_top_of_alpha(); plane_mat->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA); plane_mat->set_cull_mode(StandardMaterial3D::CULL_DISABLED); @@ -6782,7 +6787,7 @@ void fragment() { shader_type spatial; -render_mode unshaded, depth_test_disabled; +render_mode unshaded, depth_test_disabled, fog_disabled; uniform vec4 albedo; @@ -6790,14 +6795,14 @@ mat3 orthonormalize(mat3 m) { vec3 x = normalize(m[0]); vec3 y = normalize(m[1] - x * dot(x, m[1])); vec3 z = m[2] - x * dot(x, m[2]); - z = normalize(z - y * (dot(y,m[2]))); + z = normalize(z - y * (dot(y, m[2]))); return mat3(x,y,z); } void vertex() { mat3 mv = orthonormalize(mat3(MODELVIEW_MATRIX)); vec3 n = mv * VERTEX; - float orientation = dot(vec3(0, 0, -1), n); + float orientation = dot(vec3(0.0, 0.0, -1.0), n); if (orientation <= 0.005) { VERTEX += NORMAL * 0.02; } @@ -6832,7 +6837,7 @@ void fragment() { shader_type spatial; -render_mode unshaded, depth_test_disabled; +render_mode unshaded, depth_test_disabled, fog_disabled; uniform vec4 albedo; @@ -6840,16 +6845,16 @@ mat3 orthonormalize(mat3 m) { vec3 x = normalize(m[0]); vec3 y = normalize(m[1] - x * dot(x, m[1])); vec3 z = m[2] - x * dot(x, m[2]); - z = normalize(z - y * (dot(y,m[2]))); - return mat3(x,y,z); + z = normalize(z - y * (dot(y, m[2]))); + return mat3(x, y, z); } void vertex() { mat3 mv = orthonormalize(mat3(MODELVIEW_MATRIX)); mv = inverse(mv); - VERTEX += NORMAL*0.008; - vec3 camera_dir_local = mv * vec3(0,0,1); - vec3 camera_up_local = mv * vec3(0,1,0); + VERTEX += NORMAL * 0.008; + vec3 camera_dir_local = mv * vec3(0.0, 0.0, 1.0); + vec3 camera_up_local = mv * vec3(0.0, 1.0, 0.0); mat3 rotation_matrix = mat3(cross(camera_dir_local, camera_up_local), camera_up_local, camera_dir_local); VERTEX = rotation_matrix * VERTEX; } @@ -6944,6 +6949,7 @@ void fragment() { Ref plane_mat = memnew(StandardMaterial3D); plane_mat->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED); + plane_mat->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true); plane_mat->set_on_top_of_alpha(); plane_mat->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA); plane_mat->set_cull_mode(StandardMaterial3D::CULL_DISABLED); diff --git a/editor/plugins/polygon_3d_editor_plugin.cpp b/editor/plugins/polygon_3d_editor_plugin.cpp index c1b124070887..2ea251c45520 100644 --- a/editor/plugins/polygon_3d_editor_plugin.cpp +++ b/editor/plugins/polygon_3d_editor_plugin.cpp @@ -561,6 +561,7 @@ Polygon3DEditor::Polygon3DEditor() { line_material->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA); line_material->set_flag(StandardMaterial3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true); line_material->set_flag(StandardMaterial3D::FLAG_SRGB_VERTEX_COLOR, true); + line_material->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true); line_material->set_albedo(Color(1, 1, 1)); handle_material = Ref(memnew(StandardMaterial3D)); @@ -569,6 +570,7 @@ Polygon3DEditor::Polygon3DEditor() { handle_material->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA); handle_material->set_flag(StandardMaterial3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true); handle_material->set_flag(StandardMaterial3D::FLAG_SRGB_VERTEX_COLOR, true); + handle_material->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true); Ref handle = EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("Editor3DHandle"), EditorStringName(EditorIcons)); handle_material->set_point_size(handle->get_width()); handle_material->set_texture(StandardMaterial3D::TEXTURE_ALBEDO, handle); diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp index c5fb8a0d8def..e6bb5532a322 100644 --- a/editor/plugins/skeleton_3d_editor_plugin.cpp +++ b/editor/plugins/skeleton_3d_editor_plugin.cpp @@ -916,24 +916,32 @@ Skeleton3DEditor::Skeleton3DEditor(EditorInspectorPluginSkeleton *e_plugin, Skel // Skeleton 3D gizmo handle shader. shader_type spatial; -render_mode unshaded, shadows_disabled, depth_draw_always; +render_mode unshaded, shadows_disabled, depth_draw_always, fog_disabled; + uniform sampler2D texture_albedo : source_color; -uniform float point_size : hint_range(0,128) = 32; +uniform float point_size : hint_range(0, 128) = 32; + void vertex() { if (!OUTPUT_IS_SRGB) { - COLOR.rgb = mix( pow((COLOR.rgb + vec3(0.055)) * (1.0 / (1.0 + 0.055)), vec3(2.4)), COLOR.rgb* (1.0 / 12.92), lessThan(COLOR.rgb,vec3(0.04045)) ); + COLOR.rgb = mix(pow((COLOR.rgb + vec3(0.055)) * (1.0 / (1.0 + 0.055)), vec3(2.4)), COLOR.rgb * (1.0 / 12.92), lessThan(COLOR.rgb, vec3(0.04045))); } + VERTEX = VERTEX; POSITION = PROJECTION_MATRIX * VIEW_MATRIX * MODEL_MATRIX * vec4(VERTEX.xyz, 1.0); - POSITION.z = mix(POSITION.z, 0, 0.999); + POSITION.z = mix(POSITION.z, 0.0, 0.999); POINT_SIZE = point_size; } + void fragment() { - vec4 albedo_tex = texture(texture_albedo,POINT_COORD); + vec4 albedo_tex = texture(texture_albedo, POINT_COORD); vec3 col = albedo_tex.rgb + COLOR.rgb; - col = vec3(min(col.r,1.0),min(col.g,1.0),min(col.b,1.0)); + col = vec3(min(col.r, 1.0), min(col.g, 1.0), min(col.b, 1.0)); ALBEDO = col; - if (albedo_tex.a < 0.5) { discard; } + + if (albedo_tex.a < 0.5) { + discard; + } + ALPHA = albedo_tex.a; } )"); @@ -1184,6 +1192,7 @@ Skeleton3DGizmoPlugin::Skeleton3DGizmoPlugin() { unselected_mat->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA); unselected_mat->set_flag(StandardMaterial3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true); unselected_mat->set_flag(StandardMaterial3D::FLAG_SRGB_VERTEX_COLOR, true); + unselected_mat->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true); selected_mat = Ref(memnew(ShaderMaterial)); selected_sh = Ref(memnew(Shader)); diff --git a/modules/gridmap/editor/grid_map_editor_plugin.cpp b/modules/gridmap/editor/grid_map_editor_plugin.cpp index b5a53fa1bf3c..f7c01ff8402c 100644 --- a/modules/gridmap/editor/grid_map_editor_plugin.cpp +++ b/modules/gridmap/editor/grid_map_editor_plugin.cpp @@ -1412,6 +1412,7 @@ GridMapEditor::GridMapEditor() { inner_mat.instantiate(); inner_mat->set_albedo(Color(0.7, 0.7, 1.0, 0.2)); inner_mat->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED); + inner_mat->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true); inner_mat->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA); d[RS::ARRAY_VERTEX] = triangles; @@ -1424,11 +1425,13 @@ GridMapEditor::GridMapEditor() { outer_mat->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED); outer_mat->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA); + outer_mat->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true); selection_floor_mat.instantiate(); selection_floor_mat->set_albedo(Color(0.80, 0.80, 1.0, 1)); selection_floor_mat->set_on_top_of_alpha(); selection_floor_mat->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED); + selection_floor_mat->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true); d[RS::ARRAY_VERTEX] = lines; RenderingServer::get_singleton()->mesh_add_surface_from_arrays(selection_mesh, RS::PRIMITIVE_LINES, d); @@ -1457,6 +1460,7 @@ GridMapEditor::GridMapEditor() { indicator_mat->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA); indicator_mat->set_flag(StandardMaterial3D::FLAG_SRGB_VERTEX_COLOR, true); indicator_mat->set_flag(StandardMaterial3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true); + indicator_mat->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true); indicator_mat->set_albedo(Color(0.8, 0.5, 0.1)); } diff --git a/scene/3d/mesh_instance_3d.cpp b/scene/3d/mesh_instance_3d.cpp index 0b0b098f65c3..78b02d74d559 100644 --- a/scene/3d/mesh_instance_3d.cpp +++ b/scene/3d/mesh_instance_3d.cpp @@ -458,6 +458,7 @@ MeshInstance3D *MeshInstance3D::create_debug_tangents_node() { sm->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED); sm->set_flag(StandardMaterial3D::FLAG_SRGB_VERTEX_COLOR, true); sm->set_flag(StandardMaterial3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true); + sm->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true); Ref am; am.instantiate(); diff --git a/scene/3d/ray_cast_3d.cpp b/scene/3d/ray_cast_3d.cpp index 13519ecec7b9..b821181d291a 100644 --- a/scene/3d/ray_cast_3d.cpp +++ b/scene/3d/ray_cast_3d.cpp @@ -463,6 +463,7 @@ void RayCast3D::_update_debug_shape_material(bool p_check_collision) { debug_material = material; material->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED); + material->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true); // Use double-sided rendering so that the RayCast can be seen if the camera is inside. material->set_cull_mode(BaseMaterial3D::CULL_DISABLED); material->set_transparency(BaseMaterial3D::TRANSPARENCY_ALPHA); diff --git a/scene/3d/shape_cast_3d.cpp b/scene/3d/shape_cast_3d.cpp index b6401832ed04..4d9eeada06cb 100644 --- a/scene/3d/shape_cast_3d.cpp +++ b/scene/3d/shape_cast_3d.cpp @@ -547,6 +547,7 @@ void ShapeCast3D::_update_debug_shape_material(bool p_check_collision) { debug_material = material; material->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED); + material->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true); // Use double-sided rendering so that the RayCast can be seen if the camera is inside. material->set_cull_mode(BaseMaterial3D::CULL_DISABLED); material->set_transparency(BaseMaterial3D::TRANSPARENCY_ALPHA); diff --git a/scene/3d/voxelizer.cpp b/scene/3d/voxelizer.cpp index 42b07486989f..7c752545db32 100644 --- a/scene/3d/voxelizer.cpp +++ b/scene/3d/voxelizer.cpp @@ -990,6 +990,7 @@ Ref Voxelizer::create_debug_multimesh() { fsm->set_flag(StandardMaterial3D::FLAG_SRGB_VERTEX_COLOR, true); fsm->set_flag(StandardMaterial3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true); fsm->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED); + fsm->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true); fsm->set_albedo(Color(1, 1, 1, 1)); mesh->surface_set_material(0, fsm); diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index d357e35c1d5d..ebe4f4c59d5a 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -789,6 +789,7 @@ Ref SceneTree::get_debug_paths_material() { _debug_material->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA); _debug_material->set_flag(StandardMaterial3D::FLAG_SRGB_VERTEX_COLOR, true); _debug_material->set_flag(StandardMaterial3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true); + _debug_material->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true); _debug_material->set_albedo(get_debug_paths_color()); debug_paths_material = _debug_material; @@ -808,6 +809,7 @@ Ref SceneTree::get_debug_collision_material() { line_material->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA); line_material->set_flag(StandardMaterial3D::FLAG_SRGB_VERTEX_COLOR, true); line_material->set_flag(StandardMaterial3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true); + line_material->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true); line_material->set_albedo(get_debug_collisions_color()); collision_material = line_material; @@ -829,6 +831,7 @@ Ref SceneTree::get_debug_contact_mesh() { mat->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA); mat->set_flag(StandardMaterial3D::FLAG_SRGB_VERTEX_COLOR, true); mat->set_flag(StandardMaterial3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true); + mat->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true); mat->set_albedo(get_debug_collision_contact_color()); Vector3 diamond[6] = { diff --git a/servers/navigation_server_3d.cpp b/servers/navigation_server_3d.cpp index 75036b935b61..eccacd3ea81f 100644 --- a/servers/navigation_server_3d.cpp +++ b/servers/navigation_server_3d.cpp @@ -301,6 +301,7 @@ Ref NavigationServer3D::get_debug_navigation_geometry_face_m face_material->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA); face_material->set_albedo(get_debug_navigation_geometry_face_color()); face_material->set_cull_mode(StandardMaterial3D::CULL_DISABLED); + face_material->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true); if (enabled_geometry_face_random_color) { face_material->set_flag(StandardMaterial3D::FLAG_SRGB_VERTEX_COLOR, true); face_material->set_flag(StandardMaterial3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true); @@ -321,6 +322,7 @@ Ref NavigationServer3D::get_debug_navigation_geometry_edge_m Ref line_material = Ref(memnew(StandardMaterial3D)); line_material->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED); line_material->set_albedo(get_debug_navigation_geometry_edge_color()); + line_material->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true); if (enabled_edge_lines_xray) { line_material->set_flag(StandardMaterial3D::FLAG_DISABLE_DEPTH_TEST, true); } @@ -339,6 +341,7 @@ Ref NavigationServer3D::get_debug_navigation_geometry_face_d face_disabled_material->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED); face_disabled_material->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA); face_disabled_material->set_albedo(get_debug_navigation_geometry_face_disabled_color()); + face_disabled_material->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true); debug_navigation_geometry_face_disabled_material = face_disabled_material; @@ -355,6 +358,7 @@ Ref NavigationServer3D::get_debug_navigation_geometry_edge_d Ref line_disabled_material = Ref(memnew(StandardMaterial3D)); line_disabled_material->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED); line_disabled_material->set_albedo(get_debug_navigation_geometry_edge_disabled_color()); + line_disabled_material->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true); if (enabled_edge_lines_xray) { line_disabled_material->set_flag(StandardMaterial3D::FLAG_DISABLE_DEPTH_TEST, true); } @@ -374,6 +378,7 @@ Ref NavigationServer3D::get_debug_navigation_edge_connection Ref edge_connections_material = Ref(memnew(StandardMaterial3D)); edge_connections_material->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED); edge_connections_material->set_albedo(get_debug_navigation_edge_connection_color()); + edge_connections_material->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true); if (enabled_edge_connections_xray) { edge_connections_material->set_flag(StandardMaterial3D::FLAG_DISABLE_DEPTH_TEST, true); } @@ -392,6 +397,7 @@ Ref NavigationServer3D::get_debug_navigation_link_connection Ref material = Ref(memnew(StandardMaterial3D)); material->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED); material->set_albedo(debug_navigation_link_connection_color); + material->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true); if (debug_navigation_enable_link_connections_xray) { material->set_flag(StandardMaterial3D::FLAG_DISABLE_DEPTH_TEST, true); } @@ -409,6 +415,7 @@ Ref NavigationServer3D::get_debug_navigation_link_connection Ref material = Ref(memnew(StandardMaterial3D)); material->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED); material->set_albedo(debug_navigation_link_connection_disabled_color); + material->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true); if (debug_navigation_enable_link_connections_xray) { material->set_flag(StandardMaterial3D::FLAG_DISABLE_DEPTH_TEST, true); } @@ -427,6 +434,7 @@ Ref NavigationServer3D::get_debug_navigation_agent_path_line material->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED); material->set_albedo(debug_navigation_agent_path_color); + material->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true); if (debug_navigation_enable_agent_paths_xray) { material->set_flag(StandardMaterial3D::FLAG_DISABLE_DEPTH_TEST, true); } @@ -445,6 +453,7 @@ Ref NavigationServer3D::get_debug_navigation_agent_path_poin material->set_albedo(debug_navigation_agent_path_color); material->set_flag(StandardMaterial3D::FLAG_USE_POINT_SIZE, true); material->set_point_size(debug_navigation_agent_path_point_size); + material->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true); if (debug_navigation_enable_agent_paths_xray) { material->set_flag(StandardMaterial3D::FLAG_DISABLE_DEPTH_TEST, true); } @@ -476,6 +485,7 @@ Ref NavigationServer3D::get_debug_navigation_avoidance_obsta Ref material = Ref(memnew(StandardMaterial3D)); material->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED); + material->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true); material->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA); material->set_cull_mode(StandardMaterial3D::CULL_DISABLED); material->set_albedo(debug_navigation_avoidance_obstacles_radius_color); @@ -492,6 +502,7 @@ Ref NavigationServer3D::get_debug_navigation_avoidance_stati Ref material = Ref(memnew(StandardMaterial3D)); material->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED); + material->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true); material->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA); material->set_cull_mode(StandardMaterial3D::CULL_DISABLED); material->set_albedo(debug_navigation_avoidance_static_obstacle_pushin_face_color); @@ -508,6 +519,7 @@ Ref NavigationServer3D::get_debug_navigation_avoidance_stati Ref material = Ref(memnew(StandardMaterial3D)); material->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED); + material->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true); material->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA); material->set_cull_mode(StandardMaterial3D::CULL_DISABLED); material->set_albedo(debug_navigation_avoidance_static_obstacle_pushout_face_color); @@ -524,6 +536,7 @@ Ref NavigationServer3D::get_debug_navigation_avoidance_stati Ref material = Ref(memnew(StandardMaterial3D)); material->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED); + material->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true); //material->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA); //material->set_cull_mode(StandardMaterial3D::CULL_DISABLED); material->set_albedo(debug_navigation_avoidance_static_obstacle_pushin_edge_color); @@ -541,6 +554,7 @@ Ref NavigationServer3D::get_debug_navigation_avoidance_stati Ref material = Ref(memnew(StandardMaterial3D)); material->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED); + material->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true); ///material->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA); //material->set_cull_mode(StandardMaterial3D::CULL_DISABLED); material->set_albedo(debug_navigation_avoidance_static_obstacle_pushout_edge_color);