SlideShare a Scribd company logo
1 of 51
Per-Face Texture Mapping forPer-Face Texture Mapping for
Realtime RenderingRealtime Rendering
““Realtime Ptex”Realtime Ptex”
Quick NoteQuick Note
• For CUDA/Compute folks:For CUDA/Compute folks:
– Ptex != PTXPtex != PTX
GoalsGoals
 Render native Ptex datasets in real-time on commodity
hardware
 Remove texture seams from textured modelsRemove texture seams from textured models
 Remove expensive, manual model unwrap step from artRemove expensive, manual model unwrap step from art
pipelinepipeline
 Support arbitrary resolutions on a per-face basisSupport arbitrary resolutions on a per-face basis
Video Time!Video Time!
© Disney. Used with permission.
Video RecapVideo Recap
Stored as 8Kx8K
Rendered as 2Kx2K
© Disney. Used with permission.
Model StatisticsModel Statistics
• ~800 FPS on GTX 460 with no optimization~800 FPS on GTX 460 with no optimization
• 278M of Color Texture Data278M of Color Texture Data
• 5812 Patches5812 Patches
© Disney. Used with permission.
General StepsGeneral Steps
Load
Model
Load
Model
RenderRender
Preprocess
Draw Time
Bucket
and
Sort
Bucket
and
Sort
Generate
Mipmaps
Generate
Mipmaps
Fill
Borders
Fill
Borders
Pack
Texture
Arrays
Pack
Texture
Arrays
Reorder
Index
Buffer
Reorder
Index
Buffer
Pack
Patch
Constants
Pack
Patch
Constants
Red: Vertex and Index data
Green: Patch Constant information
Blue: Texel data
Orange: Adjacency information
Load ModelLoad Model
Load
Model
Load
Model
RenderRender
Preprocess
Draw Time
Bucket
and
Sort
Bucket
and
Sort
Generate
Mipmaps
Generate
Mipmaps
Fill
Borders
Fill
Borders
Pack
Texture
Arrays
Pack
Texture
Arrays
Reorder
Index
Buffer
Reorder
Index
Buffer
Pack
Patch
Constants
Pack
Patch
Constants
Red: Vertex and Index data
Green: Patch Constant information
Blue: Texel data
Orange: Adjacency information
Load ModelLoad Model
• Vertex DataVertex Data
– Any geometry arranged as a quad-based meshAny geometry arranged as a quad-based mesh
– Example: Wavefront OBJExample: Wavefront OBJ
• Patch TexturePatch Texture
– Power-of-two texture imagesPower-of-two texture images
• Adjacency InformationAdjacency Information
– 4 Neighbors of each quad patch4 Neighbors of each quad patch
• Easily load with library available fromEasily load with library available from http://ptex.us/http://ptex.us/
Load Model (cont’d)Load Model (cont’d)
• Texel DataTexel Data
– Per face, load the largest available mipmap level from thePer face, load the largest available mipmap level from the
source filessource files
– In memory, place the loaded texel data into a memoryIn memory, place the loaded texel data into a memory
buffer that has a fixed-size texel border regionbuffer that has a fixed-size texel border region
– The borders must be big enough for the largest filter kernelThe borders must be big enough for the largest filter kernel
you will support (Border size = ½ filter kernel size)you will support (Border size = ½ filter kernel size)
• Bilinear (2x2 kernel): 1 pixel borderBilinear (2x2 kernel): 1 pixel border
• 16x Aniso (16x16 kernel): 8 pixel border16x Aniso (16x16 kernel): 8 pixel border
Load ModelLoad Model
VB: …
IB:
Load ModelLoad Model
VB: …
IB:
Bucket and SortBucket and Sort
Load
Model
Load
Model
RenderRender
Preprocess
Draw Time
Bucket
and
Sort
Bucket
and
Sort
Generate
Mipmaps
Generate
Mipmaps
Fill
Borders
Fill
Borders
Pack
Texture
Arrays
Pack
Texture
Arrays
Reorder
Index
Buffer
Reorder
Index
Buffer
Pack
Patch
Constants
Pack
Patch
Constants
Red: Vertex and Index data
Green: Patch Constant information
Blue: Texel data
Orange: Adjacency information
Bucket and SortBucket and Sort
• Bucket ptex surfaces into groups by Aspect RatioBucket ptex surfaces into groups by Aspect Ratio
– Each Aspect Ratio will be one bucketEach Aspect Ratio will be one bucket
– 1:1 bucket, 2:1 bucket, 4:1 bucket, etc1:1 bucket, 2:1 bucket, 4:1 bucket, etc
• Then, within each bucket, sort by decreasing surfaceThen, within each bucket, sort by decreasing surface
size and assign IDs.size and assign IDs.
– This allows us to densely pack texture arrays, avoiding “empty”This allows us to densely pack texture arrays, avoiding “empty”
surfaces.surfaces.
Bucket and SortBucket and Sort
Bucket 4:1
Bucket 1:1
0
Reorder Index BufferReorder Index Buffer
Load
Model
Load
Model
RenderRender
Preprocess
Draw Time
Bucket
and
Sort
Bucket
and
Sort
Generate
Mipmaps
Generate
Mipmaps
Fill
Borders
Fill
Borders
Pack
Texture
Arrays
Pack
Texture
Arrays
Reorder
Index
Buffer
Reorder
Index
Buffer
Pack
Patch
Constants
Pack
Patch
Constants
Red: Vertex and Index data
Green: Patch Constant information
Blue: Texel data
Orange: Adjacency information
Reorder Index BufferReorder Index Buffer
• OriginalOriginal • Post Sort, we have 2!Post Sort, we have 2!
IB:
IB(1:1):
IB(4:1):
Generate MipmapsGenerate Mipmaps
Load
Model
Load
Model
RenderRender
Preprocess
Draw Time
Bucket
and
Sort
Bucket
and
Sort
Generate
Mipmaps
Generate
Mipmaps
Fill
Borders
Fill
Borders
Pack
Texture
Arrays
Pack
Texture
Arrays
Reorder
Index
Buffer
Reorder
Index
Buffer
Pack
Patch
Constants
Pack
Patch
Constants
Red: Vertex and Index data
Green: Patch Constant information
Blue: Texel data
Orange: Adjacency information
Generate MipmapsGenerate Mipmaps
• Walk through surfaces, and generate a mipmap chainWalk through surfaces, and generate a mipmap chain
from native size to (MinFilterSize x MinFilterSize) forfrom native size to (MinFilterSize x MinFilterSize) for
each surface.each surface.
– Bilinear stops at 2x2, 8xAniso stops at 8x8Bilinear stops at 2x2, 8xAniso stops at 8x8
• Ptex data files do not guarantee complete mipmapPtex data files do not guarantee complete mipmap
chains—although the library can generate all levels forchains—although the library can generate all levels for
you—with pre-multiplied alpha.you—with pre-multiplied alpha.
• Mipmap chains stop to allow for unique pinning valuesMipmap chains stop to allow for unique pinning values
in the cornersin the corners
Generate MipmapsGenerate Mipmaps
• Done for every surface, but only inside the surface—theDone for every surface, but only inside the surface—the
border is not touched.border is not touched.
Fill BordersFill Borders
Load
Model
Load
Model
RenderRender
Preprocess
Draw Time
Bucket
and
Sort
Bucket
and
Sort
Generate
Mipmaps
Generate
Mipmaps
Fill
Borders
Fill
Borders
Pack
Texture
Arrays
Pack
Texture
Arrays
Reorder
Index
Buffer
Reorder
Index
Buffer
Pack
Patch
Constants
Pack
Patch
Constants
Red: Vertex and Index data
Green: Patch Constant information
Blue: Texel data
Orange: Adjacency information
Fill BordersFill Borders
• Copy neighbor texels into border area of this surface’sCopy neighbor texels into border area of this surface’s
mip levelmip level
– Match source and destination number of pixels whenMatch source and destination number of pixels when
possiblepossible
• Bordered textures are the heart of the logical realtimeBordered textures are the heart of the logical realtime
ptex solutionptex solution
• Allows 1-2 texture lookups per ptex sample requestAllows 1-2 texture lookups per ptex sample request
– 1 if not performing tween-mip-level interpolation, 2 otherwise1 if not performing tween-mip-level interpolation, 2 otherwise
Fill BordersFill Borders
Fill BordersFill Borders
Fill BordersFill Borders
Fill BordersFill Borders
Fill BordersFill Borders
Pack Texture ArraysPack Texture Arrays
Load
Model
Load
Model
RenderRender
Preprocess
Draw Time
Bucket
and
Sort
Bucket
and
Sort
Generate
Mipmaps
Generate
Mipmaps
Fill
Borders
Fill
Borders
Pack
Texture
Arrays
Pack
Texture
Arrays
Reorder
Index
Buffer
Reorder
Index
Buffer
Pack
Patch
Constants
Pack
Patch
Constants
Red: Vertex and Index data
Green: Patch Constant information
Blue: Texel data
Orange: Adjacency information
Texture ArraysTexture Arrays
• Like 3D / Volume Textures, except:Like 3D / Volume Textures, except:
– No filtering between 2D slicesNo filtering between 2D slices
– Only X and Y decrease with mipmap level (Z doesn’t)Only X and Y decrease with mipmap level (Z doesn’t)
– Z indexed by integer index, not [0,1]Z indexed by integer index, not [0,1]
• E.g. (0.5, 0.5, 4) would be (0.5, 0.5) from the 5E.g. (0.5, 0.5, 4) would be (0.5, 0.5) from the 5thth
sliceslice
• API SupportAPI Support
– Direct3D 10+: Texture2DArrayDirect3D 10+: Texture2DArray
– OpenGL 3.0+: GL_TEXTURE_2D_ARRAYOpenGL 3.0+: GL_TEXTURE_2D_ARRAY
Pack Texture ArraysPack Texture Arrays
• Copy all generated data into Texture2DArrayCopy all generated data into Texture2DArray
• Each Texture2DArray represents a single mipmap levelEach Texture2DArray represents a single mipmap level
– Texture2DArrays present a view of the data that is efficientTexture2DArrays present a view of the data that is efficient
for GPU layoutfor GPU layout
– Logical Textures cut across the same page index of everyLogical Textures cut across the same page index of every
Texture2DArrayTexture2DArray
Pack Texture ArraysPack Texture Arrays
0 1 2
3
Logical Texture Layout
Pack Texture ArraysPack Texture Arrays
10x10x3
(1+8+1)x(1+8+1)x3
6x6x4
(1+4+1)x(1+4+1)x4
4x4x4
(1+2+1)x(1+2+1)x4
GPU Layout Texture2DArray
gColor[0]
gColor[1]
gColor[2]
Pack Patch ConstantsPack Patch Constants
Load
Model
Load
Model
RenderRender
Preprocess
Draw Time
Bucket
and
Sort
Bucket
and
Sort
Generate
Mipmaps
Generate
Mipmaps
Fill
Borders
Fill
Borders
Pack
Texture
Arrays
Pack
Texture
Arrays
Reorder
Index
Buffer
Reorder
Index
Buffer
Pack
Patch
Constants
Pack
Patch
Constants
Red: Vertex and Index data
Green: Patch Constant information
Blue: Texel data
Orange: Adjacency information
Pack Patch ConstantsPack Patch Constants
• Each primitive has a “PatchInfo” struct:Each primitive has a “PatchInfo” struct:
– TextureId – which array slice contains our dataTextureId – which array slice contains our data
– TopMipLevel – the index of the top-most mipmap level for thisTopMipLevel – the index of the top-most mipmap level for this
texturetexture
– FlipUVs – whether or not to flip UVs, allows 1:2 and 2:1 to beFlipUVs – whether or not to flip UVs, allows 1:2 and 2:1 to be
grouped into same bucketgrouped into same bucket
– MaxMipLevels – Maximum mipmap level for each edgeMaxMipLevels – Maximum mipmap level for each edge
Fill BordersFill Borders
Load
Model
Load
Model
RenderRender
Preprocess
Draw Time
Bucket
and
Sort
Bucket
and
Sort
Generate
Mipmaps
Generate
Mipmaps
Fill
Borders
Fill
Borders
Pack
Texture
Arrays
Pack
Texture
Arrays
Reorder
Index
Buffer
Reorder
Index
Buffer
Pack
Patch
Constants
Pack
Patch
Constants
Red: Vertex and Index data
Green: Patch Constant information
Blue: Texel data
Orange: Adjacency information
RenderRender
• Brief Recap of D3D11 Pipe stagesBrief Recap of D3D11 Pipe stages
New Direct3D 11 StagesNew Direct3D 11 Stages
IAIA VS HS TSTS DS GS RASRAS PS OMOM
Programmable (Shader)
Fixed Function
RenderRender
• In the Hull ShaderIn the Hull Shader
– Store pre-expansion PrimitiveID to output control pointsStore pre-expansion PrimitiveID to output control points
– This is used everywhere to determine which set of PatchThis is used everywhere to determine which set of Patch
Constants are owned by the currently running thread (inConstants are owned by the currently running thread (in
Domain, Geometry or Pixel Shaders)Domain, Geometry or Pixel Shaders)
New Direct3D 11 StagesNew Direct3D 11 Stages
IAIA VS HS TSTS DS GS RASRAS PS OMOM
RenderRender
• In the Domain ShaderIn the Domain Shader
– Vertices belonging to a quad meshes are evaluated with aVertices belonging to a quad meshes are evaluated with a
domain location, which is (0,0)-(1,1) for each patchdomain location, which is (0,0)-(1,1) for each patch
– Use this value to store our UV locationUse this value to store our UV location
New Direct3D 11 StagesNew Direct3D 11 Stages
IAIA VS HS TSTS DS GS RASRAS PS OMOM
RenderRender
• Texture lookups in Domain or Pixel Shader are replacedTexture lookups in Domain or Pixel Shader are replaced
with a “ptex” sample function.with a “ptex” sample function.
– Determines which logical texture to work fromDetermines which logical texture to work from
– Compute mipmap level(s) to accessCompute mipmap level(s) to access
– Scale and bias computed (u,v) by mipmap sizeScale and bias computed (u,v) by mipmap size
– Lookup texels, return weighted averageLookup texels, return weighted average
Texture Lookup Shader CodeTexture Lookup Shader Code
• Traditional (D3D11)Traditional (D3D11)
returnreturn
gTxDiffuse.Sample(gTxDiffuse.Sample(
gSampler,gSampler,
I.fTextureUV );I.fTextureUV );
• PtexPtex
returnreturn
ptex( gTxDiffuse,ptex( gTxDiffuse,
gSampler,gSampler,
I.uPrimitiveId,I.uPrimitiveId,
I.fTextureUV );I.fTextureUV );
Complex logic hidden
in single function call
Questions?Questions?
• jmcdonald at nvidia dot comjmcdonald at nvidia dot com
• Brent dot Burley at disneyanimation dot comBrent dot Burley at disneyanimation dot com
• http://ptex.us/http://ptex.us/
• http://groups.google.com/group/ptexhttp://groups.google.com/group/ptex
• Or visit our studio sessionOr visit our studio session
– Monday, 8 August @ 4:30 PM – 5:00 PMMonday, 8 August @ 4:30 PM – 5:00 PM
– The Studio / West Building, Ballroom AThe Studio / West Building, Ballroom A
Additional ConsiderationsAdditional Considerations
• Filtering across edges with differing numbers of pixelsFiltering across edges with differing numbers of pixels
• Filtering across cornersFiltering across corners
Filtering across edgesFiltering across edges
Filtering across edgesFiltering across edges
Filtering across edgesFiltering across edges
Filtering across cornersFiltering across corners
• Corners with valence > 4Corners with valence > 4
cannot be exactlycannot be exactly
matched with amatched with a
bilerp (4 samples)bilerp (4 samples)
© Disney. Used with permission.
Filtering across cornersFiltering across corners
• The solution is a bit more involved.The solution is a bit more involved.
– First, walk the mesh and determine which corners are sharedFirst, walk the mesh and determine which corners are shared
– For each shared group, determine the correct value for whenFor each shared group, determine the correct value for when
we’re exactly at that corner. E.g. Simple Average.we’re exactly at that corner. E.g. Simple Average.
– Then, modify every mipmap level of every surface of thatThen, modify every mipmap level of every surface of that
group s.t. the shared corner has the same valuegroup s.t. the shared corner has the same value
– When you’re in the corner, everyone will perform the sameWhen you’re in the corner, everyone will perform the same
lookup—regardless of mipmap level—and continuity prevailslookup—regardless of mipmap level—and continuity prevails
Filtering across cornersFiltering across corners
• For Realtime Ptex, we apply pinning to all corners,For Realtime Ptex, we apply pinning to all corners,
regardless of valence.regardless of valence.
Pinned CornersPinned Corners
Questions redux?Questions redux?
• jmcdonald at nvidia dot comjmcdonald at nvidia dot com
• Brent dot Burley at disneyanimation dot comBrent dot Burley at disneyanimation dot com
• http://ptex.us/http://ptex.us/
• http://groups.google.com/group/ptexhttp://groups.google.com/group/ptex
• Or visit our studio sessionOr visit our studio session
– Monday, 8 August @ 4:30 PM – 5:00 PMMonday, 8 August @ 4:30 PM – 5:00 PM
– The Studio / West Building, Ballroom AThe Studio / West Building, Ballroom A

