Random-Access Rendering of General Vector Graphics

42
Diego Nehab and Hugues Hoppe Microsoft Research Random-Access Rendering of General Vector Graphics

description

Random-Access Rendering of General Vector Graphics. Diego Nehab and Hugues Hoppe Microsoft Research. Vector graphics and resolution independence. Random-access vector graphics. Color at a point depends only on neighborhood. Cell. Cell grid. Previous work. Bixels [ Tumblin 2004 ]. - PowerPoint PPT Presentation

Transcript of Random-Access Rendering of General Vector Graphics

Page 1: Random-Access Rendering of  General Vector Graphics

Diego Nehab and Hugues HoppeMicrosoft Research

Random-Access Rendering of General Vector Graphics

Page 2: Random-Access Rendering of  General Vector Graphics

Vector graphics and resolution independence

Page 3: Random-Access Rendering of  General Vector Graphics

Random-access vector graphics Color at a point depends only on

neighborhood

Cell grid

Cell

Page 4: Random-Access Rendering of  General Vector Graphics

Previous work

[Qin et al. 2006, 2008]

Silhouette maps

[Sen 2004]

Bixels[Tumblin 2004]

Feature-based textures[Ramanarayanan 2004]

[Ray et al. 2005]Pinchmaps[Tarini 2005]

Page 5: Random-Access Rendering of  General Vector Graphics

Random-Access Rendering ofGeneral Vector Graphics

Page 6: Random-Access Rendering of  General Vector Graphics

System overview

p

Cell grid

Indirection table

Layer 1 Layer 2 Layer 3 Layer 4

1D memory buffer

Cell contents

ppp

p

Offline encoding

Pixel color

Rendering within pixel shaderLocal coordinates

Localizedrepresentation

Cell

Page 7: Random-Access Rendering of  General Vector Graphics

System overview

Inside/outside test Distance to curve Pre-filtering for anti-

aliasing Super-sampling for anti-

aliasing

p

Layer 1 Layer 2 Layer 3 Layer 4

ppp Pixel color

Rendering within pixel shaderLocal coordinates

Localizedrepresentation

p

Cell

Page 8: Random-Access Rendering of  General Vector Graphics

Inside fill:

Basic operations for rendering: in/out test

Require segment intersection Require distance to segment

Filled shapes

p

Inside stroke:

Stroked outlines

w

vdp

Page 9: Random-Access Rendering of  General Vector Graphics

Exact parametric:solving the cubic

Linearized implicit approximation

Our approximateparameter inversion

Distance to quadratic Bézier curve

Page 10: Random-Access Rendering of  General Vector Graphics

Linearized implicit distance Implicit form

Linearize around p

Find q closest to p

[Loop & Blinn 2005] [Qin et al. 2006]

Page 11: Random-Access Rendering of  General Vector Graphics

Our fast approximate distance Take q from

linearization Find approximate

inversion

Stable, explicit, efficient

Use to project q to curve

Return

Page 12: Random-Access Rendering of  General Vector Graphics

Anti-aliasing Pixel may be close to layer boundary Use fractional opacity instead of binary

decision

Aliased Anti-aliased

Page 13: Random-Access Rendering of  General Vector Graphics

Pre-filtering filled shapes Half-space approximation with aligned

kernel [Gupta & Sproull 1981] [Qin et al. 2006]

Page 14: Random-Access Rendering of  General Vector Graphics

Pre-filtering stroked shapes Using two half-space

approximations

Page 15: Random-Access Rendering of  General Vector Graphics

Rendering multiple layers Pseudo-code

Initialize pixel color to transparentFor each layer For each segment Increment number of intersections h Update closest point v Compute signed distance Use signed distance to compute opacity Composite layer fill and stroke on pixel color

Page 16: Random-Access Rendering of  General Vector Graphics

Super-sampling When approximate pre-

filtering breaks down

Page 17: Random-Access Rendering of  General Vector Graphics

Single pass super-sampling Pseudo-code

Initialize all samples to transparentFor each layer For each segment For each sample s Increment number of intersections hs

Update closest point vs For each sample s Compute signed distance Use signed distance to compute opacity Composite layer fill and stroke on sampleReturn weighted sample average color

Page 18: Random-Access Rendering of  General Vector Graphics

