Skip to content

Commit

Permalink
fix default glTF metallic & roughness factor values
Browse files Browse the repository at this point in the history
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 #19613
(cherry picked from commit 01b0120)
  • Loading branch information
rodolforg authored and hpvb committed Jul 9, 2018
1 parent b5338b6 commit 4fcb0d0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions editor/import/editor_scene_importer_gltf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1253,12 +1253,15 @@ Error EditorSceneImporterGLTF::_parse_materials(GLTFState &state) {
}

if (mr.has("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"]);
} else {
material->set_roughness(1.0);
}

if (mr.has("metallicRoughnessTexture")) {
Expand Down

0 comments on commit 4fcb0d0

Please sign in to comment.