diff options
author | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2019-02-23 19:10:31 +0100 |
---|---|---|
committer | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2019-02-23 19:10:31 +0100 |
commit | eb7983377081651e120487a095101c94343ea203 (patch) | |
tree | 97d3f4f9dff8134a0b52b4c37d69097751e27bea | |
parent | 9d78274e068d4928044220c4d5c1a7baed423670 (diff) |
Tweak SpatialMaterial's default metallic and roughness texture channels
To follow the glTF 2.0 specification in all cases (including outside
of imported glTF scenes), the blue channel is now used for metallic
and the green channel is now used for roughness.
-rw-r--r-- | editor/import/editor_scene_importer_gltf.cpp | 3 | ||||
-rw-r--r-- | scene/resources/material.cpp | 4 |
2 files changed, 2 insertions, 5 deletions
diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp index ff2f68ffd3..b88928cfcf 100644 --- a/editor/import/editor_scene_importer_gltf.cpp +++ b/editor/import/editor_scene_importer_gltf.cpp @@ -1322,9 +1322,7 @@ Error EditorSceneImporterGLTF::_parse_materials(GLTFState &state) { if (bct.has("index")) { Ref<Texture> t = _get_texture(state, bct["index"]); material->set_texture(SpatialMaterial::TEXTURE_METALLIC, t); - material->set_metallic_texture_channel(SpatialMaterial::TEXTURE_CHANNEL_BLUE); material->set_texture(SpatialMaterial::TEXTURE_ROUGHNESS, t); - material->set_roughness_texture_channel(SpatialMaterial::TEXTURE_CHANNEL_GREEN); if (!mr.has("metallicFactor")) { material->set_metallic(1); } @@ -1349,7 +1347,6 @@ Error EditorSceneImporterGLTF::_parse_materials(GLTFState &state) { Dictionary bct = d["occlusionTexture"]; if (bct.has("index")) { material->set_texture(SpatialMaterial::TEXTURE_AMBIENT_OCCLUSION, _get_texture(state, bct["index"])); - material->set_ao_texture_channel(SpatialMaterial::TEXTURE_CHANNEL_RED); material->set_feature(SpatialMaterial::FEATURE_AMBIENT_OCCLUSION, true); } } diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index 190dc707c4..3f61fc481b 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -2320,8 +2320,8 @@ SpatialMaterial::SpatialMaterial() : set_ao_light_affect(0.0); - set_metallic_texture_channel(TEXTURE_CHANNEL_RED); - set_roughness_texture_channel(TEXTURE_CHANNEL_RED); + set_metallic_texture_channel(TEXTURE_CHANNEL_BLUE); + set_roughness_texture_channel(TEXTURE_CHANNEL_GREEN); set_ao_texture_channel(TEXTURE_CHANNEL_RED); set_refraction_texture_channel(TEXTURE_CHANNEL_RED); |