5

I'm trying to reproduce a 3D design of a chip using TikZ in LaTeX. The design I'm aiming for resembles a multi-layered chip concept, similar to the image below (showing different components stacked on top of each other). I need this in a 3D view, keeping the original look as much as possible. I've attempted several approaches using TikZ, but the results either fall short in terms of 3D realism or produce errors like:

Package pgfkeys Error: I do not know the key '/tikz/3d view', to which you passed '{120}{30}', and I am going to ignore it. Perhaps you misspelled it.

\documentclass[14pt]{extreport}
\usepackage[lmargin=1.3in, rmargin=1in, tmargin=1in, bmargin=1in]{geometry}
\usepackage{tikz}
\usepackage{caption}
\usepackage{subcaption}

\begin{document}

\begin{figure}[h]
    \centering
    \begin{minipage}{0.32\textwidth}
        \centering
        % Simplified 3D Model for the chip
        \begin{tikzpicture}[scale=1, line join=bevel]
            % Chip base
            \fill[gray!20] (0,0) -- (4,0) -- (4,2) -- (0,2) -- cycle;
            \draw[thick] (0,0) -- (4,0) -- (4,2) -- (0,2) -- cycle;

            % Main component (large blue block on red base)
            \fill[blue!70] (0.5,0.5) -- (2.5,0.5) -- (2.5,1.5) -- (0.5,1.5) -- cycle;
            \draw[thick] (0.5,0.5) -- (2.5,0.5) -- (2.5,1.5) -- (0.5,1.5) -- cycle;
            \fill[red!50] (0.5,0.5) -- (2.5,0.5) -- (2.5,0.3) -- (0.5,0.3) -- cycle;
            \draw[thick] (0.5,0.5) -- (2.5,0.5) -- (2.5,0.3) -- (0.5,0.3) -- cycle;

            % Additional small component
            \fill[cyan!60] (3,0.5) -- (3.5,0.5) -- (3.5,1) -- (3,1) -- cycle;
            \draw[thick] (3,0.5) -- (3.5,0.5) -- (3.5,1) -- (3,1) -- cycle;
            \fill[purple!60] (3,0.5) -- (3.5,0.5) -- (3.5,0.3) -- (3,0.3) -- cycle;
            \draw[thick] (3,0.5) -- (3.5,0.5) -- (3.5,0.3) -- (3,0.3) -- cycle;

            % Bottom connectors
            \fill[red!80] (1,1.8) -- (2,1.8) -- (2,2) -- (1,2) -- cycle;
            \fill[red!80] (2.5,1.8) -- (3.5,1.8) -- (3.5,2) -- (2.5,2) -- cycle;
            \draw[thick] (1,1.8) -- (2,1.8) -- (2,2) -- (1,2) -- cycle;
            \draw[thick] (2.5,1.8) -- (3.5,1.8) -- (3.5,2) -- (2.5,2) -- cycle;
        \end{tikzpicture}
        \subcaption{a) Simplified 3D chip design}
    \end{minipage}
\end{figure}

\end{document}

While this produces a rough 2D isometric view, it does not capture the true 3D aspect I'm looking for, nor does it provide an accurate representation of the original image.

What I need:

A more detailed and accurate 3D representation. Components clearly stacked as in the original image, showing the chip layers and other elements.

enter image description hereenter image description here