More Related Content

What's hot

Using neon for pattern recognition in audio data
Using neon for pattern recognition in audio dataUsing neon for pattern recognition in audio data
Using neon for pattern recognition in audio dataIntel Nervana
 
Approaching zero driver overhead
Approaching zero driver overheadApproaching zero driver overhead
Approaching zero driver overheadCass Everitt
 
Holy smoke! Faster Particle Rendering using Direct Compute by Gareth Thomas
Holy smoke! Faster Particle Rendering using Direct Compute by Gareth ThomasHoly smoke! Faster Particle Rendering using Direct Compute by Gareth Thomas
Holy smoke! Faster Particle Rendering using Direct Compute by Gareth ThomasAMD Developer Central
 
Checkerboard Rendering in Dark Souls: Remastered by QLOC
Checkerboard Rendering in Dark Souls: Remastered by QLOCCheckerboard Rendering in Dark Souls: Remastered by QLOC
Checkerboard Rendering in Dark Souls: Remastered by QLOCQLOC
 
Future Directions for Compute-for-Graphics
Future Directions for Compute-for-GraphicsFuture Directions for Compute-for-Graphics
Future Directions for Compute-for-GraphicsElectronic Arts / DICE
 
OpenGL NVIDIA Command-List: Approaching Zero Driver Overhead
OpenGL NVIDIA Command-List: Approaching Zero Driver OverheadOpenGL NVIDIA Command-List: Approaching Zero Driver Overhead
OpenGL NVIDIA Command-List: Approaching Zero Driver OverheadTristan Lorach
 
