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

virtual textures
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

Anders Scheel Nielsen 1

Virtual Textures

Dealing with Enormous Texture-Based Resources

Anders Scheel Nielsen

slide-2
SLIDE 2

Anders Scheel Nielsen 2

Textures

slide-3
SLIDE 3

Anders Scheel Nielsen 3

Textures

slide-4
SLIDE 4

Anders Scheel Nielsen 4

Mipmaps

slide-5
SLIDE 5

Anders Scheel Nielsen 5

Mipmaps

slide-6
SLIDE 6

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
slide-7
SLIDE 7

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
slide-8
SLIDE 8

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
slide-9
SLIDE 9

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

Solution for ’large’ models:

  • Repeating textures
  • Blending
slide-10
SLIDE 10

Anders Scheel Nielsen 7

Repeating Textures

slide-11
SLIDE 11

Anders Scheel Nielsen 8

Repeating textures

slide-12
SLIDE 12

Anders Scheel Nielsen 9

Texture blending

slide-13
SLIDE 13

Anders Scheel Nielsen 10

Static handling of Texture budget

Using too much memory?

  • Permanently reduce the texture resolution
  • Load lower mip map levels
slide-14
SLIDE 14

Anders Scheel Nielsen 10

Static handling of Texture budget

Using too much memory?

  • Permanently reduce the texture resolution
  • Load lower mip map levels
slide-15
SLIDE 15

Anders Scheel Nielsen 10

Static handling of Texture budget

Using too much memory?

  • Permanently reduce the texture resolution
  • Load lower mip map levels
slide-16
SLIDE 16

Anders Scheel Nielsen 10

Static handling of Texture budget

Using too much memory?

  • Permanently reduce the texture resolution
  • Load lower mip map levels
slide-17
SLIDE 17

Anders Scheel Nielsen 11

Observations

slide-18
SLIDE 18

Anders Scheel Nielsen 11

Observations

Large Textures

  • All ’points’ in a surface can be truly unique
  • Artists can add all the details to the texture they want
slide-19
SLIDE 19

Anders Scheel Nielsen 11

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
slide-20
SLIDE 20

Anders Scheel Nielsen 11

Observations

Large Textures

  • All ’points’ in a surface can be truly unique
  • Artists can add all the details to the texture they want

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

Texture loading with higher granularity

  • Load only visible parts of the texture
slide-21
SLIDE 21

Anders Scheel Nielsen 12

The Method

slide-22
SLIDE 22

Anders Scheel Nielsen 13

Basic Data Structures

slide-23
SLIDE 23

Anders Scheel Nielsen 14

Flow

slide-24
SLIDE 24

Anders Scheel Nielsen 15

Calculation of visible tiles

Readback of the framebuffer:

slide-25
SLIDE 25

Anders Scheel Nielsen 16

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 }

slide-26
SLIDE 26

Anders Scheel Nielsen 17

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 }

slide-27
SLIDE 27

Anders Scheel Nielsen 18

TD-texture

slide-28
SLIDE 28

Anders Scheel Nielsen 18

TD-texture

Texture usage:

  • 5 texture types
  • 4096 x 4096
  • Usage: 80 MB
slide-29
SLIDE 29

Anders Scheel Nielsen 18

TD-texture

Texture usage:

  • 5 texture types
  • 4096 x 4096
  • Usage: 80 MB
slide-30
SLIDE 30

Anders Scheel Nielsen 18

TD-texture

1 color = tex2D(tdTexture, vertexIn.uv * coordScale); 2 color.w = tex2Dbias(tdTexture, vertexIn.uv, mipBias + resolutionBias).w;

Texture usage:

  • 5 texture types
  • 4096 x 4096
  • Usage: 80 MB

My fragment shader:

slide-31
SLIDE 31

Anders Scheel Nielsen 19

Tilbagelæsning

Tilbagelæsning fra grafikkort til systemhukommelse

slide-32
SLIDE 32

Anders Scheel Nielsen 20

Which tiles to load first?

  • Screen area prioritized
  • Based on error metric:
  • Mip map level
slide-33
SLIDE 33

Anders Scheel Nielsen 21

Which tiles to discard?

  • First In First Out
  • Least Frequently Used
  • Least Recently Used
  • Weighted Least Recently Used
slide-34
SLIDE 34

Anders Scheel Nielsen 22

Updating the Indirection Map

slide-35
SLIDE 35

Anders Scheel Nielsen 23

Updating the Indirection Map

slide-36
SLIDE 36

Anders Scheel Nielsen 24

Rendering

slide-37
SLIDE 37

Anders Scheel Nielsen 25

Rendering

slide-38
SLIDE 38

Anders Scheel Nielsen 26

Visual Results

Screenshots

slide-39
SLIDE 39

Anders Scheel Nielsen 27

Resultater

Resultater

Resultater

slide-40
SLIDE 40

Anders Scheel Nielsen 28

Diskussion

Diskussion

Diskussion

slide-41
SLIDE 41

Anders Scheel Nielsen 29

Resultater: Tilbagelæsning

slide-42
SLIDE 42

Anders Scheel Nielsen 30

Resultater: Tilbagelæsning

slide-43
SLIDE 43

Anders Scheel Nielsen 31

