SlideServe
Menu
Préférences
© SlideServe · v2026

Advanced Render Pipeline Techniques: Transformation, Shading, and Lighting

norman avatar
19 diapositives · 306 Views · Sep 17, 2014

Explore the rendering pipeline phases, from transformation and backface culling to shading, lighting, and scan-conversion. Understand handling vertex data, normalizing view volumes, applying perspective transformations, and shading models. Learn about scan-line approaches, hidden surface removal, and optimizing OpenGL commands for efficient rendering.

Advanced Render Pipeline Techniques: Transformation, Shading, and Lighting - slide 1
01 / 19Advanced Render Pipeline Techniques: Transformation, Shading, and Lighting
1 / 17

Télécharger la présentation

Advanced Render Pipeline Techniques: Transformation, Shading, and Lighting
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Assignment 2 Rendering Pipeline

  2. Outlines • Phase 1 • Transformation • Backface culling • Projection and Wireframe output • Phase 2 • Shading • Lighting • Scan-Convert

  3. The Data Structure • For a polygon, it should contain the following data • Position of all vertices • Normal of all vertices • Material data

  4. Y Y Y X Z Z X Z X Translate Rotate Phase 1 – Transformation1/4 • Viewing Transformation • World coordinate to View coordinate

  5. Phase 1 – Transformation2/4 • The translate matrix • Translate the eye point to origin • The rotate matrix • Rotate view direction to –Z-axis • For vertices, apply both two matrices, for normal, apply the rotate matrix.

  6. 1 Far -1 1 Near -1 Phase 1 – Transformation3/4 • Perspective Transformation • Normalize the view volume • Perspective view volume to canonical view volume

  7. Height/2 1 -Width/2 Width/2 -Height/2 -1 1 -1 Phase 1 – Transformation4/4 • Viewport Transformation • Scale the X and Y axis to the window size

  8. Phase 1 – Backface Culling1/2 • Backface Culling • The backface test equation • ni is the normal of vertex i • vi is the position of vertex i • e is the eye point

  9. Phase 1 – Backface Culling2/2 • Since we translate the eye point to origin, the equation can be rewritten as • Backface test of a polygon • A polygon is backface if and only if all it’s vertices sarisfy backface test equation.

  10. Phase 1 – Projection1/2 • Projection (using OpenGL) • Since the view volume is scaled to the window size, we should use gluOrtho2D(-width/2, width/2, -height/w, height/2); command to fit our view volume.

  11. Phase 1 – Projection2/2 • The code gluOrthi2D(-width/2,width/2,-height/2,height/2); for each polygon { glBegin(GL_LINE_LOOP); for all vertex of this polygon glVertex2i(position_X, position_Y); glEnd(); }

  12. Phase 2 - Shading1/2 • Gouraud shading • The light calculation is done before we apply the perspective transformation. • For each vertex

  13. Phase 2 – Shading2/2 • Phong shading • The light calculation is done when apply scan convert to get the point (pixel) on screen. • Inverse the transformation to get the correct relation between this point, light, and eye point. • For each point (pixel) when scan convert.

  14. Phase 2 - Lighting • Light calculation • The phong model

  15. V3 Y V2 x=j Vy1 y=i y=i Vy2 Vy1 Vx Vy2 V1 X Phase 2 - Scan-Convert1/4 • Scan convert • Use scan-line approach

  16. Phase 2 - Scan-Convert2/4 • The position of Vx in our view volume is • Vx(x, y, z) = (screen_X, screen_y, Z_interpolated); • For gouraud shading • Use scan-line to get the color of Vx. • Draw the point using OpenGL command glBegin(GL_POINTS); glColor3fv(color_of_Vx); glVertex3fv(Vx); glEnd();

  17. Phase 2 - Scan-Convert3/4 • For phong shading • Use scan-line to get the normal of Vx. • Apply inverse transform to Vx (and light) back to perspective view volume. • Calculate the color of Vx and render it as what gouraud shading do. • We need to set the view volume in OpenGL to fit our view volume as in phase 1. • glOrtho2D(…)

  18. Phase 2 - Scan-Convert4/4 • Hidden Surface Removal • We use glVertex3f() to render Vx, since there is Z-component in it, OpenGL will apply the HSR by Z-buffer itself (you should enable GL_DEPTH_TEST first).

  19. Any Question ?