I have a question regarding Asymptote, which I recently started to use to make some simple drawings. I am facing some problems when I try to create 2D output files.

I am working in a software company, and I am drawing some simple sketches in Asymptote. The sketches are intended to be displayed in the graphical user interface (GUI) of my company's software. The sketches are three dimensional, and some of the surfaces are transparent.

At first, I simply used the OpenGL renderer to produce high resolution PNG-files. This worked well until I enabled transparency. With transparency enabled, the OpenGL renderer creates misdrawn triangles on my surfaces, which disturb the overall look of the figure. I have been told on the official Sourceforge Asymptote forum that this is a known problem with OpenGL, and I don't know of any way to alleviate this issue within the framework of OpenGL.

Consequently, I tried to produce 3D PDF (PRC-files) instead. This solves the problem with the misdrawn triangles. When I look at my 3D figures in Acrobat Reader, the graphics look beautiful when the active content in the PDF is enabled. The only thing I need to do is to convert the PRC-file to a suitable file format which can then be displayed in the GUI. The GUI programmers in my company have suggested that I hand over the files in a 2D format, like PNG or SVG.

It should be noted that in Acrobat Reader, my 3D figure only looks good when the active content is enabled. When the active content is disabled, the figure looks horrible. I think this is because, when the active content is disabled, Acrobat Reader just shows a preview of the 3D graphics. This preview is created in Asymptote by including the line

settings.render = 0;

Unfortunately, the preview obtained with this command looks very odd. I think this is because Asymptote's algorithm for turning three-dimensional graphics into two-dimensional vector drawings has some problems (as mentioned in the Asymptote tutorial by Charles Staats).

I have tried to export the PDF-file to JPEG and PNG using Adobe Acrobat Pro DC. However, the pictures obtained with this method were extremely blurred. I have also tried to print the graphics using the Adobe PDF printer, but this also yields poor results.

I don't have much experience with 3D PDF. As I mentioned, I can view my 3D graphics in Acrobat Reader when I enable the active content, and I can rotate the graphics, and it looks great.

The only work around I have come up with so far is to use my Windows snip tool to take a screen shot when the graphics is shown in Acrobat Reader. This actually works, and I can get a PNG-file of decent quality, but only at a relatively low solution. In any case, this is hardly a satisfactory solution.

My question is: Is there some way that I can obtain a high quality 2D file format from the 3D PDF (PRC-file) format?

  • Welcome to TeX - LaTeX! You question seems to be rather tangential to the main focus of this site, being about converting 3D PDF graphic format. Maybe the Computer Graphics SE site is more relevant. – Andrew Swann Jun 27 '17 at 9:49
  • I've had good luck with Imagemagick from the command line. For example "convert -density 300x300 sample.pdf sample.png". – James Jun 27 '17 at 11:15
  • Thank you for your comments and suggestions. I agree that conversion of 3D PDF format might be somewhat in the periphery of this forum. I have now asked the same question in the computer graphics forum of stack exchange. However, I still think this question could be relevant for other Asymptote users. My understanding is that questions pertaining to Asymptote falls within the topics covered in this site. – Henrik Jun 27 '17 at 13:27
  • Try settings.render=4 or higher. – John Bowman Jun 28 '17 at 3:06
  • Relevant to the comment in the question by Henrik and pertinent to others using PDF as a means to extract a graphic content produced by tex or other means via display. The quality is often relative to the zoom level, i.e. zoom to 200% before capture and the result in raw terms is usually 4 times greater. – user170109 Oct 2 '18 at 0:49

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.