Week 5 - Friday
What did we talk about last time? Euler angles Quaternions Started vertex blending and morphing
If we animate by moving rigid bodies around each other, joints won't look natural To do so, we define bones and skin and have the rigid bone changes dictate blended changes in the skin
The following equation shows the effect that each bone i (and its corresponding animation transform matrix B i ( t ) and bone to world transform matrix M i ) have on the p , the original location of a vertex − − n 1 n 1 ∑ ∑ − = = 1 u ( t ) w B ( t ) M p where w 1 i i i i = = i 0 i 0 Vertex blending is popular in part because it can be computed in hardware with the vertex shader
Morphing is the technique for interpolating between two complete 3D models It has two problems: Vertex correspondence ▪ What if there is not a 1 to 1 correspondence between vertices? Interpolation ▪ How do we combine the two models?
We're going to ignore the correspondence problem (because it's really hard) If there's a 1 to 1 correspondence, we use parameter s ∈ [0,1] to indicate where we are between the models and then find the new location m based on the two locations p 0 and p 1 = − + m ( 1 s ) p s p 0 1 Morph targets is another technique that adds in weighted poses to a neutral model
Finally, we deal with the issue of projecting the points into view space Since we only have a 2D screen, we need to map everything to x and y coordinates Like other transforms, we can accomplish projection with a 4 x 4 matrix Unlike affine transforms, projection transforms can affect the w components in homogeneous notation
An orthographic projection maintains the property that parallel lines are still 1 0 0 0 parallel after projection The most basic orthographic projection 0 1 0 0 = P 0 matrix simply removes all the z values 0 0 0 0 This projection is not ideal because z values are lost 0 0 0 1 Things behind the camera are in front z -buffer algorithms don't work
To maintain relative depths and allow for clipping, we usually set up a canonical view volume based on ( l , r , b , t , n , f ) + 2 r l These letters simply refer to the six − 0 0 − − bounding planes of the cube r l r l + Left 2 t b − 0 0 Right = − − P 0 t b t b Bottom + 2 f n − 0 0 Top − − f n f n Near 0 0 0 1 Far Here is the (OpenGL) matrix that translates all points and scales them into the canonical view volume
OpenGL normalizes to a canonical view volume from + 2 r l − [-1,1] in x , [-1,1] in y , and [- 0 0 − − r l r l 1,1] in z + 2 t b − 0 0 Just to be silly, MonoGame = − − P 0 t b t b normalizes to a canonical 1 n − 0 0 − − view volume of [-1,1] in x , [- f n f n 1,1] in y , and [0,1] in z 0 0 0 1 Thus, its projection matrix is:
A perspective projection does not preserve parallel lines Lines that are farther from the camera will appear smaller Thus, a view frustum must be normalized to a canonical view volume Because points actually move (in x and y ) based on their z distance, there is a distorting term in the w row of the projection matrix
Here is the MonoGame projection matrix It is different from the OpenGL again because it only uses [0,1] for z + 2 n r l 0 0 − − r l r l + 2 n t b 0 0 = − − P 0 t b t b − f fn − 0 0 − − f n f n − 0 0 1 0
Light Materials Sensors
Read Chapter 5 for Monday Finish Project 1 Due tonight by 11:59 p.m.! Keep working on Assignment 2 Due next Friday
Recommend
More recommend