polynomial texture maps - hp labs · hewlett-packard laboratories polynomial texture maps. texture...

32
Tom Malzbender Dan Gelb Hans Wolters Hewlett-Packard Laboratories Polynomial Texture Maps

Upload: others

Post on 28-Jul-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Polynomial Texture Maps - HP Labs · Hewlett-Packard Laboratories Polynomial Texture Maps. Texture Mapping [ Catmull ‘74 ] Pro: • Photographic ... scan-converted without normalization

Tom MalzbenderDan GelbHans Wolters

Hewlett-Packard Laboratories

Polynomial Texture Maps

Page 2: Polynomial Texture Maps - HP Labs · Hewlett-Packard Laboratories Polynomial Texture Maps. Texture Mapping [ Catmull ‘74 ] Pro: • Photographic ... scan-converted without normalization

Texture Mapping[ Catmull ‘74 ]

Pro:• Photographic

input• Simplicity• Hardware Support

Con: • Unrealistic Silhouettes• Static Lighting

Bump Mapping[ Blinn 78 ]

Pro:• Lighting

VariationsCon:

• Per-pixel lightingcomputation

• Filtering is Problematic • Procedural Synthesis

(Not image-based.)[ Rushmeier ‘97 ]

Page 3: Polynomial Texture Maps - HP Labs · Hewlett-Packard Laboratories Polynomial Texture Maps. Texture Mapping [ Catmull ‘74 ] Pro: • Photographic ... scan-converted without normalization

Top: Polynomial Texture Map

Bottom: Conventional Texture Map

PTM Demonstration:

Advantages:• Image based unlike Bump Mapping• Simpler to evaluate than Bump Mapping• Can leverage Mip Mapping

Page 4: Polynomial Texture Maps - HP Labs · Hewlett-Packard Laboratories Polynomial Texture Maps. Texture Mapping [ Catmull ‘74 ] Pro: • Photographic ... scan-converted without normalization

Acquiring PTM’s Photographically

• Fixed object, fixed camera.• Limited to Diffuse Objects.

Page 5: Polynomial Texture Maps - HP Labs · Hewlett-Packard Laboratories Polynomial Texture Maps. Texture Mapping [ Catmull ‘74 ] Pro: • Photographic ... scan-converted without normalization

Acquiring Lighting ModelsDebevec Goerghiades ‘99

Page 6: Polynomial Texture Maps - HP Labs · Hewlett-Packard Laboratories Polynomial Texture Maps. Texture Mapping [ Catmull ‘74 ] Pro: • Photographic ... scan-converted without normalization

5v4u3vu22

v12

