Skip to content Skip to sidebar Skip to footer

c wpf 3d graphics visual studio drawing a cube

Skip to main content

3D Graphics Overview

The 3D functionality in Windows Presentation Foundation (WPF) enables developers to depict, transform, and breathing 3D graphics in both markup and procedural lawmaking. Developers can combine 2d and 3D graphics to create rich controls, provide circuitous illustrations of information, or enhance the user experience of an awarding's interface. 3D support in WPF is not designed to provide a full-featured game-development platform. This topic provides an overview of 3D functionality in the WPF graphics system.

3D in a 2D Container

3D graphics content in WPF is encapsulated in an element, Viewport3D, that tin participate in the two-dimensional element structure. The graphics system treats Viewport3D as a two-dimensional visual element like many others in WPF. Viewport3D functions every bit a window—a viewport—into a three-dimensional scene. More accurately, it is a surface on which a 3D scene is projected.

In a conventional 2D application, utilize Viewport3D as you lot would some other container element like Grid or Canvas. Although you lot tin use Viewport3D with other 2D drawing objects in the same scene graph, you cannot interpenetrate 2D and 3D objects within a Viewport3D. This topic will focus on how to draw 3D graphics inside the Viewport3D.

3D Coordinate Space

The WPF coordinate system for second graphics locates the origin in the upper left of the rendering area (typically the screen). In the second system, positive 10-axis values continue to the right and positive y-axis values continue downward. In the 3D coordinate organization, withal, the origin is located in the center of the rendering expanse, with positive x-centrality values proceeding to the right only positive y-axis values proceeding upward instead, and positive z-axis values proceeding outward from the origin, toward the viewer.

Coordinate systems
Conventional 2D and 3D coordinate system representations

The space divers by these axes is the stationary frame of reference for 3D objects in WPF. As y'all build models in this space and create lights and cameras to view them, it's helpful to distinguish this stationary frame of reference, or "world space," from the local frame of reference you create for each model when you apply transformations to it. Remember also that objects in world space might look entirely different, or not be visible at all, depending on light and camera settings, only the position of the camera does non change the location of objects in earth space.

Cameras and Projections

Developers who work in 2D are accustomed to positioning cartoon primitives on a two-dimensional screen. When y'all create a 3D scene, it's important to remember that you are really creating a 2D representation of 3D objects. Because a 3D scene looks different depending on the onlooker's point of view, yous must specify that point of view. The Camera grade allows you to specify this bespeak of view for a 3D scene.

Another way to empathise how a 3D scene is represented on a second surface is by describing the scene as a project onto the viewing surface. The ProjectionCamera allows you to specify dissimilar projections and their properties to alter how the onlooker sees 3D models. A PerspectiveCamera specifies a project that foreshortens the scene. In other words, the PerspectiveCamera provides vanishing-point perspective. You can specify the position of the photographic camera in the coordinate space of the scene, the direction and field of view for the camera, and a vector that defines the direction of "up" in the scene. The following diagram illustrates the PerspectiveCamera's projection.

The NearPlaneDistance and FarPlaneDistance backdrop of ProjectionCamera limit the range of the camera'southward projection. Considering cameras tin can be located anywhere in the scene, it'south possible for the camera to be actually positioned inside a model or very near a model, making information technology hard to distinguish objects properly. NearPlaneDistance allows you to specify a minimum distance from the camera beyond which objects will non be drawn. Conversely, FarPlaneDistance lets you specify a distance from the camera across which objects will not be fatigued, which ensures that objects also far away to be recognizable won't be included in the scene.

Camera setup
Camera position

OrthographicCamera specifies an orthogonal projection of a 3D model to a second visual surface. Like other cameras, it specifies a position, viewing direction, and "upward" direction. Unlike PerspectiveCamera, notwithstanding, OrthographicCamera describes a projection that does non include perspective foreshortening. In other words, OrthographicCamera describes a viewing box whose sides are parallel, instead of one whose sides meet in a signal at the camera. The following image shows the same model equally viewed using PerspectiveCamera and OrthographicCamera.

Orthographic and perspective projection
Perspective and Orthographic Projections

