synthesis of compact textures for real-time terrain rendering nader salman 22 juin 2007 encadrant :...

77
Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre

Upload: claude-sims

Post on 17-Jan-2016

221 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre

Synthesis of Compact Textures for real-time Terrain Rendering

Nader Salman22 juin 2007

Encadrant : Sylvain Lefebvre

Page 2: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre

Motivations• Need for large textures

– Simple repetition: low quality

• Texture synthesis from example– Pre-computation:

• Need to store large result

• Limited memory!

– Image Compression:• Rendering: Hinders sequential coding

• Block based: Fixed rate (÷ 6)

– Our approach :

Synthesize compact textures, that can be efficiently decoded at rendering time

[Garber 1981, Popat & Picard 1993, Efros & Leung 1999, Wei & Levoy 2000, Ashikhmin 2001, Hertzmann et al 2001, Tong et al 2002 …]

Page 3: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre

Our approach

• Inspired by patch-based synthesis– Patch-based Synthesis

[Praun et al 2000, Liang et al 2001, Efros and Freeman 2001, Kwatra et al 2003]

Page 4: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre

Our approach

• Inspired by patch-based synthesis– Record patch positioning and stitching

(instead of final image)– Decode at rendering time

• Main difficulties:– Adapt synthesis for compact encoding– Prepare for efficient decoding on GPU

Page 5: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre

ExemplarExemplar

Positioning

1 2

Cuts

3

Stitch

Our approach

Page 6: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre

A first example

• Memory size:– Full image: 805 MB ( result size: 16K x16K )– Our encoding: 26 MB ( patch size: 128x128 )

Exemplar(1024x1024)

Synthesis Result

Compact representation

Page 7: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre

Overview

• Introduction• Our approach

– Patch positioning– Optimal cuts– Seam removal

• Results and performance• Future Work

– Multiple materials– Slope– GPU Decoding

Page 8: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre

Our approach

ExemplarExemplar

Positioning

1 2

Cuts

3

Stitch

1. Positioning

ExemplarExemplar

• Scan exemplar• Choose best fit patch• Place patch• Memorize position

?

Patch positionPatch position

Compact representationCompact representation

Page 9: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre

ExemplarExemplar

Positioning

1 2

Cuts

3

Stitch

Our approach

Page 10: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre

Why do we cut?

Page 11: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre

Graph cut

1 4 72 5 83 6 9

1 4 72 5 83 6 9

A

B Construct graph such that:

Graph Mincut Best Seam

A

∞B

1 4

2 5

3 6

7

8

9

Potential Seam Cost Constraint

20 100

3010

1585

40

35

1 4

2 5

3 6

7

8

9

A B

20

3010

15

Seam

12 53 6

4 789

A

B

[Kwatra 2003]

Page 12: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre

Graph cut

• Problem with encoding:– Cut can be arbitraryExpensive to store!

• Our approach– Constrain cuts to be 1D functions– Still search for optimal!

0

0

2

2

2

2

2

1

1

1

1

0

Page 13: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre

Our approach

ExemplarExemplar

Positioning

1 2

Cuts

3

Stitch

2. Optimal Cuts

Current outputCurrent output

A

B

B

Constrained arcsConstrained arcs

Bidirectional arcsBidirectional arcs

One D. SeamOne D. Seam

Horizontal Overlap ImageHorizontal Overlap Image 00 02 2 2 2 1 1 0 0

Vertical Overlap ImageVertical Overlap Image 2 2 2 1 1 0 1 1

Compact representationsCompact representations

Page 14: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre

ExemplarExemplar

Positioning

1 2

Cuts

3

Stitch

Our approach

Page 15: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre

Why stitching ?

• Seams might still be visible in some cases

Avoid visible discontinuities

Page 16: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre

Our approach3. Stitching

New patch Existing texture

PoissonImageEditing

Current positionMask

[Perez et al. 2003]

Page 17: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre

Encoding of Poisson field (1)

Before Poisson After Poisson Deformation Field(x8 for visualisation)

Page 18: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre

Encoding of Poisson field (2)

• Problem: – Deformation is an image as big as output!

Approx ?

Page 19: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre

• Compression:– Per patch

• Approximate as sum of 2 fields• Each is a ‘flattened 1D pyramid’

– Optimize with least square• argmin || Ax - b ||2

– Fast reconstruction on the GPU• 1D pyramid = 1D MIP-map

Encoding of Poisson field (3)

High Frequency

Smooth

Page 20: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre

Encoding of Poisson field (4)

pSNR = 43,7 dB

Output with Poisson Approximated Output

High Frequencies

Page 21: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre

Output with Poisson

pSNR = 50,2 dBpSNR = 43,2 dB pSNR = 46,12dB

Approx. outputs

Page 22: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre

Overview• Introduction• Our approach

– Patch positioning– Optimal cuts– Seam removal

• Results and performance• Upcoming Work

