# Packing Square Tiles into One Texture Eurographics 2004 Philippe Decaudin Fabrice Neyret GRAVIR/IMAG-INRIA, Grenoble, France ?

## Presentation on theme: "Packing Square Tiles into One Texture Eurographics 2004 Philippe Decaudin Fabrice Neyret GRAVIR/IMAG-INRIA, Grenoble, France ?"— Presentation transcript:

Packing Square Tiles into One Texture Eurographics 2004 Philippe Decaudin Fabrice Neyret GRAVIR/IMAG-INRIA, Grenoble, France ?

2Packing Square Tiles into One TextureEG 04 Introduction Aim Aim Pack square texture tiles of the same size into 1 texture Pack square texture tiles of the same size into 1 texture Reduce space loss Reduce space loss Packing is important Packing is important Graphic context switching performance penalty Graphic context switching performance penalty Easier to manage one texture instead of a set Easier to manage one texture instead of a set 10 tiles

3Packing Square Tiles into One TextureEG 04 Introduction (cont.) Why packing N tiles with no space loss is difficult ? Why packing N tiles with no space loss is difficult ? Texture size is constrained Texture size is constrained w / h = 2 i w and h are bounded (< 4096) w / h = 2 i w and h are bounded (< 4096) For others N, efficient schemes are not obvious… For others N, efficient schemes are not obvious… Trivial packing with no space loss: N = 2 n and N = n 2 Trivial packing with no space loss: N = 2 n and N = n 2 N = 2 0 2 1 2 2 2 3 2 4 … N = 2 2 3 2 …

4Packing Square Tiles into One TextureEG 04 Packing an arbitrary number of tiles Space loss can be substantial Space loss can be substantial E.g., packing 5 tiles E.g., packing 5 tiles 10 tiles 17 tiles Best known packings Best known packings [Jennings95, Fridman98] [Jennings95, Fridman98] Complex schemes Complex schemes And still space lost And still space lost 37% unused55% unused

5Packing Square Tiles into One TextureEG 04 Our packing scheme We propose a packing scheme with no loss for many N We propose a packing scheme with no loss for many N Ranges of uncovered numbers are small loss greatly reduced for other values of N Ranges of uncovered numbers are small loss greatly reduced for other values of N The trick: texture space has special properties The trick: texture space has special properties Torus topology texture addresses wrap ( GL_REPEAT or D3DADDRESS_WRAP ) Torus topology texture addresses wrap ( GL_REPEAT or D3DADDRESS_WRAP ) Can be rotated Can be rotated

6Packing Square Tiles into One TextureEG 04 ? Using these properties, 2 tiles can be packed into 1 square texture Using these properties, 2 tiles can be packed into 1 square texture Basic example

7Packing Square Tiles into One TextureEG 04 2, 2 n and n 2 packing schemes 2, 2 n and n 2 packing schemes 2 n scheme n 2 scheme 2 scheme 2 n scheme n 2 scheme 2 scheme 2 4 8 Packing schemes can be combined Packing schemes can be combined E.g., E.g.,

8Packing Square Tiles into One TextureEG 04 Generalization We can define ( n 2 + k 2 ) … We can define ( n 2 + k 2 ) … First, let consider the packing of 5 tiles (2 2 + 1 2 ) First, let consider the packing of 5 tiles (2 2 + 1 2 )

9Packing Square Tiles into One TextureEG 04 here, n =3 k =2 n k nknk The ( n 2 + k 2 ) packing scheme, with k n n n square subdivided by 2 sets of parallel slanted lines n n square subdivided by 2 sets of parallel slanted lines 13 tiles ( n 2 + k 2 ) This construction results in n 2 + k 2 square tiles This construction results in n 2 + k 2 square tiles Proof is in the paper Proof is in the paper k =1 10 tiles k =0 9 tiles k =3 18 tiles

10Packing Square Tiles into One TextureEG 04 Reachable numbers ( n 2 + k 2 ) schemes provide a dense set of reachable N with no loss ( n 2 + k 2 ) schemes provide a dense set of reachable N with no loss By combining these schemes, any tiles number of the form can be reached ( k i < n i, p i positive int.) By combining these schemes, any tiles number of the form can be reached ( k i < n i, p i positive int.)

11Packing Square Tiles into One TextureEG 04 Conclusion We have shown that N tiles can be packed into 1 texture with no space loss for all N of the form We have shown that N tiles can be packed into 1 texture with no space loss for all N of the form Allows many more possible schemes for no loss packing than the common schemes Allows many more possible schemes for no loss packing than the common schemes Could be extended to 3D textures for cubic tiles space saved for volume data could be consequential [Kraus-Ertl02, Lefebvre-Neyret03] Could be extended to 3D textures for cubic tiles space saved for volume data could be consequential [Kraus-Ertl02, Lefebvre-Neyret03] For an arbitrary N, it provides a packing with little loss For an arbitrary N, it provides a packing with little loss

12Packing Square Tiles into One TextureEG 04 Thanks… http://www-imagis.imag.fr/Publications/2004/DN04b Questions ?

13Packing Square Tiles into One TextureEG 04 Reachable numbers (cont.) Similarities with prime factor decomposition, with some gaps. Some primes missing: 3, 7, 11, 19, 23,… Similarities with prime factor decomposition, with some gaps. Some primes missing: 3, 7, 11, 19, 23,…

Download ppt "Packing Square Tiles into One Texture Eurographics 2004 Philippe Decaudin Fabrice Neyret GRAVIR/IMAG-INRIA, Grenoble, France ?"

Similar presentations