The post-obit lawmaking shows some typical photographic camera settings.

              // Defines the photographic camera used to view the 3D object. In lodge to view the 3D object, // the camera must be positioned and pointed such that the object is within view // of the photographic camera. PerspectiveCamera myPCamera = new PerspectiveCamera();  // Specify where in the 3D scene the camera is. myPCamera.Position = new Point3D(0, 0, ii);  // Specify the management that the camera is pointing. myPCamera.LookDirection = new Vector3D(0, 0, -ane);  // Define camera'due south horizontal field of view in degrees. myPCamera.FieldOfView = 60;  // Asign the camera to the viewport myViewport3D.Camera = myPCamera;                          
              ' Defines the camera used to view the 3D object. In order to view the 3D object, ' the camera must be positioned and pointed such that the object is inside view  ' of the camera. Dim myPCamera Equally New PerspectiveCamera()  ' Specify where in the 3D scene the camera is. myPCamera.Position = New Point3D(0, 0, 2)  ' Specify the management that the camera is pointing. myPCamera.LookDirection = New Vector3D(0, 0, -ane)  ' Define camera's horizontal field of view in degrees. myPCamera.FieldOfView = 60  ' Asign the camera to the viewport myViewport3D.Photographic camera = myPCamera                          

Model and Mesh Primitives

Model3D is the abstract base class that represents a generic 3D object. To build a 3D scene, yous need some objects to view, and the objects that brand up the scene graph derive from Model3D. Currently, the WPF supports modeling geometries with GeometryModel3D. The Geometry property of this model takes a mesh primitive.

To build a model, begin by building a primitive, or mesh. A 3D primitive is a collection of vertices that form a single 3D entity. Almost 3D systems provide primitives modeled on the simplest closed figure: a triangle defined by three vertices. Because the three points of a triangle are coplanar, you can continue adding triangles in order to model more circuitous shapes, called meshes.

The WPF 3D system currently provides the MeshGeometry3D course, which allows y'all to specify whatever geometry; it does non currently back up predefined 3D primitives like spheres and cubic forms. Brainstorm creating a MeshGeometry3D by specifying a list of triangle vertices as its Positions belongings. Each vertex is specified as a Point3D. (In Extensible Application Markup Language (XAML), specify this property as a list of numbers grouped in threes that stand for the coordinates of each vertex.) Depending on its geometry, your mesh might be composed of many triangles, some of which share the same corners (vertices). To describe the mesh correctly, the WPF needs information about which vertices are shared by which triangles. You provide this information by specifying a list of triangle indices with the TriangleIndices holding. This list specifies the order in which the points specified in the Positions list will make up one's mind a triangle.

              <GeometryModel3D>   <GeometryModel3D.Geometry>           <MeshGeometry3D                Positions="-ane -1 0  1 -1 0  -1 1 0  ane i 0"               Normals="0 0 1  0 0 1  0 0 1  0 0 1"               TextureCoordinates="0 1  ane 1  0 0  one 0   "               TriangleIndices="0 1 two  1 3 ii" />       </GeometryModel3D.Geometry>       <GeometryModel3D.Material>           <DiffuseMaterial>               <DiffuseMaterial.Brush>                   <SolidColorBrush Colour="Cyan" Opacity="0.3"/>               </DiffuseMaterial.Brush>           </DiffuseMaterial>       </GeometryModel3D.Fabric>   <!-- Translate the airplane. -->       <GeometryModel3D.Transform>           <TranslateTransform3D             OffsetX="2" OffsetY="0" OffsetZ="-1"   >           </TranslateTransform3D>       </GeometryModel3D.Transform>   </GeometryModel3D>                          

In the preceding example, the Positions list specifies eight vertices to ascertain a cube-shaped mesh. The TriangleIndices belongings specifies a list of twelve groups of iii indices. Each number in the list refers to an offset into the Positions list. For case, the starting time iii vertices specified past the Positions list are (1,1,0), (0,1,0), and (0,0,0). The first 3 indices specified by the TriangleIndices list are 0, 2, and 1, which correspond to the first, third, and second points in the Positions listing. Equally a result, the beginning triangle that makes up the cube model will be composed from (1,ane,0) to (0,1,0) to (0,0,0), and the remaining 11 triangles will exist determined similarly.

