vectorgraphics / asymptote

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

bug with 3D opacity and exporting #298

Closed transientsolutions closed 2 years ago

transientsolutions commented 2 years ago

A small example works properly without opacity. Also, it works properly (WITH opacity) under: asymptote 2.74 64 bit Windows 7 GPL Ghostscript 9.27 And it has got bug (WITH opacity) under: asymptote ver. 2.75 64 bit Windows 10 GPL Ghostscript 9.55.0

Level of degradation depends on settings.render

Sample:

settings.render = 8;

import three;

size(7cm,0);
//defaultpen(fontsize(8pt));

// currentprojection = perspective (2.5, -2, 4); //

real h = 2*sqrt(2);

triple A=(0,0,0),B=(0,2,0),C=(2,2,0),D=(2,0,0);
triple Ss=(1,1,h),O=(1,1,0);
triple F=(1.33333,0.66667,2*h/3),F_=(1.33333,1.33333,2*h/3);
triple Ee=(0.88889,0.88889,8*h/9),E_=(0.88889,1.11111,8*h/9);

path3 sect=F--F_--E_--Ee--cycle;

surface secsur = surface(sect);

draw(secsur, light=nolight, mediumgray+opacity(0.4));
//draw(secsur, light=nolight, mediumgray);

draw(Ss--D);
draw(Ss--C);
draw(Ss--B);
draw(Ss--A,dashed);
draw(D--C--B);
draw(D--A--B,dashed);

bugopacity-9 27 bugopacity-9 55

johncbowman commented 2 years ago

Ghostscript isn't used by this example, so we can eliminate that. It helps knowing which version this first occurred with. I am able to reproduce the issue. The example renders fine on the screen; the issue happens only upon export.

I am reimplementing the 3D transparency shaders in asy 2.78 and will use this example for testing. In the meantime, you can work around the issue with settings.GPUindexing=false (or specifying the command line option -noGPUindexing).

transientsolutions commented 2 years ago

Thank you! This advise (GPUindex=false) works for me. And I'm glad that sample above will be helpful!

And how can I discus with you another problem with embeded (in Latex, XeLaTex) 3d asy-script like above? Problem is with font in the labels. In 2d asy-script labels are performed separatly, but 3d are not. So, I should use tricks with project-funtction. It is not right. But, what to do?

johncbowman commented 2 years ago

The Asymptote Forum is a good place for discussions: https://sourceforge.net/p/asymptote/discussion/409349