I am trying to reproduce this picture
shown in this answer to this question. The code provided in the answer is:
% impsurfsmooth.tex :
%
\documentclass[10pt,a4paper]{article}
\usepackage{lmodern}
\usepackage{subcaption}
\usepackage{asypictureB}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\begin{asyheader}
settings.outformat="png";
settings.render=8;
import graph3;
import smoothcontour3;
pen bpen = rgb(0.75, 0.7, 0.1);
material m = material(diffusepen=0.7bpen, ambientpen=bpen, emissivepen=0.3*bpen,
specularpen=0.999white, shininess=1.0);
\end{asyheader}
%
\begin{document}
%
\begin{figure}
\captionsetup[subfigure]{justification=centering}
\centering
\begin{subfigure}[b]{0.49\textwidth}
\begin{asypicture}{name=ellipsoid}
size(200,0);
currentprojection = orthographic(9,10,4);
// ellipsoid
real f(real x, real y, real z) {
return (x^2)/(2^2) + (y^2)/(3^2) + (z^2)/(2^2) - 1;
}
draw(implicitsurface(f, (-3,-3,-3), (3,3,3), overlapedges=true), surfacepen=m);
xaxis3(Label("$x$",1),-4,4,red);
yaxis3(Label("$y$",1),-4,4,red);
zaxis3(Label("$z$",1),-4,4,red);
\end{asypicture}
%
\caption{$(\frac{x}{2})^2+(\frac{y}{3})^2+(\frac{z}{2})^2= 1$ (ellipsoid)}
\label{fig:1a}
\end{subfigure}
%
\begin{subfigure}[b]{0.49\textwidth}
\begin{asypicture}{name=hyperboliccylinder}
size(200,0);
currentprojection=orthographic(9,4,4);
// hyperbolic cylinder
real f(real x, real y, real z) {
return 2*x*y + 2*x*z - 1;
}
draw(implicitsurface(f, (-3,-3,-3), (3,3,3), overlapedges=true), surfacepen=m);
xaxis3(Label("$x$",1),-4,4,red);
yaxis3(Label("$y$",1),-4,4,red);
zaxis3(Label("$z$",1),-4,4,red);
\end{asypicture}
%
\caption{$2xy + 2xz = 1$ (hyperbolic cylinder)}
\label{fig:1b}
\end{subfigure}
\caption{}
\label{fig:1}
\end{figure}
%
\end{document}
%
% Process:
%
% pdflatex --shell-escape impsurfsmooth.tex
When I execute pdflatex --shell-escape impsurfsmooth.tex, I do not get the output shown in the answer, but just the figure and subfigure captions. The relevant part of the output is:
*geometry* driver: auto-detecting
*geometry* detected driver: pdftex
Attempting to run asy on impsurfsmooth-ellipsoid.asy
|
(/usr/local/texlive/2019/texmf-dist/tex/latex/lm/omllmm.fd)
(/usr/local/texlive/2019/texmf-dist/tex/latex/lm/omslmsy.fd)
(/usr/local/texlive/2019/texmf-dist/tex/latex/lm/omxlmex.fd)
Attempting to run asy on impsurfsmooth-hyperboliccylinder.asy
/
[1{/usr/local/texlive/2019/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
Asymptote produces two error files, trial3-ellipsoid_errors.txt and trial3-hyperboliccylinder_errors.txt, but they are both empty.
In impsurfsmooth.log, there's the following:
\openout3 = `impsurfsmooth-temp.asy'.
runsystem(cp impsurfsmooth-temp.asy impsurfsmooth-ellipsoid.asy)...executed.
Attempting to run asy on impsurfsmooth-ellipsoid.asy
runsystem(asy -noV impsurfsmooth-ellipsoid.asy 2> impsurfsmooth-ellipsoid_error
s.txt)...executed.
! LaTeX Error: File `impsurfsmooth-ellipsoid' not found.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.41 \end{asypicture}
I could not locate the file with any of these extensions:
.pdf,.png,.jpg,.mps,.jpeg,.jbig2,.jb2,.PDF,.PNG,.JPG,.JPEG,.JBIG2,.JB2,.eps
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
There's a similar section complaining about the file impsurfsmooth-hyperboliccylinder not having been found.
I tried the same from within TeXShop, with the same result. What am I doing wrong? (I'm running MacTeX 2019 (fully up-to-date) on macOS 10.14.6.)
EDIT: I followed @Marijn's suggestion and tried running Asymptote on the file directly. I extracted the following from the above example:
settings.outformat="png";
settings.render=8;
import graph3;
import smoothcontour3;
pen bpen = rgb(0.75, 0.7, 0.1);
material m = material(diffusepen=0.7bpen, ambientpen=bpen, emissivepen=0.3*bpen,
specularpen=0.999white, shininess=1.0);
size(200,0);
currentprojection = orthographic(9,10,4);
// ellipsoid
real f(real x, real y, real z) {
return (x^2)/(2^2) + (y^2)/(3^2) + (z^2)/(2^2) - 1;
}
draw(implicitsurface(f, (-3,-3,-3), (3,3,3), overlapedges=true), surfacepen=m);
xaxis3(Label("$x$",1),-4,4,red);
yaxis3(Label("$y$",1),-4,4,red);
zaxis3(Label("$z$",1),-4,4,red);
Running this using through asy -vv trial4.asy does not seem to produce any error messages, but also produces no output. The last few lines of the output are:
latex \scrollmode
latex -output-format=dvi \nonstopmode\input trial4_.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019) (preloaded format=latex)
restricted \write18 enabled.
entering extended mode
LaTeX2e <2018-12-01>
(./trial4_.tex (/usr/local/texlive/2019/texmf-dist/tex/latex/base/article.cls
Document Class: article 2018/09/03 v1.4i Standard LaTeX document class
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/size12.clo))
(/usr/local/texlive/2019/texmf-dist/tex/generic/oberdiek/ifluatex.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)
(/usr/local/texlive/2019/texmf-dist/tex/latex/graphics-def/dvips.def)))
No file trial4_.aux.
[1] [2] [3] (./trial4_.aux) )
Output written on trial4_.dvi (3 pages, 2312 bytes).
Transcript written on trial4_.log.
dvips -R -Pdownload35 -D600 -q -otrial4_.ps trial4_.dvi
gs -q -dBATCH -P -dSAFER -sDEVICE=eps2write -sOutputFile=/dev/null trial4_.ps
No files are being produced - not even trial4_.aux or trial4_.log. Running with -vvv does not give any clues (at least not to me).
EDIT 2: Following @Willie Wong's suggestion, I changed to settings.render=0;, which produced this rasterised image:


asy impsurfsmooth-ellipsioid.asyif the temporary file is preserved, otherwise you need to make the file yourself by putting the asy header code and the plotting code in a separate.asyfile) to see if you get more informative error messages. – Marijn Sep 22 '19 at 18:50settings.render=8tosettings.render=0, does the compilation succeed? If so, this may indicate compatibility issues between asymptote and your graphics card/driver/3d library. (Render = 0 generates only a rasterized 2D projection of the image, but bypasses your graphics card.) – Willie Wong Sep 23 '19 at 17:41asy -V your_filename.asy? I think there is some problems with OpenGL, graphics card driver and Asymptote – O.G. Sep 24 '19 at 11:44