You can continue defining the model by specifying values for the Normals and TextureCoordinates properties. To render the surface of the model, the graphics arrangement needs information about which management the surface is facing at any given triangle. It uses this information to make lighting calculations for the model: surfaces that face up directly towards a light source appear brighter than those angled abroad from the light. Though the WPF can determine default normal vectors past using the position coordinates, you can also specify dissimilar normal vectors to approximate the advent of curved surfaces.

The TextureCoordinates holding specifies a collection of Points that tell the graphics system how to map the coordinates that decide how a texture is drawn to the vertices of the mesh. TextureCoordinates are specified as a value between zero and ane, inclusive. As with the Normals property, the graphics system tin can calculate default texture coordinates, but yous might choose to gear up different texture coordinates to command the mapping of a texture that includes part of a repeating pattern, for example. More information about texture coordinates can be found in subsequent topics or in the Managed Direct3D SDK.

The following example shows how to create 1 confront of the cube model in procedural code. Yous tin can depict the unabridged cube as a single GeometryModel3D; this instance draws the cube'southward confront every bit a singled-out model in lodge to utilize separate textures to each face subsequently.

              MeshGeometry3D side1Plane = new MeshGeometry3D();                          
              Private side1Plane As New MeshGeometry3D()                          
              side1Plane.Positions.Add(new Point3D(-0.5, -0.5, -0.five)); side1Plane.Positions.Add(new Point3D(-0.5, 0.five, -0.five)); side1Plane.Positions.Add together(new Point3D(0.5, 0.5, -0.5)); side1Plane.Positions.Add(new Point3D(0.v, 0.v, -0.five)); side1Plane.Positions.Add(new Point3D(0.5, -0.5, -0.5)); side1Plane.Positions.Add together(new Point3D(-0.5, -0.5, -0.5));  side1Plane.TriangleIndices.Add(0); side1Plane.TriangleIndices.Add(1); side1Plane.TriangleIndices.Add(2); side1Plane.TriangleIndices.Add together(3); side1Plane.TriangleIndices.Add together(4); side1Plane.TriangleIndices.Add(five);  side1Plane.Normals.Add together(new Vector3D(0, 0, -1)); side1Plane.Normals.Add together(new Vector3D(0, 0, -1)); side1Plane.Normals.Add(new Vector3D(0, 0, -1)); side1Plane.Normals.Add together(new Vector3D(0, 0, -one)); side1Plane.Normals.Add(new Vector3D(0, 0, -1)); side1Plane.Normals.Add(new Vector3D(0, 0, -one));  side1Plane.TextureCoordinates.Add(new Indicate(ane, 0)); side1Plane.TextureCoordinates.Add(new Signal(one, ane)); side1Plane.TextureCoordinates.Add(new Signal(0, 1)); side1Plane.TextureCoordinates.Add together(new Signal(0, 1)); side1Plane.TextureCoordinates.Add(new Point(0, 0)); side1Plane.TextureCoordinates.Add(new Point(1, 0));                          
              side1Plane.Positions.Add(New Point3D(-0.5, -0.5, -0.five)) side1Plane.Positions.Add(New Point3D(-0.5, 0.5, -0.5)) side1Plane.Positions.Add(New Point3D(0.five, 0.v, -0.5)) side1Plane.Positions.Add together(New Point3D(0.5, 0.five, -0.v)) side1Plane.Positions.Add(New Point3D(0.v, -0.5, -0.5)) side1Plane.Positions.Add(New Point3D(-0.5, -0.five, -0.5))  side1Plane.TriangleIndices.Add(0) side1Plane.TriangleIndices.Add together(1) side1Plane.TriangleIndices.Add(2) side1Plane.TriangleIndices.Add together(three) side1Plane.TriangleIndices.Add(four) side1Plane.TriangleIndices.Add(5)  side1Plane.Normals.Add(New Vector3D(0, 0, -i)) side1Plane.Normals.Add(New Vector3D(0, 0, -ane)) side1Plane.Normals.Add together(New Vector3D(0, 0, -1)) side1Plane.Normals.Add(New Vector3D(0, 0, -1)) side1Plane.Normals.Add together(New Vector3D(0, 0, -1)) side1Plane.Normals.Add(New Vector3D(0, 0, -1))  side1Plane.TextureCoordinates.Add(New Bespeak(1, 0)) side1Plane.TextureCoordinates.Add(New Point(1, 1)) side1Plane.TextureCoordinates.Add(New Point(0, 1)) side1Plane.TextureCoordinates.Add(New Indicate(0, 1)) side1Plane.TextureCoordinates.Add(New Point(0, 0)) side1Plane.TextureCoordinates.Add(New Bespeak(1, 0))                          