Anti-aliasing comparison

Original signal Point sampled Pre-filtered

Pre-filtering +8X super-sampling

8X super-sampling 400X Super-sampling

Page 19: Random-Access Rendering of  General Vector Graphics

System overview

p

Cell grid

Indirection table

Layer 1 Layer 2 Layer 3 Layer 4

1D memory buffer

Cell contents

ppp

p

Offline encoding

Pixel color

Rendering within pixel shaderLocal coordinates

Localizedrepresentation

Cell

Page 20: Random-Access Rendering of  General Vector Graphics

System overview Lattice-clipping

algorithm Shortcut segments Extended cells

Input

Indirection table

Layer 1 Layer 2 Layer 3 Layer 4

1D memory buffer

Cell contents

Offline encoding

Localizedrepresentation

Page 21: Random-Access Rendering of  General Vector Graphics

The encoding algorithm Must “clip” shape against

every cell

Page 22: Random-Access Rendering of  General Vector Graphics

The encoding algorithm Must “clip” shape against

every cell

Page 23: Random-Access Rendering of  General Vector Graphics

Alternatives Brute force [Sutherland-Hodgman 74]

Clip independently against each cell

Hierarchical subdivision [Warnock 69]

Clip recursively using a quadtree structure

Lattice clipping [Our method]

Visits each input vertex only once Visits only cells that have content

n input verticesr 2 grid cellsa output size

Page 24: Random-Access Rendering of  General Vector Graphics

The lattice-clipping algorithm Rendering only casts rays to

the right Polygon clipping is overkill

Page 25: Random-Access Rendering of  General Vector Graphics

The lattice-clipping algorithm Segment clipping, however, is not

enough

✕✕

✕✕

✕✕

Page 26: Random-Access Rendering of  General Vector Graphics

The lattice-clipping algorithm Segment clipping + shortcut

segments Enough for rendering, easier to

generate✓

✓✓

✓✓

Page 27: Random-Access Rendering of  General Vector Graphics

Generating shortcut segments Computation requires non-local

information What happens to a contour once it

leaves a cell?

Page 28: Random-Access Rendering of  General Vector Graphics

Generating shortcut segments Delay decision, fix later Start by assuming contours always

go up

Page 29: Random-Access Rendering of  General Vector Graphics

Generating shortcut segments Identify

violations

Page 30: Random-Access Rendering of  General Vector Graphics

Generating shortcut segments Consolidate violations right-

to-left

← ⊕ 3

← ⊕ 1

← ⊕ 1

← ⊕ 1

← ⊕ 2

← ⊕ 2

Page 31: Random-Access Rendering of  General Vector Graphics

Generating shortcut segments Consolidate violations right-

to-left1

1

Page 32: Random-Access Rendering of  General Vector Graphics

Generating shortcut segments Add shortcuts to cancel effect of

violations1

1

Page 33: Random-Access Rendering of  General Vector Graphics

Generating shortcut segments Simplify shortcut

segments

Page 34: Random-Access Rendering of  General Vector Graphics

Simplify shortcut segmentsGenerating shortcut segments

Page 35: Random-Access Rendering of  General Vector Graphics

Generating shortcut segments Equivalent to desired

results

Page 36: Random-Access Rendering of  General Vector Graphics

Generating shortcut segments Equivalent to desired

results

Page 37: Random-Access Rendering of  General Vector Graphics

Extended cells Anti-aliasing near cell

edges Requires overlap between

cells

Page 38: Random-Access Rendering of  General Vector Graphics

Extended cells Lattice-clipping deals with

extended cells

Page 39: Random-Access Rendering of  General Vector Graphics

Summary of contributions Rich set of primitives

Multiple transparent layers Both fills and strokes Color gradients

High-quality anti-aliasing Fast distance to quadratics Thin strokes Single-pass super-sampling

Lattice-clipping algorithm Linear time on

input/output size

Page 40: Random-Access Rendering of  General Vector Graphics

Future work Focus on encoding stage

Parallel implementation on CPU

GPU implementation? Fast enough for dynamic

content? Support for blur

Additional rendering passes?

Page 41: Random-Access Rendering of  General Vector Graphics

More results

Page 42: Random-Access Rendering of  General Vector Graphics

Thank You