-ViewCaptureToFile with coloured meshes and TransparentBackground=Yes

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.

Thank you all for your time
Kind regards

Axa

Hi Axa - I see this as well with vertex colors- I am not sure what is expected for this setting with vertex colors. I’ll see what I can find out.

@jeff - can you shed any light?

thanks,

-Pascal

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.

Thanks for reporting it.
-Jeff

1 Like

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.

Regards
Axa

Hello again. I’ve just tested this with the latest WIP. The transparency bug still exists, but the result looks different now. Here is a screenshot:

This is what ViewCaptureToFile with TransparentBackground=Yes produces:

This is the Rhino file:

coloured_mesh.3dm (173.1 KB)

May I request this ticket to be re-opened, please

Have a good weekend

Hi Axa - thanks, I see that.

https://mcneel.myjetbrains.com/youtrack/issue/RH-40207

-Pascal

RH-40207 is fixed in the latest WIP

2 Likes

Thank you, Brian. This is working beautifully now.

1 Like