Marco Tarini · Kai Hormann · Paolo Cignoni · Claudio Montani PolyCube-Maps seamless texture...

Preview:

Citation preview

Our GoalOur Goal

• Texture mapping– seamless– hardware supported– low distortion– general object

Texture Atlas(multi-chart approach to parameterization)Texture Atlas(multi-chart approach to parameterization)

+ =

2D texture image textured bunny3D mesh

images courtesy of Lévy, Sylvain, Ray and Maillot , SIGGRAPH 02

disk-like patchestexture charts

u

v

Cube-MapsCube-Maps

• Typically used for environment mapping

images from Bubble demonstration program, nVidia

environment texturemesh

Abusing Cube-MapsAbusing Cube-Maps

• What if we store surface color in a cube-map?

+ =

meshwith per-vertex

3D texture coord. (u,v,w) cube-map textured apple

u

v

w

object spacetexture spaceobject space

texture

fromchart

A

texturefrom

chart B

• cube-map– seamless– a triangle can span multiple

faces– mesh independent– mipmapping ok– no packing: no wasted texels– no boundaries, no artifacts– texel neighbors always

defined

• texture atlas– seams– a triangle cannot span

multiple charts– mesh dependency– mipmapping difficult– chart packing: wasted

texels– artifacts at boundaries– no defined neighbors

for boundary texels

• cube-map– seamless– a triangle can span multiple

faces– mesh independent– mipmapping ok– no packing: no wasted texels– no boundaries, no artifacts– texel neighbors always

defined

• texture atlas– seams– a triangle cannot span

multiple charts– mesh dependency– mipmapping difficult– chart packing: wasted

texels– artifacts at boundaries– no defined neighbors

for boundary texels

texture

fromchart

A

texturefrom

chart B

• cube-map– seamless– a triangle can span multiple

faces– mesh independent– mipmapping ok– no packing: no wasted texels– no boundaries, no artifacts– texel neighbors always

defined

• texture atlas– seams– a triangle cannot span

multiple charts– mesh dependency– mipmapping difficult– chart packing: wasted

texels– artifacts at boundaries– no defined neighbors

for boundary texels

• cube-map– seamless– a triangle can span multiple

faces– mesh independent– mipmapping ok– no packing: no wasted texels– no boundaries, no artifacts– texel neighbors always

defined

• texture atlas– seams– a triangle cannot span

multiple charts– mesh dependency– mipmapping difficult– chart packing: wasted

texels– artifacts at boundaries– no defined neighbors

for boundary texels

• cube-map– seamless– a triangle can span multiple

faces– mesh independent– mipmapping ok– no packing: no wasted texels– no boundaries, no artifacts– texel neighbors always

defined

• texture atlas– seams– a triangle cannot span

multiple charts– mesh dependency– mipmapping difficult– chart packing: wasted

texels– artifacts at boundaries– no defined neighbors

for boundary texels

• cube-map– seamless– a triangle can span multiple

faces– mesh independent– mipmapping ok– no packing: no wasted texels– no boundaries, no artifacts– texel neighbors always

defined

– does not (~spheres only!)

• texture atlas– seams

– a triangle cannot span multiple charts

– mesh dependency

– mipmapping difficult

– chart packing: wasted texels

– artifacts at boundaries

– no defined neighbors for boundary texels

– works (is general)

interpolated coordinatesin 3D texture space

…from

rasterizer

What we Keep from CubeMapsWhat we Keep from CubeMaps

FR

AG

ME

NT

SH

AD

ER

coordinates in 3D texture domain

(a 2-manifold similar to the mesh)

coordinatesin 2D texture domain

projection

2D texturefetch…

mapping

• Per-fragment• Hardware

implemented

• Texture defined in 3D BUT stored in 2D

Going Beyond ApplesGoing Beyond Apples

• Cube-Maps work well only for sphere-like objects

sphere-like mesh cubic texture domain

texture spaceworld space

?

Going Beyond ApplesGoing Beyond Apples

• But for more general objects?

texture spaceworld space

arbitrary meshes cubic texture domain

?

Going Beyond ApplesGoing Beyond Apples

• But for more general objects?

texture spaceworld space

arbitrary meshes cubic texture domain

[Praun Hoppe SIGGGRAPH 2003]

...huge distortions,incompatible topology

