0

I just installed Asymptote to make a 3D model with annotations in LaTeX.

My model consist on several 3D objects and they are not overlapping well, it seems that they are being drawn in the same order that is in my script.

Here is my code:

import graph3;
import solids;
import three;

currentlight=White;

render render=render(compression=0,merge=true);

//body
revolution sph=sphere((0,0,0.0),1.0);
draw(surface(sph),green+white+opacity(1.0), render);

//arms
revolution armY=cylinder(O,0.25,5.0,Y);
draw(surface(armY),green+white+opacity(1.0), render);
draw(surface(shift(0,-5,0)*armY),green+white+opacity(1.0), render);

revolution armX=cylinder(O,0.25,5.0,X);
draw(surface(armX),green+white+opacity(1.0), render);
draw(surface(shift(-5,0,0)*armX),green+white+opacity(1.0), render);

//motors
revolution motor=cylinder(O,0.25,0.6,Z);

draw(surface(shift(0,5,-0.25)*motor),green+white+opacity(0.05), render);
draw(surface(shift(5,0,-0.25)*motor),green+white+opacity(0.05), render);
draw(surface(shift(0,-5,-0.25)*motor),green+white+opacity(0.05), render);
draw(surface(shift(-5,0,-0.25)*motor),green+white+opacity(0.05), render);

And this is my output Output image with wrong overlapping

I think is a problem with

render render=render(compression=0,merge=true);

I also tried running the examples from the Asymptote page 3D examples from Asymptote site and the answer code for this question 3D Asymptote examples from StackExchange but I always got wrong overlapping.

I installed Asymptote version 2.67 along with Ghostscript 9.19, all in Ubuntu 18.

Can you see anything that I am missing. Thanks in advance.

2

For solid 3d rendering use raster output. for example, with command

asy -f png -noprc -render=4  3d-overlap.asy

we have

enter image description here

where 3d-overlap.asy contains the code from the question with the size added:

size(9cm);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.