1

I try to use asymptote to plot the lattice. But the 3d effect of sphere is not so good. I need to use opacity(0.3) function, since I need to plot inside the sphere other elements. Currently, it looks like 2d to me (see the attached figure). Is there a way to improve it? Or is it possible to add shading effect to it?

My Asymptote code is as following,

size(400);
import solids;
import three; import graph3;
currentprojection=orthographic(8,8,10);
viewportmargin=(10,10);



int N=4;

for(int i=0; i<N; ++i)
{ 
draw((0,i,0)--(N-1,i,0), 2+gray);
draw((i,0,0)--(i,N-1,0), 2+gray);

}

for(int i=0; i<N; ++i)
for(int j=0; j<N; ++j)
draw(shift((i,j,0))*scale(0.4,0.4,0.4)*unitsphere, opacity(0.3)+red,currentlight);

With the following output, enter image description here

Tao Qin
  • 31
  • 2
    I like asymptote, but to make really nice 3d graphics you might consider the POV-Ray program instead as in my answer to the following question. http://tex.stackexchange.com/questions/281002/drawing-complicated-3d-designs-within-tikz – James Feb 01 '16 at 12:47
  • 1
    Thanks a lot. I will have a look POV-Ray. I hope it will not be so difficult to learn. – Tao Qin Feb 01 '16 at 17:08

0 Answers0