u0vu alalallalala),lL(u,v;l +++++=

Modeling Pixel Color Changes Directly(u,v)

Light Direction Space

Page 7: Polynomial Texture Maps - HP Labs · Hewlett-Packard Laboratories Polynomial Texture Maps. Texture Mapping [ Catmull ‘74 ] Pro: • Photographic ... scan-converted without normalization

5v4u3vu22

v12

u0vu alalallalala),lL(u,v;l +++++=

Modeling Pixel Color Changes Directly(u,v)

Light Direction Space

Page 8: Polynomial Texture Maps - HP Labs · Hewlett-Packard Laboratories Polynomial Texture Maps. Texture Mapping [ Catmull ‘74 ] Pro: • Photographic ... scan-converted without normalization

Polynomial Texture Mapping

PTM: Store RGB per pixel andStore polynomial coefficients (a0-a5) per textel:

5v4u3vu22

v12

u0vu alalallalala),lL(u,v;l +++++=

Why Polynomials? • Compact Representation• Consist solely of multiplies and adds.• Cheap to evaluate on both modern CPUs and VLSI

R = L R'G = L G'B = L B'

Page 9: Polynomial Texture Maps - HP Labs · Hewlett-Packard Laboratories Polynomial Texture Maps. Texture Mapping [ Catmull ‘74 ] Pro: • Photographic ... scan-converted without normalization

What PTMs Capture

• Shading effects.• Self shadowing.• Interreflections.• Sub-surface scattering.

Page 10: Polynomial Texture Maps - HP Labs · Hewlett-Packard Laboratories Polynomial Texture Maps. Texture Mapping [ Catmull ‘74 ] Pro: • Photographic ... scan-converted without normalization

Light Direction Parametrization

u,v - texture coordinatesa0-a5 - fitted coefficients stored in texture maplu,lv - projection of light direction into texture plane

u

v N L(lu,lv)

5v4u3vu22

v12

u0vu alalallalala),lL(u,v;l +++++=

lu

lv

* lu,lv can be scan-converted without normalization.

Page 11: Polynomial Texture Maps - HP Labs · Hewlett-Packard Laboratories Polynomial Texture Maps. Texture Mapping [ Catmull ‘74 ] Pro: • Photographic ... scan-converted without normalization

Fitting PTMs to Image Data

=

−−−−−−− 1

1

0

5

1

0

111111

111111

000000

1

11

NvNuNvNuN2vN

2uN

vuvu2v

2u

vuvu2v

2u

L

LL

a

aa

llllll

llllllllllll

MMMMMMMM

• Given N light sources we compute the best fit for (a0-a6) in the L2 norm using S.V.D.

• SVD computed once for a given lighting arrangement.

Page 12: Polynomial Texture Maps - HP Labs · Hewlett-Packard Laboratories Polynomial Texture Maps. Texture Mapping [ Catmull ‘74 ] Pro: • Photographic ... scan-converted without normalization

PTM Fitting Errors

• Smoothing is not spatial, it occurs in light space.• High spatial frequencies are well preserved.• Hard shadows become softer.• Point lights become area lights.

Photograph PTM

Page 13: Polynomial Texture Maps - HP Labs · Hewlett-Packard Laboratories Polynomial Texture Maps. Texture Mapping [ Catmull ‘74 ] Pro: • Photographic ... scan-converted without normalization

• LRGB -

• RGB -

• ENC - Index to L.U.T. storing Polynomial Coefficients

...

PTM FormatsFormat

+

Per Pixel Storage

R,G,B

Page 14: Polynomial Texture Maps - HP Labs · Hewlett-Packard Laboratories Polynomial Texture Maps. Texture Mapping [ Catmull ‘74 ] Pro: • Photographic ... scan-converted without normalization

Scale and Bias

• Allows polynomial coefficients to be stored as 8 bit values.

• Handles large dynamic range among coefficients.

• 12 Global values stored per texture map (LRGB).

)( 'iiii aa Ω−= λ

Page 15: Polynomial Texture Maps - HP Labs · Hewlett-Packard Laboratories Polynomial Texture Maps. Texture Mapping [ Catmull ‘74 ] Pro: • Photographic ... scan-converted without normalization

Mip Mapping PTM’s vs Bump Maps

• Mip-mapping bump maps effectively smooths geometry.[ Schilling 97 ]

• PTMs are linear in polynomial coefficientsso mip-mapping PTMs is accurate.

5v4u3vu22

v12

u0vu alalallalala),lL(u,v;l +++++=

)),v(uan

(L)),v(u(aLn Ωi,j

jir,g,bΩi,j

jir,g,b ∑∑∈

−∈

− = 505011

Page 16: Polynomial Texture Maps - HP Labs · Hewlett-Packard Laboratories Polynomial Texture Maps. Texture Mapping [ Catmull ‘74 ] Pro: • Photographic ... scan-converted without normalization

Evaluation – MMX / SSD Implementation

Parallel computation• Fixed point arithmetic• Pack 4 PTM coefficients in 64 bit

integer MMX register• Parallel multiply/adds

Yields 6.5M pixels/sec on a 1 Ghz CPU (software only).

Page 17: Polynomial Texture Maps - HP Labs · Hewlett-Packard Laboratories Polynomial Texture Maps. Texture Mapping [ Catmull ‘74 ] Pro: • Photographic ... scan-converted without normalization

Evaluation – Programmable Hardware

Vertex Processing• Store precomputed tangent and binormal per vertex• Vertex code projects light vector onto tangent and binormal

tangent

binormalN

L

(lu,lv)Pixel Processing

• lu,lv passed from vertex stage • PTM coefficients stored in 2 textures• Calculate using dot products / multiplies / adds• Single pass on current hardware

Page 18: Polynomial Texture Maps - HP Labs · Hewlett-Packard Laboratories Polynomial Texture Maps. Texture Mapping [ Catmull ‘74 ] Pro: • Photographic ... scan-converted without normalization

Bump Maps as PTM’s• If PTM rendering methods are implemented, they can

be used for rendering bump maps.• Provides specular and diffuse effects.

nssddaa H)(NkIL)(NkIkII ⋅+⋅+=

• Precompute PTM L.U.T.• Convert Normals to PTM using L.U.T.• Render PTM

Diffuse - evaluateSpecular - evaluate

VN ⋅

nHN )( ⋅LN ⋅

Page 19: Polynomial Texture Maps - HP Labs · Hewlett-Packard Laboratories Polynomial Texture Maps. Texture Mapping [ Catmull ‘74 ] Pro: • Photographic ... scan-converted without normalization

Complex Shading EffectsCombine with hardware lighting

• Use with existing Phong lighting• PTM models more complex reflectance effects

• Examples:Anisotropic FresnelOff-specular

Page 20: Polynomial Texture Maps - HP Labs · Hewlett-Packard Laboratories Polynomial Texture Maps. Texture Mapping [ Catmull ‘74 ] Pro: • Photographic ... scan-converted without normalization

2D Applications

• Enhancement of Cuneiform Tablets w/ Zuckerman USC

• PTMs for Short Image Sequences

• PTMs for Depth of Focus Effects.

Page 21: Polynomial Texture Maps - HP Labs · Hewlett-Packard Laboratories Polynomial Texture Maps. Texture Mapping [ Catmull ‘74 ] Pro: • Photographic ... scan-converted without normalization

Surface Normal Extraction

Yields maximum surface brightness

Page 22: Polynomial Texture Maps - HP Labs · Hewlett-Packard Laboratories Polynomial Texture Maps. Texture Mapping [ Catmull ‘74 ] Pro: • Photographic ... scan-converted without normalization

Surface Normal ExtractionFor a diffuse object, coordinates of (lu,lv) that maximize luminance yield local surface normals.

Setting 0=∂∂=

∂∂

vL

uL

yields:2

210

31420 4

2aaa

aaaalu −−=

2210

40320 4

2aaa

aaaalv −−=

Providing a surface normal per textel:

)1,,( 20

2000 vuvu llllN −−=

v

lu0,lv0

Page 23: Polynomial Texture Maps - HP Labs · Hewlett-Packard Laboratories Polynomial Texture Maps. Texture Mapping [ Catmull ‘74 ] Pro: • Photographic ... scan-converted without normalization

Specular Enhancement

Cuneiform tablet courtesy of Dr. Bruce Zuckerman at U.S.C.

Page 24: Polynomial Texture Maps - HP Labs · Hewlett-Packard Laboratories Polynomial Texture Maps. Texture Mapping [ Catmull ‘74 ] Pro: • Photographic ... scan-converted without normalization

Diffuse Gain - a reflection transformation that:• Keeps the surface normal fixed.• Increases the curvature (second derivative)

of the reflectance function by g.

50440'

33

0022

012

005

402014

302003

22

11

00

)'()(

))(1('

)2)(1(')2)(1('

'''

alaalaa

llalalaga

alalagaalalaga

gaagaagaa

vu

vuvu

uv

vu

+−+−

+++−=

++−=++−=

===

Page 25: Polynomial Texture Maps - HP Labs · Hewlett-Packard Laboratories Polynomial Texture Maps. Texture Mapping [ Catmull ‘74 ] Pro: • Photographic ... scan-converted without normalization

Light Direction Extrapolation• Input images are collected across a

hemisphere of light directions, i.e. -1<= lu,lv <=1

• PTM’s can be evaluated outside of the hemisphere,( lu,lv < -1 or lu,lv > 1 )

Page 26: Polynomial Texture Maps - HP Labs · Hewlett-Packard Laboratories Polynomial Texture Maps. Texture Mapping [ Catmull ‘74 ] Pro: • Photographic ... scan-converted without normalization

PTMs as Parametric Images

5v4u3vu22

v12

u0 alalallalala +++++For each (u,v) we have:

Page 27: Polynomial Texture Maps - HP Labs · Hewlett-Packard Laboratories Polynomial Texture Maps. Texture Mapping [ Catmull ‘74 ] Pro: • Photographic ... scan-converted without normalization

Depth of Focus

Page 28: Polynomial Texture Maps - HP Labs · Hewlett-Packard Laboratories Polynomial Texture Maps. Texture Mapping [ Catmull ‘74 ] Pro: • Photographic ... scan-converted without normalization

Palletization• Random Access – Each pixel treated independently. • Light Space Lookup table – contains polynomials.• LUT constructed by K-means clustering.• RGB values can be stored in L.U.T. or image space.

a0,a1,a2,a3,a4,a5,a6

………a0,a1,a2,a3,a4,a5,a6

a0,a1,a2,a3,a4,a5,a6

a0,a1,a2,a3,a4,a5,a6

L.U.T.

8 bitindex

PTM

Each textel stores:R,G,B,Index

Page 29: Polynomial Texture Maps - HP Labs · Hewlett-Packard Laboratories Polynomial Texture Maps. Texture Mapping [ Catmull ‘74 ] Pro: • Photographic ... scan-converted without normalization

Palletization• Random Access – Each pixel treated independently. • Light Space Lookup table – contains polynomials.• LUT constructed by K-means clustering.• RGB values can be stored in L.U.T. or image space.

a0,a1,a2,a3,a4,a5,a6,R,G,B………a0,a1,a2,a3,a4,a5,a6,R,G,Ba0,a1,a2,a3,a4,a5,a6,R,G,Ba0,a1,a2,a3,a4,a5,a6,R,G,B

L.U.T.

8 bitindex

PTM

Each textel stores:Index

8 bit valuesonly

Page 30: Polynomial Texture Maps - HP Labs · Hewlett-Packard Laboratories Polynomial Texture Maps. Texture Mapping [ Catmull ‘74 ] Pro: • Photographic ... scan-converted without normalization

Compression• Allows better rate/distortion tradeoff than palletization.• Similar to compression of multispectral images.• Removes correlations within and between byte planes.• Sacrifices pixel independence.• Visible artifacts don’t appear until ~10 bits/pixel.

10.1 bits10.1 bits13.5 bits13.5 bits17.1 bits17.1 bits27.4 bits27.4 bits72 72 -- 144 bits144 bits

Loss = 4 grey levels

Loss = 2 grey levels

Loss = 1 grey level

LosslessOriginal SizePerceptually lossless results:

Page 31: Polynomial Texture Maps - HP Labs · Hewlett-Packard Laboratories Polynomial Texture Maps. Texture Mapping [ Catmull ‘74 ] Pro: • Photographic ... scan-converted without normalization

Future Work, Conclusions + Web Tools

Tools available at hpl.hp.com/ptm• sample PTMs• PTM viewer• Polynomial Fitter• PTM format document

• PTM’s are fast, compact, effective representations.• PTM’s encoding opacity channels?• Full BRDF’s can be modelled using PTMs by

trading off spatial variation with viewing angle.• Applications in Medicine, Forensics, Paleontology

Page 32: Polynomial Texture Maps - HP Labs · Hewlett-Packard Laboratories Polynomial Texture Maps. Texture Mapping [ Catmull ‘74 ] Pro: • Photographic ... scan-converted without normalization

The End

hpl.hp.com/ptm