rendering issue with set context in 3D?

I want to save an image (3D) with a transparent background (alpha=0). As the screen copy button saves in .jpeg format, which does retain the alpha, i am obliged use setcontext to draw to an image of size width,height. (saveimage is saved in .png format and retains the alpha).

So, the transparent background works, but i find that the setcontext image is slightly different from the screencopy image- in some regions of the setcontext image it looks like there are horizontal shifts of tens of pixels. This can be seen in the attached image on the spheres in the top left quarter. (I use a custom shader to draw the circles on the 3D spheres). @john, @Simeon any ideas?

Would be really convenient for me if the save screen button would save in .png format rather than .jpeg.

@piinthesky Is that supposed to be one of those neutrino detectors with a neutrino streeking thru.

yes, it is KM3NeT, a kilometre cube deep sea neutrino telescope in the Mediterranean Sea. I wrote an event display in Codea for the telescope. Some of the images feature on the website for the experiment- see

Actually the image in my previous post features on the teeshirt of the experiment.

Here is a poor quality video of driving a submarine through the event display… Next time i’ll save it in higher resolution on youtube!

Next project is to rewrite it in codea craft in AR.

Not sure if this has anything to do with it, but I encountered some trouble trying to render images with see-through areas on a mesh, and I solved it by calling background(0,0,0,0) after setContext(yourContext). That filled the image with an alpha-zero color before drawing anything to it.

In effect it seemed like the mesh was confused by empty space but knew how to handle colors with alpha zero. Hope that helps!