• 沒有找到結果。

Chapter 2 Background

2.2 Rendering Process

2.2.1 Transformation

Transformation includes three coordinate spaces:

A. Local or modeling coordinates systems

For ease of modelling it makes sense to store the vertices of a polygon mesh object with respect to some point located in or near the object. For example, we would almost certainly want to locate the origin of a cube at one of the cube vertices, or we would want to make the axis of symmetry of an object generated as a solid of revolution, coincident with the z axis. As well as storing the polygon vertices in a coordinate system that is local to the object, we would also store the polygon normal and the vertex normals. When local transformations are applied to the vertices of an object, the corresponding transformations are applied to the associated normals.

B. World coordinate systems

Once an object has been modeled the next stage is to place it in the scene that we wish to render. All objects that together constitute a scene have their separate local coordinate systems. The global coordinate system of the scene is known as the ‘world coordinate system’. All objects have to be transformed into this common space in order that their relative spatial relationships may be defined. The act of placing an object in a scene defines the transformation required to take the object from local space to world space.

If the object is being animated, then the animation system provides a time-varying transformation that takes the object into world space on a frame by frame basis.

The scene is lit in world space. Light sources are specified, and if the shaders within the renderer function are in world space then this is the final transformation that the normals of the object have to undergo. The surface attributes of an object – texture, colour, and so on – are specified and tuned in this space.

C. Camera or eye view coordinate system

The eye, camera or view coordinate system is a space that is used to establish

viewing parameters (view point, view direction) and a view volume. (A virtual camera is often used as the analogy in viewing systems, but if such an allusion is made we must be careful to distinguish between external camera parameters or those that affect the nature and size of the image on the film plane. Most rendering systems imitate a camera which in practice would be a perfect pinhole. However, there are other facilities in computer graphics that cannot be imitated by a camera and because of this the analogy is of limited utility.)

We will now deal with a basic view coordinate system and the transformation from world space to view coordinate space. The reason that this space exist, after all we could go directly from world space to screen space, is that certain operations ( and specifications ) are most conveniently carried out in view space.

We define a viewing system as being the combination of a view coordinate system together with the specification of certain facilities such as a view volume. The simplest or minimum system would consist of the following:

z A view point which establishes the viewer’s position in world space;

this can either be the origin of the view coordinate system or the centre of projection together with a view direction N.

z A view coordinate system defined with respect to the view point.

z A view plane onto which the two-dimensional image of the scene is projected.

z A view frustum or volume which defines the field or view.

Figure 2-3 The minimum entities required in a practical viewing system [1]

These entities are show in Figure 2.3. The view coordinate system, UVN, has N coincident with the viewing direction and V and U lying in a plane parallel to the view plane. We can consider the origin of the system to be the vie point C. The view plane containing U and V is of infinite extent and we specify a view volume or frustum which defines a window in the view plane.

It is the contents of this window – the projection of that part of the scene that is contained within the view volume – that finally appears in the screen.

Thus, using the virtual camera analogue we have a camera that can be positioned anywhere in world coordinate space, pointed in any direction and rotated about the viewing direction N.

To transform points in world coordinate space we invoke a change of coordinate system transformation and this split into two components: a translational one and a rotational one. Thus:

The minimum entities required in a practical viewing system.

(a) View point C and viewing direction N.

(b) A view plane normal to the viewing direction N positioned d units from C.

(c) A view coordinates system with the origin C and UV axes embedded in plane parallel to the view plane.

(d) A view volume defined by the frustum formed by C and the view plane window.

(1)

The only problem now is specifying a user interface for the system and mapping whatever parameters are used by the interface into U, V and N. A user needs to specify C, N and V. C is easy enough. N, the viewing direction or view plane normal, can be entered say, using two angles in a spherical coordinate system – this seems reasonably intuitive:

θ the azimuth angle

φ the colatitude or elevation angle where:

V is more problematic. For example, a user may require ‘up’ to be the same sense as ‘up’ in the world coordinates system. However, this cannot be achieved by setting:

(0, 0,1) V =

because V must be perpendicular to N. A sensible strategy is to allow a user to specify an approximate orientation for V, say V’ and have the system calculate V. Figure 2.4 demonstrate this. V’ is the user-specified up vector.

This is projected onto the view plane:

' ( ' ) (5)

V = −V V N Ni

and normalized. U can be specified or not depending on the user’s requirements. If U is unspecified, it is obtained from:

(6) U = ×N V

This results in a left-hand coordinate system, which although somewhat inconsistent, conforms with our intuition of a practical viewing system, which has increasing distances from the view point as increasing values along the view direction axis. Having established the viewing transformation using UVN notation, we will in subsequent section use ( ,x y zv v, v) to specify points in the view coordinate system.

Figure 2-4 The calculation of up vector V [1]

The up vector V can be calculated from an ‘indication’ given by V’.

相關文件