1 / 25

Geometric Objects and Basic Transformations

Geometric Objects and Basic Transformations. Paul Taylor 2010. 3D Coordinate systems. DirectX OpenGL. http://alt.pluralsight.com/wiki/default.aspx/Craig.DirectX/CoordinateSystemsTutorial.html. xMax , 0. 2D Coordinates in Windows. 0,0. 0, yMax. xMax , yMax.

bern
Télécharger la présentation

Geometric Objects and Basic Transformations

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Geometric Objects and Basic Transformations Paul Taylor 2010

  2. 3D Coordinate systems DirectX OpenGL http://alt.pluralsight.com/wiki/default.aspx/Craig.DirectX/CoordinateSystemsTutorial.html

  3. xMax, 0 2D Coordinates in Windows 0,0 0, yMax xMax, yMax

  4. In both OpenGL and Direct3D Z is the depth of the viewport!!!! hence the Z-buffer (Depth Buffer)

  5. Z Buffer Depth • Due to the scalar nature of the Pyramid Viewport • Depth precision drops as the distance between the Near and Far planes are moved apart • This will result in more artefacts and visual errors

  6. Using the Z Buffer glEnable(GL_DEPTH_TEST); This enables the Z buffer, but is entirely useless without: glDepthFunc(GL_LEQUAL); You’ll find that the default for the Depth buffer usually doesn’t work.

  7. Viewport types • Orthogonal • No depth perception (scaling) • Projected • This is the typical 3D viewport • Objects \ Vertices are scaled and rotated based on the ‘virtual’ distance from the screen

  8. Viewport Creation • glOrtho(left, right, bottom, top, near, far) • gluOrtho2D • Sets the Near and Far values to 1.0 • (Only renders objects with z=1.0) • Same as glOrtho with near & far = 1.0 • GluPerspective(…) • Creates the Viewport Frame based on a FOV • GlFrustrum(…) • Create the Viewport in a more numerical way • Create your viewport matrix manually if you like!

  9. Matriceis • GL_PROJECTION • GL_MODEL_VIEW • GL_TEXTURE_MATRIX

  10. Matrix Math (Joy!) • Matrix Addition • Matrix Multiplication • Translation and Rotation Matrices

  11. Matrix Addition = + = +

  12. Matrix Multiplication Row,Colum = x = x

  13. That’s great, what do I need them for? Translation Matrices • Coordinates from Object Coordinates to world Coordinates Object Translation World Typically we use a Matrix Multiplication = +

  14. Scalar Matrices Object Scalar (1/10) World This can be done by glScalef(x,y,z); = x

  15. Translation by Multiplication • This is a computationally longer way to do a simple translation • glTranslatef(x,y,z); = x

  16. Rotational Matrices glRotatef(Theta,x,y,z); http://en.wikipedia.org/wiki/Rotation_matrix#Dimension_three A Rotation around the unit vector u = (ux,uy,uz)

  17. Putting it all together Typically you will want to: Translate Rotate Scale Matrix Multiplication is the inverse to the logical order! So: Scale then Rotate, then Translate

  18. Retrieving Matrices • This is slow! • The Video Matricies are 4x4 hence: GLfloat matrix[16]; glGetFloatv(GL_PROJECTION_MATRIX, &matrix[0]); matrix = Simillarly you can do this for GL_MODEL_VIEW and GL_TEXTURE_MATRIX Setting your own Matrix void glLoadMatrixf( &matrix[0]);

  19. BG115 has XNA

  20. Silent Hill 5 (Homecoming) From Jason Allen (Lead Designer) …” We made a decision during development to support invert aim and not invert camera.  Unfortunately none of the team nor any of our test group actually had a preference for playing with an inverted camera, so the issue of its omission never came up.”… http://72.14.235.132/search?q=cache:ylhQ9HOmPg4J:gamesblog.ugo.com/index.php/gamesblog/more/silent_hill_homecomings_jason_allen_on_inverted_aim/+silent+hill+5+no+camera+invert&cd=3&hl=en&ct=clnk&gl=au&client=firefox-a

  21. Matrix Mathematics Continued • Matrix Cross Product • We use this to create Normals

  22. Matrix Dot Product

  23. Normalising Matrcies

  24. Come along to the BIGGEST FREE Engineering Expo on 25 March from 2.00pm to 7.00pm at Etihad Stadium, Docklands (Enter via Gate 9).This event will provide you access to;• 70+ Exhibitors • Recruitment Opportunities• Career and Professional Development Advice • Engineering Industry Insight &Updates on Engineering Projects• Knowledge on Engineering Capability & Leadership Information• FREE Seminars You must pre-register to attend. For more information, please visitwww.engineeringexpo.org.au Don’t miss this showcase of Engineers that ‘Make it So’This event is proudly sponsored by General Electric and Engineering Education Australia. HAVE YOU REGISTERED TO ATTEND THE LARGEST ENGINEERING EXPO IN AUSTRALIA?

  25. LIST OF EXHIBITORS AT 2010 ENGINEERING EXPO Monash University Engineering

More Related