vectorgraphics / asymptote

2D & 3D TeX-Aware Vector Graphics Language
https://asymptote.sourceforge.io/
GNU General Public License v3.0
556 stars 93 forks source link

Crashes and wrong results with opacity in Ubuntu #246

Closed fmariofilho closed 3 years ago

fmariofilho commented 3 years ago

I have been (like many others it seems) having very strange results when trying to use opacity. The code I am compiling is:

settings.outformat = "pdf";
settings.prc = false;

import three;

size(4cm);

draw(unitsphere, material(palegray + opacity(0.25), shininess=0.5));
draw(circle(c=0.5Z, r=sqrt(1 - 0.5^2), normal=Z));
draw(circle(c=0.8Z, r=sqrt(1 - 0.8^2), normal=Z));

On my MacBook running asy version 2.41 and ghostscript 9.21 I get the expected result.

On my Ubuntu system I get wildly different results:

I tried to install asy 2.41 and ghostscript 9.21 on my Ubuntu system to see if it would work: it doesn't. link.pdf

johncbowman commented 3 years ago

We don't support obsolete software. You need to upgrade to asy 2.70 and ghostscript 9.53. Don't waste time on old versions. In particular, ghostscript versions are unfortunately not backwards compatible.

Make sure that you have OpenGL support (your attachment shows flattened postscript produced with settings.render=0 or on a system lacking OpenGL support; this is not normally what one wants). If you don't want to install the required GPU libraries, you may still be able to produce WebGL output with settings.outformat="html". So see what support you have:

asy --version

The opacity bug in OpenGL is well known and not limited to Asymptote. A workaround is being developed: https://github.com/vectorgraphics/asymptote/issues/35