Starting from:
$30

$24

CSC4140 Assignment II Computer Graphics Transformation

    • From Model to Screen (80 points)

If we want to get a model to screen, we bacially need the following steps:

    1. Model Translation T

    2. Model Scaling S

    3. Model Rotation R

    4. View Translation

    5. View Rotation

    6. Project

Written in Matrix production:


M odelV iewP roject = P roject V iewR  V iewT  M odelS  M odelR  M odelT
(1)

For this assignment, your tasks are


1.1    Implement Model Matrix (40 Points)

Complete the given function.





1
get_model_matrix( f l o a t  rotation_angle ,

2
Eigen:: Vector3f T,

3
Eigen:: Vector3f S,





4
Eigen:: Vector3f
P0,

5
Eigen:: Vector3f
P1):










Note: express the tranforms in each steps use homogeneous coordinates. For example use 4 Matrix to express the translation Vector3f T. (You can also validate your results by using the Eigen’s lib function.)

Follow the instructions in the give code structure.


 

1.2    Implement perspective projection Matrix (40 Points)

1

get_projection_matrix( f l o a t
eye_fov,






2

f l o a t
aspect_ratio ,





3

f l o a t zNear,

4

f l o a t
Zfar )













1.3    Implement main() function according to your needs (20 Points)



1

2

3

4


i n t main( i n t argc ,  const char **  argv)

{

\\ your code

}



1.4    Useful information you need this time



    • \\Member Variables


2
\\ three transformation matrix



    • Matrix4f model,  view,  projection ;

4


    • \\ frame buffer :  cache what you want to draw on screen

    • vector < Vector3f >  frame_buf;

7


    • \\Member Functions

    • \\ t r a n s f e r model matrix as

10
\\ parameters to  r a s t e r i z e r ( given)


    11 set_model( const Eigen:: Matrix4f& m)

12

13
\\ set view transformation to view matrix


    14 set_view( const Eigen:: Matrix4f&  v)

15

16
\\  t r a n s f e r  projection matrix to  r a s t e r i z e r


    17 set_projection ( const Eigen:: Matrix4f&  p)

18

19    \\    set  p i x e l ( i , j )  on screen with color ( r ,g,b)


3

20


21

\\  and write to frame buffer


set_pixel ( Vector2f point ,  Vector3f color )




    • Your report (20 Points)

For this assignment, 10% is for the template using. Do submit your report using the given template in the first assignment. 80% is listed in Section 1. 10% is for your completing you main() function and make it easier to use (e.g., define a .xml file to record eye_position, rotation angle or other parameters. This part is not limited)

In your report,

    1) You need to define a proper eye position freely

    2) define a proper triangle

    3) define your eye_fov, aspect_ratio, zNear, zFar.

    4) all other missing information


You need to think where you should define the object (triangle), your eye position and other parameters. As if you cannot define a proper parameters, you might get nothing on your screen as your "eye" cannot see it. So in your report, write down this parameters by either inside your code or an extra parameter file (e.g. .xml which you do not always need compile the code), and show the corresponding results on the screen.

In your report, I would like to see at least two corresponding results (at least see a triangle on your screen, you can put more). Make it easier to run for TAs, just save the results images as "results_1.png, results_2.png, ...). Your report and your code result must match each other.

submission list    all naming roles is given in last assignment, zip them together submit it.

    1) PDF report

    2) codes

    3) CMake file

    4) Readme: describe how to run your code and some extra work you think I can give you more grades.

    5) a bash file that can compile the code, run the code(save the results). Direct run and see result.










4

More products