\documentclass{standalone} \usepackage{tikz} \usepackage{grid} \begin{document} \begin{tikzpicture} % the positions of the smoothing cubes \def\smoothingsquares{(0,0),(4,4),(-4,0),(-4,4),(-8,4),(-4,8),(0,12),(4,8),(12,12),(12,8),(16,4)} % the positions of the bad cubes \def\badsquares{(-0.5,0),(-1.5,0),(-2,0),(-0.5,0.5),(-1.5,0.5),(-2,0.5),(-7,4.5),(-7,5.5),(-6,4.5),(-6,5.5),(-5.5,5.5),(-5.5,5),(-5,7.5),(-5.5,7.5),(-5.5,8),(-5,8),(0,10.5),(-0.5,10.5),(0,11),(-0.5,11),(3.5,5.5),(4,5.5),(4,6),(3.5,6),(10.5,8.5),(10.5,9.5),(10.5,10.5),(10.5,11.5),(10.5,12),(11.5,12),(12.5,12),(12.5,11),(12.5,10),(12,9),(11.5,8.5),(12,9.5),(15,4),(16,4),(16,3),(15,3)} % first fill the smearings \foreach\pos in\smoothingsquares{ \fillsquare{\pos}5{blue} } % fill the smoothing cubes \foreach\pos in\smoothingsquares{ \fillsquare{\pos}4{gray} } % fill the bad cubes \foreach\pos in\badsquares{ \fillsquare{\pos}{1}{green} } % draw grid \grid{(-11,-3)}{0.5}{60}{36} % stroke the smoothing squares \foreach\pos in\smoothingsquares{ \square{\pos}4 } \end{tikzpicture} \end{document}