virtual textures
play

Virtual Textures Dealing with Enormous Texture-Based Resources - PowerPoint PPT Presentation

Virtual Textures Dealing with Enormous Texture-Based Resources Anders Scheel Nielsen 1 Anders Scheel Nielsen Textures 2 Anders Scheel Nielsen Textures 3 Anders Scheel Nielsen Mipmaps 4 Anders Scheel Nielsen Mipmaps 5 Anders Scheel


  1. Virtual Textures Dealing with Enormous Texture-Based Resources Anders Scheel Nielsen 1 Anders Scheel Nielsen

  2. Textures 2 Anders Scheel Nielsen

  3. Textures 3 Anders Scheel Nielsen

  4. Mipmaps 4 Anders Scheel Nielsen

  5. Mipmaps 5 Anders Scheel Nielsen

  6. Real life problems Problems: • Limited amount of resources (avg. 256 MB) • Large variation in system resources • Maximum texture sizes from: fra 2048 x 2048 til 8192 x 8192 • Atomic Resource 6 Anders Scheel Nielsen

  7. Real life problems Problems: • Limited amount of resources (avg. 256 MB) • Large variation in system resources • Maximum texture sizes from: fra 2048 x 2048 til 8192 x 8192 • Atomic Resource 6 Anders Scheel Nielsen

  8. Real life problems Problems: • Limited amount of resources (avg. 256 MB) • Large variation in system resources • Maximum texture sizes from: fra 2048 x 2048 til 8192 x 8192 • Atomic Resource 6 Anders Scheel Nielsen

  9. Real life problems Problems: • Limited amount of resources (avg. 256 MB) • Large variation in system resources • Maximum texture sizes from: fra 2048 x 2048 til 8192 x 8192 • Atomic Resource Solution for ’large’ models: • Repeating textures • Blending 6 Anders Scheel Nielsen

  10. Repeating Textures 7 Anders Scheel Nielsen

  11. Repeating textures 8 Anders Scheel Nielsen

  12. Texture blending 9 Anders Scheel Nielsen

  13. Static handling of Texture budget Using too much memory? • Permanently reduce the texture resolution • Load lower mip map levels 10 Anders Scheel Nielsen

  14. Static handling of Texture budget Using too much memory? • Permanently reduce the texture resolution • Load lower mip map levels 10 Anders Scheel Nielsen

  15. Static handling of Texture budget Using too much memory? • Permanently reduce the texture resolution • Load lower mip map levels 10 Anders Scheel Nielsen

  16. Static handling of Texture budget Using too much memory? • Permanently reduce the texture resolution • Load lower mip map levels 10 Anders Scheel Nielsen

  17. Observations 11 Anders Scheel Nielsen

  18. Observations Large Textures • All ’points’ in a surface can be truly unique • Artists can add all the details to the texture they want 11 Anders Scheel Nielsen

  19. Observations Large Textures • All ’points’ in a surface can be truly unique • Artists can add all the details to the texture they want Texture loading with higher granularity • Load only visible parts of the texture 11 Anders Scheel Nielsen

  20. Observations Large Textures • All ’points’ in a surface can be truly unique • Artists can add all the details to the texture they want Texture loading with higher granularity • Load only visible parts of the texture Load Textures Runtime: • Artists/developers: No headaches from keeping texture budgets! • Smoother scaling for different hardware configurations • Artists can (in theory) work in arbitrary resolution 11 Anders Scheel Nielsen

  21. The Method 12 Anders Scheel Nielsen

  22. Basic Data Structures 13 Anders Scheel Nielsen

  23. Flow 14 Anders Scheel Nielsen

  24. Calculation of visible tiles Readback of the framebuffer: 15 Anders Scheel Nielsen

  25. Barrett’s Fragment shader 1 float mipmapLevel = calcMipmapLevel(uv * textureSize); 2 float2 tilePos = floor(uv * indirectionSize); 3 tilePos /= 256.0; 4 float2 tilePos_low = frac(tilePos); 5 float2 tilePos_high = floor(tilePos); 6 color.bg = floor(tilePos_low * 256.0 + 0.5)/255.0; 7 color.r = (tilePos_high.x + tilePos_high.y * 16)/255.0; 8 color.a = (mipmapLevel + textureId * 16)/255.0; 9 10 float calcTextureMipmapLevel(float2 uv) { 11 float2 dtdx = dFdx(uv); 12 float2 dtdy = dFdy(uv); 13 float2 dtex = dtdx*dtdx + dtdy*dtdy; 14 float minDelta = max(dtex.x,dtex.y); 15 float miplevel = max(0.5 * log2(minDelta), 0.0); 16 return miplevel; 17 } 16 Anders Scheel Nielsen

  26. Barrett’s Fragment shader 1 float mipmapLevel = calcMipmapLevel(uv * textureSize); 2 float2 tilePos = floor(uv * indirectionSize); 3 tilePos /= 256.0; 4 float2 tilePos_low = frac(tilePos); 5 float2 tilePos_high = floor(tilePos); 6 color.bg = floor(tilePos_low * 256.0 + 0.5)/255.0; 7 color.r = (tilePos_high.x + tilePos_high.y * 16)/255.0; 8 color.a = (mipmapLevel + textureId * 16)/255.0; 9 10 float calcTextureMipmapLevel(float2 uv) { 11 float2 dtdx = dFdx(uv); 12 float2 dtdy = dFdy(uv); 13 float2 dtex = dtdx*dtdx + dtdy*dtdy; 14 float minDelta = max(dtex.x,dtex.y); 15 float miplevel = max(0.5 * log2(minDelta), 0.0); 16 return miplevel; 17 } 17 Anders Scheel Nielsen

  27. TD-texture 18 Anders Scheel Nielsen

  28. TD-texture Texture usage: • 5 texture types • 4096 x 4096 • Usage: 80 MB 18 Anders Scheel Nielsen

  29. TD-texture Texture usage: • 5 texture types • 4096 x 4096 • Usage: 80 MB 18 Anders Scheel Nielsen

  30. TD-texture Texture usage: • 5 texture types • 4096 x 4096 • Usage: 80 MB My fragment shader: 1 color = tex2D(tdTexture, vertexIn.uv * coordScale); 2 color.w = tex2Dbias(tdTexture, vertexIn.uv, mipBias + resolutionBias).w; 18 Anders Scheel Nielsen

  31. Tilbagelæsning Tilbagelæsning fra grafikkort til systemhukommelse 19 Anders Scheel Nielsen

  32. Which tiles to load first? • Screen area prioritized • Based on error metric: •Mip map level 20 Anders Scheel Nielsen

  33. Which tiles to discard? • First In First Out • Least Frequently Used • Least Recently Used • Weighted Least Recently Used 21 Anders Scheel Nielsen

  34. Updating the Indirection Map 22 Anders Scheel Nielsen

  35. Updating the Indirection Map 23 Anders Scheel Nielsen

  36. Rendering 24 Anders Scheel Nielsen

  37. Rendering 25 Anders Scheel Nielsen

  38. Visual Results Screenshots 26 Anders Scheel Nielsen

  39. Resultater Resultater 27 Resultater Anders Scheel Nielsen

  40. Diskussion Diskussion 28 Diskussion Anders Scheel Nielsen

  41. Resultater: Tilbagelæsning 29 Anders Scheel Nielsen

  42. Resultater: Tilbagelæsning 30 Anders Scheel Nielsen

  43. Resultater: Tilbagelæsning 31 Anders Scheel Nielsen

  44. Resultater: tilbagelæsning + CPU 32 Anders Scheel Nielsen

  45. Resultater: HDD read 33 Anders Scheel Nielsen

  46. Resultater: Hvilke tiles skal indlæses? 34 Anders Scheel Nielsen

  47. Resultater: Hvilke tiles skal kasseres? 35 Anders Scheel Nielsen

  48. The demo Virtual Textures: 36 Anders Scheel Nielsen

  49. The demo Virtual Textures: • Efficient handling of giant textures: Demo: 128k x 128k, theoretical: 2M x 2M (16 TB) 36 Anders Scheel Nielsen

  50. The demo Virtual Textures: • Efficient handling of giant textures: Demo: 128k x 128k, theoretical: 2M x 2M (16 TB) • Texture usage for a 20 GB texture: 17 MB 36 Anders Scheel Nielsen

  51. The demo Virtual Textures: • Efficient handling of giant textures: Demo: 128k x 128k, theoretical: 2M x 2M (16 TB) • Texture usage for a 20 GB texture: 17 MB • Frame rate: 150-200 FPS (8800GT) 36 Anders Scheel Nielsen

  52. Demo time 37 Anders Scheel Nielsen

  53. Future work Prediction of visible tiles • Camera vector • A priori map Virtuel Terrain • Height map as a Virtual Texture Other uses than games • Browsing pictures • Google Earth’ish applications • Streaming Casual Games with Instant Game Play 38 Anders Scheel Nielsen

  54. Contributions Contributions • Calculating visible tiles at greater precision with 2 lines of code • Simple, but effective tile prediction method • New strategies for prioritizing tiles • Faster methods for critical tasks in the VT-system 39 Anders Scheel Nielsen

  55. 40 Konklusion Anders Scheel Nielsen

  56. Thank you! Andreas Bærentzen , DTU Carsten Kjær , Dalux Daniel Povlsen , Aptocore Martin Mittring , CryTek GmbH Sean Barrett Per Rasmussen Hardware provided by HwT.dk Anders.Scheel@gmail.com 40 Konklusion Anders Scheel Nielsen

  57. Media 41 Anders Scheel Nielsen

  58. Media Seek time is a killer: 10 tiles @ 256 x 256 = 650KB 41 Anders Scheel Nielsen

  59. Reading tiles from media 42 Anders Scheel Nielsen

  60. Reading tiles from media • Maximizing throughput MPixels/s: • Compression = more MPixels/s • Texture Layout on media: minimizing seek time 42 Anders Scheel Nielsen

  61. Reading tiles from media • Maximizing throughput MPixels/s: • Compression = more MPixels/s • Texture Layout on media: minimizing seek time 42 Anders Scheel Nielsen

  62. Reading tiles from media • Maximizing throughput MPixels/s: • Compression = more MPixels/s • Texture Layout on media: minimizing seek time 42 Anders Scheel Nielsen

  63. Reading tiles from media • Maximizing throughput MPixels/s: • Compression = more MPixels/s • Texture Layout on media: minimizing seek time • Invalidated by the future: SSD harddrives? 42 Anders Scheel Nielsen

  64. Diskussion 1 Ulemper ved metoden: Transparente objekter • Et ekstra prepass Antal unikke teksturer • Pakke flere teksturer i ét VT • 8 bit tile-position Kvalitetstab pga. manglende tekstur • Højere teksturkomprimering • Fjern visuel pops 43 Anders Scheel Nielsen

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend