Sei sulla pagina 1di 28

SinglepassWireframeRendering

withHiddenSurfaceRemoval

AndreasBrentzen,SteenLundNielsen,MikkelGjl,BentD.
LarsenandNielsJrgenChristensen

Overview
Whatiswrongwiththetraditionaloffsetbased
methodsforwireframedrawing?

Asinglepassmethodforwireframedrawingwith
hiddensurfaceremoval.

Drawingprefilteredlines.
Results
Discussionandfuturework.

OffsetBasedMethods
Offsetbasedmethodshavetwopasses:
Pass1:Drawmeshasfilledpolygons.
Zwriteandcomparisonenabled.

Pass2:DrawmeshaswireframewithZoffset.
Zwritedisabled.Zcomparisonenabled.

Offsetensuresfilled

polygonsdonotocclude
wireframe.

OffsetBasedMethods
Twotriangleswiththeiredgesdrawnusingnooffset,
slopebasedoffset,constantoffset.

OffsetBasedMethods

uselinedrawingwhichisslow.
areinherentlytwopass(evenslower)
requireantialiasingtolookgood(slowerstill)
haveartifactsbecauseitisimpossibletopickaperfectoffsetin
mostcases.

Admittedly,wecanlivewiththesemethods,butwedon't
haveto!

Approaches
Edgeisdrawnonlyifthepixelalreadycontainsa

fragmentfromthecorrespondingfilledpolygon.E.g.
[Herreletal.1995].

Ourmethod:Drawwireframedirectlyasyouare
drawingfilledpolygon.Allinonepass.

SinglePassMethod
Foreachfragment,

computecolorfrom
distancetoclosestedge:

ComputingDistance
Weneed2Dwindowspacedistance.
In2D,distancetolineisanaffinefunction.
Linearinterpolationreproducesaffinefunctions.

ComputingDistances
Pervertex:
Input:Allverticesof
triangle.

Vertexshaderprojectsall
verticesoftriangle.

Distancestoalledgesare
computed.

Output:vectorofdistances
toallthreeedges.

ComputingDistances
Perfragment:
Interpolatedistances.

Computecolorusing

previousfragmentprogram.

Note:Thismethod
extendstoquads.

PerspectiveCorrection
Oops!Graphicscardsperformperspectivecorrect
interpolation

However,itiseasytofix:
Negateperspectivecorrection.
WaitforD3D10orOpenGL3.0hardware.

Teapot

usingour
method...
sofar.

Preintegratedlines
Colorisnowafunctionof
distance:

Teapot

usingour
method

SinglepassMethod
Detailofteapot
Noticesmoothlines
Perhapslinesarealittle
thick?

SinglepassMethod
Thinnerlinesareeasy.
However,wetrade
thinnessforalittle
aliasing.

Offsetbasedmethod
Constoffset=2000
Noticestippling
Offsetcouldbechanged
butthereisnoperfect
value

Offsetbasedmethod
Slopebasedoffset
Noticedisocclusion
artefacts

Usedepthtofade
outlinecolor.

Usedepthto
decideline
thickness.

Usealphatesting

toremoveinterior
ofpolygon.

IndexedPrimitives
Usingthe

geometry
shadersofD3D
10allowsusto
drawwireframe
trianglestrips.

LineStyles

Results
Performance

Issues

Themethoddoesnotsupportindexedgeometry
Primitive/geometryshadersalleviatethis!
Silhouetteedgesdrawnfromonesideonly
Onlynoticeableonsmallmeshes
Thisisessentiallyamethodfortrianglesand
quadrilaterals
yesbutthatisaverycommonspecialcase

Merits
Methodisfast
Singlepass
Avoidslineprimitive
Littleperfragmentcomputation

Highqualitylines
Prefiltered
NoZissues

Tweakable
Manylinestylesarepossible

Thisisafutureworkteaser.
Acknowledgements:
MarkHarris,NVIDIA,andPeterPikeSloan,
Microsoft,wereveryhelpful.

Microsoftmadeitpossibletotestthemethod
onD3D10viaaWindowsVistaBeta.

Linetypes
4x4super
sampling

Ourmethod

Prefilteringwith
Gaussian

Potrebbero piacerti anche