Going Beyond ApplesGoing Beyond Apples

• But for more general objects?

texture spaceworld space

arbitrary mesh coarse mesh

far too complex

(GPU)

Space & DomainSpace & Domain

•R3 -Object space

•T3 -3D texture space

R3

T3

T3 T2

•T3 -3D texture domain

•T2 -2D texture domain

Introducing PolycubesIntroducing Polycubes

Po·ly·cube: n. (Geom.) A solid composed by multiple unit cubes attached face to face

surface of a polycubeas 3D texture domain T3

mesh polycube

Choosing a PolycubeChoosing a Polycube

• Polycube should roughly resemble the mesh

texture spaceworld space

ProcessProcess

1. Assign each vertex v of the mesha unique 3D texture position

2. At rendering time• Vertices, 3D texture positions

→ Graphics pipeline → Rasterizer (interpolates 3D texture position fI3

for every produced fragment f ) → Pass fI3 into fragment shader

vT3 = (vr, vs, vt) ∈ T3

T3

T3

ProcessProcess

• Problem: Even if all 3D texture positions vT3 line on T3 , this is not necessarily the case for the interpolated 3D texture position fI3

• Fragment shader

– Projection P: T3 → T3

– Mapping M: T3 → T2

R3

T2

Projection & MappingProjection & Mapping

3D texture space T3

3D texture domain

T3

Most important feature of PolyCube-Maps: Continuously → seamless texture mapping (texture information itself is stored as a collection of square images)

2D analogue

texture stored in 1D

values definedin a 2D space

How PolyCube-Maps Work?How PolyCube-Maps Work?

• Dual partition – cubic cells

• Cell configurations -- facelets

• The projection P P

• The mapping M M

dual grid

Partition of Texture SpacePartition of Texture Space

polycube

2D analogue

case A

case B

cell

Partition of the Parameter SpaceCell Configurations and The Projection PPPartition of the Parameter SpaceCell Configurations and The Projection PP

back to 3Dcase 3 case 4-a case 4-b case 5 case 6-a case 6-b

facelet

squarelet texture patchS

The Mapping MMThe Mapping MM

• The upper left corner can be stored as a global 2D offset for each particular cell

• Local offsets don’t need to be stored

• A point p∈T3 inside a cell (3 steps)– relative position of p inside the containing facelet is

determined → multiplied with S to give the relative position in the corresponding squarelet

– offset the result according to the fixed packing of the squarelets inside the texture patch

– global offset of that patch in T2 is added

A Simple PolyCube-Map exampleA Simple PolyCube-Map example

Subdivide into 8 cells of type 3

Each cell contains three facelets thatsotred as a set of three texture squarelets

partition of theparameter spacepartition of theparameter space

back to 3D

dual cells

case 3

case 4-a

case 4-b

case 5

partition of theparameter spacepartition of theparameter space

case 3

case 4-a

case 4-b

case 5

dual cells

3D Look-up Table3D Look-up Table

• Store cell-structure of TT33 in 3D look-up table TT33

LUTLUT (define each cell through a set of

parameters in the corresponding entry of TT33LUTLUT)

• Processing a fragment ff (fragment shader)– determine the cell that contains the ffI3I3

– access to TT33LUTLUT at the corresponding entry

returns all the parameters needed to compute PP and MM (use to find the final 2D texture position ffT2 T2 ∈TT22 )

3D Look-up Table – Parameter3D Look-up Table – Parameter

• Each entry of TT33LUTLUT is packed in one

(r, g, b)-texel• An entry e is composed of 3 parts

– e.Ce.C – cell configurations (index)– e.Re.R – axis-to-axis rotation (index)– e.Oe.O – global offset of the patch (in TT22)

• TT33LUTLUT is always smaller than on Kilo texel

• TT22 can be several Mega texels• Construction of the look-up table !!

stored in texture RAM as:

a packed texture image

texture space (3D!)

the polycube

polycube-maps in a nutshellpolycube-maps in a nutshell

object space

plus a tiny structure to store polycube layoutthe mesh

(with per-vertex text. coord)

uv

w

not necessarilyon the polycubesurface: project

map to 2D

a fragmentwith interpolated

texture coord

final texel valuefor the fragment

Examples of poly-cubic parameterizationsExamples of poly-cubic parameterizations

texture space

polycube-map

