Merge pull request #48798 from josefkaragoli/emission_fix
Disable GIProbe emission when disabled on a material
This commit is contained in:
commit
530a999fb8
@ -536,6 +536,8 @@ VoxelLightBaker::MaterialCache VoxelLightBaker::_get_material_cache(Ref<Material
|
||||
|
||||
MaterialCache mc;
|
||||
|
||||
Ref<Image> empty;
|
||||
|
||||
if (mat.is_valid()) {
|
||||
Ref<Texture> albedo_tex = mat->get_texture(SpatialMaterial::TEXTURE_ALBEDO);
|
||||
|
||||
@ -547,6 +549,7 @@ VoxelLightBaker::MaterialCache VoxelLightBaker::_get_material_cache(Ref<Material
|
||||
mc.albedo = _get_bake_texture(img_albedo, Color(1, 1, 1), mat->get_albedo()); // no albedo texture, color is additive
|
||||
}
|
||||
|
||||
if (mat->get_feature(SpatialMaterial::FEATURE_EMISSION)) {
|
||||
Ref<Texture> emission_tex = mat->get_texture(SpatialMaterial::TEXTURE_EMISSION);
|
||||
|
||||
Color emission_col = mat->get_emission();
|
||||
@ -563,10 +566,11 @@ VoxelLightBaker::MaterialCache VoxelLightBaker::_get_material_cache(Ref<Material
|
||||
} else {
|
||||
mc.emission = _get_bake_texture(img_emission, emission_col * emission_energy, Color(0, 0, 0));
|
||||
}
|
||||
} else {
|
||||
mc.emission = _get_bake_texture(empty, Color(0, 0, 0), Color(0, 0, 0));
|
||||
}
|
||||
|
||||
} else {
|
||||
Ref<Image> empty;
|
||||
|
||||
mc.albedo = _get_bake_texture(empty, Color(0, 0, 0), Color(1, 1, 1));
|
||||
mc.emission = _get_bake_texture(empty, Color(0, 0, 0), Color(0, 0, 0));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user