3D Meshes

Transcript

3D Meshes
Quad meshes or Trinagle meshes?
due triangoli!
un quadrilatero?
"quad"
“diagonal split”
Marco Tarini ‧ Computer Graphics ‧
Polygonal meshes or triangle meshes?
triangolarizzazione di poligono:
(es: se ne occupa la API
durante in rendering)
2014/15 ‧ Università dell’Insubria
3D Meshes: resolution
(n-2) triangoli!
un poligono a n lati?
(in 3D, non un problema del tutto banale...)
Marco Tarini ‧ Computer Graphics ‧
2014/15 ‧ Università dell’Insubria
“Level of Detail (LoD) Pyramid”
performance
LoD 1
quality
usare quando
visto da vicino
LoD 2
LoD 3
LoD 4
usare quando
visto da lontano
1
3D Meshes: adaptive resolution
3D Meshes: the good and the bad
• The good:
– GPU friendly
– flexible, adaptive resolution
• The bad:
– just a (piecewise linear) approximation
– smooth surfaces: approximated
Marco Tarini ‧ Computer Graphics ‧
2014/15 ‧ Università dell’Insubria
Marco Tarini ‧ Computer Graphics ‧
2014/15 ‧ Università dell’Insubria
Formati files per mesh
Formati files per mesh …
(una Torre di Babele!)
(xkcd.com)
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
3DS - 3D Studio Max file format
OBJ - Another file format for 3D objects
MA, MB - Maya file formats
3DX - Rinoceros file format
BLEND - Blender file format
DAE - COLLADA file format (Khornos)
FBX - Autodesk interchange file format
X - Direct X object
SMD - good for animations (by Valve)
MD3 - quake 3 vertex animations
DEM - Digital Elevation Models
DXF - (exchange format, Autodesk's AutoCAD)
FIG - Used by REND386/AVRIL
FLT - MulitGen Inc.'s OpenFlight format
HDF - Hierarchical Data Format
IGES - Initial Graphics Exchange Specification
IV - Open Inventor File Format Info
LWO, LWB & LWS - Lightwave 3D file formats
MAZ - Used by Division's dVS/dVISE
MGF - Materials and Geometry Format
MSDL - Manchester Scene Description Language
3DML - by Flatland inc.
C4D – Cinema 4D file format
SLDPTR - SolidWork "part"
WINGS - Wings3D object
NFF - Used by Sense8's WorldToolKit
SKP - Google sketch up
KMZ - Google Earth model
OFF - A general 3D mesh Object File Format
OOGL - Object Oriented Graphics Library
PLG - Used by REND386/AVRIL
POV - “persistence of vision” ray-tracer
QD3D - Apple's QuickDraw 3D Metafile format
TDDD - for Imagine & Turbo Silver ray-tracers
NFF & ENFF - (Extended) Neutral File Format
VIZ - Used by Division's dVS/dVISE
VRML, VRML97 - Virtual Reality Modeling Language (RIP)
X3D - tentato successore di VRML
PLY - introdotto by Cyberware – tipic. dati range scan
DICOM - Dalla casa omonima – tipic. dati CAT scan
Renderman - per l'omonimo visualizzatore
RWX - RenderWare Object
Z3D - ZModeler File format
etc, etc, etc...
2
Formati file per mesh
i più diffusi
.OBJ (wavefront)
più diffusi
☺ max diffusione
☺ indexed, normali , uv-mapping
no colori (solo indice materiale x faccia)
no skinning o ani
.SMD (
)
Mesh 3D
.3DS (
☺ si: colori, uv-mapping,
indexed, materiali, tessiture…
no: normali
limite al numero di vert (64K)
.COLLADA (
meno diffusi
☺ animazioni scheletali + skinning
☺ normali , uv-mapping
no indexed!
no colori
Repositories,
asset stores,
public
databeses,
online shops,
etc.
)
)
☺ completissimo
☺ nato apposta per essere interscambio
☺ open standard
quasi impossibile da parsare completamente
.MD3 (Quake, IDsoft)
.FBX (
☺ vertex animations, normali
no colori
)
☺ completo, comprese animations
complesso, difficile da parsare
.PLY (cyberware)
.MA / .MB (
☺ customizzabile
“accademico”
)
☺ completo, comprese animations
complesso, difficile da parsare
semplici
complessi
Come rappresento una mesh?
(quali strutture dati)
Circa la connettività di una mesh
• indexed mesh
• è two-manifold ? (una "varietà due")
V1
V2
T1
T3
T2
V4
V5
V3
vert
X
Y
Z
R
G
B
V1
x1
y1
z1
r1
g1
b1
V2
x2
y2
z2
r2
g2
b2
V3
x3
y3
z3
r3
g3
b3
V4
x4
y4
z4
r4
g4
b4
x5
y5
z5
r5
g5
b5
V5
GEOMETRIA + ATTRIBUTI
Tri:
Wedge
1:
Wedge
2:
Wedge
3:
T1
V4
V1
V2
T2
V4
V2
V5
T3
V5
V2
V3
– two-manifold = localmente è una superficie
• SI = bene, NO = male
• (molti algoritmi su mesh necessitano che sia two-manifold)
– per le mesh:
1. two-manifold = ogni edge condiviso da max 2 faccie
NO
SI
CONNETTIVITA’
Marco Tarini ‧ Computer Graphics ‧
2014/15 ‧ Università dell’Insubria
Marco Tarini ‧ Computer Graphics
‧ 2012/13 ‧ Università dell’Insubria
3
Circa la connettività di una mesh
Examples of NOT 2-manifolds meshes
• è two-manifold ? (una "varietà due")
– two-manifold = localmente è una superficie
• SI = bene, NO = male
• (molti algoritmi su mesh necessitano che sia two-manifold)
– per le mesh:
2. two-manifold = ogni vertice condiviso da max 1 stella
1 non manifold
edge here
NON COSI
Marco Tarini ‧ Computer Graphics
‧ 2012/13 ‧ Università dell’Insubria
Circa la connettività di una mesh
• Orientamento delle facce
D
1 non manifold
edge here
Marco Tarini ‧ Computer Graphics ‧
1 2
C
t_a = {A,C,D}
t_b = {A,B,C}
1
2014/15 ‧ Università dell’Insubria
Circa la connettività di una mesh
• Orientabile, non orientabile
– è possibile assegnare un orientamento ad ogni
faccia coerentemente?
– orientabile = normali coerenti!
A
0 0
2
1 non manifold
vertex here
A
1 1
B
D
3
2 3
C
2
B
senso opposto, edge coerente
Marco Tarini ‧ Computer Graphics
‧ 2012/13 ‧ Università dell’Insubria
Marco Tarini ‧ Computer Graphics
‧ 2012/13 ‧ Università dell’Insubria
4
Circa la connettività di una mesh
Come rappresento una mesh?
(quali strutture dati)
• Orientabile, non orientabile
• connettività con half-edges
– esempi di mesh non orientabili:
• mesh non two-manifold
• e...
V1
V2
H2
H1
H8
H3
H4
Bottiglia di Klein
(non orientabile, aperta)
Marco Tarini ‧ Computer Graphics
V3
H9
H6
V4
Nastro di Moebius
H5
H7
V5
(non orientabile, chiusa)
‧ 2012/13 ‧ Università dell’Insubria
Da:
A:
Next:
Opposite:
H1
V4
V1
H2
--
H2
V1
V2
H3
--
H3
V2
V4
H1
H4
H4
V4
V2
H5
H3
H5
V2
V5
H6
H7
H6
V5
V4
H4
--
H7
V5
V2
H8
H5
H8
V2
V3
H9
--
H9
V3
V5
H7
--
CONNETTIVITA’
2014/15 ‧ Università dell’Insubria
3D models categorization:
Origin
Strutture per connettività
a confronto
INDEXED
HALF-EDGES
•
HW friendly
•
Rendering… complicato
•
Navigazione… complicata
•
Navigazione semplice
– richiede strutture dati
ulteriori (“di adiacenza”)
Marco Tarini ‧ Computer Graphics ‧
Half
edge:
informazione
– es: x trovare tutti i vertici nella
“stella 1” di un vertice…
•
Ok per: mesh “pure”
(di soli tri, o, al max, di soli quad)
•
Ok anche per: polygonal mesh
(poligoni misti a piacere)
•
Compatta: 3 indici x tri
•
Prolissa: 12 indici per tri
•
> adatta per
rendering
•
> adatta a mesh
processing
construction
MODEL 3D
of
the scene
preprocessing
rendering
Images
modelling
applicazione interattiva
Marco Tarini ‧ Computer Graphics ‧
2014/15 ‧ Università dell’Insubria
Marco Tarini ‧ Computer Graphics ‧
2014/15 ‧ Università dell’Insubria
5
Mesh processing
aka Geometry Processing
Geometry Processing
Alcune buone librerieLibrerie:
• Un buon manuale
x programmare
mesh processing:
• VCG-Lib (CNR,
)
– Vision and Computer Graphic Lib
• OpenMesh (RWTH,
– + open flipper
• CGAL (INRIA,
de )
)
– Computational Geometry Algorithms Library
(tutte: C++, open-source.)
Marco Tarini ‧ Computer Graphics ‧
2014/15 ‧ Università dell’Insubria
Marco Tarini ‧ Computer Graphics ‧
2014/15 ‧ Università dell’Insubria
Geometry Processing
Geometry Processing: esempio
• Un buon applicativo
• Es: Mesh smoothing
Marco Tarini ‧ Computer Graphics ‧
2014/15 ‧ Università dell’Insubria
Marco Tarini ‧ Computer Graphics ‧
2014/15 ‧ Università dell’Insubria
6
Geometry Processing: esempio
Geometry Processing: esempio
• Es: Mesh smoothing
• Es: Mesh denoising
(img by Iman Sadeghi)
Marco Tarini ‧ Computer Graphics ‧
2014/15 ‧ Università dell’Insubria
Semplificazione automatica
di modelli 3D
Marco Tarini ‧ Computer Graphics ‧
2014/15 ‧ Università dell’Insubria
Semplificazione automatica
• Molte tecniche diverse
• parametri:
– Adattive oppure no
• usare piu' triangoli dove c'e' bisogno (es non nelle zone cmq piatte)
• oppure no
– un errore massimo
– o un numero di facce obiettivo
– Errore massimo introdotto:
• misurato e/o limitato
• oppure no
– Topologia:
• mantenuta
• oppure no
automaticamente
– Streaming
• Possibile
• Oppure no
– ...
mesh originale
mesh semplificata
500K triangoli
2K triangles
Marco Tarini ‧ Computer Graphics
‧ 2012/13 ‧ Università dell’Insubria
7
Automatic simplification (or poly-reduction)
Semplificazione automatica
• Different possible strategies:
• Strategie completamente diverse
– iterative approaches
– Vertex clustering:
• repeat
remove
vertex
– do a local operation
– (pick the least expensive one
in term of error increase)
• until (objective reached)
edge
collapse
• dividi i vertici originali in una griglia regolare
• "collassa" in un solo vertice tutti quelli nella stessa casella
• togli i triangoli che hanno solo 1 o 2 vertici diversi
– Approssimazione dipende da dimensione griglia
– e.g.: poly count,
o max error
remove
face
Marco Tarini ‧ Computer Graphics
‧ 2012/13 ‧ Università dell’Insubria
Marco Tarini ‧ Computer Graphics
‧ 2012/13 ‧ Università dell’Insubria
Semplificazione automatica
Simplificazione ad edge collapse
(adattva)
215k faces
Marco Tarini ‧ Computer Graphics
Semplificazione a clustering
(non adattiva)
235k faces
‧ 2012/13 ‧ Università dell’Insubria
8