world space

in texture RAM

uv

w

object

Examples of poly-cubic parameterizationsExamples of poly-cubic parameterizations

texture space

polycube-map

world space

u

v

w

object

Examples of poly-cubic parameterizationsExamples of poly-cubic parameterizations

texture space

polycube-map

world space

u

v

w

object

Examples of poly-cubic parameterizationsExamples of poly-cubic parameterizations

texture space

polycube-map

world space

object

uv

w

An example application: same texture for different LODAn example application: same texture for different LOD

Geo

met

ry 2

Geo

met

ry 1

Geo

met

ry 3

+

+

+

=

=

=

u

v

w

the same polycube-map

texture

How to build aPolycube-Map (for a given mesh)

How to build aPolycube-Map (for a given mesh)

• Not automatic, to this point– get a suitable

polycube– warp it around

the mesh– project mesh over it– unwarp – global optimization

MT3

projectwarp

-1

optimize

warp

Global optimizationGlobal optimization

projection(not optimized)

mean value MIPS ext. MIPS

Most Isometric ParametrizationSMost Isometric ParametrizationS

the horse head model parameterized using different angle/area preservation tradeoffs

θ = 0.3 θ = 1.0 θ = 3.0

Experimental ResultsExperimental Results

distortion Stretch efficiency

area angle T3 → M M → T3 [Gu] [Praun]

3-holes 1.003 1.011 0.986 0.986

Laurana 1.141 1.101 0.795 0.745

Bunny 1.034 1.069 0.892 0.913 0.639 0.703

armadillo 1.224 1.318 0.616 0.577 0.607 0.465

Frame Rate30 fps (mip-mapping)10 fps (mip-mapping + bilinear interpolation)

nVIDIA GeForce FX 5600 ATI Radeon 9800 ProoPentium 4 2.4 Ghz

DiscussionDiscussion

Pros• truly seamless texture

mapping• no patch boundaries• no color bleeding• very low distortion• nearly optimal texture

packing• bilinear filtering possible• mipmapping possible• mesh independency

Cons• long fragment program

– ~60 GPU instruction long– could be improved, with

little branching support

• 3 t-coords per vertex– instead of 2

Limits• cannot handle arbitrary

shape/topology complexity– e.g. a tree

Thank you! Questions?Thank you! Questions?

http://vcg.isti.cnr.it/~polycubemaps/http://vcg.isti.cnr.it/~polycubemaps/

or, just Google for “polycube-map”or, just Google for “polycube-map”

http://vcg.isti.cnr.it/~polycubemaps/http://vcg.isti.cnr.it/~polycubemaps/

or, just Google for “polycube-map”or, just Google for “polycube-map”

Marco Tarini Marco Tarini ·· Kai Hormann Kai Hormann ·· Paolo Cignoni Paolo Cignoni ·· Claudio Montani Claudio MontaniMarco Tarini Marco Tarini ·· Kai Hormann Kai Hormann ·· Paolo Cignoni Paolo Cignoni ·· Claudio Montani Claudio MontaniVisual Computing Lab Visual Computing Lab · · ISTI ISTI · · CNR CNR ·· Pisa, Italy Pisa, ItalyVisual Computing Lab Visual Computing Lab · · ISTI ISTI · · CNR CNR ·· Pisa, Italy Pisa, Italy

Q: Aren’t cubemaps just another atlas?Q: Aren’t cubemaps just another atlas?

texture charts?

chart boundaries?

A: true, but such chart borders are:

• transparent for triangles• invisible for mipmapping...• hidden from the user

uv

w

Q: isn’t it a lot of work to build a polycube map?Q: isn’t it a lot of work to build a polycube map?

• Polycube-maps

– Get a fitting polycube

– Warp it around mesh

– Project mesh over it– Unwarp back– Global optimization

• Atlases

– Find a good division into disk-like patches

– Pack charts togheter

– Global optimization

Q: isn’t it a lot of work to build a polycube map?Q: isn’t it a lot of work to build a polycube map?

• Polycube-maps– New.

Not studied at all.– Future work: design

tools to make task a lot easier (but still user guided)

– In any case, final result will be clean (seamless...)

• Atlases– Very much studied

problem– Automatic results

inferior w.r.t. manual results

– In any case, final parameterization bound to have drawbacks (seams...)

Recommended