When drawing a 2d object, it's easy to understand thy tikz works at it does: simply put the latest drawing on the top. This behavier doesn't translate so well to 3d, so is there a good way to tell tikz what object to put on top?
This:
\documentclass{standalone}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[darkstyle/.style={circle,draw,fill=gray!40,minimum size=20}]
\filldraw[fill = red!20!white,fill opacity=0.6,draw = black] (0,2,0) -- ++(0,0,3) -- ++(3,0,0) -- ++ (0,0,-3) --++(-3,0,0) -- cycle;
\filldraw[fill = red!10!white,fill opacity=0.6,draw = black] (0,2.1,0) -- ++(0,0,3) -- ++(3,0,0) -- ++ (0,0,-3) --++(-3,0,0) -- cycle;
\foreach \x in {0,...,3}
\foreach \y in {0,...,3}
\foreach \z in {0,...,3}
\filldraw[fill = white, draw = black] (\x,\y,\z) circle (5pt) ;
\end{tikzpicture}
\end{document}
gives this:
but this:
\documentclass{standalone}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[darkstyle/.style={circle,draw,fill=gray!40,minimum size=20}]
\foreach \x in {0,...,3}
\foreach \y in {0,...,3}
\foreach \z in {0,...,3}
\filldraw[fill = white, draw = black] (\x,\y,\z) circle (5pt) ;
\filldraw[fill = red!20!white,fill opacity=0.6,draw = black] (0,2,0) -- ++(0,0,3) -- ++(3,0,0) -- ++ (0,0,-3) --++(-3,0,0) -- cycle;
\filldraw[fill = red!10!white,fill opacity=0.6,draw = black] (0,2.1,0) -- ++(0,0,3) -- ++(3,0,0) -- ++ (0,0,-3) --++(-3,0,0) -- cycle;
\end{tikzpicture}
\end{document}
gives this:
Is there any good way of telling tikz
which balls to draw over the plane and which to draw under? Or even better is there a way to make tikz
know what part of every fill should be below, and which part should be above the planes? so that half of one ball could recieve the red tint wile the other stayed white?