Overview of 3D graphics in Windows Presentation Foundation

Windows Presentation Foundation 3-D classes allow developers to create 3D models in Windows applications as a part of GUI.

Creating 3D Models involves
1. Creating 3D surfaces by defining more number of triangular surfaces
2. Assigning Material property for the 3D model
3. Creating light sources
4. Creating camera to visualize the 3D model from different angle.
5. Animating the models



Coordinate System

Cameras and Projections

With Camera, a 3D model can be viewed in different angles. The camera can be positioned at any distance from the model for a particular view angle. The NearPlaneDistance and FarPlaneDistance properties of ProjectionCamera limit the range for the projection, the model within this range are displayed in the screen.

There are two types of Camera available in WPF

· PerspectiveCamera
· OrthographicCamera

Using Perspective camera, 3D models can be visualized more realistically. There is a vanishing point for Perspective camera, the point where the edges of the surfaces tend to join. In Orthographic projection, edges are parallel.

Model and Mesh Primitives

At present the Windows Presentation Foundation supports modeling geometries with GeometryModel3D and the Geometry property of this particular model takes a mesh primitive.

There are two types of 3D models

Mesh

Solid

The Mesh is a model defined using surfaces, formed using triangle. The solid model is it defined using volume. The WPF supports 3D models based on the mesh geomentry.

To create a 3D Model

1. Define vertex points in 3D co-ordinate system ( P1 to P8 )



2. Define the indexes of 3 vertices, which form a triangular surface.

3. Define normal vector for each triangle

4. Define more no of triangular surfaces as above to form a 3D model.

Applying Materials to the Model

We need to apply material to the mesh surface. Depending on the material surface property, they get illuminated differently when the light rays fall on the surface.

There are three types of materials, based on their light reflecting property.

1. Diffuse Material - don't reflect light, ex. cotton clothes.

2. Specular Meterial - reflect light so the surface looks glossy, ex. floor tiles

3. Emissive Material - emits lights equal to the color of brush

Illuminating the Scene

At least one light is included in the scene (3D models & space). This makes the 3D model visible. They create different effect shadow, reflection effect on the materials surfaces.

There are 4 types of lights

Ambient light - Illuminates all surfaces equally, regardless of its orientation and location.

Directional light - It is like a beam of light rays. It has only the direction vector, but no location.

Point light - It has position information. The objects near to the light get more illuminated than the objects in the far.

Spot light - it is derived from the point light and directional light. They have both direction and position. InnerConeAngle, OuterConeAngle, and position are specified.

Transforming Models

Transforming 3D models are possible. It is very difficult to define vertex of the model for each location, rotation and scale. Instead the transformation of these vertexes is possible in WPF.

Animating Models

The animation is used to visualize the 3D models in motion. They are based on time interval and location. The following object can be animated.

The object or group of objects, camera, light, or combination of these can be animated.

The properties of these WPF elements are changed at different time interval to create animation effect.

Thus as a developer you can use the Windows Presentation Foundation 3-D classes to create 3D model for giving more visual representation of their system.


“Amazon and the Amazon logo are trademarks of Amazon.com, Inc. or its affiliates.”

| Privacy Policy for www.dotnet-guide.com | Disclosure | Contact |

Copyright - © 2004 - 2024 - All Rights Reserved.