Anil Thomas - Object recognition
Anil Thomas - Object recognitionAnil Thomas - Object recognition
Anil Thomas - Object recognitionIntel Nervana
 
Your Game Needs Direct3D 11, So Get Started Now!
Your Game Needs Direct3D 11, So Get Started Now!Your Game Needs Direct3D 11, So Get Started Now!
Your Game Needs Direct3D 11, So Get Started Now!Johan Andersson
 
Advanced Scenegraph Rendering Pipeline
Advanced Scenegraph Rendering PipelineAdvanced Scenegraph Rendering Pipeline
Advanced Scenegraph Rendering PipelineNarann29
 
Triangle Visibility buffer
Triangle Visibility bufferTriangle Visibility buffer
Triangle Visibility bufferWolfgang Engel
 
EXT_window_rectangles
EXT_window_rectanglesEXT_window_rectangles
EXT_window_rectanglesMark Kilgard
 
A Certain Slant of Light - Past, Present and Future Challenges of Global Illu...
A Certain Slant of Light - Past, Present and Future Challenges of Global Illu...A Certain Slant of Light - Past, Present and Future Challenges of Global Illu...
A Certain Slant of Light - Past, Present and Future Challenges of Global Illu...Electronic Arts / DICE
 
Screen Space Reflections in The Surge
Screen Space Reflections in The SurgeScreen Space Reflections in The Surge
Screen Space Reflections in The SurgeMichele Giacalone
 
