dynamic clipping plane with TikZ

i have a problem with TikZ. I'd like to draw a dynamic clipping-plane. the top of the red area is dynamic, the blue one should be the same high/level but much larger dimension... to seperate optical from the red area. some ideas?

Update I added another picture to make my point clear. the blue square should fit perfect on top of the red frustum. it should be dynamic, so if i change the hight of the frustum, the blue square will move as well. My problem is that the height of the red frustum is a part of the ray from the viewpoint to the bottom. if it possible to give a parameter for height wich fit in the perspektive and the ray, that would solve the problem as well i think.

\begin{tikzpicture}[scale=1]
\usetikzlibrary{calc}
%%% Parameter %%%
\pgfmathsetmacro{\frameHeight}{8}
\pgfmathsetmacro{\frameWidth}{0.92}
\pgfmathsetmacro{\frameDepth}{0.87}
\pgfmathsetmacro{\viewpointDepth}{0.5}
\pgfmathsetmacro{\viewpointCentering}{0.5}
\pgfmathsetmacro{\projectionHeight}{0.36}
\pgfmathsetmacro{\projectionWidth}{0.96}
\pgfmathsetmacro{\projectionDepth}{0.07}
% Fluchtpunkte
\coordinate (F1) at (30:50cm);
\coordinate (F2) at (150:50cm);
% Eckpunkte
\coordinate (P1) at (0cm,0cm);                  % v U
\coordinate (P2) at (0cm,\frameHeight);     % v O
\coordinate (P3) at ($(F1)!\frameDepth!(P1)$);  % h U
\coordinate (P4) at ($(F1)!\frameDepth!(P2)$);  % h O
\coordinate (P5) at ($(F2)!\frameWidth!(P1)$);
\coordinate (P6) at ($(F2)!\frameWidth!(P2)$);
\coordinate (P7) at (intersection cs: first line={(P5) -- (F1)}, second line={(P3) -- (F2)});
\coordinate (P8) at (intersection cs: first line={(P6) -- (F1)}, second line={(P4) -- (F2)});
\coordinate (P9) at ($(P2)!\viewpointDepth!(P4)$);
\coordinate (P10) at (intersection cs: first line={(P9) -- (F2)}, second line={(P6) -- (P8)});
% Sichtfeld
\coordinate (A) at ($(P5)!\projectionWidth!(P1)$);
\coordinate (B) at ($(P1)!\projectionWidth!(P5)$);
\coordinate (C) at ($(A)!\projectionDepth!(F1)$);
\coordinate (D) at (intersection cs: first line={(C) -- (F2)}, second line={(B) -- (F1)});
\coordinate (V) at ($(P9)!\viewpointCentering!(P10)$);
% Nutzfläche Schnitt
\coordinate (E) at ($(A)!\projectionHeight!(V)$);
\coordinate (F) at (intersection cs: first line={(E) -- (F2)}, second line={(V) -- (B)});
\coordinate (G) at (intersection cs: first line={(E) -- (F1)}, second line={(V) -- (C)});
\coordinate (H) at (intersection cs: first line={(F) -- (F1)}, second line={(V) -- (D)});
% nutz Sichtfeld Ebene
\coordinate (P11) at ($(E)$); %({(E)--(F2)}:2);
\coordinate (P12) at ($(F)$);
\coordinate (P13) at ($(G)$);
\coordinate (P14) at ($(H)$);
% real Sichtfeld Ebene
\coordinate (P15) at (0, -1);
\coordinate (P16) at ($(P15)!0.115!(F2)$);
\coordinate (P17) at ($(F1)!0.835!(P15)$);
\coordinate (P18) at (intersection cs: first line={(P16) -- (F1)}, second line={(P17) -- (F2)});
%Linien
\draw[rounded corners, draw=black!80, fill=yellow!80, opacity=0.5] (P15) -- (P16) -- (P18) -- (P17)  -- cycle;
% Tiefe / Verlauf
\begin{scope}[opacity=0.2]
\shade[top color=gray!70,bottom color=gray!5] (P1) -- (P3) -- (P7) -- (P5);
\shade[right color=gray!70,left color=gray!5] (P5) -- (P6) -- (P8) -- (P7);
\shade[left color=gray!70,right color=gray!5] (P7) -- (P3) -- (P4) -- (P8);
\end{scope}
% Sichtfeld der Kamera
\fill [red!80, opacity=0.4] (A) -- (B) -- (D) -- (C);
\begin{scope}[thin, dashed, red]%thick, dashed, fill=red!80, opacity=1]
\draw (A) -- (V);
\draw (B) -- (V);
\draw (C) -- (V);
\draw (D) -- (V);
\end{scope}
\begin{scope}[red]
\draw (A) -- (E);
\draw (B) -- (F);
\draw (D) -- (H);
\draw (C) -- (G);
\end{scope}
\draw [thin, red] (A) -- (B) -- (D) -- (C) -- (A);
\draw [thin, red] (E) -- (F) -- (H) -- (G) -- (E);
%\draw [thick, red!80] (
\begin{scope}[red!80, opacity=0.1]
\fill (A) -- (B) -- (F) -- (E);
\fill (C) -- (A) -- (E) -- (G);
\fill (D) -- (C) -- (G) -- (H);
\fill (B) -- (D) -- (H) -- (F);
\end{scope}
\draw[rounded corners, draw=black!80, fill=blue!80, opacity=0.5] (P11) -- (P12) -- (P14) -- (P13) -- cycle;
% Frame
\begin{scope}[thin, opacity=0.6]
\draw (P1) -- (P3) -- (P4) -- (P2) -- (P1) ;
\draw (P1) -- (P5) -- (P6) -- (P2) -- (P1) ;
\draw (P2) -- (P6) -- (P8) -- (P4) -- (P2) ;
\draw (P3) -- (P7) -- (P8) -- (P4) -- (P3) ;
\draw (P1) -- (P5) -- (P7) -- (P3) -- (P1) ;
\end{scope}
\draw[thin,dashed] (P9) -- (P10);
% Verbindungspunkte
\foreach \i in {1,2,...,10}
{
\shade[shading=ball, ball color=black!80] (P\i) circle (0.05em) node[above right] {}; %\tiny \i};
}
\foreach \i in {A, B,...,H}
{
\shade[shading=ball, ball color=red] (\i) circle (0.05em) node[above right] {}; %\tiny \i};
}
%Beschriftung
%\draw[fill=red] (V) circle (0.25em) node[above right] {\tiny Viewpoint};
\shade[shading=ball, ball color=red] (V) circle (0.25em) node[above right] {\tiny Betrachtungspunkt};
\draw[] (4.75,0.8) to[out=90,in=-90] (0.75,2);
\draw (4.75,0.5) node[] {\footnotesize nutzbares Sichtfeld};
\draw[] (-5.5,4.3) to[out=90,in=-90] (-0.5,4.5);
\draw (-5.5,4) node[] {\footnotesize unterer Schwellwert};
\draw[] (-5.5,0.8) to[out=90,in=-90] (-3,1.4);
\draw (-5.5,0.5) node[] {\footnotesize oberer Schwellwert};
\end{tikzpicture}  • Welcome to LaTeX! As new user without image posting privileges simply include the image as normal and remove the ! in front of it to turn it into a link. A moderator or another user with edit privileges can then reinsert the ! to turn it into an image again until you get more rep points. – percusse Aug 29 '12 at 11:47
• That's a pretty impressive picture! I'm not sure I understand your question though. When you say "the red area", do you mean the red square that's lying on the yellow surface? What do you mean by "the top of the red area"? What do you mean with "much larger dimension"? A larger extent of the blue (or purplish) square? – Jake Aug 29 '12 at 13:04
• sorry, my english is not that good, basicly there is the red frustum. on top of that is the blue square. actualy the points are the same (see in code (E-H)src --> (P11-P14)). i'd like to have the blue(P11-P14) square with same dimension as the yellow in the high of frustum for example... clear? i dont know how to calculate the corners – Alex Aug 29 '12 at 13:41
• I really don't understand what you're asking. As you labeled your picture in german, would you mind appending a small section to your question where you explain it in german? – Tom Bombadil Aug 29 '12 at 14:56
• @Alex: If I understand correctly, you could define a new set of points using \coordinate (P15') at (0, \projectionHeight*\frameHeight); \coordinate (P16') at ($(P15')!0.115!(F2)$); \coordinate (P17') at ($(F1)!0.835!(P15')$); \coordinate (P18') at (intersection cs: first line={(P16') -- (F1)}, second line={(P17') -- (F2)}); (note the definition of (P15') and draw a rectangle in the same manner as for the yellow rectangle? – Jake Aug 29 '12 at 14:58

Is this what you want (changing the \projectionHeight value will move the frustum and the plane together)? \documentclass{report}
\usepackage[T1]{fontenc}

\usepackage{pgfplots}
\usetikzlibrary{intersections}

\begin{document}

\begin{tikzpicture}[scale=1]
\usetikzlibrary{calc}
%%% Parameter %%%
\pgfmathsetmacro{\frameHeight}{8}
\pgfmathsetmacro{\frameWidth}{0.92}
\pgfmathsetmacro{\frameDepth}{0.87}
\pgfmathsetmacro{\viewpointDepth}{0.5}
\pgfmathsetmacro{\viewpointCentering}{0.5}
\pgfmathsetmacro{\projectionHeight}{0.5}
\pgfmathsetmacro{\projectionWidth}{0.96}
\pgfmathsetmacro{\projectionDepth}{0.07}
% Fluchtpunkte
\coordinate (F1) at (30:50cm);
\coordinate (F2) at (150:50cm);
% Eckpunkte
\coordinate (P1) at (0cm,0cm);                  % v U
\coordinate (P2) at (0cm,\frameHeight);     % v O
\coordinate (P3) at ($(F1)!\frameDepth!(P1)$);  % h U
\coordinate (P4) at ($(F1)!\frameDepth!(P2)$);  % h O
\coordinate (P5) at ($(F2)!\frameWidth!(P1)$);
\coordinate (P6) at ($(F2)!\frameWidth!(P2)$);
\coordinate (P7) at (intersection cs: first line={(P5) -- (F1)}, second line={(P3) -- (F2)});
\coordinate (P8) at (intersection cs: first line={(P6) -- (F1)}, second line={(P4) -- (F2)});
\coordinate (P9) at ($(P2)!\viewpointDepth!(P4)$);
\coordinate (P10) at (intersection cs: first line={(P9) -- (F2)}, second line={(P6) -- (P8)});
% Sichtfeld
\coordinate (A) at ($(P5)!\projectionWidth!(P1)$);
\coordinate (B) at ($(P1)!\projectionWidth!(P5)$);
\coordinate (C) at ($(A)!\projectionDepth!(F1)$);
\coordinate (D) at (intersection cs: first line={(C) -- (F2)}, second line={(B) -- (F1)});
\coordinate (V) at ($(P9)!\viewpointCentering!(P10)$);
% Nutzfläche Schnitt
\coordinate (E) at ($(A)!\projectionHeight!(V)$);
\coordinate (F) at (intersection cs: first line={(E) -- (F2)}, second line={(V) -- (B)});
\coordinate (G) at (intersection cs: first line={(E) -- (F1)}, second line={(V) -- (C)});
\coordinate (H) at (intersection cs: first line={(F) -- (F1)}, second line={(V) -- (D)});
% nutz Sichtfeld Ebene
\coordinate (P11) at ($(E)$); %({(E)--(F2)}:2);
\coordinate (P12) at ($(F)$);
\coordinate (P13) at ($(G)$);
\coordinate (P14) at ($(H)$);
% real Sichtfeld Ebene
\coordinate (P15) at (0, -1);
\coordinate (P16) at ($(P15)!0.115!(F2)$);
\coordinate (P17) at ($(F1)!0.835!(P15)$);
\coordinate (P18) at (intersection cs: first line={(P16) -- (F1)}, second line={(P17) -- (F2)});
\coordinate (P15') at (0, \projectionHeight*\frameHeight);
\coordinate (P16') at ($(P15')!0.115!(F2)$);
\coordinate (P17') at ($(F1)!0.835!(P15')$);
\coordinate (P18') at (intersection cs: first line={(P16') -- (F1)}, second line={(P17') -- (F2)});
%Linien
\draw[rounded corners, draw=black!80, fill=yellow!80, opacity=0.5] (P15) -- (P16) -- (P18) -- (P17)  -- cycle;
\draw[rounded corners, draw=black!80, fill=cyan!80, opacity=0.5] (P15') -- (P16') -- (P18') -- (P17')  -- cycle;
% Tiefe / Verlauf
\begin{scope}[opacity=0.2]
\shade[top color=gray!70,bottom color=gray!5] (P1) -- (P3) -- (P7) -- (P5);
\shade[right color=gray!70,left color=gray!5] (P5) -- (P6) -- (P8) -- (P7);
\shade[left color=gray!70,right color=gray!5] (P7) -- (P3) -- (P4) -- (P8);
\end{scope}
% Sichtfeld der Kamera
\fill [red!80, opacity=0.4] (A) -- (B) -- (D) -- (C);
\begin{scope}[thin, dashed, red]%thick, dashed, fill=red!80, opacity=1]
\draw (A) -- (V);
\draw (B) -- (V);
\draw (C) -- (V);
\draw (D) -- (V);
\end{scope}
\begin{scope}[red]
\draw (A) -- (E);
\draw (B) -- (F);
\draw (D) -- (H);
\draw (C) -- (G);
\end{scope}
\draw [thin, red] (A) -- (B) -- (D) -- (C) -- (A);
\draw [thin, red] (E) -- (F) -- (H) -- (G) -- (E);
%\draw [thick, red!80] (
\begin{scope}[red!80, opacity=0.1]
\fill (A) -- (B) -- (F) -- (E);
\fill (C) -- (A) -- (E) -- (G);
\fill (D) -- (C) -- (G) -- (H);
\fill (B) -- (D) -- (H) -- (F);
\end{scope}
% Frame
\begin{scope}[thin, opacity=0.6]
\draw (P1) -- (P3) -- (P4) -- (P2) -- (P1) ;
\draw (P1) -- (P5) -- (P6) -- (P2) -- (P1) ;
\draw (P2) -- (P6) -- (P8) -- (P4) -- (P2) ;
\draw (P3) -- (P7) -- (P8) -- (P4) -- (P3) ;
\draw (P1) -- (P5) -- (P7) -- (P3) -- (P1) ;
\end{scope}
\draw[thin,dashed] (P9) -- (P10);
% Verbindungspunkte
\foreach \i in {1,2,...,10}
{
\shade[shading=ball, ball color=black!80] (P\i) circle (0.05em) node[above right] {}; %\tiny \i};
}
\foreach \i in {A, B,...,H}
{
\shade[shading=ball, ball color=red] (\i) circle (0.05em) node[above right] {}; %\tiny \i};
}
%Beschriftung
%\draw[fill=red] (V) circle (0.25em) node[above right] {\tiny Viewpoint};
\shade[shading=ball, ball color=red] (V) circle (0.25em) node[above right] {\tiny Betrachtungspunkt};
\draw[] (4.75,0.8) to[out=90,in=-90] (0.75,2);
\draw (4.75,0.5) node[] {\footnotesize nutzbares Sichtfeld};
\draw[] (-5.5,4.3) to[out=90,in=-90] (-0.5,4.5);
\draw (-5.5,4) node[] {\footnotesize unterer Schwellwert};
\draw[] (-5.5,0.8) to[out=90,in=-90] (-3,1.4);
\draw (-5.5,0.5) node[] {\footnotesize oberer Schwellwert};
\end{tikzpicture}

\end{document}
• right, basicly thats the final goal. as you can see in your picture, that the height of the blue square and red frustum is NOT on the same level... this is because there are 2 messurements.. one along the ray, one along the pole of the frame – Alex Aug 29 '12 at 15:36
• @Alex: Aber die sind doch auf der gleichen Höhe. Wenn du \projectionHeight auf 0 setzt, liegt die blaue Fläche auf dem Boden des Kastens, bei 1 liegt sie auf dem Deckel des Kastens. Die Ecke die dem Betrachter am nächsten ist, fällt dabei bei der blauen Fläche und dem Kasten zusammen. Das tut sie bei der gelben Fläche auch, aber weil du die auf z=-1 gesetzt hast, sieht das nicht so aus. – Jake Aug 29 '12 at 15:39
• @Alex: Bzgl. "2 messurements.. one along the ray, one along the pole of the frame": Die sind aber äquivalent, weil du ja eine relative Länge benutzt. Entlang des Strahls ist es \projectionHeight*<Länge des Strahls>, entlang der Kastenkante ist es \projectionHeight*\frameHeight. – Jake Aug 29 '12 at 15:49
• hmm, aber \projectionHeight bezieht sich doch auf den Strahl von V nach A... also wenn ich den Punkt V nach ganz hinten links in die Ecke schiebe ist er länger als die Höhe des Rahmens und somit passt es nicht richtig. Das geht nur so grob auf weil die Diagonale nicht sooo großartig länger ist. Falsch? – Alex Aug 29 '12 at 16:08
• @Alex: Ja, falsch, weil es eben eine relative Angabe ist. Der Punkt mit der \projectionHeight=0 auf dem Strahl von V nach A (oder korrekter von A nach V) ist Punkt A, der Punkt mit der \projectionHeight=1 ist Punkt V. Die Höhe des Punktes mit der \projectionHeight=0.5 liegt genau auf der halben Höhe zwischen der Boden- und Deckelfläche des Kastens. – Jake Aug 29 '12 at 16:12

Final Solution. Thanks @all

\begin{tikzpicture}[scale=0.9]
\usetikzlibrary{calc}
%%% Parameter %%%
\pgfmathsetmacro{\frameHeight}{8}
\pgfmathsetmacro{\frameWidth}{0.92}
\pgfmathsetmacro{\frameDepth}{0.87}
\pgfmathsetmacro{\viewpointDepth}{0.5}
\pgfmathsetmacro{\viewpointCentering}{0.6}
\pgfmathsetmacro{\projectionHeight}{0.36}
\pgfmathsetmacro{\projectionWidth}{0.96}
\pgfmathsetmacro{\projectionDepth}{0.07}
\pgfmathsetmacro{\clippingPlaneHeight}{0.1}
\pgfmathsetmacro{\clippingPlaneWidth}{0.91}
%%%%%%%%%%%%
%%%%%%%%%%%%
% Fluchtpunkte
\coordinate (F1) at (30:50cm);
\coordinate (F2) at (150:50cm);
% Eckpunkte
\coordinate (P1) at (0cm,0cm);                  % v U
\coordinate (P2) at (0cm,\frameHeight);     % v O
\coordinate (P3) at ($(F1)!\frameDepth!(P1)$);  % h U
\coordinate (P4) at ($(F1)!\frameDepth!(P2)$);  % h O
\coordinate (P5) at ($(F2)!\frameWidth!(P1)$);
\coordinate (P6) at ($(F2)!\frameWidth!(P2)$);
\coordinate (P7) at (intersection cs: first line={(P5) -- (F1)}, second line={(P3) -- (F2)});
\coordinate (P8) at (intersection cs: first line={(P6) -- (F1)}, second line={(P4) -- (F2)});
\coordinate (P9) at ($(P2)!\viewpointDepth!(P4)$);
\coordinate (P10) at (intersection cs: first line={(P9) -- (F2)}, second line={(P6) -- (P8)});
% Sichtfeld
\coordinate (A) at ($(P5)!\projectionWidth!(P1)$);
\coordinate (B) at ($(P1)!\projectionWidth!(P5)$);
\coordinate (C) at ($(A)!\projectionDepth!(F1)$);
\coordinate (D) at (intersection cs: first line={(C) -- (F2)}, second line={(B) -- (F1)});
\coordinate (V) at ($(P9)!\viewpointCentering!(P10)$);
% Nutzfläche Schnitt
\coordinate (E) at ($(A)!\projectionHeight!(V)$);
\coordinate (F) at (intersection cs: first line={(E) -- (F2)}, second line={(V) -- (B)});
\coordinate (G) at (intersection cs: first line={(E) -- (F1)}, second line={(V) -- (C)});
\coordinate (H) at (intersection cs: first line={(F) -- (F1)}, second line={(V) -- (D)});
% nutz Sichtfeld Ebene
\coordinate (P11) at (0, \projectionHeight*\frameHeight-0.5);
\coordinate (P12) at ($(P11)!\clippingPlaneHeight!(F2)$);
\coordinate (P13) at ($(F1)!\clippingPlaneWidth!(P11)$);
\coordinate (P14) at at (intersection cs: first line={(P12) -- (F1)}, second line={(P13) -- (F2)});
% real Sichtfeld Ebene
\coordinate (P15) at (0, -0.5);
\coordinate (P16) at ($(P15)!\clippingPlaneHeight!(F2)$);
\coordinate (P17) at ($(F1)!\clippingPlaneWidth!(P15)$);
\coordinate (P18) at (intersection cs: first line={(P16) -- (F1)}, second line={(P17) -- (F2)});
% Hilfspunkte Höhe Ebene
\coordinate (P19) at (0, \projectionHeight*\frameHeight);
\coordinate (P20) at ($(F2)!\frameWidth!(P19)$);
%Linien
\draw[rounded corners, draw=black, fill=yellow!30, opacity=0.7] (P15) -- (P16) -- (P18) -- (P17)  -- cycle;
% Tiefe / Verlauf
\begin{scope}[opacity=0.1]
\shade[top color=gray!70,bottom color=gray!5] (P1) -- (P3) -- (P7) -- (P5);
\shade[right color=gray!70,left color=gray!5] (P5) -- (P6) -- (P8) -- (P7);
\shade[left color=gray!70,right color=gray!5] (P7) -- (P3) -- (P4) -- (P8);
\end{scope}
%Frustum
\begin{scope}[red!80]
\draw (A) -- (E);
\draw (B) -- (F);
\draw (D) -- (H);
\draw (C) -- (G);
\end{scope}
%Frame Unterteil + Hinterteil
\draw[thick, color=black!25]  (P3) -- (P7) -- (P8)  (P5) -- (P7);
\draw[thick, color=black!40]  (P20) -- (P5) -- (P1) -- (P19);
% Sichtfeld der Kamera
\fill [red!80, opacity=0.3] (A) -- (B) -- (D) -- (C);
\fill [red!80, opacity=0.4] (E) -- (F) -- (H) -- (G);
\draw [thin, red!80] (A) -- (B) -- (D) -- (C) -- (A);
\draw [thin, red] (E) -- (F) -- (H) -- (G) -- (E);
%\draw [thick, red!80] (
\begin{scope}[red!80, opacity=0.1]
\fill (A) -- (B) -- (F) -- (E);
\fill (C) -- (A) -- (E) -- (G);
\fill (D) -- (C) -- (G) -- (H);
\fill (B) -- (D) -- (H) -- (F);
\end{scope}
\draw[rounded corners, draw=black, fill=blue!25, opacity=0.7] (P11) -- (P12) -- (P14) -- (P13) -- cycle;
\begin{scope}[thin, dashed, red!80]%thick, dashed, fill=red!80, opacity=1]
\draw (E) -- (V);
\draw (F) -- (V);
\draw (G) -- (V);
\draw (H) -- (V);
%\draw (F1) -- (F3);
%\draw (F2) -- (F4);
\end{scope}
% Frame Oberteil
\draw[thick,color=black!40] (P19) -- (P2) (P3) -- (P4) (P20) -- (P6)
(P1) -- (P3) (P2) -- (P4) (P2)--(P6) (P6) -- (P8) -- (P4);
\draw[thin,dashed, color=black !70] (P9) -- (P10);
% Verbindungspunkte
\foreach \i in {1,2,..., 10} %20}
{
%\shade[shading=ball, ball color=black!80] (P\i) circle (0.05em) node[above right] {}; %\tiny \i};
}
\foreach \i in {A, B,...,H}
{
%\shade[shading=ball, ball color=red!] (\i) circle (0.05em) node[above right] {}; %\tiny \i};
}
%Beschriftung
%\draw[fill=red] (V) circle (0.25em) node[above right] {\tiny Viewpoint};
\shade[shading=ball, ball color=red!80] (V) circle (0.25em) node[above right] {\footnotesize Kamera};
%\draw (-1.1,9.3) node[] {\footnotesize Kamera};
\draw[thin, -to] (4.75,0.8) to[out=135,in=-45] (0.75,2);
\draw (4.75,0.5) node[] {\footnotesize nutzbares Sichtfeld};
\draw[thin, -to] (-5.5,3.6) to[out=45,in=-135] (-3,4.2);
\draw (-5.5,3.2) node[] {\footnotesize unterer Schwellwert};
\draw[thin, -to] (-5.5,0.9) to[out=45,in=-135] (-3,1.5);
\draw (-5.5,0.5) node[] {\footnotesize oberer Schwellwert};
\end{tikzpicture} Here's an approach using 3D coordinates, this way you can directly compute the corners of the blue rectangle and don't need clipping. You can change the height of the vertex (\vertexheight), at what percentage of the height the blue rectangle should be (\posalongpath) as well as orientation and length of the coordinate axes (\Cangle and \Clength)

