Export (0) Print
Expand All

ProjectionCamera.NearPlaneDistance Property

Gets or sets a value that specifies the distance from the camera of the camera's near clip plane.

Namespace:  System.Windows.Media.Media3D
Assembly:  PresentationCore (in PresentationCore.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation

member NearPlaneDistance : float with get, set
<object NearPlaneDistance="double" .../>

Property Value

Type: System.Double
Double that specifies the distance from the camera of the camera's near clip plane.

Identifier field


Metadata properties set to true


It is recommended that this property be set to a positive value. If the user does not set a value for this property, its value defaults to 0.125.

This example shows how to create a 3-D object that looks like a flat sheet of paper which has been rotated. A Viewport3D along with the following components are used to create this simple 3-D scene:

  • A camera is created using a PerspectiveCamera. The camera specifies what part of the 3-D scene is viewable.

  • A mesh is created to specify the shape of 3-D object (sheet of paper) using the Geometry property of GeometryModel3D.

  • A material is specified to be displayed on the surface of the object (linear gradient in this sample) using the Material property of GeometryModel3D.

  • A light is created to shine on the object using DirectionalLight.

The code below shows how to create a 3-D scene in XAML.

<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
      <Canvas Width="321" Height="201">

        <!-- The Viewport3D provides a rendering surface for 3-D visual content. -->
        <Viewport3D ClipToBounds="True" Width="150" Height="150" Canvas.Left="0" Canvas.Top="10">

          <!-- Defines the camera used to view the 3D object. -->
            <PerspectiveCamera Position="0,0,2" LookDirection="0,0,-1" FieldOfView="60" />

          <!-- The ModelVisual3D children contain the 3D models -->

            <!-- This ModelVisual3D defines the light cast in the scene. Without light, the 3D 
                 object cannot be seen. Also, the direction of the lights affect shadowing. If desired,
                 you can create multiple lights with different colors that shine from different directions. -->
                <DirectionalLight Color="#FFFFFF" Direction="-0.612372,-0.5,-0.612372" />

                  <!-- The geometry specifes the shape of the 3D plane. In this sample, a flat sheet is created. -->
                     TriangleIndices="0,1,2 3,4,5 "
                     Normals="0,0,1 0,0,1 0,0,1 0,0,1 0,0,1 0,0,1 "
                     TextureCoordinates="0,0 1,0 1,1 1,1 0,1 0,0 "
                     Positions="-0.5,-0.5,0.5 0.5,-0.5,0.5 0.5,0.5,0.5 0.5,0.5,0.5 -0.5,0.5,0.5 -0.5,-0.5,0.5 " />

                  <!-- The material specifies the material applied to the 3D object. In this sample a linear gradient 
                       covers the surface of the 3D object.-->
                          <LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5">
                              <GradientStop Color="Yellow" Offset="0" />
                              <GradientStop Color="Red" Offset="0.25" />
                              <GradientStop Color="Blue" Offset="0.75" />
                              <GradientStop Color="LimeGreen" Offset="1" />

                  <!-- Apply a transform to the object. In this sample, a rotation transform is applied, rendering the 
                       3D object rotated. -->
                        <AxisAngleRotation3D Axis="0,3,0" Angle="40" />


The code below shows how to create the same 3-D scene in procedural code.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.5.3, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

© 2014 Microsoft