Avoiding Texture Seams by Discarding Sample Taps Robert Toth Intel, Advanced Rendering Technology 2014-03-15 1
Part I Seams: Atlases and Ptex
Texture Seams Atlas Source: Microsoft DirectX SDK Visual & Parallel Computing Group 3
Texture Seams Connected Atlas Connected Connected Source: Microsoft DirectX SDK Visual & Parallel Computing Group 4
Texture Seams Atlas Texture filter Source: Microsoft DirectX SDK Visual & Parallel Computing Group 5
Texture Seams Ptex Visual & Parallel Computing Group 6
Texture Seams Ptex Connected Connected Visual & Parallel Computing Group 7
Texture Seams Ptex Texture filter Visual & Parallel Computing Group 8
Realtime Ptex implementations Algo gorith ithm Wide de filt lter Mem emory ory Loo ookup kups McDonald, Burley: SIGGRAPH 2011 Yes Large 1 Real-time Ptex (Per-Face Texture Mapping) Kim, Hillesland, Hensley: SIGGRAPH Asia 2011 No Small 1 A Space-efficient and hardware-friendly Implementation of Ptex McDonald: GDC 2013 Yes* Small 5/10 Eliminating Texture Waste: Borderless Ptex *: over edges only, not corners Visual & Parallel Computing Group 9
Part II Analysis: What, and Why?
Goal Need to determine pixel colors • Scene is a continuous signal • Display has finite number of pixels Visual & Parallel Computing Group 11
Two interpretations Interpretation 1: • This is a sampling and reconstruction problem! Interpretation 2: • This is an error minimization problem! Regardless: integrate scene modulated by filter function, f(x) Visual & Parallel Computing Group 12
Integrate 𝑄 = 𝑢 𝑗 𝒗 𝑗 𝒚 𝑔 𝒚 𝑒𝒚 Ω 𝑗 𝑗 Visual & Parallel Computing Group 13
Integrate 𝑄 = 𝑢 𝑗 𝒗 𝑗 𝒚 𝑔 𝒚 𝑒𝒚 Ω 𝑗 𝑗 Pixel color value Visual & Parallel Computing Group 14
Integrate 𝑄 = 𝑢 𝑗 𝒗 𝑗 𝒚 𝑔 𝒚 𝑒𝒚 Ω 𝑗 𝑗 Integrate over each contributing surface Visual & Parallel Computing Group 15
Integrate 𝑄 = 𝑢 𝑗 𝒗 𝑗 𝒚 𝑔 𝒚 𝑒𝒚 Ω 𝑗 𝑗 Pixel filter function Visual & Parallel Computing Group 16
Integrate 𝑄 = 𝑢 𝑗 𝒗 𝑗 𝒚 𝑔 𝒚 𝑒𝒚 Ω 𝑗 𝑗 Texture Texcoords Visual & Parallel Computing Group 17
Integrate 𝑄 = 𝑢 𝑗 𝒗 𝑗 𝒚 𝑔 𝒚 𝑒𝒚 Ω 𝑗 𝑗 Visual & Parallel Computing Group 18
Integrate 𝑄 = 𝑢 𝑗 𝒗 𝑗 𝒚 𝑔 𝒚 𝑒𝒚 Ω 𝑗 𝑗 MSAA: 𝑄′ = 𝑑 𝑗 𝑔 𝒚 𝑒𝒚 Ω 𝑗 𝑗 Visual & Parallel Computing Group 19
Integrate 𝑄 = 𝑢 𝑗 𝒗 𝑗 𝒚 𝑔 𝒚 𝑒𝒚 Ω 𝑗 𝑗 Resolve filter MSAA: Many † visibility samples 𝑄′ = 𝑑 𝑗 𝑔 𝒚 𝑒𝒚 -> Riemann integral Ω 𝑗 𝑗 † a few Visual & Parallel Computing Group 20
Integrate 𝑄 = 𝑢 𝑗 𝒗 𝑗 𝒚 𝑔 𝒚 𝑒𝒚 Ω 𝑗 𝑗 Pixel shader MSAA: Pass the problem on to the developer 𝑄′ = 𝑑 𝑗 𝑔 𝒚 𝑒𝒚 Pass the problem on Ω 𝑗 𝑗 to the texture sampler Visual & Parallel Computing Group 21
Solution 𝑄′ = 𝑑 𝑗 𝑔 𝒚 𝑒𝒚 Ω 𝑗 𝑗 Visual & Parallel Computing Group 22
Solution: Simple 𝑄′ = 𝑑 𝑗 𝑔 𝒚 𝑒𝒚 Ω 𝑗 𝑗 𝑇 = 𝑢 𝑗 𝒗 𝑗 𝒚 𝑑 𝑗 𝑔 𝒚 𝑒𝒚 Ω 𝑄 Visual & Parallel Computing Group 23
Solution: Simple 𝑄′ = 𝑑 𝑗 𝑔 𝒚 𝑒𝒚 Ω 𝑗 𝑗 𝑇 = 𝑢 𝑗 𝒗 𝑗 𝒚 𝑑 𝑗 𝑔 𝒚 𝑒𝒚 Ω 𝑄 Extrapolation Visual & Parallel Computing Group 24
Solution: Simple 𝑄′ = 𝑑 𝑗 𝑔 𝒚 𝑒𝒚 Ω 𝑗 𝑗 𝑇 = 𝑢 𝑗 𝒗 𝑗 𝒚 𝑑 𝑗 𝑔 𝒚 𝑒𝒚 Ω 𝑄 𝑇 𝑔 𝒚 𝑒𝒚 𝑄 ′ = 𝑑 𝑗 ≠ 𝑄 Ω 𝑗 𝑗 Visual & Parallel Computing Group 25
Solution: Traverse 𝑄′ = 𝑑 𝑗 𝑔 𝒚 𝑒𝒚 Ω 𝑗 𝑗 𝑈 = 𝑢 𝑘 𝒗 𝑘 𝒚 𝑑 𝑗 𝑔 𝒚 𝑒𝒚 = 𝑄 Ω 𝑘 𝑘 Visual & Parallel Computing Group 26
Solution: Traverse 𝑄′ = 𝑑 𝑗 𝑔 𝒚 𝑒𝒚 Ω 𝑗 𝑗 𝑈 = 𝑢 𝑘 𝒗 𝑘 𝒚 𝑑 𝑗 𝑔 𝒚 𝑒𝒚 = 𝑄 Ω 𝑘 𝑘 Visual & Parallel Computing Group 27
Solution: Traverse 𝑄′ = 𝑑 𝑗 𝑔 𝒚 𝑒𝒚 Ω 𝑗 𝑗 𝑈 = 𝑢 𝑘 𝒗 𝑘 𝒚 𝑑 𝑗 𝑔 𝒚 𝑒𝒚 = 𝑄 Ω 𝑘 𝑘 𝑈 𝑔 𝒚 𝑒𝒚 𝑄′ = 𝑑 𝑗 = 𝑄 𝑔 𝒚 𝑒𝒚 = 𝑄 Ω 𝑗 Ω 𝑗 𝑗 𝑗 Visual & Parallel Computing Group 28
Solution: Traverse 𝑄′ = 𝑑 𝑗 𝑔 𝒚 𝑒𝒚 Ω 𝑗 𝑗 𝑈 = 𝑢 𝑘 𝒗 𝑘 𝒚 𝑑 𝑗 𝑔 𝒚 𝑒𝒚 = 𝑄 Ω 𝑘 𝑘 𝑈 𝑔 𝒚 𝑒𝒚 𝑄′ = 𝑑 𝑗 = 𝑄 𝑔 𝒚 𝑒𝒚 = 𝑄 Ω 𝑗 Ω 𝑗 𝑗 𝑗 Visual & Parallel Computing Group 29
Solution: Traverse 𝑄′ = 𝑑 𝑗 𝑔 𝒚 𝑒𝒚 Ω 𝑗 𝑗 𝑈 = 𝑢 𝑘 𝒗 𝑘 𝒚 𝑑 𝑗 𝑔 𝒚 𝑒𝒚 = 𝑄 Ω 𝑘 𝑘 Connectivity 𝑈 𝑔 𝒚 𝑒𝒚 𝑄′ = 𝑑 𝑗 = 𝑄 𝑔 𝒚 𝑒𝒚 = 𝑄 Ω 𝑗 Ω 𝑗 𝑗 𝑗 Visual & Parallel Computing Group 30
Solution: Traverse 𝑄′ = 𝑑 𝑗 𝑔 𝒚 𝑒𝒚 Ω 𝑗 𝑗 𝑈 = 𝑢 𝑘 𝒗 𝑘 𝒚 𝑑 𝑗 𝑔 𝒚 𝑒𝒚 = 𝑄 Ω 𝑘 𝑘 Neighboring textures 𝑈 𝑔 𝒚 𝑒𝒚 𝑄′ = 𝑑 𝑗 = 𝑄 𝑔 𝒚 𝑒𝒚 = 𝑄 Ω 𝑗 Ω 𝑗 𝑗 𝑗 Visual & Parallel Computing Group 31
Solution: Traverse 𝑄′ = 𝑑 𝑗 𝑔 𝒚 𝑒𝒚 Ω 𝑗 𝑗 𝑈 = 𝑢 𝑘 𝒗 𝑘 𝒚 𝑑 𝑗 𝑔 𝒚 𝑒𝒚 = 𝑄 Ω 𝑘 𝑘 Curvature 𝑈 𝑔 𝒚 𝑒𝒚 𝑄′ = 𝑑 𝑗 = 𝑄 𝑔 𝒚 𝑒𝒚 = 𝑄 Ω 𝑗 Ω 𝑗 𝑗 𝑗 Visual & Parallel Computing Group 32
Solution: Traverse 𝑄′ = 𝑑 𝑗 𝑔 𝒚 𝑒𝒚 Ω 𝑗 𝑗 𝑈 ≈ 𝑢 𝑘 𝒗 𝑘 𝒚 𝑑 𝑗 𝑔 𝒚 𝑒𝒚 = 𝑄 Ω 𝑘 𝑘 𝑈 𝑔 𝒚 𝑒𝒚 𝑄 ′ = 𝑑 𝑗 ≈ 𝑄 𝑔 𝒚 𝑒𝒚 = 𝑄 Ω 𝑗 Ω 𝑗 𝑗 𝑗 Visual & Parallel Computing Group 33
New solution: Discard 𝑄′ = 𝑑 𝑗 𝑔 𝒚 𝑒𝒚 Ω 𝑗 𝑗 𝑢 𝑗 𝒗 𝑗 𝒚 𝑔 𝒚 𝑒𝒚 𝐸 = Ω 𝑗 𝑑 𝑗 𝑔 𝒚 𝑒𝒚 Ω 𝑗 Visual & Parallel Computing Group 34
New solution: Discard 𝑄′ = 𝑑 𝑗 𝑔 𝒚 𝑒𝒚 Ω 𝑗 𝑗 𝑢 𝑗 𝒗 𝑗 𝒚 𝑔 𝒚 𝑒𝒚 𝐸 = Ω 𝑗 𝑑 𝑗 𝑔 𝒚 𝑒𝒚 Ω 𝑗 Visual & Parallel Computing Group 35
New solution: Discard 𝑄′ = 𝑑 𝑗 𝑔 𝒚 𝑒𝒚 Ω 𝑗 𝑗 𝑢 𝑗 𝒗 𝑗 𝒚 𝑔 𝒚 𝑒𝒚 𝐸 = Ω 𝑗 𝑑 𝑗 𝑔 𝒚 𝑒𝒚 Ω 𝑗 Normalize filter weight = Visual & Parallel Computing Group 36
New solution: Discard 𝑄′ = 𝑑 𝑗 𝑔 𝒚 𝑒𝒚 Ω 𝑗 𝑗 𝑢 𝑗 𝒗 𝑗 𝒚 𝑔 𝒚 𝑒𝒚 𝐸 = Ω 𝑗 𝑑 𝑗 𝑔 𝒚 𝑒𝒚 Ω 𝑗 𝐸 𝑔 𝒚 𝑒𝒚 𝑄′ = 𝑑 𝑗 = 𝑢 𝑗 𝒗 𝑗 𝒚 𝑔 𝒚 𝑒𝒚 = 𝑄 Ω 𝑗 Ω 𝑗 𝑗 𝑗 Visual & Parallel Computing Group 37
New solution: Discard 𝑄′ = 𝑑 𝑗 𝑔 𝒚 𝑒𝒚 Ω 𝑗 𝑗 𝑢 𝑗 𝒗 𝑗 𝒚 𝑔 𝒚 𝑒𝒚 𝐸 = Ω 𝑗 𝑑 𝑗 𝑔 𝒚 𝑒𝒚 Ω 𝑗 𝐸 𝑔 𝒚 𝑒𝒚 𝑄′ = 𝑑 𝑗 = 𝑢 𝑗 𝒗 𝑗 𝒚 𝑔 𝒚 𝑒𝒚 = 𝑄 Ω 𝑗 Ω 𝑗 𝑗 𝑗 Visual & Parallel Computing Group 38
New solution: Discard 𝑄′ = 𝑑 𝑗 𝑔 𝒚 𝑒𝒚 Ω 𝑗 𝑗 𝑢 𝑗 𝒗 𝑗 𝒚 𝑔 𝒚 𝑒𝒚 𝐸 = Ω 𝑗 𝑑 𝑗 𝑔 𝒚 𝑒𝒚 Ω 𝑗 Resolve filter Texture filter 𝐸 𝑔 𝒚 𝑒𝒚 𝑄′ = 𝑑 𝑗 = 𝑢 𝑗 𝒗 𝑗 𝒚 𝑔 𝒚 𝑒𝒚 = 𝑄 Ω 𝑗 Ω 𝑗 𝑗 𝑗 Visual & Parallel Computing Group 39
New solution: Discard 𝑄′ = 𝑑 𝑗 𝑔 𝒚 𝑒𝒚 Ω 𝑗 𝑗 𝑢 𝑗 𝒗 𝑗 𝒚 𝑔 𝒚 𝑒𝒚 𝐸 = Ω 𝑗 𝑑 𝑗 𝑔 𝒚 𝑒𝒚 Ω 𝑗 Local information 𝐸 𝑔 𝒚 𝑒𝒚 𝑄′ = 𝑑 𝑗 = 𝑢 𝑗 𝒗 𝑗 𝒚 𝑔 𝒚 𝑒𝒚 = 𝑄 Ω 𝑗 Ω 𝑗 𝑗 𝑗 Visual & Parallel Computing Group 40
New solution: Discard Restrict all the edges? Visual & Parallel Computing Group 41
New solution: Discard Restrict all the edges? • No, only texture boundaries Interiors are less problematic Sampler would need edge information Visual & Parallel Computing Group 42
John McDonald [2013] * (Traverse) C = lookup(texture, texcoord(p)) W = lookup(one, texcoord(p)) for each neighboring patch K: C += lookup(K.texture, K.texcoord(p)) W += lookup(K.one, K.texcoord(p)) return C/W * Eliminating Texture Waste: Borderless Ptex https://developer.nvidia.com/gdc-2013/ Visual & Parallel Computing Group 43
New solution (Discard) C = lookup(texture, texcoord(p)) W = lookup(one, texcoord(p)) //for each neighboring patch K: // C += lookup(K.texture, K.texcoord(p)) // W += lookup(K.one, K.texcoord(p)) return C/W Visual & Parallel Computing Group 44
Part III Really?
Recommend
More recommend