The Code

\documentclass[tikz]{standalone}
\usetikzlibrary{calc}

\begin{document}

\newcommand{\xangle}{7}
\newcommand{\yangle}{138}
\newcommand{\zangle}{90}

\newcommand{\xlength}{1}
\newcommand{\ylength}{1}
\newcommand{\zlength}{1}

\pgfmathsetmacro{\xx}{\xlength*cos(\xangle)}
\pgfmathsetmacro{\xy}{\xlength*sin(\xangle)}
\pgfmathsetmacro{\yx}{\ylength*cos(\yangle)}
\pgfmathsetmacro{\yy}{\ylength*sin(\yangle)}
\pgfmathsetmacro{\zx}{\zlength*cos(\zangle)}
\pgfmathsetmacro{\zy}{\zlength*sin(\zangle)}

\pgfmathsetmacro{\posalongpath}{0.37}
\pgfmathsetmacro{\vertexheight}{5}

\begin{tikzpicture}[x={(\xx cm,\xy cm)}, y={(\yx cm,\yy cm)}, z={(\zx cm,\zy cm)}]
\coordinate (A) at (0,0,0);
\coordinate (B) at (3,0,0);
\coordinate (C) at (3,3,0);
\coordinate (D) at (0,3,0);
\coordinate (V) at (2,2,\vertexheight);

