[Bf-blender-cvs] [1d59a7aa777] blender-v3.1-release: Fix T95384: new obj exporter inaccurate roughness value in new exporter.
Aras Pranckevicius
noreply at git.blender.org
Sun Feb 6 20:54:47 CET 2022
Commit: 1d59a7aa777909a75420970d50f27be48c96e150
Author: Aras Pranckevicius
Date: Sun Feb 6 14:53:07 2022 -0500
Branches: blender-v3.1-release
https://developer.blender.org/rB1d59a7aa777909a75420970d50f27be48c96e150
Fix T95384: new obj exporter inaccurate roughness value in new exporter.
Fixes T95384. New exporter was missing a fix for T94516 that recently got applied to the python exporter.
Also changed the obj export tests code so that when save_failing_test_output is requested and MTL result is different from the golden expectation, it is saved as well, similar to how it's done for the OBJ file result.
===================================================================
M source/blender/io/wavefront_obj/exporter/obj_export_mtl.cc
M source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc
===================================================================
diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_mtl.cc b/source/blender/io/wavefront_obj/exporter/obj_export_mtl.cc
index 48136dad5f7..3637a3f3c5f 100644
--- a/source/blender/io/wavefront_obj/exporter/obj_export_mtl.cc
+++ b/source/blender/io/wavefront_obj/exporter/obj_export_mtl.cc
@@ -193,8 +193,8 @@ static void store_bsdf_properties(const nodes::NodeRef *bsdf_node,
copy_property_from_node(SOCK_FLOAT, bnode, "Roughness", {&roughness, 1});
}
/* Empirical approximation. Importer should use the inverse of this method. */
- float spec_exponent = (1.0f - roughness) * 30;
- spec_exponent *= spec_exponent;
+ float spec_exponent = (1.0f - roughness);
+ spec_exponent *= spec_exponent * 1000.0f;
float specular = material->spec;
if (bnode) {
diff --git a/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc b/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc
index ecae93f8f7a..dbadc33906d 100644
--- a/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc
+++ b/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc
@@ -313,8 +313,14 @@ class obj_exporter_regression_test : public obj_exporter_test {
std::string output_mtl_str = read_temp_file_in_string(out_mtl_file_path);
std::string golden_mtl_file_path = blender::tests::flags_test_asset_dir() + "/" + golden_mtl;
std::string golden_mtl_str = read_temp_file_in_string(golden_mtl_file_path);
- ASSERT_TRUE(strings_equal_after_first_lines(output_mtl_str, golden_mtl_str));
- BLI_delete(out_mtl_file_path.c_str(), false, false);
+ are_equal = strings_equal_after_first_lines(output_mtl_str, golden_mtl_str);
+ if (save_failing_test_output && !are_equal) {
+ printf("failing test output in %s\n", out_mtl_file_path.c_str());
+ }
+ ASSERT_TRUE(are_equal);
+ if (!save_failing_test_output || are_equal) {
+ BLI_delete(out_mtl_file_path.c_str(), false, false);
+ }
}
}
};
More information about the Bf-blender-cvs
mailing list