Understanding 3D Graphics for Game Programming: Vertex Processing, Spaces, and Transforms, Study notes of Computer Graphics

A chapter extract from the book '3D Graphics for Game Programming' by J. Han. It covers the concepts of vertex processing, spaces, transforms, and affine transforms in computer graphics. The chapter explains the main stages of the rendering pipeline, the role of vertex processing, and the use of affine transforms for scaling, rotation, and translation. It also provides examples and explanations of homogeneous coordinates, world transform, view transform, and projection transform.

Typology: Study notes

2021/2022

Uploaded on 09/07/2022

adnan_95
adnan_95 🇮🇶

4.3

(39)

918 documents

1 / 39

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
3D Graphics for Game Programming (J. Han)
Chapter II
Vertex Processing
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27

Partial preview of the text

Download Understanding 3D Graphics for Game Programming: Vertex Processing, Spaces, and Transforms and more Study notes Computer Graphics in PDF only on Docsity!

3D Graphics for Game Programming (J. Han)

Chapter II

Vertex Processing

Rendering Pipeline

§ Main stages in the pipeline § The vertex processing stage operates on every input vertex stored in the vertex buffer and performs various operations such as transform. § The rasterization stage assembles polygons from the vertices and converts each polygon into a set of fragments. (A fragment refers to a set of data needed to update a pixel in the color buffer. The color buffer is a memory space storing the pixels to be displayed on the screen.) § The fragment processing stage operates on each fragment and determines its color. § In the output merging stage, the fragment competes or combines with the pixel in the color buffer to update the pixel color.

Spaces and Transforms for Vertex Processing

§ Typical operations on a vertex § Transform - This chapter § Lighting - This chapter and Chapter 5 § Animation - Chapter 11 § Transforms at the vertex processing stage § World transform § View transform § Projection transform.

Affine Transform – Scaling

§ The world and view transforms are built upon affine transforms. § Affine transform § Linear transform § Scaling § Rotation § Translation § Scaling examples in 2D § If all of the scaling factors, sx , sy , and sz , are identical, the scaling is called uniform. Otherwise, it is a non-uniform scaling. 1 2 2 2 1 1 2 4 (-1,-1) (-2,-1) (-1,-1/2) (-2,-2) ( sx , sy )=(2,1) ( sx , sy )=(1,1/2) ( sx ,^ sy )=(2,2)

Affine Transform – Rotation (cont’d)

§ 3D rotation about z - axis ( Rz ) § 3D rotation about x - axis can be obtained through cyclic permutation, i.e., x- , y- , and z- coordinates are replaced by y - , z - , and x - coordinates, respectively. § One more cyclic permutation leads to 3D rotation about y - axis.

Affine Transform – Translation

§ Translation does not fall into the class of linear transforms, and is represented as vector addition. § We can describe translation as matrix multiplication if we use the homogeneous coordinates. Given the 3D Cartesian coordinates ( x , y , z ) of a point, we can simply take ( x , y , z , 1) as its homogeneous coordinates. § The matrices for scaling and rotation should be extended into 4x4 matrices.

World Transform

§ A model is created in its own object space. The object space for a model typically has no relationship to that of another model. § The world transform ‘assembles’ all models into a single coordinate system called world space.

World Transform (cont’d)

Euler Transform

§ When we successively rotate an object about the x - , y - , and z - axes, the object acquires a specific orientation.

§ The rotations angles ( θ x ,θ y ,θ z ) are called the Euler angles. When three rotations

are combined into one, it is called Euler transform.

Normal Transform

View Transform

§ The world transform has been done, and now all objects are in the world space. § Next step: camera pose specification § EYE : camera position § AT : a reference point toward which the camera is aimed § UP : view up vector that roughly describes where the top of the camera is pointing. (In most cases, UP is set to the y - axis of the world space.) § Then, the camera space , { EYE , u , v , n }, can be created.

View Transform (cont’d)

§ A point is given different coordinates in distinct spaces. § If all the world-space objects can be newly defined in terms of the camera space in the manner of the teapot's mouth, it becomes much easier to develop the rendering algorithms. In general, it is called space change. § The view transform converts each vertex from the world space to the camera space.

Orthonormal Basis

§ Orthonormal basis = an orthogonal set of unit vectors § The camera space has an orthonormal basis { u , v , n }. § Note that uu = vv = nn =1 and uv = vn = nu =0. orthonormal standard non-orthonormal non-standard orthonormal non-standard

2D Analogy for View Transform

§ The coordinates of p are (1,1) in the world space but (-√2,0) in the camera space. § Let’s superimpose the camera space to the world space while imagining invisible rods connecting p and the camera space such that the transform is applied to p. § As the camera space becomes identical to the world space, the world-space coordinates of p" can be taken as the camera-space coordinates. translation by (-2,-2) rotation by^ -^45 º