Movatterモバイル変換


[0]ホーム

URL:


Uploaded bybasisspace
PPT, PDF1,910 views

Realtime Per Face Texture Mapping (PTEX)

The document discusses a technique for per-face texture mapping in real-time rendering, specifically using native ptex datasets to eliminate texture seams and manual model unwrapping. The process involves various steps like loading models, generating mipmaps, filling borders, and packing textures to achieve high performance, with reported frame rates of ~800 fps on a GTX 460. It also highlights the importance of addressing filtering issues across edges and corners for continuous texture appearance.

Embed presentation

Downloaded 12 times
Per-Face Texture Mapping forPer-Face Texture Mapping forRealtime 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 commodityhardware 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 artpipelinepipeline 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 RecapStored as 8Kx8KRendered 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 StepsLoadModelLoadModelRenderRenderPreprocessDraw TimeBucketandSortBucketandSortGenerateMipmapsGenerateMipmapsFillBordersFillBordersPackTextureArraysPackTextureArraysReorderIndexBufferReorderIndexBufferPackPatchConstantsPackPatchConstantsRed: Vertex and Index dataGreen: Patch Constant informationBlue: Texel dataOrange: Adjacency information
Load ModelLoad ModelLoadModelLoadModelRenderRenderPreprocessDraw TimeBucketandSortBucketandSortGenerateMipmapsGenerateMipmapsFillBordersFillBordersPackTextureArraysPackTextureArraysReorderIndexBufferReorderIndexBufferPackPatchConstantsPackPatchConstantsRed: Vertex and Index dataGreen: Patch Constant informationBlue: Texel dataOrange: 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 thesource filessource files– In memory, place the loaded texel data into a memoryIn memory, place the loaded texel data into a memorybuffer 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 kernelyou 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 ModelVB: …IB:
Load ModelLoad ModelVB: …IB:
Bucket and SortBucket and SortLoadModelLoadModelRenderRenderPreprocessDraw TimeBucketandSortBucketandSortGenerateMipmapsGenerateMipmapsFillBordersFillBordersPackTextureArraysPackTextureArraysReorderIndexBufferReorderIndexBufferPackPatchConstantsPackPatchConstantsRed: Vertex and Index dataGreen: Patch Constant informationBlue: Texel dataOrange: 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 surfacesize 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 SortBucket 4:1Bucket 1:10
Reorder Index BufferReorder Index BufferLoadModelLoadModelRenderRenderPreprocessDraw TimeBucketandSortBucketandSortGenerateMipmapsGenerateMipmapsFillBordersFillBordersPackTextureArraysPackTextureArraysReorderIndexBufferReorderIndexBufferPackPatchConstantsPackPatchConstantsRed: Vertex and Index dataGreen: Patch Constant informationBlue: Texel dataOrange: 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 MipmapsLoadModelLoadModelRenderRenderPreprocessDraw TimeBucketandSortBucketandSortGenerateMipmapsGenerateMipmapsFillBordersFillBordersPackTextureArraysPackTextureArraysReorderIndexBufferReorderIndexBufferPackPatchConstantsPackPatchConstantsRed: Vertex and Index dataGreen: Patch Constant informationBlue: Texel dataOrange: Adjacency information
Generate MipmapsGenerate Mipmaps• Walk through surfaces, and generate a mipmap chainWalk through surfaces, and generate a mipmap chainfrom native size to (MinFilterSize x MinFilterSize) forfrom native size to (MinFilterSize x MinFilterSize) foreach 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 mipmapchains—although the library can generate all levels forchains—although the library can generate all levels foryou—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 valuesin 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—theborder is not touched.border is not touched.
Fill BordersFill BordersLoadModelLoadModelRenderRenderPreprocessDraw TimeBucketandSortBucketandSortGenerateMipmapsGenerateMipmapsFillBordersFillBordersPackTextureArraysPackTextureArraysReorderIndexBufferReorderIndexBufferPackPatchConstantsPackPatchConstantsRed: Vertex and Index dataGreen: Patch Constant informationBlue: Texel dataOrange: Adjacency information
Fill BordersFill Borders• Copy neighbor texels into border area of this surface’sCopy neighbor texels into border area of this surface’smip levelmip level– Match source and destination number of pixels whenMatch source and destination number of pixels whenpossiblepossible• Bordered textures are the heart of the logical realtimeBordered textures are the heart of the logical realtimeptex 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 ArraysLoadModelLoadModelRenderRenderPreprocessDraw TimeBucketandSortBucketandSortGenerateMipmapsGenerateMipmapsFillBordersFillBordersPackTextureArraysPackTextureArraysReorderIndexBufferReorderIndexBufferPackPatchConstantsPackPatchConstantsRed: Vertex and Index dataGreen: Patch Constant informationBlue: Texel dataOrange: 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 5ththsliceslice• 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 efficientfor GPU layoutfor GPU layout– Logical Textures cut across the same page index of everyLogical Textures cut across the same page index of everyTexture2DArrayTexture2DArray
Pack Texture ArraysPack Texture Arrays0 1 23Logical Texture Layout
Pack Texture ArraysPack Texture Arrays10x10x3(1+8+1)x(1+8+1)x36x6x4(1+4+1)x(1+4+1)x44x4x4(1+2+1)x(1+2+1)x4GPU Layout Texture2DArraygColor[0]gColor[1]gColor[2]
Pack Patch ConstantsPack Patch ConstantsLoadModelLoadModelRenderRenderPreprocessDraw TimeBucketandSortBucketandSortGenerateMipmapsGenerateMipmapsFillBordersFillBordersPackTextureArraysPackTextureArraysReorderIndexBufferReorderIndexBufferPackPatchConstantsPackPatchConstantsRed: Vertex and Index dataGreen: Patch Constant informationBlue: Texel dataOrange: 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 thistexturetexture– 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 begrouped into same bucketgrouped into same bucket– MaxMipLevels – Maximum mipmap level for each edgeMaxMipLevels – Maximum mipmap level for each edge
Fill BordersFill BordersLoadModelLoadModelRenderRenderPreprocessDraw TimeBucketandSortBucketandSortGenerateMipmapsGenerateMipmapsFillBordersFillBordersPackTextureArraysPackTextureArraysReorderIndexBufferReorderIndexBufferPackPatchConstantsPackPatchConstantsRed: Vertex and Index dataGreen: Patch Constant informationBlue: Texel dataOrange: Adjacency information
RenderRender• Brief Recap of D3D11 Pipe stagesBrief Recap of D3D11 Pipe stagesNew Direct3D 11 StagesNew Direct3D 11 StagesIAIA VS HS TSTS DS GS RASRAS PS OMOMProgrammable (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 PatchConstants are owned by the currently running thread (inConstants are owned by the currently running thread (inDomain, Geometry or Pixel Shaders)Domain, Geometry or Pixel Shaders)New Direct3D 11 StagesNew Direct3D 11 StagesIAIA 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 adomain 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 locationNew Direct3D 11 StagesNew Direct3D 11 StagesIAIA 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 replacedwith 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)returnreturngTxDiffuse.Sample(gTxDiffuse.Sample(gSampler,gSampler,I.fTextureUV );I.fTextureUV );• PtexPtexreturnreturnptex( gTxDiffuse,ptex( gTxDiffuse,gSampler,gSampler,I.uPrimitiveId,I.uPrimitiveId,I.fTextureUV );I.fTextureUV );Complex logic hiddenin 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 > 4cannot be exactlycannot be exactlymatched with amatched with abilerp (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 whenwe’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 thatgroup 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 samelookup—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

Recommended

PPTX
Borderless Per Face Texture Mapping
PPTX
Beyond porting
PDF
Modern OpenGL Usage: Using Vertex Buffer Objects Well
PDF
Masked Software Occlusion Culling
PPTX
FlameWorks GTC 2014
PDF
OpenGL 4.4 - Scene Rendering Techniques
PPTX
OpenGL 4.5 Update for NVIDIA GPUs
PPSX
Oit And Indirect Illumination Using Dx11 Linked Lists
PPTX
Hair in Tomb Raider
PDF
Using neon for pattern recognition in audio data
PPTX
Approaching zero driver overhead
PPSX
Holy smoke! Faster Particle Rendering using Direct Compute by Gareth Thomas
PDF
Checkerboard Rendering in Dark Souls: Remastered by QLOC
 
PPTX
Future Directions for Compute-for-Graphics
PDF
OpenGL NVIDIA Command-List: Approaching Zero Driver Overhead
PDF
Extreme dxt compression
PDF
Anil Thomas - Object recognition
PPT
Your Game Needs Direct3D 11, So Get Started Now!
 
PDF
Advanced Scenegraph Rendering Pipeline
PPTX
Triangle Visibility buffer
PPTX
NvFX GTC 2013
PPT
EXT_window_rectangles
PPTX
A Certain Slant of Light - Past, Present and Future Challenges of Global Illu...
PDF
Screen Space Reflections in The Surge
PDF
PT-4054, "OpenCL™ Accelerated Compute Libraries" by John Melonakos
PDF
NAS EP Algorithm
PDF
A Platform for Accelerating Machine Learning Applications
PPTX
Parallel Futures of a Game Engine
 
PDF
Smedberg niklas bringing_aaa_graphics
PPT
CS 354 Texture Mapping

More Related Content

PPTX
Borderless Per Face Texture Mapping
PPTX
Beyond porting
PDF
Modern OpenGL Usage: Using Vertex Buffer Objects Well
PDF
Masked Software Occlusion Culling
PPTX
FlameWorks GTC 2014
PDF
OpenGL 4.4 - Scene Rendering Techniques
PPTX
OpenGL 4.5 Update for NVIDIA GPUs
PPSX
Oit And Indirect Illumination Using Dx11 Linked Lists
Borderless Per Face Texture Mapping
Beyond porting
Modern OpenGL Usage: Using Vertex Buffer Objects Well
Masked Software Occlusion Culling
FlameWorks GTC 2014
OpenGL 4.4 - Scene Rendering Techniques
OpenGL 4.5 Update for NVIDIA GPUs
Oit And Indirect Illumination Using Dx11 Linked Lists

What's hot

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

Similar to Realtime Per Face Texture Mapping (PTEX)

PDF
Smedberg niklas bringing_aaa_graphics
PPT
CS 354 Texture Mapping
PPTX
4,000 Adams at 90 Frames Per Second | Yi Fei Boon
PPTX
GFX Part 4 - Introduction to Texturing in OpenGL ES
PPTX
Geometry Batching Using Texture-Arrays
PDF
Gdce 2010 dx11
PPTX
Optimizing Games for Mobiles
 
PPTX
FGS 2011: Making A Game With Molehill: Zombie Tycoon
PPSX
Dx11 performancereloaded
PDF
Дмитрий Вовк - Learn iOS Game Optimization. Ultimate Guide
PPTX
Mantle for Developers
PPTX
Windows to reality getting the most out of direct3 d 10 graphics in your games
PPT
D3 D10 Unleashed New Features And Effects
PPTX
Real-time lightmap baking
PDF
GeForce 8800 OpenGL Extensions
PPT
Far cry 3
PPTX
The Rendering Pipeline - Challenges & Next Steps
 
PPSX
Rendering Battlefield 4 with Mantle by Yuriy ODonnell
PPT
Order Independent Transparency
 
PDF
DX12 & Vulkan: Dawn of a New Generation of Graphics APIs
Smedberg niklas bringing_aaa_graphics
CS 354 Texture Mapping
4,000 Adams at 90 Frames Per Second | Yi Fei Boon
GFX Part 4 - Introduction to Texturing in OpenGL ES
Geometry Batching Using Texture-Arrays
Gdce 2010 dx11
Optimizing Games for Mobiles
 
FGS 2011: Making A Game With Molehill: Zombie Tycoon
Dx11 performancereloaded
Дмитрий Вовк - Learn iOS Game Optimization. Ultimate Guide
Mantle for Developers
Windows to reality getting the most out of direct3 d 10 graphics in your games
D3 D10 Unleashed New Features And Effects
Real-time lightmap baking
GeForce 8800 OpenGL Extensions
Far cry 3
The Rendering Pipeline - Challenges & Next Steps
 
Rendering Battlefield 4 with Mantle by Yuriy ODonnell
Order Independent Transparency
 
DX12 & Vulkan: Dawn of a New Generation of Graphics APIs

Recently uploaded

PDF
Rolling out Enterprise AI: Tools, Insights, and Team Empowerment
PPTX
kernel PPT (Explanation of Windows Kernal).pptx
PPTX
Support, Monitoring, Continuous Improvement & Scaling Agentic Automation [3/3]
PDF
[BDD 2025 - Full-Stack Development] Agentic AI Architecture: Redefining Syste...
PDF
[BDD 2025 - Full-Stack Development] The Modern Stack: Building Web & AI Appli...
PDF
Top Crypto Supers 15th Report November 2025
PDF
[BDD 2025 - Artificial Intelligence] Building AI Systems That Users (and Comp...
PDF
Transcript: The partnership effect: Libraries and publishers on collaborating...
PPTX
UFCD 0797 - SISTEMAS OPERATIVOS_Unidade Completa.pptx
PPTX
Leon Brands - Intro to GPU Occlusion (Graphics Programming Conference 2024)
PDF
Beyond Basics: How to Build Scalable, Intelligent Imagery Pipelines
PDF
KMWorld - KM & AI Bring Collectivity, Nostalgia, & Selectivity
PPTX
"Feelings versus facts: why metrics are more important than intuition", Igor ...
 
PDF
Lets Build a Serverless Function with Kiro
PPTX
Guardrails in Action - Ensuring Safe AI with Azure AI Content Safety.pptx
PDF
"DISC as GPS for team leaders: how to lead a team from storming to performing...
 
PDF
Dev Dives: Build smarter agents with UiPath Agent Builder
PDF
Crane Accident Prevention Guide: Key OSHA Regulations for Safer Operations
PDF
Cybersecurity Prevention and Detection: Unit 2
PDF
Mulesoft Meetup Online Portuguese: MCP e IA
Rolling out Enterprise AI: Tools, Insights, and Team Empowerment
kernel PPT (Explanation of Windows Kernal).pptx
Support, Monitoring, Continuous Improvement & Scaling Agentic Automation [3/3]
[BDD 2025 - Full-Stack Development] Agentic AI Architecture: Redefining Syste...
[BDD 2025 - Full-Stack Development] The Modern Stack: Building Web & AI Appli...
Top Crypto Supers 15th Report November 2025
[BDD 2025 - Artificial Intelligence] Building AI Systems That Users (and Comp...
Transcript: The partnership effect: Libraries and publishers on collaborating...
UFCD 0797 - SISTEMAS OPERATIVOS_Unidade Completa.pptx
Leon Brands - Intro to GPU Occlusion (Graphics Programming Conference 2024)
Beyond Basics: How to Build Scalable, Intelligent Imagery Pipelines
KMWorld - KM & AI Bring Collectivity, Nostalgia, & Selectivity
"Feelings versus facts: why metrics are more important than intuition", Igor ...
 
Lets Build a Serverless Function with Kiro
Guardrails in Action - Ensuring Safe AI with Azure AI Content Safety.pptx
"DISC as GPS for team leaders: how to lead a team from storming to performing...
 
Dev Dives: Build smarter agents with UiPath Agent Builder
Crane Accident Prevention Guide: Key OSHA Regulations for Safer Operations
Cybersecurity Prevention and Detection: Unit 2
Mulesoft Meetup Online Portuguese: MCP e IA

Realtime Per Face Texture Mapping (PTEX)

  • 2.
    Per-Face Texture MappingforPer-Face Texture Mapping forRealtime RenderingRealtime Rendering““Realtime Ptex”Realtime Ptex”
  • 3.
    Quick NoteQuick Note•For CUDA/Compute folks:For CUDA/Compute folks:– Ptex != PTXPtex != PTX
  • 4.
    GoalsGoals Render nativePtex datasets in real-time on commodityhardware 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 artpipelinepipeline 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 RecapStoredas 8Kx8KRendered 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 StepsLoadModelLoadModelRenderRenderPreprocessDrawTimeBucketandSortBucketandSortGenerateMipmapsGenerateMipmapsFillBordersFillBordersPackTextureArraysPackTextureArraysReorderIndexBufferReorderIndexBufferPackPatchConstantsPackPatchConstantsRed: Vertex and Index dataGreen: Patch Constant informationBlue: Texel dataOrange: Adjacency information
  • 9.
    Load ModelLoad ModelLoadModelLoadModelRenderRenderPreprocessDrawTimeBucketandSortBucketandSortGenerateMipmapsGenerateMipmapsFillBordersFillBordersPackTextureArraysPackTextureArraysReorderIndexBufferReorderIndexBufferPackPatchConstantsPackPatchConstantsRed: Vertex and Index dataGreen: Patch Constant informationBlue: Texel dataOrange: 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)LoadModel (cont’d)• Texel DataTexel Data– Per face, load the largest available mipmap level from thePer face, load the largest available mipmap level from thesource filessource files– In memory, place the loaded texel data into a memoryIn memory, place the loaded texel data into a memorybuffer 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 kernelyou 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
  • 12.
  • 13.
  • 14.
    Bucket and SortBucketand SortLoadModelLoadModelRenderRenderPreprocessDraw TimeBucketandSortBucketandSortGenerateMipmapsGenerateMipmapsFillBordersFillBordersPackTextureArraysPackTextureArraysReorderIndexBufferReorderIndexBufferPackPatchConstantsPackPatchConstantsRed: Vertex and Index dataGreen: Patch Constant informationBlue: Texel dataOrange: Adjacency information
  • 15.
    Bucket and SortBucketand 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 surfacesize 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 SortBucketand SortBucket 4:1Bucket 1:10
  • 17.
    Reorder Index BufferReorderIndex BufferLoadModelLoadModelRenderRenderPreprocessDraw TimeBucketandSortBucketandSortGenerateMipmapsGenerateMipmapsFillBordersFillBordersPackTextureArraysPackTextureArraysReorderIndexBufferReorderIndexBufferPackPatchConstantsPackPatchConstantsRed: Vertex and Index dataGreen: Patch Constant informationBlue: Texel dataOrange: Adjacency information
  • 18.
    Reorder Index BufferReorderIndex Buffer• OriginalOriginal • Post Sort, we have 2!Post Sort, we have 2!IB:IB(1:1):IB(4:1):
  • 19.
    Generate MipmapsGenerate MipmapsLoadModelLoadModelRenderRenderPreprocessDrawTimeBucketandSortBucketandSortGenerateMipmapsGenerateMipmapsFillBordersFillBordersPackTextureArraysPackTextureArraysReorderIndexBufferReorderIndexBufferPackPatchConstantsPackPatchConstantsRed: Vertex and Index dataGreen: Patch Constant informationBlue: Texel dataOrange: Adjacency information
  • 20.
    Generate MipmapsGenerate Mipmaps•Walk through surfaces, and generate a mipmap chainWalk through surfaces, and generate a mipmap chainfrom native size to (MinFilterSize x MinFilterSize) forfrom native size to (MinFilterSize x MinFilterSize) foreach 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 mipmapchains—although the library can generate all levels forchains—although the library can generate all levels foryou—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 valuesin 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—theborder is not touched.border is not touched.
  • 22.
    Fill BordersFill BordersLoadModelLoadModelRenderRenderPreprocessDrawTimeBucketandSortBucketandSortGenerateMipmapsGenerateMipmapsFillBordersFillBordersPackTextureArraysPackTextureArraysReorderIndexBufferReorderIndexBufferPackPatchConstantsPackPatchConstantsRed: Vertex and Index dataGreen: Patch Constant informationBlue: Texel dataOrange: Adjacency information
  • 23.
    Fill BordersFill Borders•Copy neighbor texels into border area of this surface’sCopy neighbor texels into border area of this surface’smip levelmip level– Match source and destination number of pixels whenMatch source and destination number of pixels whenpossiblepossible• Bordered textures are the heart of the logical realtimeBordered textures are the heart of the logical realtimeptex 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
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
    Pack Texture ArraysPackTexture ArraysLoadModelLoadModelRenderRenderPreprocessDraw TimeBucketandSortBucketandSortGenerateMipmapsGenerateMipmapsFillBordersFillBordersPackTextureArraysPackTextureArraysReorderIndexBufferReorderIndexBufferPackPatchConstantsPackPatchConstantsRed: Vertex and Index dataGreen: Patch Constant informationBlue: Texel dataOrange: 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 5ththsliceslice• API SupportAPI Support– Direct3D 10+: Texture2DArrayDirect3D 10+: Texture2DArray– OpenGL 3.0+: GL_TEXTURE_2D_ARRAYOpenGL 3.0+: GL_TEXTURE_2D_ARRAY
  • 31.
    Pack Texture ArraysPackTexture 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 efficientfor GPU layoutfor GPU layout– Logical Textures cut across the same page index of everyLogical Textures cut across the same page index of everyTexture2DArrayTexture2DArray
  • 32.
    Pack Texture ArraysPackTexture Arrays0 1 23Logical Texture Layout
  • 33.
    Pack Texture ArraysPackTexture Arrays10x10x3(1+8+1)x(1+8+1)x36x6x4(1+4+1)x(1+4+1)x44x4x4(1+2+1)x(1+2+1)x4GPU Layout Texture2DArraygColor[0]gColor[1]gColor[2]
  • 34.
    Pack Patch ConstantsPackPatch ConstantsLoadModelLoadModelRenderRenderPreprocessDraw TimeBucketandSortBucketandSortGenerateMipmapsGenerateMipmapsFillBordersFillBordersPackTextureArraysPackTextureArraysReorderIndexBufferReorderIndexBufferPackPatchConstantsPackPatchConstantsRed: Vertex and Index dataGreen: Patch Constant informationBlue: Texel dataOrange: Adjacency information
  • 35.
    Pack Patch ConstantsPackPatch 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 thistexturetexture– 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 begrouped into same bucketgrouped into same bucket– MaxMipLevels – Maximum mipmap level for each edgeMaxMipLevels – Maximum mipmap level for each edge
  • 36.
    Fill BordersFill BordersLoadModelLoadModelRenderRenderPreprocessDrawTimeBucketandSortBucketandSortGenerateMipmapsGenerateMipmapsFillBordersFillBordersPackTextureArraysPackTextureArraysReorderIndexBufferReorderIndexBufferPackPatchConstantsPackPatchConstantsRed: Vertex and Index dataGreen: Patch Constant informationBlue: Texel dataOrange: Adjacency information
  • 37.
    RenderRender• Brief Recapof D3D11 Pipe stagesBrief Recap of D3D11 Pipe stagesNew Direct3D 11 StagesNew Direct3D 11 StagesIAIA VS HS TSTS DS GS RASRAS PS OMOMProgrammable (Shader)Fixed Function
  • 38.
    RenderRender• In theHull 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 PatchConstants are owned by the currently running thread (inConstants are owned by the currently running thread (inDomain, Geometry or Pixel Shaders)Domain, Geometry or Pixel Shaders)New Direct3D 11 StagesNew Direct3D 11 StagesIAIA VS HS TSTS DS GS RASRAS PS OMOM
  • 39.
    RenderRender• In theDomain ShaderIn the Domain Shader– Vertices belonging to a quad meshes are evaluated with aVertices belonging to a quad meshes are evaluated with adomain 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 locationNew Direct3D 11 StagesNew Direct3D 11 StagesIAIA VS HS TSTS DS GS RASRAS PS OMOM
  • 40.
    RenderRender• Texture lookupsin Domain or Pixel Shader are replacedTexture lookups in Domain or Pixel Shader are replacedwith 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 ShaderCodeTexture Lookup Shader Code• Traditional (D3D11)Traditional (D3D11)returnreturngTxDiffuse.Sample(gTxDiffuse.Sample(gSampler,gSampler,I.fTextureUV );I.fTextureUV );• PtexPtexreturnreturnptex( gTxDiffuse,ptex( gTxDiffuse,gSampler,gSampler,I.uPrimitiveId,I.uPrimitiveId,I.fTextureUV );I.fTextureUV );Complex logic hiddenin single function call
  • 42.
    Questions?Questions?• jmcdonald atnvidia 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
  • 44.
  • 45.
  • 46.
  • 47.
    Filtering across cornersFilteringacross corners• Corners with valence > 4Corners with valence > 4cannot be exactlycannot be exactlymatched with amatched with abilerp (4 samples)bilerp (4 samples)© Disney. Used with permission.
  • 48.
    Filtering across cornersFilteringacross 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 whenwe’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 thatgroup 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 samelookup—regardless of mipmap level—and continuity prevailslookup—regardless of mipmap level—and continuity prevails
  • 49.
    Filtering across cornersFilteringacross 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.
  • 50.
  • 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

  • #8 Top Mipmap level size is color coded in Roy G. Biv ordering, followed by white->grayscaleRed is 2048, Yellow is 512, Green is 256 and so on.
  • #13 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.
  • #17 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.
  • #24 For each surface, for each edge, for each mip level.Use adjacency information loaded from ptex file format
  • #25 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
  • #26 And again with the right.
  • #27 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.
  • #28 Along the bottom edge, the adjacent edge (from the neighbor) has more pixels than we do.
  • #29 Drop to the next mipmap level and copy the pixels straight across from that mipmap.
  • #31 Introduced in Direct3D 10
  • #32 For each render chunk
  • #33 Note that although not shown, all borders (including corners) would be filled out by this time.
  • #37 Red: Vertex and Index dataGreen: Patch Constant informationBlue: Image dataOrange: Adjacency information
  • #41 Determines which surface to work fromCompute Mip Level(s) and weight factorsScale and bias computed uv for each mip levelLookup texels, return weighted average of two mip levels
  • #44 Corners:Filtering across corners requires a pre-process, where a pinned value for each shared corner is computedBoth improvements require clamping the bottom mip level s.t. a filtered lookup can
  • #45 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.
  • #46 When a bilerp is taken from a theoretically matching UV, the values being computed can be radically different!
  • #47 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.
  • #49 Pre-walk mesh, determine which corners are grouped together. For each group, determine a “correct” weighted value to represent that cornerFor 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

[8]ページ先頭

©2009-2025 Movatter.jp