– Multiple materials– Slope– GPU Decoding

Page 23: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre

Algorithm performance

Patch size(pixels)

Output size (MB)

Patch Size 16x16Output 2,4 GB

Patch Size 32x32Output 542 MB

Patch Size 128x128Output 90 MB

Input size: 1024 x 1024 Output size: 32K x 32K

32K x 32K 3GB uncompressed

Page 24: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre

Quick comparison

Our approach

[Kwatra 2003]

Page 25: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre

Overview

• Introduction• Our approach

– Patch positioning– Optimal cuts– Seam removal

• Results and performance• Upcoming Work

– Multiple materials– Slope– GPU Decoding

Page 26: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre

Conclusion• Need for detailed large textures

– Limited memory

• Contributions– High quality texture synthesis

• Results comparable to existing schemes– Directly into compact representation

• Reduced storage– Decoded at rendering time only

• Never stored ‘uncompressed’

• First step in more general approach– Data amplification:

• Details at runtime from compact representation

Page 27: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre

Thank you

Page 28: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre
Page 29: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre
Page 30: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre
Page 31: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre
Page 32: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre
Page 33: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre
Page 34: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre
Page 35: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre
Page 36: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre
Page 37: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre
Page 38: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre
Page 39: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre
Page 40: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre
Page 41: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre
Page 42: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre
Page 43: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre
Page 44: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre
Page 45: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre
Page 46: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre
Page 47: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre
Page 48: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre
Page 49: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre
Page 50: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre
Page 51: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre
Page 52: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre
Page 53: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre
Page 54: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre
Page 55: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre
Page 56: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre
Page 57: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre
Page 58: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre
Page 59: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre
Page 60: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre
Page 61: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre
Page 62: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre
Page 63: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre
Page 64: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre
Page 65: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre
Page 66: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre
Page 67: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre

Compression value

Output size

4k x 4k 8k x 8k 16k x 16k 131k x 131k

Uncompressed 50 MB 201 MB 805 MB 51 GB

Our technique 4 MB 9 MB 26 MB 1.4 GB

Exemplar size: 1024 x 1024 pixelsPatch Size: 128 x 128 pixels

Ratio improves as output gets largerVaries in this case from 12 up to 36

Page 68: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre

Compression

• Defauts des compression JPEG/PNG– Pas effectuable au rendu– Necessite de decompresser sur GPU

• Division en blocs – Compression maximale facteur 6– Entraine des pertes significatives

• Or nous voulons– Facteur plus important que 6– Pouvoir etre realise au rendu sur GPU

Page 69: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre

Calculating the compact size• Output side size : S• Exemplar side size : E• Patch side size : P• Overlap size : O

• Number of patches per side :

n = S ÷ (P – O)

• Number of patches :

nPatches = ceil (n) * ceil(n)

• Total size :

total = nPatches*2 + 2*p*nPatches + e*e*3 + 2*(2*P-1)*2*nPatches

Page 70: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre

Run-time synthesis

Tiles

Combined to form a texture

• Synthesized at rendering time– Pixel-based

Fine-scale variety

Fast and parallel

Unique material

Complex to implement

– Tile-based

On-demand evaluation

Variety limited by number of tiles

Too many tiles if multiple materials

Distinctive features reveal tiling structure

[Lefebvre and Hoppe 2005]

[Cohen etal. 2003, Lefebvre and Neyret 2003, Wei 2004]

Example

Page 71: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre

Run-time synthesis

Tiles

Combined to form a texture

• Pixel-based Fine-scale variety

Fast

Still not fast enough

Unique material

Complex to implement

• Tile-based On-demand evaluation

Variety limited by number of tiles

Distinctive features reveal tiling structure

Exemplar Synthesized

[Lefebvre and Hoppe 2005]

[Wei 2004]

Page 72: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre

g

g

over div vf

[Perez et al 2003]

Poisson image editing

f*

Ω

g

PoissonImageEditing

f

*2 with min ffgf

f

© Disney/Pixar 2003

Page 73: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre

Oblivion ©2006 Bethesda Softworks

Bad transitions

Distortion

Repetitions

Page 74: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre

Multiple materials• User guided• Edge map• Color or edge depending on material

(In progress)

Page 75: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre

Steep patches

• Difficulty:– Adapt each step for steep patches

(In progress)

Page 76: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre

• Input size: 1024 x 1024 px

• Output size: 32K x 32K px

• Uncompressed output :

32K x 32K x 3 = 3 GB !!

Our algorithm : 90 MB !!

Algorithm performance (1)

Page 77: Synthesis of Compact Textures for real-time Terrain Rendering Nader Salman 22 juin 2007 Encadrant : Sylvain Lefebvre

Contributions

• High quality texture synthesis– Results comparable to existing schemes

• Directly into compact representation– Reduced storage

• Decoded at rendering time only– Never stored ‘uncompressed’