Parcourir la source

Fix Collada material roughness import function

Fixes NaN roughness in Godot when hardness in Blender is set to more than 255.
Also corrects dependency: more hardness = more roughness (it says shininess, but it actually is hardness).
Dmitriy Romanov il y a 7 ans
Parent
commit
89f4e71679
1 fichiers modifiés avec 1 ajouts et 1 suppressions
  1. 1 1
      editor/import/editor_import_collada.cpp

+ 1 - 1
editor/import/editor_import_collada.cpp

@@ -480,7 +480,7 @@ Error ColladaImport::_create_material(const String &p_target) {
 		}
 	}
 
-	float roughness = Math::sqrt(1.0 - ((Math::log(effect.shininess) / Math::log(2.0)) / 8.0)); //not very right..
+	float roughness = - Math::sqrt(1.0 - ((Math::log(effect.shininess) / Math::log(2.0)) / 9.0)) + 1;
 	material->set_roughness(roughness);
 
 	if (effect.double_sided) {