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);