'

Applying Materials to the Model

For a mesh to await similar a iii-dimensional object, it must have an applied texture to cover the surface defined by its vertices and triangles so it tin can be lit and projected by the photographic camera. In 2d, you use the Brush class to apply colors, patterns, gradients, or other visual content to areas of the screen. The advent of 3D objects, yet, is a function of the lighting model, non but of the color or blueprint applied to them. Real-world objects reflect calorie-free differently depending on the quality of their surfaces: sleeky and shiny surfaces don't await the same every bit rough or matte surfaces, and some objects seem to absorb lite while others glow. Y'all can apply all the same brushes to 3D objects that y'all can utilise to 2D objects, but y'all can't apply them straight.

To ascertain the characteristics of a model'due south surface, WPF uses the Cloth abstract class. The physical subclasses of Material determine some of the advent characteristics of the model's surface, and each also provides a Brush property to which yous tin can pass a SolidColorBrush, TileBrush, or VisualBrush.

  • DiffuseMaterial specifies that the brush will exist applied to the model equally though that model were lit diffusely. Using DiffuseMaterial most resembles using brushes straight on 2nd models; model surfaces do not reflect light as though shiny.

  • SpecularMaterial specifies that the castor will be applied to the model every bit though the model'southward surface were hard or shiny, capable of reflecting highlights. You can set the degree to which the texture will suggest this reflective quality, or "smooth," past specifying a value for the SpecularPower property.

  • EmissiveMaterial allows you lot to specify that the texture volition be applied as though the model were emitting light equal to the color of the brush. This does non brand the model a low-cal; nevertheless, it will participate differently in shadowing than it would if textured with DiffuseMaterial or SpecularMaterial.

For better performance, the backfaces of a GeometryModel3D (those faces that are out of view because they are on the opposite side of the model from the camera) are culled from the scene. To specify a Material to apply to the backface of a model like a airplane, set the model's BackMaterial holding.

To accomplish some surface qualities, like glowing or reflective effects, you might want to apply several different brushes to a model in succession. You can use and reuse multiple Materials by using the MaterialGroup class. The children of the MaterialGroup are applied first to concluding in multiple rendering passes.

The post-obit code examples show how to utilise a solid color and a drawing as brushes to 3D models.

              <GeometryModel3D.Cloth>     <DiffuseMaterial>         <DiffuseMaterial.Castor>             <SolidColorBrush Color="Cyan" Opacity="0.3"/>         </DiffuseMaterial.Brush>     </DiffuseMaterial> </GeometryModel3D.Textile>                          
              <DrawingBrush x:Key="patternBrush" Viewport="0,0,0.ane,0.1" TileMode="Tile">   <DrawingBrush.Drawing>     <DrawingGroup>       <DrawingGroup.Children>         <GeometryDrawing Geometry="M0,0.1 L0.i,0 1,0.ix, 0.nine,1z"           Brush="Gray" />         <GeometryDrawing Geometry="M0.9,0 L1,0.1 0.1,1 0,0.9z"           Brush="Gray" />         <GeometryDrawing Geometry="M0.25,0.25 L0.5,0.125 0.75,0.25 0.5,0.5z"           Brush="#FFFF00" />         <GeometryDrawing Geometry="M0.25,0.75 L0.five,0.875 0.75,0.75 0.five,0.5z"           Castor="Black" />         <GeometryDrawing Geometry="M0.25,0.75 L0.125,0.5 0.25,0.25 0.v,0.5z"           Brush="#FF0000" />         <GeometryDrawing Geometry="M0.75,0.25 L0.875,0.five 0.75,0.75 0.5,0.5z"           Castor="MediumBlue" />       </DrawingGroup.Children>     </DrawingGroup>   </DrawingBrush.Drawing> </DrawingBrush>                          
              DiffuseMaterial side5Material = new DiffuseMaterial((Brush)Application.Current.Resources["patternBrush"]);                          
              Dim side5Material As New DiffuseMaterial(CType(Application.Electric current.Resource("patternBrush"), Brush))                          

