Merge pull request #26205 from Calinou/spatialmaterial-use-packed-channels

Tweak SpatialMaterial's default metallic and roughness texture channels
This commit is contained in:
Rémi Verschelde 2019-06-20 11:46:01 +02:00 committed by GitHub
commit b9f8e072ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 5 deletions

View File

@ -1326,9 +1326,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);
}
@ -1353,7 +1351,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);
}
}

View File

@ -2353,8 +2353,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);