diff --git a/editor/import/3d/resource_importer_scene.cpp b/editor/import/3d/resource_importer_scene.cpp index e70a8479bd9..f0da6d24603 100644 --- a/editor/import/3d/resource_importer_scene.cpp +++ b/editor/import/3d/resource_importer_scene.cpp @@ -2080,7 +2080,7 @@ void ResourceImporterScene::get_internal_import_options(InternalImportCategory p r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "generate/shadow_meshes", PROPERTY_HINT_ENUM, "Default,Enable,Disable"), 0)); r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "generate/lightmap_uv", PROPERTY_HINT_ENUM, "Default,Enable,Disable"), 0)); r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "generate/lods", PROPERTY_HINT_ENUM, "Default,Enable,Disable"), 0)); - r_options->push_back(ImportOption(PropertyInfo(Variant::FLOAT, "lods/normal_merge_angle", PROPERTY_HINT_RANGE, "0,180,0.1,degrees"), 60.0f)); + r_options->push_back(ImportOption(PropertyInfo(Variant::FLOAT, "lods/normal_merge_angle", PROPERTY_HINT_RANGE, "0,180,1,degrees"), 20.0f)); } break; case INTERNAL_IMPORT_CATEGORY_MATERIAL: { r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "use_external/enabled", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), false)); @@ -2514,7 +2514,7 @@ Node *ResourceImporterScene::_generate_meshes(Node *p_node, const Dictionary &p_ //do mesh processing bool generate_lods = p_generate_lods; - float merge_angle = 60.0f; + float merge_angle = 20.0f; bool create_shadow_meshes = p_create_shadow_meshes; bool bake_lightmaps = p_light_bake_mode == LIGHT_BAKE_STATIC_LIGHTMAPS; String save_to_file; diff --git a/scene/resources/3d/importer_mesh.cpp b/scene/resources/3d/importer_mesh.cpp index 7820f09e7be..efa84d2a953 100644 --- a/scene/resources/3d/importer_mesh.cpp +++ b/scene/resources/3d/importer_mesh.cpp @@ -443,8 +443,8 @@ void ImporterMesh::generate_lods(float p_normal_merge_angle, Array p_bone_transf float attrib_weights[attrib_count] = {}; - // Give more weight to normal preservation - attrib_weights[0] = attrib_weights[1] = attrib_weights[2] = 2.0f; + // Give some weight to normal preservation + attrib_weights[0] = attrib_weights[1] = attrib_weights[2] = 1.0f; // Give some weight to colors but only if present to avoid redundant computations during simplification if (colors_ptr) { @@ -474,7 +474,7 @@ void ImporterMesh::generate_lods(float p_normal_merge_angle, Array p_bone_transf unsigned int index_target = 12; // Start with the smallest target, 4 triangles unsigned int last_index_count = 0; - const float max_mesh_error = FLT_MAX; // We don't want to limit by error, just by index target + const float max_mesh_error = 1.0f; // we only need LODs that can be selected by error threshold float mesh_error = 0.0f; while (index_target < index_count) { diff --git a/thirdparty/meshoptimizer/patches/0001-simplifier-distance-only-error.patch b/thirdparty/meshoptimizer/patches/0001-simplifier-distance-only-error.patch deleted file mode 100644 index ce16f4ab9c9..00000000000 --- a/thirdparty/meshoptimizer/patches/0001-simplifier-distance-only-error.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/thirdparty/meshoptimizer/simplifier.cpp b/thirdparty/meshoptimizer/simplifier.cpp -index af64cbda49..8a7072fe4e 100644 ---- a/thirdparty/meshoptimizer/simplifier.cpp -+++ b/thirdparty/meshoptimizer/simplifier.cpp -@@ -2048,7 +2048,7 @@ size_t meshopt_simplifyEdge(unsigned int* destination, const unsigned int* indic - - // result_error is quadratic; we need to remap it back to linear - if (out_result_error) -- *out_result_error = sqrtf(result_error) * error_scale; -+ *out_result_error = sqrtf(vertex_error) * error_scale; - - return result_count; - } diff --git a/thirdparty/meshoptimizer/simplifier.cpp b/thirdparty/meshoptimizer/simplifier.cpp index 8a7072fe4ee..af64cbda49d 100644 --- a/thirdparty/meshoptimizer/simplifier.cpp +++ b/thirdparty/meshoptimizer/simplifier.cpp @@ -2048,7 +2048,7 @@ size_t meshopt_simplifyEdge(unsigned int* destination, const unsigned int* indic // result_error is quadratic; we need to remap it back to linear if (out_result_error) - *out_result_error = sqrtf(vertex_error) * error_scale; + *out_result_error = sqrtf(result_error) * error_scale; return result_count; }