I’m trying to take save out a view to a transparent PNG image using -ViewCaptureToFile with the TransparentBackground=Yes option set. The object is a mesh that has its vertices colored: mesh_with_colored_verts2.3dm (78.3 KB). I’ve opened the image in GIMP and took a screenshot (chequerboard indicates transparent areas): .
Most of the mesh is blue-ish, which comes out ok in a normal screenshot: .
I’ve extracted RGBA along a line into a spreadsheet and plotted RGBA:
It appears that the alpha channel somehow follows the red one, although not completely. I would expect alpha to be 0 (i.e. fully transparent) outside of the mesh, but 255 (i.e opaque) where the mesh is. I can’t see why alpha would have any kind of gradient to it. Is this my misunderstanding of what TransparentBackground=Yes should do, or is this a bug?
I’ve confirmed that Alpha=0 for all vertices with a little Python script that created a dump of MeshVertexColors(). I’m using Rhino5, SR12 64-bit.
Somehow the alpha channel is getting adjusted when vertex color processing is active. I will take a look… If all vertex colors do have 1.0 as their alpha component, then yes, this obviously shouldn’t happen. I’ve got the file here now, and will take a look at this some time today.
So yes, this looks like a bug…but unfortunately it’s not going to get fixed in V5…just a heads-up.
I’ll report back when I know more about the problem.
Just a quick update with a work around I found. If you make sure your background is white when the views are captured with TransparentBackground=No, (and also assuming there are no white objects or mesh vertices), the white background can be made transparent with ImageMagick’s convert.exe:
convert.exe -transparent white in.png out.png
A different background colour will work, too, as long is it is not also an object or vertex colour.
This is easy to implement in a Windows or RhinoPython script. A while-we-are-awaiting-Rhino6 solution.