Download presentation

Presentation is loading. Please wait.

Published byTheresa Bangs Modified about 1 year ago

2
CSC418 Computer Graphics n Polygon normals n Back Faces n Visibility Algorithms

3
Polygon Normal n Triangle normal calculation n Polygon normal calculation n Polymeshes (vertex normals)

4
Polygon Normal n Triangle normal calculation N=(P2-P1)X(P3-P2) P2 P3 P1

5
Polygon Normal n Polygon normal calculation N=(P2-P1)X(P3-P2) P2 P3 P1 P4 P5 Pn

6
Polygon Normal n Polygon normal calculation N=(P2-P1)X(P3-P2) Problems n Sliver triangles n Non-planar polygons P2 P3 P1 P4 P5 Pn

7
Polygon Normal n Polygon normal calculation Nx = yj – yi)(zj + zi) Ny = zj – zi)(xj + xi) Nz = xj – xi)(yj + yi) j= (i+1) mod n P2 P3 P1 P4 P5 Pn

8
Polymesh Normal n Face normals

9
Polymesh Normal n Vertex normals

10
Polymesh Normal n Vertex normals average the face normals

11
Bilinear Interpolation P uv = (1-u)(1-v)P0 + ( u )(1-v)P1 + ( u )( v )P2 + (1-u)( v )P3 P0 P1 P2 P3 u v P uv

12
Bilinear Interpolation P uv = (1-u)(1-v)P0 + ( u )(1-v)P1 + ( u )( v )P2 + (1-u)( v )P3 P0 P1 P2 P3 u v P uv Gourard shading (color interpolation)

13
Visibility Problem n What is NOT visible?

14
Visibility Problem n What is NOT visible? primitives outside of the field of view back-facing primitives primitives occluded by other objects closer to the camera

15
Backface culling

17
V N E

18
n N.V > 0 is a back face?

19
Backface culling n N.(P-E) >0 V N E P

20
Backface culling Where in the graphics pipeline can we do backface culling? canonical projection

21
Occluded faces Does backface culling always determine visibility completely for a single object?

22
Occluded faces n In typical scenes some polygons will overlap, we must determine which portion of each polygon is visible to eye!

23
Painters Algorithm n Sort primitives in Z. n Draw primitives back to front (CBA). A B C

24
Painters Algorithm n Problems –Large faces –Intersecting faces –Cycles

25
Visibility Problem n Image space algorithms –Operate in display terms pixels, scanlines –Visibility resolved to display resolution –Examples: Z-buffer, ray-tracing –O(n*resolution) n Object Space algorithms –Analytically compute visible fragments –Examples: painters algorithm, BSP –O(n 2 )

26
CSC418 Computer Graphics n Next Lecture –BSP trees –Depth sorting –Z-buffer A-buffer

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google