Intersection of 3 planes

UPDATE: Since this is a repeating question, I tried to improve on this. So far one had to order the elements of the drawing by hand. Examples of this type can be found in the lower parts of this answer. One may wonder if it is possible to let TikZ decide in which order to draw things. The answer is yes. Here is something that can be thought of as a proof of principle.

  1. The drawing order depends on the distance of the object. The distance may be defined as the projection of the barycenter of the object on the normal of the screen.
  2. In order to compute these projections, we need some tools. The tools I am using here are from the experimental library 3dtools, which can be found here. You need to save the library as tikzlibrary3dtools.code.tex and put it somewhere where TeX can find it, such as the same folder as the document below.
  3. Given the projections we can establish an ordering and draw the stuff in the respective layer.

At this point, you still need to find out what the intersection pieces are by hand. As I said, this is a proof of principle. pgfplots offers something very similar with patchplots.

\documentclass[tikz,border=3mm]{standalone}
\usepackage{tikz-3dplot}
\usetikzlibrary{3dtools}
\begin{document}
% define a command for the projections (to become a part of the library)
\newcommand\GetProj[2]{\begingroup
\foreach \Coord [count=\nCoord] in #1
  {\ifnum\nCoord=1
  \xdef\temp{\Coord}
  \else
  \xdef\temp{\temp+\Coord}
  \fi}
  \edef\ntemp{\noexpand\path[overlay,3d coordinate={(tmp)=\temp}];}
  \ntemp
  \pgfmathsetmacro{#2}{TD("(n)o(tmp)")}
  \pgfmathsmuggle#2\endgroup}
% counter for 3d ordering  
\newcounter{tdorder}
% set a sufficient number of layers (for more complex scenarios you need more)
\foreach \X in {1,...,20}
{\pgfdeclarelayer{layer\X}
\ifnum\X=1
\xdef\LstLayers{layer\X}
\else
\xdef\LstLayers{\LstLayers,layer\X}
\fi}
\pgfsetlayers\LstLayers
\tikzset{closed polygon/.style={insert path={foreach \Coord [count=\nCoord] in {#1}
 {\ifnum\nCoord=1
  \Coord
 \else
  -- \Coord
 \fi} -- cycle}},polygon/.style={insert path={foreach \Coord [count=\nCoord] in {#1}
 {\ifnum\nCoord=1
  \Coord
 \else
  -- \Coord
 \fi}}}}
% main code
\foreach \X in {5,15,...,355}
{\tdplotsetmaincoords{90+30*sin(\X)}{\X}
\begin{tikzpicture}[tdplot_main_coords,font=\sffamily,fill opacity=1]
  \path[tdplot_screen_coords,use as bounding box] (-5,-5) rectangle (5,5);
  % define the vertices (there are certainly superior naming conventions)
  \path (-3,-3,0)  coordinate (m1) (-3,0,-3) coordinate (m2)
   (-3,0,0)  coordinate (m3) (-3,0,3) coordinate (m4) (-3,3,0)  coordinate (m5)
   (-2,-3,3) coordinate (m6) (-2,0,3)  coordinate (m7) (-2,3,3) coordinate (m8)
   (0,-3,0) coordinate (m9) (0,0,0) coordinate (O) (0,3,0) coordinate (p1)
   (2,-3,-3) coordinate (p2) (2,0,-3) coordinate (p3) (2,3,-3) coordinate (p4)
   (3,-3,0) coordinate (p5) (3,0,-3) coordinate (p6) (3,0,0) coordinate (p7)
   (3,0,3) coordinate (p8) (3,3,0) coordinate (p9);
  % define the plane data as a list of <drawing options>/<shape>/<vertices> 
  \def\PlaneData{%
  {draw,fill=red}/closed polygon/{(m2),(p3),(O),(m3)},%
  {draw,fill=red}/closed polygon/{(p6),(p3),(O),(p7)},%
  {draw,fill=red}/closed polygon/{(m4),(m7),(O),(m3)},%
  {draw,fill=red}/closed polygon/{(p8),(m7),(O),(p7)},%
  {draw,fill=blue}/closed polygon/{(m1),(m3),(O),(m9)},%
  {draw,fill=blue}/closed polygon/{(m5),(m3),(O),(p1)},%
  {draw,fill=blue}/closed polygon/{(p5),(p7),(O),(m9)},%
  {draw,fill=blue}/closed polygon/{(p9),(p7),(O),(p1)},%
  {draw,fill=green}/closed polygon/{(m6),(m9),(O),(m7)},%
  {draw,fill=green}/closed polygon/{(m8),(p1),(O),(m7)},%
  {draw,fill=green}/closed polygon/{(p2),(m9),(O),(p3)},%
  {draw,fill=green}/closed polygon/{(p4),(p1),(O),(p3)},%
  {draw,thick}/polygon/{(m3),(O)},%
  {draw,thick}/polygon/{(O),(p7)}}
  % normal of screen (last row of the rotation matrix)
  \path[overlay] ({sin(\tdplotmaintheta)*sin(\tdplotmainphi)},
       {-1*sin(\tdplotmaintheta)*cos(\tdplotmainphi)},
       {cos(\tdplotmaintheta)}) coordinate (n); 
  % build up the list of projections       
  \foreach \Style/\Poly/\CoordLst [count=\nC] in \PlaneData
  {%
  \GetProj{\CoordLst}{\currproj}
  \ifnum\nC=1
    \xdef\LstProj{\currproj}
  \else
    \xdef\LstProj{\LstProj,\currproj}
  \fi}
  % draw the planes in appropriate layers
  \foreach \Style/\Poly/\CoordLst [count=\nC] in \PlaneData
  {%
  \GetProj{\CoordLst}{\currproj}
  \setcounter{tdorder}{1}
  \foreach \Proj in \LstProj
  {\pgfmathtruncatemacro{\itest}{ifthenelse(\Proj<\currproj,1,0)}
  \ifnum\itest=1
  \stepcounter{tdorder}
  \fi}
  \begin{pgfonlayer}{layer\number\value{tdorder}}
  \edef\temp{\noexpand\path[\Style,\Poly={\CoordLst}];}
  \temp
  \end{pgfonlayer}
  }
%   
\end{tikzpicture}}
\end{document}

enter image description here

Needless to say that this can be applied to other scenarios that intersecting D-branes.

\documentclass[tikz,border=3mm]{standalone}
\usepackage{tikz-3dplot}
\usetikzlibrary{3dtools}
\begin{document}
\newcommand\GetProj[2]{\begingroup
\foreach \Coord [count=\nCoord] in #1
  {\ifnum\nCoord=1
  \xdef\temp{\Coord}
  \else
  \xdef\temp{\temp+\Coord}
  \fi}
  \edef\ntemp{\noexpand\path[overlay,3d coordinate={(tmp)=\temp}];}
  \ntemp
  \pgfmathsetmacro{#2}{TD("(n)o(tmp)")}
  \pgfmathsmuggle#2\endgroup}
\newcounter{tdorder}
\foreach \X in {1,...,20}
{\pgfdeclarelayer{layer\X}
\ifnum\X=1
\xdef\LstLayers{layer\X}
\else
\xdef\LstLayers{\LstLayers,layer\X}
\fi}
\pgfsetlayers\LstLayers
\tikzset{closed polygon/.style={insert path={foreach \Coord [count=\nCoord] in {#1}
 {\ifnum\nCoord=1
  \Coord
 \else
  -- \Coord
 \fi} -- cycle}},polygon/.style={insert path={foreach \Coord [count=\nCoord] in {#1}
 {\ifnum\nCoord=1
  \Coord
 \else
  -- \Coord
 \fi}}}}
%
\foreach \X in {5,15,...,355}
{\tdplotsetmaincoords{90-30*cos(\X)}{\X}
\begin{tikzpicture}[tdplot_main_coords,font=\sffamily,fill opacity=1]
  \path[tdplot_screen_coords,use as bounding box] (-5,-5) rectangle (5,5);
  \path foreach \X [count=\cX] in {A,B}
   {foreach \Y [count=\cY] in {A,B}
   {foreach \Z [count=\cZ] in {A,B}
   {(4.5-3*\cX,4.5-3*\cY,4.5-3*\cZ) coordinate(\X\Y\Z)}}}
   (0,0,4.5) coordinate (T);
  \def\PlaneData{%
  {draw,fill=red}/closed polygon/{(AAA),(ABA),(ABB),(AAB)},%
  {draw,fill=red!80}/closed polygon/{(ABA),(BBA),(BBB),(ABB)},%
  {draw,fill=red!50}/closed polygon/{(BBA),(BAA),(BAB),(BBB)},%
  {draw,fill=red!70}/closed polygon/{(BAA),(AAA),(AAB),(BAB)},%
  {draw,fill=blue}/closed polygon/{(AAA),(ABA),(T)},%
  {draw,fill=blue!80}/closed polygon/{(ABA),(BBA),(T)},%
  {draw,fill=blue!50}/closed polygon/{(BBA),(BAA),(T)},%
  {draw,fill=blue!70}/closed polygon/{(BAA),(AAA),(T)},%
  {draw,fill=gray}/closed polygon/{(AAB),(ABB),(BBB),(BAB)},%
  {draw,thick}/polygon/{(AAA),(AAB)}}
  % normal of screen 
  \path[overlay] ({sin(\tdplotmaintheta)*sin(\tdplotmainphi)},
       {-1*sin(\tdplotmaintheta)*cos(\tdplotmainphi)},
       {cos(\tdplotmaintheta)}) coordinate (n); 
  % build up the list of projections       
  \foreach \Style/\Poly/\CoordLst [count=\nC] in \PlaneData
  {%
  \GetProj{\CoordLst}{\currproj}
  \ifnum\nC=1
    \xdef\LstProj{\currproj}
  \else
    \xdef\LstProj{\LstProj,\currproj}
  \fi}
  % draw the planes in appropriate layers
  \foreach \Style/\Poly/\CoordLst [count=\nC] in \PlaneData
  {%
  \GetProj{\CoordLst}{\currproj}
  \setcounter{tdorder}{1}
  \foreach \Proj in \LstProj
  {\pgfmathtruncatemacro{\itest}{ifthenelse(\Proj<\currproj,1,0)}
  \ifnum\itest=1
  \stepcounter{tdorder}
  \fi}
  \begin{pgfonlayer}{layer\number\value{tdorder}}
  \edef\temp{\noexpand\path[\Style,\Poly={\CoordLst}];}
  \temp
  \end{pgfonlayer}
  }
%   
\end{tikzpicture}}
\end{document}

enter image description here

OLDER ANSWER: You need to draw the pieces of the planes in the right order. For the given view in your case this is

\documentclass[tikz,border=3mm]{standalone}
\usepackage{tikz-3dplot}
\begin{document}
\tdplotsetmaincoords{70}{110}
\foreach \X in {0.1,0.2,...,1,0.9,0.8,...,0.2}
{\begin{tikzpicture}[tdplot_main_coords,font=\sffamily,fill opacity=\X]
  \draw[fill=red] (-3,0,-3)  -- (2,0,-3) -- (0,0,0) -- (-3,0,0) -- cycle;
   \draw[thick](-3,0,0) -- (0,0,0);
  \draw[fill=blue] (-3,-3,0) -- (-3,3,0) -- (0,3,0) -- (0,-3,0) -- cycle;
  \draw[fill=red] (-3,0,0) -- (0,0,0) --  (-2,0,3) -- (-3,0,3) -- cycle;
  \draw[fill=green] (2,-3,-3) -- (2,3,-3) -- (-2,3,3) -- (-2,-3,3) -- cycle;
  \draw[fill=red] (3,0,-3)  -- (2,0,-3) -- (0,0,0) -- (3,0,0) -- cycle;
  \draw[fill=blue] (3,-3,0) -- (3,3,0) -- (0,3,0) -- (0,-3,0) -- cycle;% %\draw (0,-3,0) -- (0,3,0);
  \draw[fill=red] (3,0,0) -- (0,0,0) --  (-2,0,3) -- (3,0,3) -- cycle;
  \draw[thick](0,0,0)--(3,0,0);
  \fill[red] (0,0,0) circle (3pt);
  \node[anchor=south west,align=center] (line) at (4,6,3.5) 
   {Solution\\ intersection};
  \draw[-latex] (line) to[out=180,in=75] (0.05,0.05,0.1);
\end{tikzpicture}}
\end{document}

enter image description here

You need to select your favorite fill opacity from the loop.

Here is an alternative way to make intersecting planes fully rotatable.

enter image description here

You "only" need to distinguish enough cases.

ADDENDUM: As for your request in the comments: the strategy is precisely the same as above.

\documentclass[tikz,border=3mm]{standalone}
\usepackage{tikz-3dplot}
\begin{document}
\tdplotsetmaincoords{70}{110}
\foreach \X in {0.1,0.2,...,1,0.9,0.8,...,0.2}
{\begin{tikzpicture}[tdplot_main_coords,font=\sffamily,fill opacity=\X]
 \draw[fill=red] (-3,0,-3) -- (-3,0,0) -- (3,0,0) -- (3,0,-3) --  cycle;
 \draw[fill=green] (-3,2,-3) -- (-3,0,0) -- (3,0,0) -- (3,2,-3)  -- cycle;
 \draw[fill=blue] (-3,-3,0) -- (-3,3,0) -- (3,3,0) -- (3,-3,0) --  cycle;
 \draw[fill=green] (-3,-2,3) -- (-3,0,0) -- (3,0,0) -- (3,-2,3)  -- cycle;
 \draw[fill=red] (-3,0,3) -- (-3,0,0) -- (3,0,0) -- (3,0,3) --  cycle;
 \draw[thick](-3,0,0)--(3,0,0);
 \fill[red] (0,0,0) circle (3pt);
 \node[anchor=south west,align=center,text opacity=1] (line) at (4,6,3.5) {Solution\\ 
    intersection};
 \draw[-latex] (line) to[out=180,in=75] (0.05,0.05,0.1);
\end{tikzpicture}}
\end{document}

enter image description here