Upload
dagush
View
213
Download
0
Embed Size (px)
Citation preview
8/18/2019 Vector drawings as textures
1/23
Easy going vector
graphics as textures onthe GPU
Gustavo Patow
8/18/2019 Vector drawings as textures
2/23
Like playing games?
8/18/2019 Vector drawings as textures
3/23
Typical problem withtextures
8/18/2019 Vector drawings as textures
4/23
However, vector graphics
8/18/2019 Vector drawings as textures
5/23
!ain i"ea
If vector graphics
preserve quality overresolution, why don’t weuse them?
8/18/2019 Vector drawings as textures
6/23
#hat to expect
Bitmaps have constant evaluation cost
Vector graphics (eps, pdf, …)
have a clear dependency over the number of objects
8/18/2019 Vector drawings as textures
7/23
#here?
Point-wise evaluation in thefragment shaders, lie
regular te!tures"
(Problem# power $%& 'P)
8/18/2019 Vector drawings as textures
8/23
How to evaluate
o point-in-polygon is betterthan
*(log(n)) n + number ofedges
If we have m polygons, wedhave
8/18/2019 Vector drawings as textures
9/23
Evaluation solution $%&
Image regular grid ofcells
≅ hash for the vectordrawing"
te!el
8/18/2019 Vector drawings as textures
10/23
Evaluation solution $%%&
•or each te!el we should build aneasy evaluation structure
•./P trees seem easy enough•*verlapping polygons
• $hen the evaluation of the upper poly
gives“outside
”, join with ne!t poly• $hen evaluation gives inside, return
the polygon’s color
8/18/2019 Vector drawings as textures
11/23
out
colorout
'ata (tructure
8/18/2019 Vector drawings as textures
12/23
color
color Back-groun
d
Linking
8/18/2019 Vector drawings as textures
13/23
) couple o* optimi+ations
If a top polygon fully covers ate!el
• /tore a color instead of apointer
If a deeper polygon covers thefull te!el
• store its color instead of a
subtree
8/18/2019 Vector drawings as textures
14/23
eal time evaluation
Pi!el/hader (0oat1 te!coord) # color0oat2 colour + %ead 34/3 te!ture with te!coord
if (is a pointer(colour))
0oat pos + compute pos from colour
while (pos 5 676)0oat inde! + -pos 8 19
0oat2 (segment, dest) + %ead bspodes te!ture withInde!
0oat sign + sign*fPoint$%&:ine( segment7!,
segment7y, segment7;, segment7w,
te!coord7!, te!coord7y)9
pos + (sign < 6)? dest7!# dest7y9
colour + mae colour from pos
return colour9
8/18/2019 Vector drawings as textures
15/23
!agni*ication
/imply super-sample the te!elarea"
• &ae several samples on ate!ture area de=ned by theprojected are of the currentpi!el (++current hardwareimplementations)
• If samples can be grouped, tryto re-use evaluations
• &his was not im lemented in our
8/18/2019 Vector drawings as textures
16/23
!ini*ication
4t a distance from the observerwe switch to a regular raster
texture with mip-mappingenabled
• &his distance can be de=ned
absolutely or depending on thepi!el projected area
%esults are e>cientl anti-
8/18/2019 Vector drawings as textures
17/23
8/18/2019 Vector drawings as textures
18/23
'iscussion
*ur algorithm is pi!el- bound#most worload on the fragment
shaders• :arger si;e on screen +< moreevaluations
'omputational cost*(p ln(n))
n number of primitives
8/18/2019 Vector drawings as textures
19/23
%n*luence o* the gri" si+e
• 3ash resolution only in0uences the amountof detail contained within each te!el
• :arger resolutions correspond to less detail
@arA1B• .ounded from below
• C7g7, at cells where polygon boundaries overlap,we need to store the intersection itself
• Increasing grid resolution +< fewerevaluations at each sample +< more speed"
8/18/2019 Vector drawings as textures
20/23
Possible improvement
•/ort the root elements in theodes &e!ture following a Dorton
line @arA1B•'urrently, cells are sored in rasterorder
•%egular te!ture access patternsshow that Dorton encoding bene=tscoalesced memory access
8/18/2019 Vector drawings as textures
21/23
!ore -uture #ork
4dd gradient evaluations anddiEusion curves, much in theline of /un et al7 /FGHA1B
• &his implies solving comple!
computations +
8/18/2019 Vector drawings as textures
22/23
Easy going vector graphics as textures on
the GPU
Questions?
Thanks.
8/18/2019 Vector drawings as textures
23/23