Set materials without (1, 1, 1, 1) opacity as transparent.
Use single channel (Alpha) to populate alpha value.
The issue can be seen when importing a collada file which has a material with transparency in a color and not a texture. Currently, blender will create non-transparent materials for these collada materials.
This fixes it by checking for the default non-transparent opacity color (white). If it is different, it will assign a transparent material and use the alpha of the opacity color.
Best would be to get a blend file that can be used to check if the Blender collada exporter exports the material correct (with transparency). If the exporter can not do this right now, i can take a look into this.
Also it would be nice to get a collada file that can be used to check Blender's collada importer. Then we can verify that the patch does what it is supposed to do on the importer side.
Here an example .blend file () and the corresponding .dae file ( ) generated with blender 2.77a.
It's a cube with .75 alpha and transparency enabled.
The generated .dae file seems to alright in the xml:
<effect id="Material-effect"> <profile_COMMON> <technique sid="common"> <phong> <!-- ... --> <transparency> <float sid="transparency">0.75</float> </transparency> <!-- ... --> </phong> </technique> </profile_COMMON> </effect>
And when you look at the .dae in another application such as FBX review, the transparency is still there:
However, when importing the .dae in blender it loses its transparency information.
From this, I can confirm the issue is in the import and not the export. I have also had these issues with non-blender generated .dae.
Thanks for the patch. I applied it with a small change:
You check on color != white instead of alpha < 1
As far as i can see, both checks should give the same result in this case.
But since at the end it is the alpha value that gets assigned it sounds more to the topic to check on alpha < 1.
Please let me know if i overlooked anything.
Thanks for merging.
In the future I'd appreciate it if the commit properly listed me as author (e.g. https://developer.blender.org/diffusion/BA/history/master/;dbb54eee76d38e6936f0a32fd21a14844800f498)
As for color != white instead of alpha < 1, it was simply to cover more of the case where the transparency mode was activated but the alpha was still set to 1. White seems to be the default value exported when the transparency mode has not been activated.
Alpha < 1 seems fine. I don't think anyone will complain that their alpha 1 material is no longer transparent.
I am very sorry for this. I tried a lot to get your name mentioned as you want it to be. But i can not figure out how i can do this. I tried using the --author attribute during commit, but this gives me unknown author error. It looks like i needed your email address to use --author in that case but i can not find your email address. So i mentioned you in the commit message instead. I meanwhile also asked in the irc about how to do this. But so far i was advised to just add a "thank you for the patch" here.
But i already mentioned you in the commit message. So i thought that was the best i could do. Anyways, thanks a lot for your patch!,
For the future i will figure out how mont29 did it in the example you mentioned, so i can make it right the next time :)