Illuminating the Scene

Lights in 3D graphics do what lights do in the existent globe: they brand surfaces visible. More to the signal, lights make up one's mind what office of a scene will be included in the projection. Low-cal objects in WPF create a diverseness of light and shadow effects and are modeled after the behavior of various real-world lights. Include at least one light in your scene, or no models volition exist visible.

The following lights derive from the base class Calorie-free:

  • AmbientLight: Provides ambient lighting that illuminates all objects uniformly regardless of their location or orientation.

  • DirectionalLight: Illuminates similar a distant light source. Directional lights have a Direction specified as a Vector3D, simply no specified location.

  • PointLight: Illuminates similar a nearby calorie-free source. PointLights have a position and bandage light from that position. Objects in the scene are illuminated depending on their position and altitude with respect to the low-cal. PointLightBase exposes a Range property, which determines a altitude beyond which models will not exist illuminated by the low-cal. PointLight besides exposes attenuation properties, which determine how the light's intensity diminishes over distance. You tin can specify constant, linear, or quadratic interpolations for the light'south attenuation.

  • SpotLight: Inherits from PointLight. Spotlights illuminate like PointLight and have both position and management. They project light in a cone-shaped area fix by InnerConeAngle and OuterConeAngle properties, specified in degrees.

Lights are Model3D objects, and so you tin can transform and animate light properties, including position, colour, direction, and range.

              <ModelVisual3D.Content>     <AmbientLight Colour="#333333" /> </ModelVisual3D.Content>                          
              DirectionalLight myDirLight = new DirectionalLight();                          
              Individual myDirLight Equally New DirectionalLight()                          
              myDirLight.Color = Colors.White; myDirLight.Direction = new Vector3D(-3, -iv, -5);                          
              myDirLight.Color = Colors.White myDirLight.Management = New Vector3D(-3, -4, -5)                          
              modelGroup.Children.Add together(myDirLight);                          
              modelGroup.Children.Add together(myDirLight)                          

Transforming Models

When you create models, they have a item location in the scene. To move those models around in the scene, to rotate them, or to modify their size, it'due south not applied to change the vertices that ascertain the models themselves. Instead, only as in 2d, y'all utilize transformations to models.

Each model object has a Transform holding with which you tin can motion, reorient, or resize the model. When you employ a transform, yous finer offset all the points of the model past whatever vector or value specified by the transform. In other words, y'all've transformed the coordinate space in which the model is defined ("model infinite"), but you haven't changed the values that make up the model's geometry in the coordinate system of the entire scene ("world space").

For more than information most transforming models, see 3D Transformations Overview.

Animative Models

The WPF 3D implementation participates in the same timing and animation system every bit 2D graphics. In other words, to animate a 3D scene, animate the properties of its models. It's possible to animate backdrop of primitives directly, just it's typically easier to animate transformations that change the position or appearance of models. Because transformations can be applied to Model3DGroup objects as well as individual models, it's possible to apply one set of animations to a child of a Model3DGroup and some other set up of animations to a group of kid objects. You lot can also attain a variety of visual effects by animating the properties of your scene's lighting. Finally, you might cull to animate the projection itself by animating the camera position or field of view. For background information on the WPF timing and animation arrangement, see the Animation Overview, Storyboards Overview, and Freezable Objects Overview topics.

To animate an object in WPF, you lot create a timeline, define an animation (which is really a change in some property value over time), and specify the belongings to which to apply the animation. Considering all the objects in a 3D scene are children of Viewport3D, the properties targeted by any blitheness you want to utilise to the scene are backdrop of Viewport3D.

