Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGaia Clary <gaia.clary@machinimatrix.org>2019-07-22 19:57:44 +0300
committerGaia Clary <gaia.clary@machinimatrix.org>2019-07-22 20:03:56 +0300
commit8c618371507fc95d51671d2f807e864adf1f4791 (patch)
treed3f1e4817eef35f3a508b052f14d5c171dd8adb1 /source/blender/collada/EffectExporter.cpp
parent2de95e8149a3483341a29c36de9e1200e398c26a (diff)
Incompatible usage of the Collada transparency value
Some external tools seem to have issues with the definition of Collada <transparency> - a float value in range (0,1). However it is possible to use the <transparent> color as a container for the <transparency> value. This seems to be a more reliable method to export transparency values from Blender PBSDF Shaders. The relevant documentation is in the collada 1.14 reference manual, page 7-5 about the usage of transparent and transparency. This fix makes export and import of the <transparency> and <transparent> values more convenient and more reliable. Reviewers: brecht, jesterking Reviewed By: brecht Differential Revision: https://developer.blender.org/D5305
Diffstat (limited to 'source/blender/collada/EffectExporter.cpp')
-rw-r--r--source/blender/collada/EffectExporter.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/source/blender/collada/EffectExporter.cpp b/source/blender/collada/EffectExporter.cpp
index a784776d342..80f84738f6e 100644
--- a/source/blender/collada/EffectExporter.cpp
+++ b/source/blender/collada/EffectExporter.cpp
@@ -102,7 +102,12 @@ void EffectsExporter::set_shader_type(COLLADASW::EffectProfile &ep, Material *ma
void EffectsExporter::set_transparency(COLLADASW::EffectProfile &ep, Material *ma)
{
double alpha = bc_get_alpha(ma);
- ep.setTransparency(alpha, false, "alpha");
+ if (alpha < 1) {
+ // workaround use <transparent> to avoid wrong handling of <transparency> by other tools
+ COLLADASW::ColorOrTexture cot = bc_get_cot(0, 0, 0, alpha);
+ ep.setTransparent(cot, false, "alpha");
+ ep.setOpaque(COLLADASW::EffectProfile::A_ONE);
+ }
}
void EffectsExporter::set_diffuse_color(COLLADASW::EffectProfile &ep, Material *ma)
@@ -134,7 +139,9 @@ void EffectsExporter::set_reflective(COLLADASW::EffectProfile &ep, Material *ma)
void EffectsExporter::set_reflectivity(COLLADASW::EffectProfile &ep, Material *ma)
{
double reflectivity = bc_get_reflectivity(ma);
- ep.setReflectivity(reflectivity, false, "specular");
+ if (reflectivity > 0.0) {
+ ep.setReflectivity(reflectivity, false, "specular");
+ }
}
void EffectsExporter::set_emission(COLLADASW::EffectProfile &ep, Material *ma)