<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>XAML</title>
        <link>http://www.statichippo.com/category/9.aspx</link>
        <description>XAML</description>
        <language>en-US</language>
        <copyright>Noah</copyright>
        <generator>Subtext Version 2.1.2.2</generator>
        <item>
            <title>Getting started with 3D Elements in WPF</title>
            <link>http://statichippo.com/archive/2009/12/08/getting-started-with-3d-elements-in-wpf.aspx</link>
            <description>&lt;p&gt;I was watching the video entitled &lt;a href="http://windowsclient.net/learn/video.aspx?v=293715" target="_blank"&gt;How Do I: Get started with 3D Elements in WPF&lt;/a&gt; and was just completely thrown off by author, Todd Miranda’s, complete lack of visuals.  So I played around with his example until I better understood what was going on and I figured I’d share.  Please understand that I am not a XAML master and certainly not in 3D, so if you find any errors please let me know. &lt;/p&gt;  &lt;p&gt;The XAML that Todd starts off with is:&lt;/p&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 90%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &amp;lt;Page xmlns=&lt;span style="color: #006080"&gt;"http://schemas.microsoft.com/winfx/2006/xaml/presentation"&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt;  xmlns:sys=&lt;span style="color: #006080"&gt;"clr-namespace:System;assembly=mscorlib"&lt;/span&gt; xmlns:x=&lt;span style="color: #006080"&gt;"http://schemas.microsoft.com/winfx/2006/xaml"&lt;/span&gt; &amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt;   &amp;lt;Grid&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;     &amp;lt;Viewport3D&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;         &amp;lt;Viewport3D.Camera&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;             &amp;lt;PerspectiveCamera Position=&lt;span style="color: #006080"&gt;"-50,20,15"&lt;/span&gt; LookDirection=&lt;span style="color: #006080"&gt;"50,-15,-10"&lt;/span&gt; UpDirection=&lt;span style="color: #006080"&gt;"0,0,1"&lt;/span&gt; /&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt;         &amp;lt;/Viewport3D.Camera&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt;         &amp;lt;ModelVisual3D&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt;   9:&lt;/span&gt;             &amp;lt;ModelVisual3D.Content&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum10"&gt;  10:&lt;/span&gt;                 &amp;lt;Model3DGroup&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum11"&gt;  11:&lt;/span&gt;                     &amp;lt;DirectionalLight Color=&lt;span style="color: #006080"&gt;"White"&lt;/span&gt; Direction=&lt;span style="color: #006080"&gt;"-1,-1,-3"&lt;/span&gt; /&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum12"&gt;  12:&lt;/span&gt;                     &amp;lt;GeometryModel3D&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum13"&gt;  13:&lt;/span&gt;                         &amp;lt;GeometryModel3D.Geometry&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum14"&gt;  14:&lt;/span&gt;                             &amp;lt;MeshGeometry3D Positions=&lt;span style="color: #006080"&gt;"0,0,0 10,0,0 10,10,0 0,10,0 0,0,10 0,10,10"&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum15"&gt;  15:&lt;/span&gt;                                         TriangleIndices=&lt;span style="color: #006080"&gt;"0 1 3  1 2 3  0 4 3  4 5 3"&lt;/span&gt; /&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum16"&gt;  16:&lt;/span&gt;                         &amp;lt;/GeometryModel3D.Geometry&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum17"&gt;  17:&lt;/span&gt;                         &amp;lt;GeometryModel3D.Material&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum18"&gt;  18:&lt;/span&gt;                             &amp;lt;DiffuseMaterial Brush=&lt;span style="color: #006080"&gt;"Red"&lt;/span&gt; /&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum19"&gt;  19:&lt;/span&gt;                         &amp;lt;/GeometryModel3D.Material&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum20"&gt;  20:&lt;/span&gt;                     &amp;lt;/GeometryModel3D&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum21"&gt;  21:&lt;/span&gt;                 &amp;lt;/Model3DGroup&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum22"&gt;  22:&lt;/span&gt;             &amp;lt;/ModelVisual3D.Content&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum23"&gt;  23:&lt;/span&gt;         &amp;lt;/ModelVisual3D&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum24"&gt;  24:&lt;/span&gt;     &amp;lt;/Viewport3D&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum25"&gt;  25:&lt;/span&gt;   &amp;lt;/Grid&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum26"&gt;  26:&lt;/span&gt; &amp;lt;/Page&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;The output is:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://statichippo.com/images/statichippo_com/WindowsLiveWriter/Gettingstartedwith3DElementsinWPF_F519/xaml_3d_1.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="xaml_3d_1" border="0" alt="xaml_3d_1" src="http://statichippo.com/images/statichippo_com/WindowsLiveWriter/Gettingstartedwith3DElementsinWPF_F519/xaml_3d_1_thumb.png" width="244" height="136" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;h2&gt;Camera Perspective&lt;/h2&gt;