Resultater: Tilbagelæsning

slide-44
SLIDE 44

Anders Scheel Nielsen 32

Resultater: tilbagelæsning + CPU

slide-45
SLIDE 45

Anders Scheel Nielsen 33

Resultater: HDD read

slide-46
SLIDE 46

Anders Scheel Nielsen 34

Resultater: Hvilke tiles skal indlæses?

slide-47
SLIDE 47

Anders Scheel Nielsen 35

Resultater: Hvilke tiles skal kasseres?

slide-48
SLIDE 48

Anders Scheel Nielsen 36

The demo

Virtual Textures:

slide-49
SLIDE 49

Anders Scheel Nielsen 36

The demo

Virtual Textures:

  • Efficient handling of giant textures:

Demo: 128k x 128k, theoretical: 2M x 2M (16 TB)

slide-50
SLIDE 50

Anders Scheel Nielsen 36

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
slide-51
SLIDE 51

Anders Scheel Nielsen 36

The demo

Virtual Textures:

  • Efficient handling of giant textures:

Demo: 128k x 128k, theoretical: 2M x 2M (16 TB)

  • Frame rate: 150-200 FPS (8800GT)
  • Texture usage for a 20 GB texture: 17 MB
slide-52
SLIDE 52

Anders Scheel Nielsen 37

Demo time

slide-53
SLIDE 53

Anders Scheel Nielsen 38

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
slide-54
SLIDE 54

Anders Scheel Nielsen 39

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
slide-55
SLIDE 55

Anders Scheel Nielsen 40 Konklusion

slide-56
SLIDE 56

Anders Scheel Nielsen 40 Konklusion

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

slide-57
SLIDE 57

Anders Scheel Nielsen 41

Media

slide-58
SLIDE 58

Anders Scheel Nielsen 41

Media

Seek time is a killer: 10 tiles @ 256 x 256 = 650KB

slide-59
SLIDE 59

Anders Scheel Nielsen 42

Reading tiles from media

slide-60
SLIDE 60

Anders Scheel Nielsen 42

Reading tiles from media

  • Maximizing throughput MPixels/s:
  • Compression = more MPixels/s
  • Texture Layout on media: minimizing seek time
slide-61
SLIDE 61

Anders Scheel Nielsen 42

Reading tiles from media

  • Maximizing throughput MPixels/s:
  • Compression = more MPixels/s
  • Texture Layout on media: minimizing seek time
slide-62
SLIDE 62

Anders Scheel Nielsen 42

Reading tiles from media

  • Maximizing throughput MPixels/s:
  • Compression = more MPixels/s
  • Texture Layout on media: minimizing seek time
slide-63
SLIDE 63

Anders Scheel Nielsen 42

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?
slide-64
SLIDE 64

Anders Scheel Nielsen 43

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
slide-65
SLIDE 65

Anders Scheel Nielsen 44

Diskussion 2

Hastighedstab pga. indirection

  • men mindre state change
  • Genbrug

Filtrering

  • Manuel i shader
  • Border padding
  • Hardwareunderstøttelse

Ulemper ved metoden :

slide-66
SLIDE 66

Anders Scheel Nielsen 45

Backup: UTM

Litteratur

slide-67
SLIDE 67

Anders Scheel Nielsen 46

Backup: SVT

Litteratur

slide-68
SLIDE 68

Anders Scheel Nielsen 47

Tilbagelæsning

Tilbagelæsning fra grafikkort til systemhukommelse

  • Grundlag for metoden er tilbagelæsning til

systemhukommelsen

  • Tendens: hurtigere tilbagelæsning!
slide-69
SLIDE 69

Anders Scheel Nielsen 48

Backup: SVT

Litteratur

slide-70
SLIDE 70

Anders Scheel Nielsen 49

Backup: Teksturrepetition

Introduktion

Introduktion Litteratur Metode Resultater Diskussion Konklusion

slide-71
SLIDE 71

Anders Scheel Nielsen 50

Tekstur

Teksturrepetition

Introduktion Litteratur Metode Resultater Diskussion Konklusion

slide-72
SLIDE 72

Anders Scheel Nielsen 51

Teksturrepetition

Introduktion

Introduktion Litteratur Metode Resultater Konklusion

slide-73
SLIDE 73

Anders Scheel Nielsen 51

Teksturrepetition

Introduktion

Introduktion Litteratur Metode Resultater Konklusion

slide-74
SLIDE 74

Anders Scheel Nielsen 51

Teksturrepetition

Introduktion

Introduktion Litteratur Metode Resultater Konklusion

slide-75
SLIDE 75

Anders Scheel Nielsen 51

Teksturrepetition

Introduktion

Introduktion Litteratur Metode Resultater Konklusion

slide-76
SLIDE 76

Anders Scheel Nielsen 51

Teksturrepetition

Introduktion

Introduktion Litteratur Metode Resultater Konklusion

slide-77
SLIDE 77

Anders Scheel Nielsen 52

Resultater: Tekstur download

Resultater

Introduktion Litteratur Metode Resultater Diskussion Konklusion

slide-78
SLIDE 78

Anders Scheel Nielsen 53

Resultater: Tekstur download

Resultater

Introduktion Litteratur Metode Resultater Diskussion Konklusion