Suppose you desire to make a model appear to wobble in place. You might choose to apply a RotateTransform3D to the model, and animate the centrality of its rotation from ane vector to some other. The following code example demonstrates applying a Vector3DAnimation to the Axis property of the transformation'southward Rotation3D, bold the RotateTransform3D to be one of several transforms practical to the model with a TransformGroup.

              //Define a rotation RotateTransform3D myRotateTransform = new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 1, 0), 1));                          
              'Define a rotation Dim myRotateTransform Every bit New RotateTransform3D(New AxisAngleRotation3D(New Vector3D(0, 1, 0), 1))                          
              Vector3DAnimation myVectorAnimation = new Vector3DAnimation(new Vector3D(-one, -i, -1), new Duration(TimeSpan.FromMilliseconds(5000))); myVectorAnimation.RepeatBehavior = RepeatBehavior.Forever;                          
              Dim myVectorAnimation Equally New Vector3DAnimation(New Vector3D(-1, -1, -ane), New Duration(TimeSpan.FromMilliseconds(5000))) myVectorAnimation.RepeatBehavior = RepeatBehavior.Forever                          
              myRotateTransform.Rotation.BeginAnimation(AxisAngleRotation3D.AxisProperty, myVectorAnimation);                          
              myRotateTransform.Rotation.BeginAnimation(AxisAngleRotation3D.AxisProperty, myVectorAnimation)                          
              //Add transformation to the model cube1TransformGroup.Children.Add together(myRotateTransform);                          
              'Add transformation to the model cube1TransformGroup.Children.Add(myRotateTransform)                          

Add 3D Content to the Window

To render the scene, add models and lights to a Model3DGroup, and then ready the Model3DGroup as the Content of a ModelVisual3D. Add the ModelVisual3D to the Children drove of the Viewport3D. Add cameras to the Viewport3D by setting its Camera property.

