In my TeX distribution there are two Asymptote examples named inlinemovie.tex and inlinemovie3.tex. (They are also available here.)

Quick question

The two animations in inlinemovie.tex have transparent backgrounds while the animation in inlinemovie3.tex has its background opaquely white. You can verify this by adding \vspace*{-3cm} between \end{verbatim} and begin{center} in both files.

I want the later transparent as well.

transparent background:

opaque background:


I have been trying understanding animations in TeX world for days. While TikZ is extremely awesome, I found Asymptote irreplaceable due to its ability to render 3D objects.

However, Asymptote is ill-documented (in English). Turns out I need following commands to compile inlinemovie.tex, say, completely:

  1. pdflatex inlinemovie.tex: creates inlinemovie-1.asy and inlinemovie-2.asy
  2. asy inlinemovie-*.asy: compiles -1.asy and -2.asy and creates junks...
  3. pdflatex inlinemovie.tex: includes images from the previous step.
  4. pdflatex inlinemovie.tex: for safety.

The problem begins from step 2. If you pass asy inlinemovie-* -keep instead, you would see that Asymptote creates files such as _movie1_9.pdf, _movie1.pdf, _movie2_9.pdf, _movie2.pdf, _movie1_9.eps, and _movie2_9.eps. It is hard to tell what is the logic behind these filenames.

Everything will be fine if the final results are of transparent background. However, when I compiled inlinemovie3.tex, I found the picture _movie3+9.pdf is of opaque background. So everything after it would have opaque background too I guess.

I know from experience that the PNG outputs are always of may have, through external programs, transparent background, no matter it is 2D or 3D. So the problem is in the animation part. Can I make the intermediate files to be PNGs so I can transparentize them then? I tried to check animation.asy and animate.sty but I cannot tell what exactly generates _movie3+9.pdf and what contributes to its background.

P.S. I made a stupid mistake so stupid that I need to edit my post, knowing that this will raise my post to the top of the list.

After O.G.'s comment I checked my old, transparent, 3D PNGs and tried to recompile some of them. Surprisingly I found that I actually had written an additional script to generate transparent version and replace old files with the same filenames --- I just forgot my efforts and regarded them as defaults.

This script still works today. So the only issue is to insert a transparentizing step. Even more precisely, may someone locate the line that generates _movie3+9.pdf and tell me if it is possible to call external scripts (probably something involving ImageMagick) in Asymptote, I would like do the remaining job.

  • 1
    The transparent background seems to be not available in 3D rendered picture. It is not related to animation, a (static) 3D picture does not have a transparent background even in png format. For one picture it is possible using convert (see sourceforge.net/p/asymptote/discussion/409349/thread/0cfb1491). Perhaps that the following code (a background for a logo) can also help sourceforge.net/p/asymptote/discussion/409349/thread/1694f7fc – O.G. Jul 16 '15 at 16:23
  • It is possible to convert ... for one picture? Cannot I convert multiple pictures as long as I modify the animation pipeline? So the remaining thing is to dig into these intermediate files. – Symbol 1 Jul 16 '15 at 23:32
  • Your experience seems to be mistaken: 3d outputs always have opaque background in any file format unless settings.render = 0;. – Charles Staats Jul 17 '15 at 16:41
  • @CharlesStaats yes... I just found that I actually wrote an additional script to make those PNG transparent. It is indeed an old experience. I messed everything up. – Symbol 1 Jul 17 '15 at 16:43
  • @O.G. sourceforge is still down... But you are right that it require more effort to make it transparent. But animation part is still the problem even though I know what I want now. – Symbol 1 Jul 17 '15 at 17:23

Your Answer

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

Browse other questions tagged or ask your own question.