PT-4054, "OpenCL™ Accelerated Compute Libraries" by John Melonakos
PT-4054, "OpenCL™ Accelerated Compute Libraries" by John MelonakosPT-4054, "OpenCL™ Accelerated Compute Libraries" by John Melonakos
PT-4054, "OpenCL™ Accelerated Compute Libraries" by John MelonakosAMD Developer Central
 
A Platform for Accelerating Machine Learning Applications
 A Platform for Accelerating Machine Learning Applications A Platform for Accelerating Machine Learning Applications
A Platform for Accelerating Machine Learning ApplicationsNVIDIA Taiwan
 
Parallel Futures of a Game Engine
Parallel Futures of a Game EngineParallel Futures of a Game Engine
Parallel Futures of a Game EngineJohan Andersson
 

What's hot (20)

Hair in Tomb Raider
Hair in Tomb RaiderHair in Tomb Raider
Hair in Tomb Raider
 
Using neon for pattern recognition in audio data
Using neon for pattern recognition in audio dataUsing neon for pattern recognition in audio data
Using neon for pattern recognition in audio data
 
Approaching zero driver overhead
Approaching zero driver overheadApproaching zero driver overhead
Approaching zero driver overhead
 
Holy smoke! Faster Particle Rendering using Direct Compute by Gareth Thomas
Holy smoke! Faster Particle Rendering using Direct Compute by Gareth ThomasHoly smoke! Faster Particle Rendering using Direct Compute by Gareth Thomas
Holy smoke! Faster Particle Rendering using Direct Compute by Gareth Thomas
 
Checkerboard Rendering in Dark Souls: Remastered by QLOC
Checkerboard Rendering in Dark Souls: Remastered by QLOCCheckerboard Rendering in Dark Souls: Remastered by QLOC
Checkerboard Rendering in Dark Souls: Remastered by QLOC
 
Future Directions for Compute-for-Graphics
Future Directions for Compute-for-GraphicsFuture Directions for Compute-for-Graphics
Future Directions for Compute-for-Graphics
 
OpenGL NVIDIA Command-List: Approaching Zero Driver Overhead
OpenGL NVIDIA Command-List: Approaching Zero Driver OverheadOpenGL NVIDIA Command-List: Approaching Zero Driver Overhead
OpenGL NVIDIA Command-List: Approaching Zero Driver Overhead
 
Extreme dxt compression
Extreme dxt compressionExtreme dxt compression
Extreme dxt compression
 
Anil Thomas - Object recognition
Anil Thomas - Object recognitionAnil Thomas - Object recognition
Anil Thomas - Object recognition
 
Your Game Needs Direct3D 11, So Get Started Now!
Your Game Needs Direct3D 11, So Get Started Now!Your Game Needs Direct3D 11, So Get Started Now!
Your Game Needs Direct3D 11, So Get Started Now!
 
Advanced Scenegraph Rendering Pipeline
Advanced Scenegraph Rendering PipelineAdvanced Scenegraph Rendering Pipeline
Advanced Scenegraph Rendering Pipeline
 
Triangle Visibility buffer
Triangle Visibility bufferTriangle Visibility buffer
Triangle Visibility buffer
 
NvFX GTC 2013
NvFX GTC 2013NvFX GTC 2013
NvFX GTC 2013
 
EXT_window_rectangles
EXT_window_rectanglesEXT_window_rectangles
EXT_window_rectangles
 
A Certain Slant of Light - Past, Present and Future Challenges of Global Illu...
A Certain Slant of Light - Past, Present and Future Challenges of Global Illu...A Certain Slant of Light - Past, Present and Future Challenges of Global Illu...
A Certain Slant of Light - Past, Present and Future Challenges of Global Illu...
 
Screen Space Reflections in The Surge
Screen Space Reflections in The SurgeScreen Space Reflections in The Surge
Screen Space Reflections in The Surge
 
PT-4054, "OpenCL™ Accelerated Compute Libraries" by John Melonakos
PT-4054, "OpenCL™ Accelerated Compute Libraries" by John MelonakosPT-4054, "OpenCL™ Accelerated Compute Libraries" by John Melonakos
PT-4054, "OpenCL™ Accelerated Compute Libraries" by John Melonakos
 
NAS EP Algorithm
NAS EP Algorithm NAS EP Algorithm
NAS EP Algorithm
 
A Platform for Accelerating Machine Learning Applications
 A Platform for Accelerating Machine Learning Applications A Platform for Accelerating Machine Learning Applications
A Platform for Accelerating Machine Learning Applications
 
Parallel Futures of a Game Engine
Parallel Futures of a Game EngineParallel Futures of a Game Engine
Parallel Futures of a Game Engine
 

Similar to Realtime Per Face Texture Mapping (PTEX)

The Technology behind Shadow Warrior, ZTG 2014
The Technology behind Shadow Warrior, ZTG 2014The Technology behind Shadow Warrior, ZTG 2014
The Technology behind Shadow Warrior, ZTG 2014Jarosław Pleskot
 
Angel cunado_The Terrain Of KUF2
Angel cunado_The Terrain Of KUF2Angel cunado_The Terrain Of KUF2
Angel cunado_The Terrain Of KUF2drandom
 
thu-blake-gdc-2014-final
thu-blake-gdc-2014-finalthu-blake-gdc-2014-final
thu-blake-gdc-2014-finalRobert Taylor
 
Windows to reality getting the most out of direct3 d 10 graphics in your games
Windows to reality   getting the most out of direct3 d 10 graphics in your gamesWindows to reality   getting the most out of direct3 d 10 graphics in your games
Windows to reality getting the most out of direct3 d 10 graphics in your gameschangehee lee
 