&lt;p&gt;First off, let’s play with the Camera perspective.  I think the best way to do this is first to define the different parts of the Camera Perspective, the most important being &lt;strong&gt;Position&lt;/strong&gt; and &lt;strong&gt;LookDirection&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://statichippo.com/images/statichippo_com/WindowsLiveWriter/Gettingstartedwith3DElementsinWPF_F519/wpf_3d_grid_1_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="wpf_3d_grid_1" border="0" alt="wpf_3d_grid_1" src="http://statichippo.com/images/statichippo_com/WindowsLiveWriter/Gettingstartedwith3DElementsinWPF_F519/wpf_3d_grid_1_thumb.png" width="244" height="184" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Take the grid above.  It’s hard to show a Z axis, so I made the font smaller to try to trick your eye into believing it’s farther away.&lt;/p&gt;

&lt;h3&gt;Position&lt;/h3&gt;

&lt;p&gt;So the grid above is akin to a room, right?  You have a top &amp;amp; bottom, right &amp;amp; left, and depth – we’ll call Z0 Backward and Z50 Forward so that if you’re walking into the room you’re walking Forward, ok?&lt;/p&gt;

&lt;p&gt;&lt;a href="http://statichippo.com/images/statichippo_com/WindowsLiveWriter/Gettingstartedwith3DElementsinWPF_F519/xaml_3d_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="xaml_3d_2" border="0" alt="xaml_3d_2" src="http://statichippo.com/images/statichippo_com/WindowsLiveWriter/Gettingstartedwith3DElementsinWPF_F519/xaml_3d_2_thumb.png" width="244" height="164" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Now here we have a video camera pointed at a box.  It’s way too close to the box, as you can see, since all you can see in the viewfinder is part of the box.  Well to get a better picture we have 3 directions to move the camera: forward/back, right/left, up/down:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://statichippo.com/images/statichippo_com/WindowsLiveWriter/Gettingstartedwith3DElementsinWPF_F519/xaml_3d_3.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="xaml_3d_3" border="0" alt="xaml_3d_3" src="http://statichippo.com/images/statichippo_com/WindowsLiveWriter/Gettingstartedwith3DElementsinWPF_F519/xaml_3d_3_thumb.png" width="244" height="164" /&gt;&lt;/a&gt; (This might be a Position of -5(Z), 25(X), and 25(Y))&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;So in this instance, I might want to move the camera backwards, like so:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://statichippo.com/images/statichippo_com/WindowsLiveWriter/Gettingstartedwith3DElementsinWPF_F519/xaml_3d_4.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="xaml_3d_4" border="0" alt="xaml_3d_4" src="http://statichippo.com/images/statichippo_com/WindowsLiveWriter/Gettingstartedwith3DElementsinWPF_F519/xaml_3d_4_thumb.png" width="244" height="164" /&gt;&lt;/a&gt; (This might be a position of –25,25,25)&lt;/p&gt;

&lt;p&gt;Now notice how I moved the camera backwards and got the whole box in the viewfinder.  I’m farther away from the box so I can see the whole thing.&lt;/p&gt;

&lt;p&gt;The same principle holds true for the X &amp;amp; Y axis:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://statichippo.com/images/statichippo_com/WindowsLiveWriter/Gettingstartedwith3DElementsinWPF_F519/xaml_3d_5.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="xaml_3d_5" border="0" alt="xaml_3d_5" src="http://statichippo.com/images/statichippo_com/WindowsLiveWriter/Gettingstartedwith3DElementsinWPF_F519/xaml_3d_5_thumb.png" width="244" height="164" /&gt;&lt;/a&gt;  Perhaps this is –25,5,25 -- I moved the camera too far to the right and only see the right most part of the box.&lt;/p&gt;

&lt;p&gt;The above is all the job of the Position attribute.  But there’s another important element to how the camera picks up the image and that is the angle of the camera&lt;/p&gt;

&lt;h3&gt;LookDirection&lt;/h3&gt;

&lt;p&gt;“Well my head went back and to the left.”&lt;/p&gt;

&lt;p /&gt;

&lt;p /&gt;

&lt;p /&gt;

&lt;p /&gt;

&lt;p&gt;In WPF, just like in real life, once you have your camera setup &lt;strong&gt;where&lt;/strong&gt; you want it, you also need to angle the camera to point in the direction of the object you want to see.  For instance, if you want to catch a right-hand side (from your view) shot of a box, what would you need to do?  You would place your camera to the right side of the box at a depth that was equal with the center of the box.  Then you would need to turn your camera to the left in order for the lens to face the box.&lt;/p&gt;

