# tikz stacked disks 3D

I would like to know if it is possible to draw an image like this in 3D using tikz? I am having some text around this picture, which looks great in tikz, but I am unable to draw this kind of 3D figure in tikz. Also the shadows around it looks quite complex to me.

Any examples, ideas, suggestions?

Thank You !

-
yes, it is possible. You can have a look here tex.stackexchange.com/questions/58633/… or here tex.stackexchange.com/questions/42812/3d-bodies-in-tikz for some ideas on lighting and 3D-body-generation. –  LaRiFaRi May 5 at 13:14
I will say that this reminds me of a standard icon pack I used back in the day. That pack came with vectors for each icon; if you have a vector for the image, there is little purpose in trying to create it with TikZ (but you can have Inkscape 'convert' it for you). –  Sean Allred May 5 at 13:16
should i get this graphic from eps and embed in tikz? is it possible? just to avoid lot of coding. –  Raj May 5 at 13:18
In my opinion this is not suited for TikZ, here you have something “similar”. –  Manuel May 5 at 13:26
@Raj Yes, I would recommend against using TikZ if you have a vector already available. If you have the vector in the same folder, you can just use \includegraphics{my-vector}—no need for TikZ. I would recommend you convert whatever you have to PDF first, just for ease of use. –  Sean Allred May 5 at 13:37

Definitely not perfect in any respect but anyway...

\documentclass[tikz,border=5]{standalone}
\tikzset{pics/.cd,
disc/.style={
code={
\path [left color=black!50, right color=black!50, middle color=black!25]
(-2+.05,-1.1) arc (180:360:2-.05 and 2/3-.05*2/3) -- cycle;
\path [top color=black!25, bottom color=white]
\path [left color=black!25, right color=black!25, middle color=white]
(-2,0) -- (-2,-1) arc (180:360:2 and 2/3) -- (2,0) arc (360:180:2 and 2/3);
\foreach \r in {225,315}
\foreach \i [evaluate={\s=30;}] in {0,2,...,30}
\fill [black, fill opacity=1/50]
(0,0) -- (\r+\s-\i:2 and 2/3) -- ++(0,-1)
arc (\r+\s-\i:\r-\s+\i:2 and 2/3) -- ++(0,1) -- cycle;
\foreach \r in {45,135}
\foreach \i [evaluate={\s=30;}] in {0,2,...,30}
\fill [black, fill opacity=1/50]
(0,0) -- (\r+\s-\i:2 and 2/3)
arc (\r+\s-\i:\r-\s+\i:2 and 2/3)  -- cycle;
}
},
disc bottom/.style={
code={
\foreach \i in {0,2,...,30}
\path pic {disc};
}
}
}
\begin{document}
\begin{tikzpicture}

\path (0,0) pic {disc bottom} (0,1.25) pic {disc} (0,2.5) pic {disc};

\end{tikzpicture}
\end{document}

-
this is amazing ! :) –  Raj May 5 at 14:20
Short and impressive! I added also this to the TeXample TikZ gallery. Most TikZ graphics I bookmark here are yours. –  Stefan Kottwitz Jul 29 at 21:02

I'm afraid I also could not resist giving it a shot with Asymptote. Unlike the TikZ solution, this actually uses an underlying 3d model. In particular, the "white ring" around the top emerged naturally as a result of rounding the corner, together with Asymptote's shading capabilities.

\documentclass[margin=10pt,convert]{standalone}
\usepackage{asypictureB}
\begin{document}
\begin{asypicture}{name=disk}
settings.outformat = "png";
settings.render=16;
unitsize(2cm);
import three;
import roundedpath;
currentprojection = orthographic(0,4,1);

int nslices = 20;
pen colorfunction(int u, real v) {
real t = (v/nslices)*4pi;
static pen dark = gray(0.3);
static pen light = white;
return interp(dark, light, (sin(t)+1)/2);
}

real radius = 2.0, height = 1.0;

surface disk = surface(to_revolve, c=O, axis=Z, n=nslices, color = colorfunction);
draw(disk);

pen undercolorfunction(int u, real v) {
pen overpen = colorfunction(u,v);
real r = point(to_revolve, u).y;
}

surface underdisk = surface(to_revolve, c=O, axis=Z, n=nslices, color=undercolorfunction);

draw(shift(-1.2*height*Z)*underdisk);
draw(shift(-2.4*height*Z)*underdisk);

\end{asypicture}
\end{document}

The result:

-
Added bonus is that you can embed the model into the PDF. –  bb010g May 6 at 1:39