Easy edd phd talks 28 oct 2008
Easy edd phd talks 28 oct 2008Easy edd phd talks 28 oct 2008
Easy edd phd talks 28 oct 2008Taha Sochi
 
4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
4K Checkerboard in Battlefield 1 and Mass Effect Andromeda4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
4K Checkerboard in Battlefield 1 and Mass Effect AndromedaElectronic Arts / DICE
 
Data-Intensive Computing for Competent Genetic Algorithms: A Pilot Study us...
Data-Intensive Computing for  Competent Genetic Algorithms:  A Pilot Study us...Data-Intensive Computing for  Competent Genetic Algorithms:  A Pilot Study us...
Data-Intensive Computing for Competent Genetic Algorithms: A Pilot Study us...Xavier Llorà
 
MySQL NDB Cluster 8.0 SQL faster than NoSQL
MySQL NDB Cluster 8.0 SQL faster than NoSQL MySQL NDB Cluster 8.0 SQL faster than NoSQL
MySQL NDB Cluster 8.0 SQL faster than NoSQL Bernd Ocklin
 
Next generation graphics programming on xbox 360
Next generation graphics programming on xbox 360Next generation graphics programming on xbox 360
Next generation graphics programming on xbox 360VIKAS SINGH BHADOURIA
 
CIFAR-10 for DAWNBench: Wide ResNets, Mixup Augmentation and "Super Convergen...
CIFAR-10 for DAWNBench: Wide ResNets, Mixup Augmentation and "Super Convergen...CIFAR-10 for DAWNBench: Wide ResNets, Mixup Augmentation and "Super Convergen...
CIFAR-10 for DAWNBench: Wide ResNets, Mixup Augmentation and "Super Convergen...Thom Lane
 
Making a game with Molehill: Zombie Tycoon
Making a game with Molehill: Zombie TycoonMaking a game with Molehill: Zombie Tycoon
Making a game with Molehill: Zombie TycoonJean-Philippe Doiron
 
Overview of graphics systems.ppt
Overview of graphics systems.pptOverview of graphics systems.ppt
Overview of graphics systems.pptMalleshBettadapura1
 
Voxel rendering on mobile devices
Voxel rendering on mobile devicesVoxel rendering on mobile devices
Voxel rendering on mobile devicesDevGAMM Conference
 
The Next Mainstream Programming Language: A Game Developer's Perspective
The Next Mainstream Programming Language: A Game Developer's PerspectiveThe Next Mainstream Programming Language: A Game Developer's Perspective
The Next Mainstream Programming Language: A Game Developer's Perspectivekfrdbs
 
Big Data LDN 2017: Big Data Analytics with MariaDB ColumnStore
Big Data LDN 2017: Big Data Analytics with MariaDB ColumnStoreBig Data LDN 2017: Big Data Analytics with MariaDB ColumnStore
Big Data LDN 2017: Big Data Analytics with MariaDB ColumnStoreMatt Stubbs
 
Gdc03 ericson memory_optimization
Gdc03 ericson memory_optimizationGdc03 ericson memory_optimization
Gdc03 ericson memory_optimizationbrettlevin
 
Scalability for All: Unreal Engine* 4 with Intel
Scalability for All: Unreal Engine* 4 with Intel Scalability for All: Unreal Engine* 4 with Intel
Scalability for All: Unreal Engine* 4 with Intel Intel® Software
 

Similar to Realtime Per Face Texture Mapping (PTEX) (20)

The Technology behind Shadow Warrior, ZTG 2014
The Technology behind Shadow Warrior, ZTG 2014The Technology behind Shadow Warrior, ZTG 2014
The Technology behind Shadow Warrior, ZTG 2014
 
Angel cunado_The Terrain Of KUF2
Angel cunado_The Terrain Of KUF2Angel cunado_The Terrain Of KUF2
Angel cunado_The Terrain Of KUF2
 
thu-blake-gdc-2014-final
thu-blake-gdc-2014-finalthu-blake-gdc-2014-final
thu-blake-gdc-2014-final
 
Basics of JVM Tuning
Basics of JVM TuningBasics of JVM Tuning
Basics of JVM Tuning
 
Far cry 3
Far cry 3Far cry 3
Far cry 3
 
Windows to reality getting the most out of direct3 d 10 graphics in your games
Windows to reality   getting the most out of direct3 d 10 graphics in your gamesWindows to reality   getting the most out of direct3 d 10 graphics in your games
Windows to reality getting the most out of direct3 d 10 graphics in your games
 
Easy edd phd talks 28 oct 2008
Easy edd phd talks 28 oct 2008Easy edd phd talks 28 oct 2008
Easy edd phd talks 28 oct 2008
 
4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
4K Checkerboard in Battlefield 1 and Mass Effect Andromeda4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
 
Data-Intensive Computing for Competent Genetic Algorithms: A Pilot Study us...
Data-Intensive Computing for  Competent Genetic Algorithms:  A Pilot Study us...Data-Intensive Computing for  Competent Genetic Algorithms:  A Pilot Study us...
Data-Intensive Computing for Competent Genetic Algorithms: A Pilot Study us...
 
MySQL NDB Cluster 8.0 SQL faster than NoSQL
MySQL NDB Cluster 8.0 SQL faster than NoSQL MySQL NDB Cluster 8.0 SQL faster than NoSQL
MySQL NDB Cluster 8.0 SQL faster than NoSQL
 
Next generation graphics programming on xbox 360
Next generation graphics programming on xbox 360Next generation graphics programming on xbox 360
Next generation graphics programming on xbox 360
 
CIFAR-10 for DAWNBench: Wide ResNets, Mixup Augmentation and "Super Convergen...
CIFAR-10 for DAWNBench: Wide ResNets, Mixup Augmentation and "Super Convergen...CIFAR-10 for DAWNBench: Wide ResNets, Mixup Augmentation and "Super Convergen...
CIFAR-10 for DAWNBench: Wide ResNets, Mixup Augmentation and "Super Convergen...
 
Making a game with Molehill: Zombie Tycoon
Making a game with Molehill: Zombie TycoonMaking a game with Molehill: Zombie Tycoon
Making a game with Molehill: Zombie Tycoon
 
Overview of graphics systems.ppt
Overview of graphics systems.pptOverview of graphics systems.ppt
Overview of graphics systems.ppt
 
Voxel rendering on mobile devices
Voxel rendering on mobile devicesVoxel rendering on mobile devices
Voxel rendering on mobile devices
 
The Next Mainstream Programming Language: A Game Developer's Perspective
The Next Mainstream Programming Language: A Game Developer's PerspectiveThe Next Mainstream Programming Language: A Game Developer's Perspective
The Next Mainstream Programming Language: A Game Developer's Perspective
 