&lt;p&gt;Step 1, move your camera to the side of the box&lt;/p&gt;

&lt;p&gt;&lt;a href="http://statichippo.com/images/statichippo_com/WindowsLiveWriter/Gettingstartedwith3DElementsinWPF_F519/xaml_3d_6.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="xaml_3d_6" border="0" alt="xaml_3d_6" src="http://statichippo.com/images/statichippo_com/WindowsLiveWriter/Gettingstartedwith3DElementsinWPF_F519/xaml_3d_6_thumb.png" width="244" height="164" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Step 2, turn your camera to the left:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://statichippo.com/images/statichippo_com/WindowsLiveWriter/Gettingstartedwith3DElementsinWPF_F519/xaml_3d_7.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="xaml_3d_7" border="0" alt="xaml_3d_7" src="http://statichippo.com/images/statichippo_com/WindowsLiveWriter/Gettingstartedwith3DElementsinWPF_F519/xaml_3d_7_thumb.png" width="244" height="164" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;h3&gt;XAML&lt;/h3&gt;

&lt;p&gt;This post was actually a lot of work to write.  I think I’ll have to break up the other elements into other blog posts and write those at another time.  However, for the sake of completion, let’s fold these new concepts back into the XAML from before.&lt;/p&gt;

&lt;p&gt;Suppose you want to look change the direction so that you’re facing the red shape head-on.  In other words, you want to look at the shape so that it looks just like a square (instead of an L shaped 3D shape).  You might change the XAML so that line 3 reads&lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &amp;lt;PerspectiveCamera Position=&lt;span style="color: #006080"&gt;"-50,0,15"&lt;/span&gt; LookDirection=&lt;span style="color: #006080"&gt;"50,0,-10"&lt;/span&gt; UpDirection=&lt;span style="color: #006080"&gt;"0,0,1"&lt;/span&gt; /&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;The output looks like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://statichippo.com/images/statichippo_com/WindowsLiveWriter/Gettingstartedwith3DElementsinWPF_F519/xaml_3d_8.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="xaml_3d_8" border="0" alt="xaml_3d_8" src="http://statichippo.com/images/statichippo_com/WindowsLiveWriter/Gettingstartedwith3DElementsinWPF_F519/xaml_3d_8_thumb.png" width="244" height="150" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Now don’t mind that it’s black on top – that has to do with the light source and is out of the context of this post.  But let’s just see how we got here.  Here are the two lines juxtaposed (I added spacing so that everything lines up):&lt;/p&gt;

&lt;p /&gt;

&lt;p /&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &amp;lt;PerspectiveCamera Position=&lt;span style="color: #006080"&gt;"-50,20,15"&lt;/span&gt; LookDirection=&lt;span style="color: #006080"&gt;"50,-15,-10"&lt;/span&gt; UpDirection=&lt;span style="color: #006080"&gt;"0,0,1"&lt;/span&gt; /&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; &amp;lt;PerspectiveCamera Position=&lt;span style="color: #006080"&gt;"-50,0 ,15"&lt;/span&gt; LookDirection=&lt;span style="color: #006080"&gt;"50, 0 ,-10"&lt;/span&gt; UpDirection=&lt;span style="color: #006080"&gt;"0,0,1"&lt;/span&gt; /&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p /&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;So first I changed the Position’s X to 0 from 20, so I’m moving the camera to the right.  Now if I didn’t change the LookDirection it would mean that the camera would be facing slightly downwards (-10)  and slightly to the left (-15), so you’re not looking at it straight on.  That’s why I dropped the X value of LookDirection up from –15 to 0.&lt;/p&gt;

&lt;p&gt;Just keep in mind that it is &lt;em&gt;very&lt;/em&gt; easy to place the Postion and/or LookDirection of the camera so that the shape is completely out of view. &lt;/p&gt;

&lt;p&gt;Hopefully this helps put some of what Todd says in his video in context.&lt;/p&gt;&lt;img src="http://statichippo.com/aggbug/48.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Noah</dc:creator>
            <guid>http://statichippo.com/archive/2009/12/08/getting-started-with-3d-elements-in-wpf.aspx</guid>
            <pubDate>Wed, 09 Dec 2009 02:33:49 GMT</pubDate>
            <wfw:comment>http://statichippo.com/comments/48.aspx</wfw:comment>
            <comments>http://statichippo.com/archive/2009/12/08/getting-started-with-3d-elements-in-wpf.aspx#feedback</comments>
            <wfw:commentRss>http://statichippo.com/comments/commentRss/48.aspx</wfw:commentRss>
            <trackback:ping>http://statichippo.com/services/trackbacks/48.aspx</trackback:ping>
        </item>
    </channel>
</rss>