Unlike PerspectiveCamera, however, OrthographicCamera describes a projection that does not include perspective foreshortening. Like other cameras, it specifies a position, viewing direction, and "upward" direction. OrthographicCamera specifies an orthogonal projection of a 3D model to a 2D visual surface. Conversely, FarPlaneDistance lets you specify a distance from the camera beyond which objects will not be drawn, which ensures that objects too far away to be recognizable won't be included in the scene. NearPlaneDistance allows you to specify a minimum distance from the camera beyond which objects will not be drawn. Because cameras can be located anywhere in the scene, it's possible for the camera to be actually positioned inside a model or very near a model, making it hard to distinguish objects properly. The NearPlaneDistance and FarPlaneDistance properties of ProjectionCamera limit the range of the camera's projection. The following diagram illustrates the PerspectiveCamera's projection. You can specify the position of the 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. In other words, the PerspectiveCamera provides vanishing-point perspective. A PerspectiveCamera specifies a projection that foreshortens the scene. The ProjectionCamera allows you to specify different projections and their properties to change how the onlooker sees 3D models. The Camera class allows you to specify this point of view for a 3D scene.Īnother way to understand how a 3D scene is represented on a 2D surface is by describing the scene as a projection onto the viewing surface. Because a 3D scene looks different depending on the onlooker's point of view, you must specify that point of view. When you create a 3D scene, it's important to remember that you are really creating a 2D representation of 3D objects. Remember also that objects in world space might look entirely different, or not be visible at all, depending on light and camera settings, but the position of the camera does not change the location of objects in world space.ĭevelopers who work in 2D are accustomed to positioning drawing primitives on a two-dimensional screen. As you 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. The space defined by these axes is the stationary frame of reference for 3D objects in WPF. In the 3D coordinate system, however, the origin is located in the center of the rendering area, with positive x-axis values proceeding to the right but positive y-axis values proceeding upward instead, and positive z-axis values proceeding outward from the origin, toward the viewer.Ĭonventional 2D and 3D coordinate system representations In the 2D system, positive x-axis values proceed to the right and positive y-axis values proceed downward. The WPF coordinate system for 2D graphics locates the origin in the upper left of the rendering area (typically the screen). This topic will focus on how to draw 3D graphics inside the Viewport3D. Although you can use Viewport3D with other 2D drawing objects in the same scene graph, you cannot interpenetrate 2D and 3D objects within a Viewport3D. In a conventional 2D application, use Viewport3D as you would another container element like Grid or Canvas. More accurately, it is a surface on which a 3D scene is projected. Viewport3D functions as a window-a viewport-into a three-dimensional scene. The graphics system treats Viewport3D as a two-dimensional visual element like many others in WPF. This topic provides an overview of 3D functionality in the WPF graphics system.ģD graphics content in WPF is encapsulated in an element, Viewport3D, that can participate in the two-dimensional element structure. The 3D functionality in WPF is not designed to provide a full-featured game-development platform.
0 Comments
Leave a Reply. |