Top Banner
A Parallel Algorithm for Polygon Rasteriza4on Zhongchuan Zhang 10/29/2009
13

A Parallel Algorithm for Polygon Rasterizaon

Feb 15, 2022

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: A Parallel Algorithm for Polygon Rasterizaon

AParallelAlgorithmforPolygonRasteriza4on�

ZhongchuanZhang10/29/2009�

Page 2: A Parallel Algorithm for Polygon Rasterizaon

Introduc4on�

•  Fastrenderingof3DZ‐bufferedlinearlyinterpolatedpolygons– 3Dtransforma4on,projec4onandlightcalcula4onofthever4ces

•  ThispaperdealswithoneaspectofthelaKerproblem:thecomputa4onoftheboundariesofapolygon

Page 3: A Parallel Algorithm for Polygon Rasterizaon

Introduc4on�

•  Waystocomputetheedgesofpolygons– Computeedgesbyalineinterpola4onalgorithm•  Notsoconvenientforframebuffers

– Useaparallelmul4pliertreetosimultaneouslycomputealinearedgefunc4on•  Highlyparallel•  Requirededicatedlogicforeachpixel

– Usealinearfunc4ontodefinepolygonedgesandcanuseconven4onalDRAMandVRAMtechnology

Page 4: A Parallel Algorithm for Polygon Rasterizaon

Theedgefunc4on �•  Defini4onE(x,y)=(x‐X)dY‐(y‐Y)dXE(x,y)>0,if(x,y)istothe“right”sideE(x,y)>0,if(x,y)isexactlyonthelineE(x,y)>0,if(x,y)istothe“le`”side

•  Linear,canbecomputedincrementallyinthesamewayascolorandZvalues•  Convenientforrasteriza4onE(x+1,y)=E(x,y)+dYE(x,y+1)=E(x,y)‐dX

Page 5: A Parallel Algorithm for Polygon Rasterizaon

Theedgefunc4on �

•  Itcanbecomputedparallelforallpixelsintheframebuffer

•  Definepolygonsusingbooleancombina4onsofedges

•  Usedasa“stencil”thatallowsapixeltobemodifiedonlyifitisinteriortothepolygon�

Page 6: A Parallel Algorithm for Polygon Rasterizaon

Incrementalclassifica4onofpointsaroundaconvexpolygon�

•  Ver4ces(Xi,Yi)0<i<=N,(X0,Y0)=(XN,YN)•  Ini4aledgefuncitonatstar4ngpoint(Xs,Ys)dXi=Xi‐X[i‐1]dYi=Yi‐Y[i‐1]Ei(Xs,Ys)=(Xs‐Xi)dYi‐(Ys‐Yi)dXi

•  MakeincrementEi(x+1,y)=Ei(x,y)+dYiEi(x‐1,y)=Ei(x,y)‐dYiEi(x,y+1)=Ei(x,y)‐dXiEi(x,y‐1)=Ei(x,y)+dXi•  InteriortothepolygonEi>=0foralli:0<i<N(usinga4ebreakrule)

Page 7: A Parallel Algorithm for Polygon Rasterizaon

Traversingthepolygon�

Traversingtheboundingbox�

Amoreefficienttraversalalgorithm �

Traversalalgorithmmayhavetosearchforedge�

Proceedingoutwardfromcenterline�

Page 8: A Parallel Algorithm for Polygon Rasterizaon

Clipping �•  Viewle`andrightclippingasaddi4onalpolygonedges

•  Usetopclipboundarytocontrolthestar4ngpoint•  UseboKomclipboundarytocontrolthelastscanline �

Page 9: A Parallel Algorithm for Polygon Rasterizaon

Sub‐pixelaccuracyofver4ces�•  Ver4cesareinfloa4ngpointformata`er3Dtransforma4onandprojec4on

•  RoundingtheXandYfloa4ngpointordinatescanleavegaps

•  Performtheinterpolatorsetupcomputa4oninfloatpointandconverttofixedpointattheend

dXi=Xi‐X[i‐1]dYi=Yi‐Y[i‐1]Ei(Xs,Ys)=(Xs‐Xi)dYi‐(Ys‐Yi)dXidXi’=FIX(dXi)dYi’=FIX(dYi)Ei’=FIX(Ei)

Page 10: A Parallel Algorithm for Polygon Rasterizaon

Parallelimplementa4on�

•  Theedgefunc4onislinear,soE(x+L,y)=E(x)+Ldy

L‐distancefromagivepoint(x,y)

•  Allowsagroupofinterpolatorstosimultaneouslycomputetheedgefunc4onofanadjacentblock(Lpixelswide)inasinglecycle

Page 11: A Parallel Algorithm for Polygon Rasterizaon

Futureworkandextensions�

•  Computehigherorderedgefunc4onandcomputecomplexshapes

•  Performtheinterpola4onoftheedgefunc4oninafloatpointlikemanner

•  Usetheedgefunc4ontoan4‐aliasedges•  Havethelookuptableproduceacrudesub‐pixelresolu4onbitmapforeachedge �

Page 12: A Parallel Algorithm for Polygon Rasterizaon

Conclusion �

•  Canbecomputedinparallelandusedwithcommonrefreshbufferwordorganiza4on

•  CanbecomputedwithhardwaresimilartothatrequiredtointerpolatecolorandZvaluesfor3Dsolids

•  Maintainsthesub‐pixelaccuracyofver4ces�

Page 13: A Parallel Algorithm for Polygon Rasterizaon