280 likes | 313 Views
Explore polygon clipping methods like view frustum clipping, normal-based back-face removal, and Sutherland-Hodgman algorithm for efficient 3D rendering. Learn about clipping space coordinates and bounding volumes in this informative guide.
E N D
A view frustum, with near- and far- clip planes. Only the shaded volume is rendered.
This manner is OK. But, it needs “Division” before clipping. Sometimes, it is kind of waste. For example, red color shapes below. Z=-f Z=0 Z = -n
Another Trivial Rejection Clipping w = -z What does it imply? Remember if a point is behind eye, we can not see it!!. i.e., z > 0, means it is behind eye. So, we can check the fourth item(before division). If the fourth item is negative, this point is behind the eye point.
Removing Back-Faces • Idea: Compare the normal of each face with the viewing direction Given n, the outward-pointing normal of F for each face F of object if (n.v > 0) throw away the faceDoes it work? It always culls half number of input polygons
Inside Outside Outside Inside A Case 2 Case 1 P’: output B A B P: output P: output second A B B P’: output first No output Case 4 Case 3 A Outside Inside Inside Outside
B A
B P: output second P’: output first A
B A P: output
A P’: output B
A No output B
B No output A
Polygon Clipping in Homogeneous Coordinates (Clipping Space Coordinates
C’ color is also linearly interpolated such as C’(r) = A’ (r)+(B’ (r)-A’(r))*t C’(g) = A’(g)+(B’(g)-A’(g))*t ……………. Or even for original 3D position (x,y,z) or texture space (u,v) or normal vector (Nx,Ny,Nz) Aout != Bout
Case 2 Case 4 Ex: left: C0=-C3 C0=A0+t(B0-A0) C3=A3+t(B3-A3) A0+t(B0-A0) = -A3-t(B3-A3) =>> (-A3-A0)=t(B0-A0+B3-A3) Case 4 Case 1 Ex: left side B0,B1,B2,B3 A0,A1,A2,A3 Return #num of vertex
P: output second A B P’: output first Case 4 Outside Inside C C Ex: left boundary: C0=-C3 C0=A0+t(B0-A0) C3=A3+t(B3-A3) A0+t(B0-A0) = -A3-t(B3-A3) =>> (-A3-A0)=t(B0-A0+B3-A3) Left boundary C0=-C3 Right boundary C0=+C3 bottom boundary X : A0, B0 Y : A1, B1 Z : A2, B2 W: A3, B3 C1=-C3 ……….. ………..
Outside Inside A Case 1 B P: output !Aout = !Bout Aout!=Bout Then, Bout is also input into the polygon!
At most,it will have 6 extra vertex after clipping with six planes Circulate each Input polygon Vertex according To Sutherland- Hodgman polygon clipping
Bounding Volume • Simple shape that completelyencloses an object • Generally a box or sphere • We’ll use spheres: • Easiest to work with • Though hard to gettight fits
Hierarchical bounding volumes Recall class about projection example