1 / 16

Implementing Transformation and Culling Techniques for 3D Object Rendering

This assignment focuses on implementing fundamental transformation techniques and culling methods in 3D graphics. You will work with modelview and projection transformations, perform perspective division, and set up viewport transformations. The assignment includes back-face culling to enhance rendering efficiency, and as a bonus task, you may implement view frustum culling to eliminate unnecessary polygons outside the view. The input will be 3D model files (.obj, .mtl), and your output will be a wireframe representation of the model that applies back-face culling.

chaela
Download Presentation

Implementing Transformation and Culling Techniques for 3D Object Rendering

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. Assignment 2 Phase 1 Transformation Back-face culling View frustum culling

  2. Outline • Implement the transformation. • Modelview transformation • Projection transformation • Perspective division • Viewport transformation • Implement back-face culling. • Bonus: Implement view frustum culling.

  3. Input and Output • Input: *.view *.obj *.mtl • Same as assignment 1 • Output: Wireframe of the obj with back-face culling

  4. Transformation 1/3 Modelview Matrix Projection Matrix Viewport Transformation Perspective Division Vertex Vertex = Projection * Modelview * Vertex ; Vertex.xyzw /= Vertex.w; Vertex = Viewport * Vertex;

  5. Model view gluLookAt( GLdouble eyex, GLdouble eyey, GLdouble eyez, GLdouble atx, GLdouble aty, GLdouble atz, GLdouble upx, GLdouble upy, GLdoubpe upz ); N = (eye - at)/|eye - at|; V = up – (N•up)N; |up| = 1.0 U = V x N ;

  6. Model view • Modelview = BT

  7. Projection • gluPerspective( GLdouble fovy, GLdouble aspect, GLdouble near, GLdouble far );

  8. Projection • n=near; • f=far; • t=n*tan( fovy *PI / 180.0 /2); • b= -t; • r= t* aspect; • l= -r;

  9. Projection • Projection = NSH =

  10. Perspective Division • x /= w; • y /= w; • z /= w; • w /= w;

  11. View Port • Viewport = TS • From [-1 , 1 ] to [0 , width (or height) ]

  12. Back-face culling • You can perform back-face culling in • World cord. • View cord. • ZN < 0 • Window cord. • Clock wise 1 Back face 3 2

  13. View frustum culling • eliminate the polygon that complete outside the view frustum. • Bonus: view frustum clipping • Remove the part of polygon that outside the view frustum.

  14. How to draw wireframe? • Render the image using glBegin(GL_LINE_LOOP); glVertex2i(x,y); … glEnd();

  15. What to do in reshape function? void GL_reshape(GLsizei w, GLsizei h){ glViewport(viewport->x, viewport->y, viewport->width, viewport->height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(viewport->x, viewport->width, viewport->y, viewport->height); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); }

  16. UI requirement • Show an input command line. • “Please input the file name.” • If I type “box”, then read box.obj and box.view etc.

More Related