290 likes | 439 Views
CS32310. ADVANCED COMPUTER GRAPHICS Down the rendering pipeline . Down the rendering pipeline. Notes adapted from D.J. Duke (pp177-192) University of York (Leeds, Bath). 177. 178. 179. Clipping versus scissoring. 180. Clipping Polygons. (Inside? Outside?). 181.
E N D
CS32310 ADVANCED COMPUTER GRAPHICS Down the rendering pipeline
Down the rendering pipeline Notes adapted from D.J. Duke (pp177-192) University of York (Leeds, Bath).
179 Clipping versus scissoring
180 Clipping Polygons (Inside? Outside?)
181 Implementing Sutherland-Hodgman
181a O J Clipping Polygons K I G A N H Clip against Left boundary F E D A B C D E F G H I J K M . L, C D M N, F G H I J O . B C L Wrap round! O joins L Wrap round from K to A produces no output
181b J O Clipping Polygons I G H Clip against Left boundary (result) F N D M L C D M N F G H I J O L C M to N crossed forwards and backwards!
181c J O Clipping Polygons I G H Clip against Right boundary F N D M L C D M N F G H I J O L C D M N F G H I J O L C No change
181d J O Clipping Polygons I G H Clip against Bottom boundary F N Q D M L C D M N F G H I J O . P, D M N F G H I J O Q L C P Wrap round from O to L produces Q
181e J O Clipping Polygons I G H Clip against Bottom boundary (result) F N D M P D M N F G H I J O Q P Q
181f J O Clipping Polygons S R I G H Clip against Top boundary F N D M P D M N F G H I J O Q . D M N F G H R . . S P P Q
181g Clipping Polygons R S G H Clip against Top boundary (result) F N D M D M N F G H R S Q P P Q
182 Implementing Sutherland-Hodgman
182 Filling a polygon horizontal edge: ignore (LM) start and interior of edge: keep end and any right edge pixel: ignore
183 Edge tables (omit lines of zero gradient in Edge Table) 8 8 7
183a Filled-polygon algorithm Walk-through example 177
183b 9 8 7 6 5 4 5 2/3 3 2 1 0 0 1 2 3 4 5 6 7 8 9 C 8 B E A F D y=1 DE DC 4 9 8 9 Active edge table
183c 9 8 7 6 5 4 5 2/3 3 2 1 0 0 1 2 3 4 5 6 7 8 9 C 8 B 2/3 E A F D y=2 AB DE FE DC 5 0 4 4 4 7 8 8 Active edge table
183d 9 8 7 6 5 4 5 2/3 3 2 1 0 0 1 2 3 4 5 6 7 8 9 C 8 B E A F D y=3 AB DE FE DC 5 4 4 4 6 8 8 Active edge table
183e 9 8 7 6 5 4 5 2/3 3 2 1 0 0 1 2 3 4 5 6 7 8 9 C 8 B E A F D y=4 AB DC 5 1 8 8 Active edge table
183f 9 8 7 6 5 4 5 2/3 3 2 1 0 0 1 2 3 4 5 6 7 8 9 C 8 B E A F D y=5 BC DC 8 2 8 7 Active edge table
183g 9 8 7 6 5 4 5 2/3 3 2 1 0 0 1 2 3 4 5 6 7 8 9 C 8 B E A F D y=6 BC DC 8 3 8 7 Active edge table
183h 9 8 7 6 5 4 5 2/3 3 2 1 0 0 1 2 3 4 5 6 7 8 9 C 8 B E A F D y=7 BC DC 8 5 8 7 Active edge table
184 Filled-polygon algorithm while e.counter >= e.dy { e.xinit++; e.counter ─= e.dy} UNTIL AET and ET are empty UNTIL AET and ET are empty 8 8
184a Filled-polygon algorithm – while loop explanation 2 updates to 2(5,3) 3(2,3) updates to 3(7,3) 4(4,3) 5(1,3) updates to 5(6,3) 6(3,3) 7(0,3) while e.counter >= e.dy { e.xinit++; e.counter ─= e.dy} UNTIL AET and ET are empty 8