Ma2 Report

  • April 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Ma2 Report as PDF for free.

More details

  • Words: 1,055
  • Pages: 6
Modelling and Rendering - Assignment 2

[THOMAS SAMPSON, GROUP 2Y, GAMES SOFTWARE DEVELOPMENT]

Maths for Modelling and Rendering Assignment 2 2009

Contents

Question 1 introduction

page 2

Question 1a (Combined matrix transformation)

page 3

Question 1b (Resultant vertices)

page 3

Introducing faces

page 4

Defining the faces

page 5

Excel for automation

page 5

Question 1c (Face normal results table)

page 5

Hidden surface removal

page 6

Question 1d (Hypothesis and results)

page 6

1

Modelling and Rendering - Assignment 2

[THOMAS SAMPSON, GROUP 2Y, GAMES SOFTWARE DEVELOPMENT]

Question 1 Personal Numbers Variable

Derivation

r = 17 s= 55 t= 33

12+5 1

( 99/2 ) + 5 1

( 84/3 ) + 5

Octahedron Vertices

A = (200,0,0) B = (0,200,0) C = (-200,0,0) D = (0,-200,0) E = (0,0,200) F = (0,0,-200)

F

B

A

1. Rotated through 17o about the šœ’-axis. 2. Translate by (33,0,0). 3. Rotated through 55o about the y-axis.

D

C

Transformation Steps

E

Matrix Multiplication Chain As we are using column vectors, (a requirement of OpenGL) the following matrices are applied from right to left.

1

Rounded to nearest whole number

2

Modelling and Rendering - Assignment 2

[THOMAS SAMPSON, GROUP 2Y, GAMES SOFTWARE DEVELOPMENT]

a) Combined matrix transformation To find a combined matrix transformation for the three transformation steps outlined on the previous page, we multiply the matrices in pairs from left to right. So, we find the product of the y-axis rotation and the translation, and then find the product of this result and the x-axis rotation. The final multiplication can be represented as follows.

Resultant Matrix

b) Resultant Vertices

A=( B=( C=( D=( E=( F=(

133.64, -28.97, -95.79, 66.83, -137.74, 175.6,

0, 191.26, 0, -191.26, -58.47, 58.47,

190.86 60.57 -136.8 -6.5 136.73 -82.67

) ) ) ) ) )

3

Modelling and Rendering - Assignment 2

[THOMAS SAMPSON, GROUP 2Y, GAMES SOFTWARE DEVELOPMENT]

Faces For this question I am required to find the normal vectors for each face of my octahedron. The way I will achieve this is to take two vectors along each face. A plane can always be represented by two vectors along the plane, and the cross, or "vector" product of these two vectors gives us the normal to the plane. Example

F As an example let us take the plane defined by the vertices C F and D. I specify the vertices in this order as we must take vertices in clockwise order when looking at the plane.

C

D

We will also use a clockwise approach to specify our vectors. The two vectors we will take are Cā†’F and Fā†’D.

Working Cā†’F = F - C and Fā†’D = D - F Cā†’F = (175.6+95.79)i + (58.47-0)j +(-82.67+136.8)k Cā†’F = 271.39i + 58.47j + 54.13k Fā†’D = (66.83-175.6)i + (-191.26-58.47)j + (-6.5+82.67)k Fā†’D = -108.77i + -249.73j 76.17k Let a = Cā†’F and b= Fā†’D Normal to the plane = a X b ("a cross b" or "the vector product of a and b") Unit Normal to the plane CFD = 0.26i -0.38j - 0.89k

4

Modelling and Rendering - Assignment 2

[THOMAS SAMPSON, GROUP 2Y, GAMES SOFTWARE DEVELOPMENT]

Defining the faces The octahedron has 8 faces which in our example can be described by the following vertices. FACE 1

=

FBA

FACE 2

=

FAD

FACE 3

=

FDC

FACE 4

=

FCB

FACE 5

=

EAB

FACE 6

=

EDA

FACE 7

=

ECD

FACE 8

=

EBC

F

B

A C

D

E

Using excel for automation To save repeating tedious calculations by hand which may result in a loss of accuracy, I have constructed a unit normal calculator (this can be found on the CD as "unit_normal_calc.xls") to find the unit normals. This spreadsheet simply carries out the vector cross product as described on the previous page, and divides the resulting normal by the modulus of the result to create a unit normal (a normal with a length of 1).

Screenshot of "unit_norm_calc.xls"

c) Face normal results table Face FACE 1 FACE 2 FACE 3 FACE 4 FACE 5 FACE 6 FACE 7 FACE 8

Unit Normal

0.645i + 0.721j + 0.253k 0.922i -0.383j + 0.059k 0.259i -0.383j -0.886k -0.017i + 0.721j -0.692k -0.259i + 0.383j + 0.886k 0.017i -0.721j + 0.692k -0.645i -0.721j - 0.253k -0.922i + 0.383j - 0.059k

5

[THOMAS SAMPSON, GROUP 2Y, GAMES SOFTWARE DEVELOPMENT]

Modelling and Rendering - Assignment 2

Hidden surface removal As the octahedron is a convex shape (each line segments joining vertices lies within the object) then the only hidden surface removal we need to deal with is back face culling as no two front facing surfaces will be occluded by one another. To achieve hidden surface removal we simply take two vectors, one joining the centre of projection with a point on the polygon, and the other being the unit normal of the polygon (calculated in the previous question). If the angle between these two vectors is acute (<90) the surface is rendered, otherwise the surface is not rendered. Finding the vector between angles To find the angle between two vectors I will use the following formula š‘Ž. š‘ = š‘Ž . š‘ š‘š‘œš‘ šœƒ Hence... šœƒ = š‘š‘œš‘  āˆ’1

š‘Ž.š‘ š‘Ž .|š‘|

Finding the polygon to camera vector Finding the vector from the camera to the polygon is a simple calculation. We take a vertex from the polygon (the top 4 faces all share a common vertex, as do the bottom 4) and the position of the camera (0,0,500) and subtract the two (as Aā†’B=B-A). d) Hypothesis and results Attempting to guess the results of these angles is near impossible after the transformations have been applied, but as a maximum 4 faces of an octahedron can ever be visible at one given time, I am hoping this is reflected in my results. Face FACE 1 FACE 2 FACE 3 FACE 4 FACE 5 FACE 6 FACE 7 FACE 8

Unit Normal 0.645i + 0.721j + 0.253k

Polygon to Camera Vector

0.286i+0.1j-0.953k

60.15

0.922i -0.383j + 0.059k

0.286i+0.1j-0.953k

73.64o

Yes

0.259i -0.383j -0.886k

0.286i+0.1j-0.953k

144.0o

No

-0.017i + 0.721j -0.692k

0.286i+0.1j-0.953k

126.34o

No

-0.259i + 0.383j + 0.886k

-0.7867i-0.149k-0.925k

123.38o

No

0.017i -0.721j + 0.692k

-0.7867i-0.149k-0.925k

116.52o

No

-0.645i -0.721j - 0.253k

-0.7867i-0.149k-0.925k

46.06o

Yes

-0.922i + 0.383j - 0.059k

-0.7867i-0.149k-0.925k

53.79o

Yes

Angle o

Visible? Yes

6

Related Documents

Ma2 Report
April 2020 2
Ma2
July 2020 9
Ma2
June 2020 17
Ma2.pdf
December 2019 12
Zbierka Ma2
November 2019 12