Finally, add the Viewport3D to the window. When the Viewport3D is included as the content of a layout element like Canvas, specify the size of the Viewport3D by setting its Height and Width properties (inherited from FrameworkElement).

              <UserControl x:Class="HostingWpfUserControlInWf.UserControl1"     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     >        <Grid>        <!-- Place a Label control at the top of the view. -->       <Label                  HorizontalAlignment="Center"                  TextBlock.TextAlignment="Center"                  FontSize="xx"                  Foreground="Red"                  Content="Model: Cone"/>        <!-- Viewport3D is the rendering surface. -->       <Viewport3D Proper noun="myViewport" >          <!-- Add together a camera. -->         <Viewport3D.Camera>           <PerspectiveCamera                          FarPlaneDistance="20"                          LookDirection="0,0,1"                          UpDirection="0,1,0"                          NearPlaneDistance="ane"                          Position="0,0,-3"                          FieldOfView="45" />         </Viewport3D.Photographic camera>          <!-- Add models. -->         <Viewport3D.Children>            <ModelVisual3D>             <ModelVisual3D.Content>                <Model3DGroup >                 <Model3DGroup.Children>                    <!-- Lights, MeshGeometry3D and DiffuseMaterial objects are added to the ModelVisual3D. -->                   <DirectionalLight Color="#FFFFFFFF" Direction="3,-iv,five" />                    <!-- Define a cherry-red cone. -->                   <GeometryModel3D>                      <GeometryModel3D.Geometry>                       <MeshGeometry3D      Positions="0.293893 -0.5 0.404509  0.475528 -0.v 0.154509  0 0.5 0  0.475528 -0.5 0.154509  0 0.5 0  0 0.5 0  0.475528 -0.five 0.154509  0.475528 -0.5 -0.154509  0 0.5 0  0.475528 -0.5 -0.154509  0 0.five 0  0 0.five 0  0.475528 -0.5 -0.154509  0.293893 -0.5 -0.404509  0 0.five 0  0.293893 -0.5 -0.404509  0 0.5 0  0 0.five 0  0.293893 -0.5 -0.404509  0 -0.v -0.5  0 0.v 0  0 -0.v -0.v  0 0.5 0  0 0.5 0  0 -0.5 -0.v  -0.293893 -0.five -0.404509  0 0.5 0  -0.293893 -0.5 -0.404509  0 0.five 0  0 0.v 0  -0.293893 -0.five -0.404509  -0.475528 -0.5 -0.154509  0 0.5 0  -0.475528 -0.v -0.154509  0 0.5 0  0 0.5 0  -0.475528 -0.5 -0.154509  -0.475528 -0.v 0.154509  0 0.5 0  -0.475528 -0.5 0.154509  0 0.5 0  0 0.5 0  -0.475528 -0.v 0.154509  -0.293892 -0.v 0.404509  0 0.5 0  -0.293892 -0.v 0.404509  0 0.v 0  0 0.5 0  -0.293892 -0.v 0.404509  0 -0.5 0.v  0 0.5 0  0 -0.v 0.five  0 0.5 0  0 0.5 0  0 -0.5 0.5  0.293893 -0.5 0.404509  0 0.5 0  0.293893 -0.5 0.404509  0 0.five 0  0 0.5 0  "      Normals="0.7236065,0.4472139,0.5257313  0.2763934,0.4472138,0.8506507  0.5308242,0.4294462,0.7306172  0.2763934,0.4472138,0.8506507  0,0.4294458,0.9030925  0.5308242,0.4294462,0.7306172  0.2763934,0.4472138,0.8506507  -0.2763934,0.4472138,0.8506507  0,0.4294458,0.9030925  -0.2763934,0.4472138,0.8506507  -0.5308242,0.4294462,0.7306172  0,0.4294458,0.9030925  -0.2763934,0.4472138,0.8506507  -0.7236065,0.4472139,0.5257313  -0.5308242,0.4294462,0.7306172  -0.7236065,0.4472139,0.5257313  -0.858892,0.429446,0.279071  -0.5308242,0.4294462,0.7306172  -0.7236065,0.4472139,0.5257313  -0.8944269,0.4472139,0  -0.858892,0.429446,0.279071  -0.8944269,0.4472139,0  -0.858892,0.429446,-0.279071  -0.858892,0.429446,0.279071  -0.8944269,0.4472139,0  -0.7236065,0.4472139,-0.5257313  -0.858892,0.429446,-0.279071  -0.7236065,0.4472139,-0.5257313  -0.5308242,0.4294462,-0.7306172  -0.858892,0.429446,-0.279071  -0.7236065,0.4472139,-0.5257313  -0.2763934,0.4472138,-0.8506507  -0.5308242,0.4294462,-0.7306172  -0.2763934,0.4472138,-0.8506507  0,0.4294458,-0.9030925  -0.5308242,0.4294462,-0.7306172  -0.2763934,0.4472138,-0.8506507  0.2763934,0.4472138,-0.8506507  0,0.4294458,-0.9030925  0.2763934,0.4472138,-0.8506507  0.5308249,0.4294459,-0.7306169  0,0.4294458,-0.9030925  0.2763934,0.4472138,-0.8506507  0.7236068,0.4472141,-0.5257306  0.5308249,0.4294459,-0.7306169  0.7236068,0.4472141,-0.5257306  0.8588922,0.4294461,-0.27907  0.5308249,0.4294459,-0.7306169  0.7236068,0.4472141,-0.5257306  0.8944269,0.4472139,0  0.8588922,0.4294461,-0.27907  0.8944269,0.4472139,0  0.858892,0.429446,0.279071  0.8588922,0.4294461,-0.27907  0.8944269,0.4472139,0  0.7236065,0.4472139,0.5257313  0.858892,0.429446,0.279071  0.7236065,0.4472139,0.5257313  0.5308242,0.4294462,0.7306172  0.858892,0.429446,0.279071  "                   TriangleIndices="0 ane 2 3 4 5 vi 7 viii nine 10 eleven 12 13 14 15 xvi 17 eighteen nineteen 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 l 51 52 53 54 55 56 57 58 59 " />                     </GeometryModel3D.Geometry>                      <GeometryModel3D.Textile>                       <DiffuseMaterial>                         <DiffuseMaterial.Brush>                           <SolidColorBrush                              Color="Reddish"                              Opacity="one.0"/>                         </DiffuseMaterial.Brush>                       </DiffuseMaterial>                     </GeometryModel3D.Material>                    </GeometryModel3D>                  </Model3DGroup.Children>               </Model3DGroup>              </ModelVisual3D.Content>            </ModelVisual3D>          </Viewport3D.Children>        </Viewport3D>     </Grid>    </UserControl>                          

Run across likewise

  • Viewport3D
  • PerspectiveCamera
  • DirectionalLight
  • Cloth
  • 3D Transformations Overview
  • Maximize WPF 3D Functioning
  • How-to Topics
  • Shapes and Basic Drawing in WPF Overview
  • Painting with Images, Drawings, and Visuals

ellisblity2000.blogspot.com

Source: https://docs.microsoft.com/en-us/dotnet/desktop/wpf/graphics-multimedia/3-d-graphics-overview

Post a Comment for "c wpf 3d graphics visual studio drawing a cube"