\path (A) -- (V) coordinate[pos=\posalongpath] (A-V);
\path (B) -- (V) coordinate[pos=\posalongpath] (B-V);
\path (C) -- (V) coordinate[pos=\posalongpath] (C-V);
\path (D) -- (V) coordinate[pos=\posalongpath] (D-V);

\pgfmathsetmacro{\blueheight}{\posalongpath*\vertexheight}

\coordinate (A1) at ($(A-V) + (0,0,-\blueheight)$);
\coordinate (B1) at ($(B-V) + (0,0,-\blueheight)$);
\coordinate (C1) at ($(C-V) + (0,0,-\blueheight)$);
\coordinate (D1) at ($(D-V) + (0,0,-\blueheight)$);

\fill[red,opacity=0.5,draw=red!80!black,thick] (A) -- (B) -- (C) -- (D) -- cycle;

\fill[yellow,opacity=0.5,draw=red!80!black,thick] (A1) -- (B1) -- (C1) -- (D1) -- cycle;

\draw[red!50!black] (A) -- (A-V) (B) -- (B-V) (C) -- (C-V) (D) -- (D-V);
\draw[blue!50!yellow,densely dashed] (A1) -- (A-V) (B1) -- (B-V) (C1) -- (C-V) (D1) -- (D-V);

\fill[blue,opacity=0.5,draw=blue!80!black,thick] (A-V) -- (B-V) -- (C-V) -- (D-V) -- cycle;

\draw[red!50!black,densely dashed] (V) -- (A-V) (V) -- (B-V) (V) -- (C-V) (V) -- (D-V);

\fill[red,opacity=0.2] (A) -- (B) -- (B-V) -- (A-V) -- (D-V) -- (D) -- cycle;

\end{tikzpicture}

\end{document}

The Output Alternate Output

\newcommand{\xangle}{45}
\newcommand{\yangle}{150}
\newcommand{\zangle}{90}
\pgfmathsetmacro{\posalongpath}{0.12}
\pgfmathsetmacro{\vertexheight}{7} • hmm... the 3D environment might eventualy solve this... but i realy like the two-point-perspektive :) – Alex Aug 29 '12 at 15:46