Big Data LDN 2017: Big Data Analytics with MariaDB ColumnStore
Big Data LDN 2017: Big Data Analytics with MariaDB ColumnStoreBig Data LDN 2017: Big Data Analytics with MariaDB ColumnStore
Big Data LDN 2017: Big Data Analytics with MariaDB ColumnStore
 
Gdc03 ericson memory_optimization
Gdc03 ericson memory_optimizationGdc03 ericson memory_optimization
Gdc03 ericson memory_optimization
 
Scalability for All: Unreal Engine* 4 with Intel
Scalability for All: Unreal Engine* 4 with Intel Scalability for All: Unreal Engine* 4 with Intel
Scalability for All: Unreal Engine* 4 with Intel
 
Graph500
Graph500Graph500
Graph500
 

Recently uploaded

ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 

Recently uploaded (20)

ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 

Realtime Per Face Texture Mapping (PTEX)

  • 1.
  • 2. Per-Face Texture Mapping forPer-Face Texture Mapping for Realtime RenderingRealtime Rendering ““Realtime Ptex”Realtime Ptex”
  • 3. Quick NoteQuick Note • For CUDA/Compute folks:For CUDA/Compute folks: – Ptex != PTXPtex != PTX
  • 4. GoalsGoals  Render native Ptex datasets in real-time on commodity hardware  Remove texture seams from textured modelsRemove texture seams from textured models  Remove expensive, manual model unwrap step from artRemove expensive, manual model unwrap step from art pipelinepipeline  Support arbitrary resolutions on a per-face basisSupport arbitrary resolutions on a per-face basis
  • 5. Video Time!Video Time! © Disney. Used with permission.
  • 6. Video RecapVideo Recap Stored as 8Kx8K Rendered as 2Kx2K © Disney. Used with permission.
  • 7. Model StatisticsModel Statistics • ~800 FPS on GTX 460 with no optimization~800 FPS on GTX 460 with no optimization • 278M of Color Texture Data278M of Color Texture Data • 5812 Patches5812 Patches © Disney. Used with permission.
  • 8. General StepsGeneral Steps Load Model Load Model RenderRender Preprocess Draw Time Bucket and Sort Bucket and Sort Generate Mipmaps Generate Mipmaps Fill Borders Fill Borders Pack Texture Arrays Pack Texture Arrays Reorder Index Buffer Reorder Index Buffer Pack Patch Constants Pack Patch Constants Red: Vertex and Index data Green: Patch Constant information Blue: Texel data Orange: Adjacency information
  • 9. Load ModelLoad Model Load Model Load Model RenderRender Preprocess Draw Time Bucket and Sort Bucket and Sort Generate Mipmaps Generate Mipmaps Fill Borders Fill Borders Pack Texture Arrays Pack Texture Arrays Reorder Index Buffer Reorder Index Buffer Pack Patch Constants Pack Patch Constants Red: Vertex and Index data Green: Patch Constant information Blue: Texel data Orange: Adjacency information
  • 10. Load ModelLoad Model • Vertex DataVertex Data – Any geometry arranged as a quad-based meshAny geometry arranged as a quad-based mesh – Example: Wavefront OBJExample: Wavefront OBJ • Patch TexturePatch Texture – Power-of-two texture imagesPower-of-two texture images • Adjacency InformationAdjacency Information – 4 Neighbors of each quad patch4 Neighbors of each quad patch • Easily load with library available fromEasily load with library available from http://ptex.us/http://ptex.us/
  • 11. Load Model (cont’d)Load Model (cont’d) • Texel DataTexel Data – Per face, load the largest available mipmap level from thePer face, load the largest available mipmap level from the source filessource files – In memory, place the loaded texel data into a memoryIn memory, place the loaded texel data into a memory buffer that has a fixed-size texel border regionbuffer that has a fixed-size texel border region – The borders must be big enough for the largest filter kernelThe borders must be big enough for the largest filter kernel you will support (Border size = ½ filter kernel size)you will support (Border size = ½ filter kernel size) • Bilinear (2x2 kernel): 1 pixel borderBilinear (2x2 kernel): 1 pixel border • 16x Aniso (16x16 kernel): 8 pixel border16x Aniso (16x16 kernel): 8 pixel border
  • 14. Bucket and SortBucket and Sort Load Model Load Model RenderRender Preprocess Draw Time Bucket and Sort Bucket and Sort Generate Mipmaps Generate Mipmaps Fill Borders Fill Borders Pack Texture Arrays Pack Texture Arrays Reorder Index Buffer Reorder Index Buffer Pack Patch Constants Pack Patch Constants Red: Vertex and Index data Green: Patch Constant information Blue: Texel data Orange: Adjacency information
  • 15. Bucket and SortBucket and Sort • Bucket ptex surfaces into groups by Aspect RatioBucket ptex surfaces into groups by Aspect Ratio – Each Aspect Ratio will be one bucketEach Aspect Ratio will be one bucket – 1:1 bucket, 2:1 bucket, 4:1 bucket, etc1:1 bucket, 2:1 bucket, 4:1 bucket, etc • Then, within each bucket, sort by decreasing surfaceThen, within each bucket, sort by decreasing surface size and assign IDs.size and assign IDs. – This allows us to densely pack texture arrays, avoiding “empty”This allows us to densely pack texture arrays, avoiding “empty” surfaces.surfaces.
  • 16. Bucket and SortBucket and Sort Bucket 4:1 Bucket 1:1 0
  • 17. Reorder Index BufferReorder Index Buffer Load Model Load Model RenderRender Preprocess Draw Time Bucket and Sort Bucket and Sort Generate Mipmaps Generate Mipmaps Fill Borders Fill Borders Pack Texture Arrays Pack Texture Arrays Reorder Index Buffer Reorder Index Buffer Pack Patch Constants Pack Patch Constants Red: Vertex and Index data Green: Patch Constant information Blue: Texel data Orange: Adjacency information
  • 18. Reorder Index BufferReorder Index Buffer • OriginalOriginal • Post Sort, we have 2!Post Sort, we have 2! IB: IB(1:1): IB(4:1):
  • 19. Generate MipmapsGenerate Mipmaps Load Model Load Model RenderRender Preprocess Draw Time Bucket and Sort Bucket and Sort Generate Mipmaps Generate Mipmaps Fill Borders Fill Borders Pack Texture Arrays Pack Texture Arrays Reorder Index Buffer Reorder Index Buffer Pack Patch Constants Pack Patch Constants Red: Vertex and Index data Green: Patch Constant information Blue: Texel data Orange: Adjacency information
  • 20. Generate MipmapsGenerate Mipmaps • Walk through surfaces, and generate a mipmap chainWalk through surfaces, and generate a mipmap chain from native size to (MinFilterSize x MinFilterSize) forfrom native size to (MinFilterSize x MinFilterSize) for each surface.each surface. – Bilinear stops at 2x2, 8xAniso stops at 8x8Bilinear stops at 2x2, 8xAniso stops at 8x8 • Ptex data files do not guarantee complete mipmapPtex data files do not guarantee complete mipmap chains—although the library can generate all levels forchains—although the library can generate all levels for you—with pre-multiplied alpha.you—with pre-multiplied alpha. • Mipmap chains stop to allow for unique pinning valuesMipmap chains stop to allow for unique pinning values in the cornersin the corners
  • 21. Generate MipmapsGenerate Mipmaps • Done for every surface, but only inside the surface—theDone for every surface, but only inside the surface—the border is not touched.border is not touched.
  • 22. Fill BordersFill Borders Load Model Load Model RenderRender Preprocess Draw Time Bucket and Sort Bucket and Sort Generate Mipmaps Generate Mipmaps Fill Borders Fill Borders Pack Texture Arrays Pack Texture Arrays Reorder Index Buffer Reorder Index Buffer Pack Patch Constants Pack Patch Constants Red: Vertex and Index data Green: Patch Constant information Blue: Texel data Orange: Adjacency information
  • 23. Fill BordersFill Borders • Copy neighbor texels into border area of this surface’sCopy neighbor texels into border area of this surface’s mip levelmip level – Match source and destination number of pixels whenMatch source and destination number of pixels when possiblepossible • Bordered textures are the heart of the logical realtimeBordered textures are the heart of the logical realtime ptex solutionptex solution • Allows 1-2 texture lookups per ptex sample requestAllows 1-2 texture lookups per ptex sample request – 1 if not performing tween-mip-level interpolation, 2 otherwise1 if not performing tween-mip-level interpolation, 2 otherwise
  • 29. Pack Texture ArraysPack Texture Arrays Load Model Load Model RenderRender Preprocess Draw Time Bucket and Sort Bucket and Sort Generate Mipmaps Generate Mipmaps Fill Borders Fill Borders Pack Texture Arrays Pack Texture Arrays Reorder Index Buffer Reorder Index Buffer Pack Patch Constants Pack Patch Constants Red: Vertex and Index data Green: Patch Constant information Blue: Texel data Orange: Adjacency information
  • 30. Texture ArraysTexture Arrays • Like 3D / Volume Textures, except:Like 3D / Volume Textures, except: – No filtering between 2D slicesNo filtering between 2D slices – Only X and Y decrease with mipmap level (Z doesn’t)Only X and Y decrease with mipmap level (Z doesn’t) – Z indexed by integer index, not [0,1]Z indexed by integer index, not [0,1] • E.g. (0.5, 0.5, 4) would be (0.5, 0.5) from the 5E.g. (0.5, 0.5, 4) would be (0.5, 0.5) from the 5thth sliceslice • API SupportAPI Support – Direct3D 10+: Texture2DArrayDirect3D 10+: Texture2DArray – OpenGL 3.0+: GL_TEXTURE_2D_ARRAYOpenGL 3.0+: GL_TEXTURE_2D_ARRAY
  • 31. Pack Texture ArraysPack Texture Arrays • Copy all generated data into Texture2DArrayCopy all generated data into Texture2DArray • Each Texture2DArray represents a single mipmap levelEach Texture2DArray represents a single mipmap level – Texture2DArrays present a view of the data that is efficientTexture2DArrays present a view of the data that is efficient for GPU layoutfor GPU layout – Logical Textures cut across the same page index of everyLogical Textures cut across the same page index of every Texture2DArrayTexture2DArray
  • 32. Pack Texture ArraysPack Texture Arrays 0 1 2 3 Logical Texture Layout
  • 33. Pack Texture ArraysPack Texture Arrays 10x10x3 (1+8+1)x(1+8+1)x3 6x6x4 (1+4+1)x(1+4+1)x4 4x4x4 (1+2+1)x(1+2+1)x4 GPU Layout Texture2DArray gColor[0] gColor[1] gColor[2]
  • 34. Pack Patch ConstantsPack Patch Constants Load Model Load Model RenderRender Preprocess Draw Time Bucket and Sort Bucket and Sort Generate Mipmaps Generate Mipmaps Fill Borders Fill Borders Pack Texture Arrays Pack Texture Arrays Reorder Index Buffer Reorder Index Buffer Pack Patch Constants Pack Patch Constants Red: Vertex and Index data Green: Patch Constant information Blue: Texel data Orange: Adjacency information
  • 35. Pack Patch ConstantsPack Patch Constants • Each primitive has a “PatchInfo” struct:Each primitive has a “PatchInfo” struct: – TextureId – which array slice contains our dataTextureId – which array slice contains our data – TopMipLevel – the index of the top-most mipmap level for thisTopMipLevel – the index of the top-most mipmap level for this texturetexture – FlipUVs – whether or not to flip UVs, allows 1:2 and 2:1 to beFlipUVs – whether or not to flip UVs, allows 1:2 and 2:1 to be grouped into same bucketgrouped into same bucket – MaxMipLevels – Maximum mipmap level for each edgeMaxMipLevels – Maximum mipmap level for each edge
  • 36. Fill BordersFill Borders Load Model Load Model RenderRender Preprocess Draw Time Bucket and Sort Bucket and Sort Generate Mipmaps Generate Mipmaps Fill Borders Fill Borders Pack Texture Arrays Pack Texture Arrays Reorder Index Buffer Reorder Index Buffer Pack Patch Constants Pack Patch Constants Red: Vertex and Index data Green: Patch Constant information Blue: Texel data Orange: Adjacency information
  • 37. RenderRender • Brief Recap of D3D11 Pipe stagesBrief Recap of D3D11 Pipe stages New Direct3D 11 StagesNew Direct3D 11 Stages IAIA VS HS TSTS DS GS RASRAS PS OMOM Programmable (Shader) Fixed Function
  • 38. RenderRender • In the Hull ShaderIn the Hull Shader – Store pre-expansion PrimitiveID to output control pointsStore pre-expansion PrimitiveID to output control points – This is used everywhere to determine which set of PatchThis is used everywhere to determine which set of Patch Constants are owned by the currently running thread (inConstants are owned by the currently running thread (in Domain, Geometry or Pixel Shaders)Domain, Geometry or Pixel Shaders) New Direct3D 11 StagesNew Direct3D 11 Stages IAIA VS HS TSTS DS GS RASRAS PS OMOM
  • 39. RenderRender • In the Domain ShaderIn the Domain Shader – Vertices belonging to a quad meshes are evaluated with aVertices belonging to a quad meshes are evaluated with a domain location, which is (0,0)-(1,1) for each patchdomain location, which is (0,0)-(1,1) for each patch – Use this value to store our UV locationUse this value to store our UV location New Direct3D 11 StagesNew Direct3D 11 Stages IAIA VS HS TSTS DS GS RASRAS PS OMOM
  • 40. RenderRender • Texture lookups in Domain or Pixel Shader are replacedTexture lookups in Domain or Pixel Shader are replaced with a “ptex” sample function.with a “ptex” sample function. – Determines which logical texture to work fromDetermines which logical texture to work from – Compute mipmap level(s) to accessCompute mipmap level(s) to access – Scale and bias computed (u,v) by mipmap sizeScale and bias computed (u,v) by mipmap size – Lookup texels, return weighted averageLookup texels, return weighted average
  • 41. Texture Lookup Shader CodeTexture Lookup Shader Code • Traditional (D3D11)Traditional (D3D11) returnreturn gTxDiffuse.Sample(gTxDiffuse.Sample( gSampler,gSampler, I.fTextureUV );I.fTextureUV ); • PtexPtex returnreturn ptex( gTxDiffuse,ptex( gTxDiffuse, gSampler,gSampler, I.uPrimitiveId,I.uPrimitiveId, I.fTextureUV );I.fTextureUV ); Complex logic hidden in single function call
  • 42. Questions?Questions? • jmcdonald at nvidia dot comjmcdonald at nvidia dot com • Brent dot Burley at disneyanimation dot comBrent dot Burley at disneyanimation dot com • http://ptex.us/http://ptex.us/ • http://groups.google.com/group/ptexhttp://groups.google.com/group/ptex • Or visit our studio sessionOr visit our studio session – Monday, 8 August @ 4:30 PM – 5:00 PMMonday, 8 August @ 4:30 PM – 5:00 PM – The Studio / West Building, Ballroom AThe Studio / West Building, Ballroom A
  • 43. Additional ConsiderationsAdditional Considerations • Filtering across edges with differing numbers of pixelsFiltering across edges with differing numbers of pixels • Filtering across cornersFiltering across corners
  • 47. Filtering across cornersFiltering across corners • Corners with valence > 4Corners with valence > 4 cannot be exactlycannot be exactly matched with amatched with a bilerp (4 samples)bilerp (4 samples) © Disney. Used with permission.
  • 48. Filtering across cornersFiltering across corners • The solution is a bit more involved.The solution is a bit more involved. – First, walk the mesh and determine which corners are sharedFirst, walk the mesh and determine which corners are shared – For each shared group, determine the correct value for whenFor each shared group, determine the correct value for when we’re exactly at that corner. E.g. Simple Average.we’re exactly at that corner. E.g. Simple Average. – Then, modify every mipmap level of every surface of thatThen, modify every mipmap level of every surface of that group s.t. the shared corner has the same valuegroup s.t. the shared corner has the same value – When you’re in the corner, everyone will perform the sameWhen you’re in the corner, everyone will perform the same lookup—regardless of mipmap level—and continuity prevailslookup—regardless of mipmap level—and continuity prevails
  • 49. Filtering across cornersFiltering across corners • For Realtime Ptex, we apply pinning to all corners,For Realtime Ptex, we apply pinning to all corners, regardless of valence.regardless of valence.
  • 51. Questions redux?Questions redux? • jmcdonald at nvidia dot comjmcdonald at nvidia dot com • Brent dot Burley at disneyanimation dot comBrent dot Burley at disneyanimation dot com • http://ptex.us/http://ptex.us/ • http://groups.google.com/group/ptexhttp://groups.google.com/group/ptex • Or visit our studio sessionOr visit our studio session – Monday, 8 August @ 4:30 PM – 5:00 PMMonday, 8 August @ 4:30 PM – 5:00 PM – The Studio / West Building, Ballroom AThe Studio / West Building, Ballroom A

