Texture mapping Ogni texel è Un colore RGB (color map, RGB map, diffuse map) Una normale (bump map, o normal map) Il coefficiente speculare (specular map) Un fattore di trasparenza (alpha map, o cutout texture) Una scavo dalla superfice (displacemnt map, o height texture) Un lighiting precalcolato (light map, baked light texture) Texture maps come assets Vari texture «sheets» associati ad una mesh o anche: più meshes sullo stesso sheet (bene) tipica struttura dati: mesh divisa in sottomesh ogni sottomesh associata a un materiale ogni materiale: 1 sheet di diffuse-map 1 sheet bumpmap (se serve) 1 sheet di alphamap (se serve) 1 vertex + fragment shader vari parametri (es, shininess, ) Marco Tarini - 2014 1
Texture maps come assets Caratteristiche: Size: risoluzione canali (es: alpha?) MIP-maps precalcolati? Tileable? Vincoli ricorrenti: res come potenze di 2 (richiesto da sempre meno engines) sia in U che in V (es: 256x256 o 1024x512) res per lato < max (es: max = 4096 o 2048) B A A B Tileable textures Marco Tarini - 2014 2
Tileable textures Tipico utilizzo: Molto efficiente in spazio! MIP map levels Pre-filtering delle tessiture LOD levels per immagini! Hardware sceglie livello giusto per pixel Evita artefatti di sottocampionamento 1x1 512x512 256x256 1024x1024 Marco Tarini - 2014 3
Texture maps come assets: formati files x immagini generiche (decomprimere tutta immagine prima di accedere ai pixel) compressione: ottima loading: pesante: decomprimere da RAM, (forse) ricomprimere in GPU-RAM MIP-map lvls etc: controllato dall engine x textures (random accessibility ai texels senza decomprimere) compressione: cattiva loading: leggero direct copy Disco => RAM => GPU RAM MIP-map lvls etc: controllato dall artista Texture maps come assets: formati files x immagini generiche:.jpg /.JPEG lossy, > compresisone, immagini fotografiche : best solo 3 canali (no choice) 8 bit x canale (no choice).png lossless < compressione disegni: best anche canale alpha possibile anche 16 bits possibile.tiff e.raw (rari) lossless compressione: vabbe max flessibilità canali etc.pnm (davvero raro) compressione: ahah ma parsing facilissimo! (no lib) x textures:.dds (direct draw surface) lossy compresisone: poco (a rate fisso) GPU ready inlcude MIPmap levels (volendo) con compressione a scelta (S3TC): DXT1 no / 1-bit alpha DXT2 rough alpha DXT3 DXT4 smooth alpha DXT5 (diversi compromessi fra qualità, costo, canali ) Marco Tarini - 2014 4
RGB maps: come si ottengono Image first, then UV-mapping e.g. immagine da fotografie e.g. tileable images UV-mapper UV-mapping first, then paint 2D paint with 2D app (e.g. photoshop) UV-mapping first, then paint 3D paint within 3D modelling software, or: 1. export 2D rendering, 2. paint over with e.g. photoshop, 3. reimport images 4. goto 1 UV-mapper UV-mapper 2D painter 3D painter RGB maps: come si ottengono or: first Paint 3D on hi-res model, paint on vertex attributes e.g. with Z bursh then coarsen build / autobuild final low-poly version then UV-map the low-poly model must be a 1:1 mapping! then auto-texture auto build texture more about this later Marco Tarini - 2014 5
Alpha mapping (texels = lvl trasparenza) Alpha map RGB map Alpha mapping (texels = lvl trasparenza) es: drappi, barba... tessitura by Micheal M a r c o T a r i n i C o m Filipowski p u t e r G r a p h i c s 2 2004 0 1 1 / 1 2 U n i v e r s i t à d e l l I n s u b r i a Marco Tarini - 2014 6
Texture mapping e Alpha Test es: alberi, foliage Texture mapping e Alpha Test Es: pelo, pellicce tessitura (ripetuta) M a r c o T a r i n i C o m p u t e r G r a p h i c s 2 0 1 1 / 1 2 U n i v e r s i t à d e l l I n s u b r i a Marco Tarini - 2014 7
Bump-Mapping (see demo) stessa geometria (una sfera) bumpmaps diverse Normal maps Memorizzati come immagini RGB => XYZ (come?) caratteristico colore RGB (0.5,0.5,1) - (128,128,255) Marco Tarini - 2014 8
Normal maps Espressi in spazio tangente Memorizzare direzioni tangenti Tangente e Bi-tangente Nuovi attributi x vertice! Computati automaticamente a partire da UV mapping (come?) Marco Tarini - 2014 9