5
  • 2
    Can you show an example which produces the Package pgfkeys Error: I do not know the key '/tikz/3d view', to which you passed '{120}{30}', and I am going to ignore it. Perhaps you misspelled it. error? Maybe you are just missing the necessary libraries? Commented 2 days ago
  • Such 3D wireframe models aren't provided (yet) by Tikz or its related packages. So you better look for such a simulator, export its result as pdf, svg or bitmap and include it in Latex docs via package graphicx.
    – MS-SPO
    Commented 2 days ago
  • 1
    3d realism and tikz don't really go together. that said, if you basically just need some cubes/cuboids stacked, you can do it reasonably straightforwardly, if not entirely conveniently e.g. tikz-3dplot can be used for simple cases if you are patient. it is not bug-free, but it would work OK here, I think.
    – cfr
    Commented 2 days ago
  • i) Am I correct that you want the 3D image shown at the bottom at the end of the post? ---> You then have to draw this with 3D coordinates. ii) I don't know if I understand everything correctly: But if a 3D image is to be created automatically from a 2D drawing, as far as I know, this doesn't work with TikZ (TikZ can't do magic). For this you need proper CAD software.
    – cis
    Commented 2 days ago
  • for cubes and cuboids, see tex.stackexchange.com/a/30316. this is a community-list answer. other answers to the same question may also be of interest. (it is worth following the first couple of links in the community list just to see some awesome looking cubes. disclaimer: I have an answer linked there, but mine is absolutely boring with not even a whiff of Tolkien about it.)
    – cfr
    Commented yesterday

1 Answer 1

10

There are a lot of cuboids here, so it's better to make a pic of it and use it again and again.

So something like this:

enter image description here

\documentclass[margin=2pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{backgrounds}

\definecolor{myblue}{HTML}{2E7CAA}
\definecolor{mybluegray}{HTML}{5A7890}
\definecolor{myred}{HTML}{E72B22}
\definecolor{mydarkred}{HTML}{DE5744}
\definecolor{mycyan}{HTML}{BDE2ED}
\definecolor{mydarkcyan}{HTML}{2DA5BC}
\definecolor{mypurple}{HTML}{C29DE5}
\definecolor{mybrown}{HTML}{935134}
\definecolor{mylightgray}{HTML}{D1D6D9}

\begin{document}
\begin{tikzpicture}[
z={({0.5cm*cos(45)},{0.5cm*sin(45)})},
% Cuboid ===============
pics/cuboid/.style n args={5}{
code={%%
\coordinate(A1) at (0,0);
\coordinate(B1) at (#1,0);
\coordinate(C1) at (#1,#2);
\coordinate(D1) at (0,#2);
\coordinate(B2) at (#1,0,#3);
\coordinate(C2) at (#1,#2,#3);
\coordinate(D2) at (0,#2,#3);
\path[draw=#4, fill=#5] (B1) -- (B2) -- (C2) -- (C1);
\path[draw=#4, fill=#5] (A1) rectangle (C1); 
\path[draw=#4, fill=#5] (D1) -- (C1) -- (C2) -- (D2) --cycle;
},%%
},% ==================
background rectangle/.style={draw=none, fill=mylightgray}, 
show background rectangle,
]

\draw (0.5,0,1.75) pic {cuboid={2}{0.5}{3}{mydarkred}{myred!66}};
\draw[] (0.75,0.5,2) pic {cuboid={1.5}{0.25}{2.5}{mybluegray}{myblue!77}};

\draw (2.5,0,3) pic {cuboid={1.25}{0.25}{2}{mydarkcyan}{mycyan}};
\draw (2.5,0.25,3) pic {cuboid={1.25}{0.25}{2}{mydarkcyan}{mycyan}};

\draw (3.125,0.5,3.25) pic {cuboid={0.5}{0.125}{1}{mybrown}{mypurple}};

\pic[thick]{cuboid={5}{0.5}{6}{mybrown}{none}};

\draw (0.5,0,0) pic {cuboid={1.25}{0}{1}{mybrown}{mybrown}};
\draw (0.75,0,0) pic {cuboid={0.25}{0.05}{1}{myred}{myred}};
\draw (1.25,0,0) pic {cuboid={0.25}{0.05}{1}{myred}{myred}};

\draw (2.5,0,0) pic {cuboid={1.25}{0}{1}{mybrown}{mybrown}};
\draw (2.75,0,0) pic {cuboid={0.25}{0.05}{1}{myred}{myred}};
\draw (3.25,0,0) pic {cuboid={0.25}{0.05}{1}{myred}{myred}};

%% CoSy
\begin{scope}[-latex, shift={(0,2)},thick]
\foreach \P/\s/\Pos in {(1,0,0)/x/above, (0,1,0)/y/right, (0,0,1)/z/right} 
\draw[] (0,0,0) -- \P node[\Pos, pos=0.9,inner sep=2pt]{$\s$};
\end{scope}
\end{tikzpicture}
\end{document}
1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .