fix default glTF metallic & roughness factor values
The glTF 2.0 spec says that these pbrMetallicRoughness material properties should be set as 1.0 by default. In fact, KhronosGroup's official Blender Exporter does not even write down those parameters if they are set as 1.0. However, Godot import them as 0.0. https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#pbrmetallicroughness Fixes: #19613 https://github.com/godotengine/godot/issues/19613
This commit is contained in:
parent
a9acdd84b7
commit
01b01209a3
|
@ -1256,12 +1256,15 @@ Error EditorSceneImporterGLTF::_parse_materials(GLTFState &state) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mr.has("metallicFactor")) {
|
if (mr.has("metallicFactor")) {
|
||||||
|
|
||||||
material->set_metallic(mr["metallicFactor"]);
|
material->set_metallic(mr["metallicFactor"]);
|
||||||
|
} else {
|
||||||
|
material->set_metallic(1.0);
|
||||||
}
|
}
|
||||||
if (mr.has("roughnessFactor")) {
|
|
||||||
|
|
||||||
|
if (mr.has("roughnessFactor")) {
|
||||||
material->set_roughness(mr["roughnessFactor"]);
|
material->set_roughness(mr["roughnessFactor"]);
|
||||||
|
} else {
|
||||||
|
material->set_roughness(1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mr.has("metallicRoughnessTexture")) {
|
if (mr.has("metallicRoughnessTexture")) {
|
||||||
|
|
Loading…
Reference in New Issue