Editor's Notes

  1. Top Mipmap level size is color coded in Roy G. Biv ordering, followed by white->grayscale Red is 2048, Yellow is 512, Green is 256 and so on.
  2. Given this simple model, let’s walk through a graphical representation of the preparation. We’re going to focus on the middle surface, the one with the blue border.
  3. Assign the surfaces ids based on decreasing size. Because the bottom surface is a 4:1 aspect ratio, it’ll be in a different bucket than our 1:1 surfaces above the dividing line.
  4. For each surface, for each edge, for each mip level. Use adjacency information loaded from ptex file format
  5. Next, we need to fill in the borders. The surfaces with matching sizes are just copied into the border region, as shown here with the left edge
  6. And again with the right.
  7. Surfaces that are smaller than this surface have duplicated pixels pushed into the borders. However, these borders should never be used as we will later see.
  8. Along the bottom edge, the adjacent edge (from the neighbor) has more pixels than we do.
  9. Drop to the next mipmap level and copy the pixels straight across from that mipmap.
  10. Introduced in Direct3D 10
  11. For each render chunk
  12. Note that although not shown, all borders (including corners) would be filled out by this time.
  13. Red: Vertex and Index data Green: Patch Constant information Blue: Image data Orange: Adjacency information
  14. Determines which surface to work from Compute Mip Level(s) and weight factors Scale and bias computed uv for each mip level Lookup texels, return weighted average of two mip levels
  15. Corners: Filtering across corners requires a pre-process, where a pinned value for each shared corner is computed Both improvements require clamping the bottom mip level s.t. a filtered lookup can
  16. Given the above surfaces, which are neighbors. Both surfaces have been setup with the neighbor’s pixel data, so the data outside the red lines is within the surface, and the pixels within the red and brown lines are the border texels from the neighbors.
  17. When a bilerp is taken from a theoretically matching UV, the values being computed can be radically different!
  18. The solution is to detect that we are along an edge, and then clamp the available Mipmaps to those shared with the neighbor. This information is conveyed in the Patch Constant data.
  19. Pre-walk mesh, determine which corners are grouped together. For each group, determine a “correct” weighted value to represent that corner For each surface in that group, paint the corner (including a portion of the surface) the pinned value. This value will pollute a sample-sized footprint of the border and interior of the surface, in the corner. Only really problematic for displacement mapping—where the tessellator conveniently ensures exact, matching UVs for all surfaces