scieee AI-readable full text Open interactive document viewer

Space-optimized texture atlases

Martínez Bayona, Jonàs

Abstract

Texture atlas parameterization provides an effective way to map a variety of colour and data attributes from 2D texture domains onto polygonal surface meshes. Most of the existing literature focus on how to build seamless texture atlases for continuous photometric detail, but little e ort has been devoted to devise e cient techniques for encoding self-repeating, uncontinuous signals such as building facades. We present a perception-based scheme for generating space-optimized texture atlases speci cally designed for intentionally non-bijective parameterizations. Our scheme combines within-chart tiling support with intelligent packing and perceptual measures for assigning texture space in accordance to the amount of information contents of the image and on its saliency. We demonstrate our optimization scheme in the context of real-time navigation through a gigatexel urban model of an European city. Our scheme achieves signi cant compression ratios and speed-up factors with visually indistinguishable results. We developed a technique that generates space-optimized texture atlases for the particular encoding of uncontinuous signals projected onto geometry. The scene is partitioned using a texture atlas tree that contains for each node a texture atlas. The leaf nodes of the tree contain scene geometry. The level of detail is controlled by traversing the tree and selecting the appropriate texture atlas for a given viewer position and orientation. In a preprocessing step, textures associated to each texture atlas node of the tree are packed. Textures are resized according to a given user-de ned texel size and the size of the geometry that are projected onto. We also use perceptual measures to assign texture space in accordance to image detail. We also explore different techniques for supporting texture wrapping of uncontinuous signals, which involved the development of e cient techniques for compressing texture coordinates via the GPU. Our approach supports texture ltering and DXTC compression without noticeable artifacts. We have implemented a prototype version of our space-optimized texture atlases technique and used it to render the 3D city model of Barcelona achieving interactive rendering frame rates. The whole model was composed by more than three million triangles and contained more than twenty thousand different textures representing the building facades with an average original resolution of 512 pixels per texture. Our scheme achieves up 100:1 compression ratios and speed-up factors of 20 with visually indistinguishable results.

Full text

UNIVERSITAT POLITÈCNICA DE CATALUNYA DEPARTAMENT DE LLENGUATGES I SISTEMES INFORMÀTICS MASTER IN COMPUTING MASTER THESIS SPACE-OPTIMIZED TEXTURE ATLASES STUDENT: JONÀS MARTÍNEZ BAYONA DIRECTOR: CARLOS ANDÚJAR GRAN DATE: 8/09/2009 Acknowledgments We would like to thank TeleAtlas for providing the tridimensional model and facade textures of Barcelona and the Institut Cartogràc de Catalunya for the aerial photos. Contents I Abstract 7 II Introduction 8 III State of the art 10 1 Image comparison metrics 10 1.1 Spatialdomainmetrics..................................... 10 1.1.1 Meansquarederror .................................. 10 1.1.2 Normalized mean squared error . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 1.1.3 Templatematching................................... 11 1.2 Spatial-frequency domain metrics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 1.2.1 Contrast sensitivity function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 1.2.2 Mannos-Sakrison's lter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 1.2.3 Daly'slter....................................... 13 1.2.4 Ahumada'slter .................................... 13 1.3 Perceptually-based metrics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 1.3.1 The human visual system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 1.3.2 Visible dierences predictor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 1.4 Tonemappingmetrics..................................... 15 1.4.1 Single scale tone reproduction operators . . . . . . . . . . . . . . . . . . . . . . . 15 1.4.2 Multi scale tone reproduction operators . . . . . . . . . . . . . . . . . . . . . . . 16 2 Image compression 17 2.1 Lossy compression methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 2.2 Lossless compression methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 2.3 Compression of images with repetitive patterns . . . . . . . . . . . . . . . . . . . . . . . 19 3 Texture atlases 20 4 Terrain and urban visualization 22 4.1 GeometryLODtechniques................................... 22 4.2 TextureLODtechniques.................................... 22 5 Texture atlas packing 24 5.1 Two-dimensionalmodels.................................... 24 5.2 Approximationalgorithms................................... 25 5.2.1 Strippacking...................................... 25 5.2.2 Binpacking....................................... 25 5.2.3 Metaheuristics ..................................... 25 5.3 Exactalgorithms........................................ 26 IV Space-optimized texture atlases 27 6 Overview of the technique 27 6.1 Creation of texture atlases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 6.2 Real-timevisualization..................................... 28 1 7 Creating optimized texture atlases 29 7.1 Image downsampling to match viewing conditions . . . . . . . . . . . . . . . . . . . . . . 29 7.2 Image downsampling to match image saliency . . . . . . . . . . . . . . . . . . . . . . . . 30 7.2.1 Generic image metric texture compression . . . . . . . . . . . . . . . . . . . . . . 30 7.2.2 Mean squared error metric compression . . . . . . . . . . . . . . . . . . . . . . . 32 7.2.3 Human visual system metric compression . . . . . . . . . . . . . . . . . . . . . . 32 7.3 Textureatlaspacking ..................................... 35 7.3.1 Predicting the minimum size of texture atlas . . . . . . . . . . . . . . . . . . . . 35 7.3.2 Texture atlas binary tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 7.3.3 Optimizing texture space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 8 Rendering optimized texture atlases 38 8.1 Texturewrapping........................................ 38 8.1.1 Mapping of the texture coordinates . . . . . . . . . . . . . . . . . . . . . . . . . . 38 8.1.2 Compression of the texture coordinates . . . . . . . . . . . . . . . . . . . . . . . 40 8.1.3 Decompression of the texture coordinates . . . . . . . . . . . . . . . . . . . . . . 40 8.1.4 Texture mipmapping and ltering . . . . . . . . . . . . . . . . . . . . . . . . . . 40 8.1.5 Texture atlas ltering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 8.1.6 Texture atlas support for DXTC compression . . . . . . . . . . . . . . . . . . . . 43 8.2 Real-timevisualization..................................... 45 8.2.1 Textureatlastree ................................... 45 8.2.2 Buildingrendering................................... 47 8.2.3 Terrainvisualization.................................. 47 V Results 49 9 Test specications 49 9.1 Testmodel ........................................... 49 9.2 Hardwaretested ........................................ 50 10 Space compression 51 10.1Imagedownsampling...................................... 52 10.1.1 Downsampling function of test images . . . . . . . . . . . . . . . . . . . . . . . . 52 10.1.2 Reconstruction of test images with varying RMSE visual tolerance . . . . . . . . 56 10.1.3 Reconstruction of test images with varying HVSE visual tolerance . . . . . . . . 61 10.1.4 Test images compression results . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 10.1.5 Image downsampling results of test model . . . . . . . . . . . . . . . . . . . . . . 74 10.2Packing ............................................. 77 10.3 Encoding texture chart coordinates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 11 Time Performance 83 12 Selected snapshots 85 VI Conclusions 88 VII Appendix 89 2 List of Figures 1 ImagesanalyzedwithRMSE ................................. 11 2 Mannos-Sakrison contrast sensitivity function . . . . . . . . . . . . . . . . . . . . . . . . 13 3 Cross Section of the human Eye (Illustration by Mark Erickson) . . . . . . . . . . . . . 14 4 Block diagram of the Visible Dierences Predictor. Heavy arrows indicate parallel processing of the spatial frequency and orientation channels. . . . . . . . . . . . . . . . . . 15 5 S3TClookuptable....................................... 18 6 Exampleofatextureatlas................................... 20 7 TileTree by Lefebvre et al. [45] Left: A torus is textured by a TileTree. Middle: The TileTree positions square texture tiles around the surface using an octree.Right: The tile map holding the set of square tiles. . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 8 Distance-dependent texture selection proposed by Buchholz and Döllner [6] . . . . . . . 23 9 The Fekete and Schepers modeling approach . . . . . . . . . . . . . . . . . . . . . . . . . 24 10 First-Fit Decreasing Height algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 11 Texture atlas creation scheme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 12 Example of search space reduction using binary search. Each point of the square represents a texture size (w, h) . Upper row : search on w (rst three steps) followed by search on h (three more steps). Lower row : alternating search on w , h . Note that in general both approaches are not guaranteed to nd the same ( wo , ho )................ 31 13 RMSE error of the subsampling of a facade detail . . . . . . . . . . . . . . . . . . . . . 32 14 Framework of the CIELAB colourmodel.......................... 33 15 HVSE error of the subsampling of a facade detail . . . . . . . . . . . . . . . . . . . . . . 34 16 Binarytreestructure...................................... 36 17 Packed texture coordinates on the atlas . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 18 Encoding of a compressed texture coordinate . . . . . . . . . . . . . . . . . . . . . . . . 40 19 Uninitialized texels at the 2x2 and 1x1 mipmaps for an atlas containing 8x8 and 4x4 textures............................................. 41 20 Bilinear ltering of lower mip-levels accesses texels from unrelated neighbouring textures 42 21 Correct bilinear ltering scheme in a 16x16 chart with 2 border texels and 2 mip-levels . 43 22 Incorrect bilinear ltering scheme in a 16x16 chart with 1 border texel and 2 mip-levels 43 23 Hierarchical texture atlas representation . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 24 Screen projection factor scheme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 25 Terrain rendering LOD example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 26 Thumbnails of a set of Teleatlas textures . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 27 Window downsampling function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 28 Rocktile downsampling function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 29 Bricktile downsampling function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 30 Fabrictile downsampling function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 31 Textureatlas downsampling function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 32 Crayons downsampling function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 33 Boat downsampling function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 34 Aerial photo downsampling function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 35 Window reconstruction using RMSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 36 Rocktile reconstruction using RMSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 37 Bricktile reconstruction using RMSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 38 Fabrictile reconstruction using RMSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 39 Textureatlas reconstruction using RMSE . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 40 Crayons reconstruction using RMSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 41 Boat reconstruction using RMSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 42 Aerialphoto reconstruction using RMSE . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 43 Window reconstruction using HVSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 3 44 Rocktile reconstruction using HVSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 45 Bricktile reconstruction using HVSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 46 Fabrictile reconstruction using HVSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 47 Textureatlas reconstruction using HVSE . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 48 Crayons reconstruction using HVSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 49 Boat reconstruction using HVSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 50 Aerialphoto reconstruction using HVSE . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 51 Textureset1packing ..................................... 77 52 Textureset2packing ..................................... 77 53 Textureset3packing ..................................... 78 54 Textureset4packing ..................................... 78 55 Textureset5packing ..................................... 79 56 Texturepackingresults .................................... 79 57 Chart encoding performance (vertices/s) . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 58 Chart encoding performance (fragments/s) . . . . . . . . . . . . . . . . . . . . . . . . . 82 59 Chart encoding performance (frames/s) . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 60 Resulting framerate for each technique (walkthrough) . . . . . . . . . . . . . . . . . . . 83 61 Framerate evolution of walkthrough . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 62 Barcelonasnapshot1...................................... 85 63 Barcelonasnapshot2...................................... 85 64 Barcelonasnapshot3...................................... 86 65 Barcelonasnapshot4...................................... 86 66 Barcelonasnapshot5...................................... 87 67 Barcelonasnapshot6...................................... 87 68 Some characteristic colours of Barcelona facades . . . . . . . . . . . . . . . . . . . . . . 91 4 List of Tables 1 Space and processing overheads of the three options considered for tiling periodic images 39 2 Area precision and mip-level associated to each atlas tree level of our implementation . 46 3 Test model geometry information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 4 Test model texture information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 5 Hardwarespecications .................................... 50 6 Testimagespecications.................................... 51 7 Texture compression with the whole city . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 8 CitydownsamplingRMSE5%................................. 75 9 City downsampling RMSE 10% . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 10 City downsampling RMSE 20% . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 11 City downsampling HVSE 10% . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 12 City downsampling HVSE 30% . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 13 City downsampling HVSE 50% . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 14 Texture set packing occupancy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 15 Chart encoding performance (for more information of the encoding techniques see Table 1) ................................................ 81 16 Resulting framerate for each technique (walkthrough) . . . . . . . . . . . . . . . . . . . 83 5 List of Algorithms 1 Subsampling image in one direction with error metric . . . . . . . . . . . . . . . . . . . 31 2 Compression of an image with error metric . . . . . . . . . . . . . . . . . . . . . . . . . 31 3 Textureatlasbinpacking ................................... 35 4 Insertinganimage ....................................... 36 5 Filling the space between leafs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 6 Optimizingtexturestretch................................... 37 7 Texture wrapping vertex program (see Section 8.1.1) . . . . . . . . . . . . . . . . . . . . 89 8 Texture wrapping fragment program (see Section 8.1.3) . . . . . . . . . . . . . . . . . . 89 9 Quadtree generation (see Section 8.2.1) . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 6 Part I Abstract Texture atlas parameterization provides an eective way to map a variety of colour and data attributes from 2D texture domains onto polygonal surface meshes. Most of the existing literature focus on how to build seamless texture atlases for continuous photometric detail, but little eort has been devoted to devise ecient techniques for encoding self-repeating, uncontinuous signals such as building facades. We present a perception-based scheme for generating space-optimized texture atlases specically designed for intentionally non-bijective parameterizations. Our scheme combines within-chart tiling support with intelligent packing and perceptual measures for assigning texture space in accordance to the amount of information contents of the image and on its saliency. We demonstrate our optimization scheme in the context of real-time navigation through a gigatexel urban model of an European city. Our scheme achieves signicant compression ratios and speed-up factors with visually indistinguishable results. We developed a technique that generates space-optimized texture atlases for the particular encoding of uncontinuous signals projected onto geometry. The scene is partitioned using a texture atlas tree that contains for each node a texture atlas. The leaf nodes of the tree contain scene geometry. The level of detail is controlled by traversing the tree and selecting the appropriate texture atlas for a given viewer position and orientation. In a preprocessing step, textures associated to each texture atlas node of the tree are packed. Textures are resized according to a given user-dened texel size and the size of the geometry that are projected onto. We also use perceptual measures to assign texture space in accordance to image detail. We also explore dierent techniques for supporting texture wrapping of uncontinuous signals, which involved the development of ecient techniques for compressing texture coordinates via the GPU. Our approach supports texture ltering and DXTC compression without noticeable artifacts. We have implemented a prototype version of our space-optimized texture atlases technique and used it to render the 3D city model of Barcelona achieving interactive rendering frame rates. The whole model was composed by more than three million triangles and contained more than twenty thousand dierent textures representing the building facades with an average original resolution of 512 ×512 pixels per texture. Our scheme achieves up 100:1 compression ratios and speed-up factors of 20 with visually indistinguishable results. 7 1.3.1 The human visual system Perception is the process by which humans, and other organisms, interpret and organize sensation in order to understand their surrounding environment. The response of the human eye to light is a complex, still not well understood process. It is dicult to quantify due to the high level of interaction between the visual system and complex brain functions. A sketch of the anatomical components of the human eye is shown in Figure 3. Figure 3: Cross Section of the human Eye (Illustration by Mark Erickson) The main structures are the iris, lens, pupil, cornea, retina, vitreous humor, optic disk and optic nerve. The path of light through the visual system begins at the pupil, is focused by the lens, then passes onto the retina, which covers the back surface of the eye. The retina is a mesh of photoreceptors, which receive light and pass the stimulus on to the brain. Some concepts are introduced when talking about Human Visual System:  Visual acuity is the ability of the Human Visual System to resolve detail in an image. The human eye is less sensitive to gradual and sudden changes in brightness in the image plane but has higher sensitivity to intermediate changes. Acuity decreases increasing the distance.  Depth perception is the ability to see the world in three dimensions and to perceive distance. Images projected onto the retina are two dimensional, from these at images three dimensional worlds are constructed.  Perceptual constancy is a phenomenon which enables the same perception of an object despite it changes in the actual pattern of light falling on the retina. A number of psychophysical experimental studies have demonstrated many features of how the Human Visual System works. However, problems arise when trying to generalize these results for use in computer graphics. This is because experiments are usually conducted under limited laboratory conditions and are typically designed to explore a single dimension of the HVS. 1.3.2 Visible dierences predictor Daly's VDP [16] is a HVS-based image quality metric, which takes two images as input and produces a probability map for dierence detection as output. It consists of three main functional components, namely amplitude non-linearity, contrast sensitivity function and detection mechanisms.  Amplitude non-linearity simulates the adaptation of HVS to local luminance. It applies a nonlinear response function to each pixel in the input images, assuming that the adaptation results from an observer xating a small image area.  A contrast sensitivity function simulates the variations in visual sensitivity of HVS, and models the variations as a function of spatial frequency. The process is similar to that described in Section 1.2.3, applying a FFT, followed by Daly's CSF, to each image. 14  Detection mechanisms simulate the spatial-frequency selectivity of HVS by decomposing each image into 31 independent streams. Multiple detection mechanisms are then applied to the corresponding streams of the two images. These mechanisms include computation of contrasts, application of a masking function to increase the threshold of detectability, and use of a psychometric function to predict the probability of detecting a dierence at every location in each stream. Finally, the detection probabilities for all streams are combined into a single image that describes the overall probability for every location. Figure 4: Block diagram of the Visible Dierences Predictor. Heavy arrows indicate parallel processing of the spatial frequency and orientation channels. 1.4 Tone mapping metrics Tone mapping is a technique used to map a set of colours to another; often to approximate the appearance of high dynamic range images in media with a more limited dynamic range. Print-outs, CRT or LCD monitors, and projectors all have a limited dynamic range which is inadequate to reproduce the full range of light intensities present in natural scenes. Essentially, tone mapping addresses the problem of strong contrast reduction from the scene values to the displayable range while preserving the image details and colour appearance important to appreciate the original scene content. The human eye is sensitive to relative luminance rather than absolute luminance. Taking advantage of this allows the overall subjective impression of a real environment to be replicated on some display media. Tone reproduction operators can be classied according to the manner in which values are transformed. Single-scale operators proceed by applying the same scaling transformation for each pixel in the image, and that scaling only depends on the current level of adaptation, and not on the real-world luminance. Multi-scale operators take a diering approach and may apply a dierent scale to each pixel in the image. Tone reproduction operators are useful for giving a measure of the perceptible dierence between two luminance levels at a given level of adaptation. This function can then be used to guide algorithms where there is a need to determine whether some process would be noticeable or not to the end user. 1.4.1 Single scale tone reproduction operators Tumblin and Rushmeier [71] were the rst to apply the dynamics of tone reproduction to realistic image synthesis. Using a psychophysical model of brightness perception rst developed by Stevens and Stevens [67] they proposed a tone reproduction operator to match the brightness of the real scene to the brightness of the computed image displayed on a CRT. 15 Applying Steven's equation, which relates brightness to target luminance, the perceived value of a real world luminance Lw , is computed as: Bw= 10β(La(w))(π×10−4Lw)α(La(w)) Where α(La(w)) and β(La(w)) are functions of the real world adaptation level: α(La(w)) = 0.4 log10(La(w))+1.519 β(La(w)) = −0.4(log10(La(w)))2−0.218 log10(La(w))+6.1642 If it is assumed that a display observer viewing a CRT screen adapts to a luminance, La(d) , the brightness of a displayed luminance value can be similarly expressed: Bd= 10β(La(d))(π×10−4Ld)α(La(d)) Where α(La(d)) and β(La(d)) are as before. To match the brightness of a real world luminance to the brightness of a display luminance, Bw must equal Bd . The luminance required to satisfy this can be determined: Ld=1 π×10−410 βa(w)−βa(d) αa(d)(π×10−4Lw) αa(w) αa(d) This represents the concatenation of the real-world observer and the inverse display observer model. Ward [74] proposed a linear transform with similar result, while reducing computational expense, transforming real world luminances, Lw , to display luminances, Ld , through m , a scaling factor: Ld=mLw The consequence of adaptation can be thought of as a shift in the absolute dierence. The scaling factor, m , dictates how to map luminances from the world to the display such that a Just Noticeable Dierence (JND) in world luminances maps to a JND in display luminances. JND is the smallest detectable dierence between a starting and secondary level of a particular sensory stimulus (the luminance in the related case). A critical aspect of tone mapping is the visual model used. As we move through dierent environments or look from place to place within a single environment our eyes adapt to the prevailing conditions of illumination both globally and within local regions of the visual eld. These adaptation processes have dramatic eects on the visibility and appearance of objects and on our visual performance. 1.4.2 Multi scale tone reproduction operators After an investigation of the eects of tone mapping in a small scene illuminated only by a single incandescent bulb, Chiu et al. [11] realized it was incorrect to apply the same mapping to each pixel. By uniformly applying tone mapping operator across the pixel of an image, incorrect results are likely. They noted that the mapping applied to a pixel should be dependent on the spatial position in the image of that pixel. Using the fact that the human visual system is more sensitive to relative changes in luminance rather than absolute levels, they developed a spatially non-uniform scaling function for high contrast images. First the image is blurred to remove all the high frequencies, and the result is inverted. This approach was capable of reproducing all the detail in the original image, but reverse intensity gradients appeared in the image when very bright and very dark areas were close to each other. Larson et al [43] developed a histogram equalization technique to create an image with the dynamic range of the original scene compressed into the range available on the display device which was subject to certain restrictions regarding limits of contrast sensitivity of the human eye. 16 2 Image compression Texture mapping is employed on rendering systems to increase the visual complexity of a scene without increasing its geometric complexity [61]. Texture compression can help to achieve higher graphics quality with given memory and bandwidth or reduce memory and bandwidth consumption without degrading quality too much. There are many compression techniques for images, most of which are geared towards compression for storage or transmission. In choosing a compression scheme for texture mapping there are several issues to consider:  Decoding speed . in order to render directly from the compressed representation, an essential feature of the compression scheme is fast decompression so that the time necessary to access a single texture pixel is not severely impacted.  Random access . It is dicult to know in advance how a renderer will access a texture. Thus, texture compression schemes must provide fast random access to pixels in the texture.  Compression rate and visual quality . While lossless compression schemes will perfectly preserve a texture, they achieve much lower compression rates than lossy schemes. However, using a lossy compression scheme introduces errors into the textures.  Encoding speed . Texture compression, however, is an asymmetric application of compression, since decoding speed is essential while encoding speed is useful but not necessary. Image compression can be lossy or lossless. Lossless compression is sometimes preferred for articial images such as technical drawings, icons or comics. This is because lossy compression methods, especially when used at low bit rates, introduce compression artifacts. Lossless compression methods may also be preferred for high value content, such as medical imagery or image scans made for archival purposes. We classify image compression techniques in the next two sections. Finally we discuss several approaches to compress textures with repeated content. Texture compression is a specialized form of image compression designed for storing texture maps in 3D computer graphics rendering systems. Unlike conventional image compression algorithms, texture compression algorithms are optimized for random access. Most texture compression algorithms involve some form of xed-rate lossy vector quantization of small xed-size blocks of pixels into small xed-size blocks of coding bits, sometimes with additional extra pre-processing and post-processing steps. Block Truncation Coding is a very simple example of this family of algorithms. Because their data access patterns are well-dened, texture decompression may be executed on-the- y during rendering as part of the overall graphics pipeline, reducing overall bandwidth and storage needs throughout the graphics system. As well as texture maps, texture compression may also be used to encode other kinds of rendering map, including bump maps and surface normal maps. Texture compression may also be used together with other forms of map processing such as MIP maps and anisotropic ltering. 2.1 Lossy compression methods  Indexed colour . Indexed colour is the rst texture compression algorithm proposed [8] as well as the rst to be considered for implementation in hardware [41]. A palettized texture has a colour table, which contains a number of colours stored at high precision. For each texel an index into the colour table is stored. This results in one indirection per texel lookup which is the reason palettized textures are rarely used today. Indexed colour can be considered a special case of vector quantization by treating the individual texels as vectors in colour space.  Vector quantization . Images can be compressed using a codebook of image blocks [30, 4]. Vector quantization uses small blocks (e.g. 4 Ö 4 pixels), because with larger blocks the codebook cannot accurately capture the wide variety of block content. By operating on small blocks, vector quantization is eectively exploiting local data correlation. 17  Chroma subsampling . This technique takes advantage of the fact that the eye perceives spatial changes of brightness more sharply than those of colour, by averaging or dropping some of the chrominance information in the image [10].  Block decomposition . Block decomposition approach is based on the subdivision of an image into small blocks with local colours. S3 Texture Compression (S3TC), sometimes also called DXTn or DXTC, is an implementation of block decomposition technique. It breaks a texture map into 4 x 4 blocks of texels. For opaque texture maps, each of these texels is represented by two bits in a bitmap, for a total of 32 bits. In addition to the bitmap, each block also has two representative 16 bit colours in RGB565 format associated with it. These two explicitly encoded colours, plus two additional colours that are derived by uniformly interpolating the explicitly encoded colours, form a four colour lookup table. This lookup table is used to determine the actual colour at any texel in the block. In total, the 16 texels are encoded using 64 bits, or an average of 4 bits per texel. Decoding blocks compressed in S3TC format is straightforward. A two-bit index is signed to each of the 16 texels. A four colour lookup table (see Figure 5) is then used to determine which 16-bit colour value should be used for each texel. The decoder can be operated at very high speeds and replicated to allow parallel decoding for very high performance solutions. Figure 5: S3TC lookup table  Transform coding . In transform coding, knowledge of the application is used to choose information to discard, thereby lowering its bandwidth. The remaining information can be compressed then via a variety of methods. When the output is decoded, the result may not be identical to the original input, but is expected to be close enough for the purpose of the application. The common JPEG image format is an example of a transform coding, one that examines small blocks of the image and averages out the colour using a discrete cosine transform to form an image with far fewer colours in total.  Fractal compression . The fractal compression technique [37] relies on the fact that in certain images, parts of the image resemble other parts of the same image. Fractal algorithms convert these parts, or more precisely, geometric shapes into mathematical data called fractal codes which are used to recreate the encoded image. Fractal compression diers from pixel-based compression schemes such as JPEG, GIF and MPEG since no pixels are saved. Once an image has been converted into fractal code its relationship to a specic resolution has been lost; it becomes resolution independent. 2.2 Lossless compression methods  Run-length encoding . Run-length encoding is a very simple form of data compression in which runs of data (that is, sequences in which the same data value occurs in many consecutive data elements) are stored as a single data value and count, rather than as the original run. This is most useful on data that contains many such runs: for example, relatively simple graphic images such as icons, line drawings, and animations. Recently, Carlos Andujar and Jonas Martinez [2] developed a locally-adaptive texture compression scheme encoding homogeneous image regions through arbitrarily-sized texel runs and using a cumulative run-length encoding supporting fast random-access allowing real-time GPU decompression. 18  Entropy encoding . Entropy coding creates and assigns a unique prex code to each unique symbol that occurs in the input. These entropy encoders then compress data by replacing each xedlength input symbol by the corresponding variable-length prex codeword. The length of each codeword is approximately proportional to the negative logarithm of the probability. Therefore, the most common symbols use the shortest codes.  Adaptive dictionary algorithms . LZW compression [81] is an example of an adaptive dictionary algorithm. A particular LZW compression algorithm takes each input sequence of bits of a given length and creates an entry in a table for that particular bit pattern, consisting of the pattern itself and a shorter code. As input is read, any pattern that has been read before results in the substitution of the shorter code. 2.3 Compression of images with repetitive patterns Compression of images with repetitive patterns is an interesting problem on the eld of image compression. They can be readily observed in man-made environments: buildings, wallpapers, oors, tiles, windows, fabric, pottery and decorative arts; and in nature: the arrangement of atoms, honeycomb, animal fur, gait patterns, feathers, leaves, waves of the ocean, and patterns of sand dunes. To simulate the real world on computers faithfully, textures with repetitive patterns deserve special attention. Humans have an innate ability to perceive and take advantage of symmetry [50]. Rao and Lohse [64] show that regularity plays an important role in human texture perception. Mathematically speaking, regular texture refers to periodic patterns that present non-trivial translation symmetry, with the possible addition of rotation, reection and glide-reection symmetries [57]. When studying periodic patterns, a useful fact from mathematics is the answer to Hilbert's 18th problem: there is only a nite number of symmetry groups for all possible periodic patterns in dimension n. When n =1 there are seven frieze groups, and when n =2 there are 17 wallpaper groups. Here group is referring to the symmetry group of a periodic pattern. A symmetry group is composed of transformations that keep the pattern invariant. Most of the work on compressing near-regular images is related to the eld of texture synthesis: the process of algorithmically constructing a large digital image from a small digital sample image by taking advantage of its structural content. Procedural texture synthesis [59] is based on generative models of texture. The sample-based approach does not require any previous texture model, yet has the capability of reproducing textures with similar appearance as the input sample [34]. The class of textures that yield good results for texture-synthesis algorithms remains an open question. Lin et al. [51] compare several texture-synthesis algorithms. Their results show that general purpose synthesis algorithms fail to preserve the structural regularity on more than 40% of the tested samples. These results demonstrate that faithful near-regular texture synthesis remains a challenging problem. Vector quantization ( on page 17) is a good option when compressing near-regular textures, but the diculty is that even if the image content is highly repetitive, the rigid placement of the blocks implies that they will most often be unique. Other techniques try to make more adaptive the placement of the blocks. Liu et al. [77] and Hays et al. [38] analyze near-regular textures to infer lattice structures and local deformations. Epitomic analysis of the image is also used [39]. The epitome of an image is its miniature, condensed version containing the essence of the textural and shape properties of the image and is built from the patches of various sizes from the input image. Wang et al. [72] propose and epitomic analysis that enables random-access reconstruction of the image, making it more suitable for interactive applications. 19 3 Texture atlases The lack of batching decreases the performance of graphical applications. A batch consists of a number of render-state changes followed by a draw-call. Submitting hundreds or worse, thousands of batches per frame inevitably makes an application CPU-limited due to inherent driver overhead. Figure 6: Example of a texture atlas The use of texture atlases reduces the number of batches caused by having to repeatedly bind dierent textures. The atlas comprises a set of charts, each of which maps a connected part of the 3D surface (a patch) onto a piece of the 2D texture domain. Models using these packed atlases need to remap their texture coordinates. One way proposed to generate an atlas is to make a chart for each triangle. The simplied triangles are then packed into texture space and sampled to generate texture maps [66]. However seams may appear between triangles due to bilinear interpolation between adjacently packed triangle charts. Alternatively, triangles may be clustered into patches which are then parameterized as charts [22]. However if the matching boundary edges dier in length or orientation in the texture domain, it is still dicult to eliminate subtle seams along the boundaries (even if a one texel padding is applied just outside the charts). Recognizing that seams are an important problem with atlases, various approaches have been developed to minimize their eect. The seams may be forced into regions of high negative curvature [49] making them less apparent. As an alternative, an image delity metric [79] can be used to minimize the visual eect of seams. Work on procedural solid texturing has produced a multi-resolution texture atlas [9], which uses standard mip-mapping on graphics hardware. This texture atlas has several desirable properties, including control of the sampling rate across the surface and ecient use of the entire texture space. However, the scheme used still generates seams between charts except at the highest-resolution mipmap level. Newer approaches avoid seams by parameterizing the surface onto regular charts [62]. While stored discontinuously, neighbouring charts have corresponding samples and a continuous interpolation can be dened along the surface. To avoid splitting the geometry along chart boundaries Tarini et al. [69] parameterize surfaces on the faces of a regular polycube: a set of xed size cubes surrounding the object. Polycube maps dene a continuous, tileable texture space. However the xed resolution has to be carefully chosen to match the geometric features, the construction requires manual intervention and a triangle mesh is required to encode the parameterization. To enable texturing of implicit surfaces and avoid explicit parameterization altogether, Benson et al. [5] and DeBry et al. [18] proposed to encode texture data in an octree surrounding the surface. This provides low distortion and adaptive texturing, at the expense of a space and time overhead. Such methods are particularly well suited for interactive painting on 3D objects, where the intrinsic adaptive sampling of the octree structure reduces the waste of memory exhibited by xed-resolution 2D maps. More recently, Lefebvre et al. [45] (see Figure 7) and Lefohn et al. [47] have proposed GPU 20 implementation of octree-textures, encoding them in simple 2D or 3D textures, adapted to ecient access by the fragment shader. Figure 7: TileTree by Lefebvre et al. [45] Left: A torus is textured by a TileTree. Middle: The TileTree positions square texture tiles around the surface using an octree.Right: The tile map holding the set of square tiles. Most of the existing literature focus on how to build seamless texture atlases for continuous photometric detail, but little eort has been devoted to devise ecient techniques for encoding self-repeating, uncontinuous signals such as building facades. When each polygon of the input model has assigned a dierent texture, seam artifacts do not occur and more simple strategies for packing the charts into an atlas are possible. In this thesis we focus on this type of models. 21 4 Terrain and urban visualization Large terrain and city models may contain millions of triangles, still far too many to render interactively by brute force. Moreover, rendering a uniformly dense triangulation can lead to aliasing artifacts, caused by an unltered many-to-one map from samples to pixels, just as in texturing without mipmaps [76]. Thus level-of-detail (LOD) control is necessary to adjust the terrain tessellation as a function of the view parameters. View-dependent LOD algorithms adaptively rene and coarsen the mesh based on screen-space geometric error, the deviation in pixels between the mesh and the original terrain. Screen-space error combines the eects of viewer distance, surface orientation, and surface geometry. In the next sections we describe several methods to achieve LOD when rendering huge terrain and city models. 4.1 Geometry LOD techniques Terrain LOD algorithms use a hierarchy of mesh renement operations to adapt the surface tessellation. Algorithms can be categorized by the structure of these hierarchies as follows:  Irregular meshes . This technique requires the tracking of mesh adjacencies and renement dependencies but provides the best approximation for a given number of faces. Some hierarchies visually softens the transition between two levels of triangulation [15] while others allow arbitrary connectivities[17].  Bin-tree hierarchies . This uses the recursive bisection of right triangles to simplify memory layout and traversal algorithms [52]. However, these semi-regular meshes still involve randomaccess memory references and immediate-mode rendering.  Bin-tree regions . Bin-tree regions [48] dene coarser-grain renement operations on regions associated with a bin-tree structure. Precomputed triangulated regions are uploaded to buers cached in video memory boosting rendering throughput.  Tiled blocks . Tiled blocks partitions the terrain into square patches that are tessellated at dierent resolutions [35, 12]. The main challenge is to stitch the block boundaries seamlessly.  Geometry clipmaps . Geometry clipmaps [54] caches the terrain in a set of nested regular grids centered about the viewer. These grids represent ltered versions of the terrain at power-of-two resolutions, and are stored as vertex buers in video memory. As the viewpoint moves, the clipmap levels shift and are incrementally relled with data. Rather than dening a world-space quadtree, the geometry clipmap dene a hierarchy centered about the viewer. The approach has parallels with the LOD treatment of images in texture mapping as it is based on texture clipmaps [68] (see Section 4.2). 4.2 Texture LOD techniques Huge urban models often require textures that exceeds the main memory capacity. The common method for dealing with large textures requires subdividing a huge texture image into small tiles of sizes directly supportable by typical graphics hardware. This approach provides good paging granularity for the system both from disk to main memory and from main memory to texture memory. The problem of texture complexity has been addressed in several approaches. Clipmaps of Tanner et al. [68] use dynamic texture representation that eciently caches textures of arbitrarily large size in a nite amount of physical memory. Cline and Egbert [13] proposed a software approach for large texture handling. At runtime, they determine the appropriate mipmap level for a group of polygons based on the projected screen size of the polygons and the corresponding area in texture space. In another terrain viewing application, Lindstrom et al. [60] use the angle at which textures are viewed to reduce texture requests over using a simple distance metric. 22 Lefebvre et al. [46] proposed a GPU-based approach for large-scale texture management of arbitrary meshes. The novel idea of their approach is to render the texture coordinates of the visible geometry into texture space to determine the necessary texture tiles for each frame. However the method requires a cost-intensive fragment shader and the geometry has to be rendered multiple times per frame. Carr and Hart [9] introduced a texture atlas for real-time procedural solid texturing. They partition the mesh surface into a hierarchy of surface regions that correspond to rectangular sections of the texture atlas. This structure supports mipmapping of the texture atlas because textures of triangles are merged only for contiguous regions on the mesh surface. Frueh et al. [27] described an approach to create texture maps for 3D city models. The technique includes the creation of a specialized texture atlas for building facades and supports ecient rendering for virtual y-throughs. Hesina et al. [29] described a texture caching approach for complex textured city models. Their approach is restricted to interactive walk-throughs. Lakhia [42] proposed an out-of-core rendering engine which applies the cost and benet approach of the Adaptive Display algorithm by Funkhouser and Sequin [28] to hierarchical levels of detail (HLOD) [23] achieving interactive rendering of detailed city models. To support texturing, they store downsampled versions of the original scene textures with each HLOD. Buchholz and Döllner [6] presented a level-of-detail texturing technique that creates a hierarchical data structure for all textures used by scene objects (see Figure 8), and it derives texture atlases at dierent resolutions. At runtime, their texturing technique requires only a small set of these texture atlases, which represent scene textures in an appropriate size depending on the current camera position and screen resolution. Figure 8: Distance-dependent texture selection proposed by Buchholz and Döllner [6] Another way to handle large textures the use of a large virtual texture as a stochastic tiling of a small set of texture image tiles [14]. The tiles may be lled with texture, patterns, or geometry that when assembled create a continuous representation. Li-Yi Wei [75] extended the tile-based texture mapping on graphics hardware. 23 7.2 Image downsampling to match image saliency In Section 1 we reviewed dierent metrics used to obtain a measure of the similarity between two images. We also have seen that dierent metrics may measure dierent properties so it is dicult to compare them. In our case we want to measure the error introduced by the further subsampling of an image. Then, given an image and a maximum error threshold we want to return a new subsampled image with an error not greater than the selected maximum error. The objective is to construct a perceptual-driven texture compression bounded by a given maximum error. This will let us decrease the image quality within a tolerance. In the next sections we will present a generic texture compression approach and two dierent image comparison metrics used by our method. Given an input image Ii , our algorithm must nd its smallest downsampled version Io such that the dierence between Ii and its reconstruction ˜ Io from Io is below an user-dened error threshold, measured by some perceptual-based metric. Therefore our algorithm must search for a pair (wo, ho) representing the nal size of Io . We restrict (wo, ho) to multiple-of-four values (the motivation of this restriction is explained in detail in Section 8.1.4). 7.2.1 Generic image metric texture compression We implemented a texture compression algorithm that reduces the dimensions of an image without surpassing a given error threshold. Let Ii be the input image, Io the output compressed image, M an image error metric and α the maximum user-dened error. An error value of zero returned by M means that the two images are identical and an error value of one means that they are totally dierent from the viewpoint of the metric. So we must accomplish the next condition: MIi,˜ Io≤α, α ∈[0,1] (1) Since analytical formulae expressing the perceptual image dierence in terms of downsampling factor are rather complex, we adopt a much simple approach. Our algorithm performs a search of the optimum (wo, ho) values using a dicotomic search. A rst option is to rst perform a dicotomic search for the minimum width wo∈[4..wi] satisfying the error threshold, and then repeat the process for nding the minimum height ho∈[4..wi] . This algorithm requires log2(wi)+log2(hi) comparisons. For typical 512×512 input size, this amounts for 18 image dierence evaluations per input image. However, since (wo, ho) are correlated, this approach tends to produce anisotropically-scaled images depending on which coordinate is optimized rst. Therefore we adopted a dierent approach, consisting in searching for the optimum (wo, ho) simultaneously, using wo and ho alternatively at each step of the binary search (i.e. instead of recursively splitting the 1D interval [4..wi] and then 1D interval [4..hi] , we split the 2D rectangular interval [4..wi]×[4..hi] alternating horizontal and vertical subdivisions. An example of how the search space for the optimum (wo, ho) is reduced at each step of the binary search is shown in Figure 12. To approximate the dimensions of the output image Io that satises Equation 1, we perform a binary search to detect the minimum size that has an error less or equal than the desired threshold. The algorithm rst decreases the image width while the error does not exceed the threshold (see Algorithm 1). Then it decreases the height using the same method. The subsampling of an image is done using a bilineal lter. For better results, the pass is also done decreasing rst the image height and then the width (see Algorithm 2). Indeed we have not seen signicant dierences between the output images when swapping the order of the decrease at each iteration. In order to make it possible the comparison between the subsampled image and the original image, we have to resize the subsampled image to the original size also using a bilineal lter. 30 Figure 12: Example of search space reduction using binary search. Each point of the square represents a texture size (w, h) . Upper row : search on w (rst three steps) followed by search on h (three more steps). Lower row : alternating search on w , h . Note that in general both approaches are not guaranteed to nd the same ( wo , ho ). Algorithm 1 Subsampling image in one direction with error metric function subsample_image ( I , α , direction) αlower = 0 {lower bound} αupper = 1 {upper bound} αc= 0 {current error} while αc/∈[α−λ, α +λ] do { λ is a tolerance threshold} φ=(αlower +αupper ) 2 if decrease direction width then Io= downsample_image_width (I, φ) ˜ I= restore_original_image_width (Io) else if decrease direction height then Io= downsample_image_height (I, φ) ˜ I= restore_original_image_height ( I , φ ) end if αc=MI, ˜ I if αc> α then αlower =φ else αupper =φ end if end while return last valid subsampled image Algorithm 2 Compression of an image with error metric function visual_metric_compression (image,error) subsampled_wh = subsample_image (image, error, width) subsampled_wh = subsample_image (subsampled_wh, error, height) subsampled_hw = subsample_image (image, error, height) subsampled_hw = subsample_image (subsampled_hw, error, width) if size (subsampled_wh) > size (subsampled_hw) then return subsampled_hw else return subsampled_wh end if 31 7.2.2 Mean squared error metric compression The rst error metric we tested for the compression is the mean squared error dierence that operates on the spatial domain (see Section 1.1.1). For a pair of two pixels we take their intensity and calculate the squared deviation. The global mean squared error is a value between 0 and 1 that quanties the amount by which the metric estimator diers from the true value of the quantity being estimated. We try to reduce the sensitivity of RMSE to the global-shift of image intensities using the normalized squared error metric (see Section 1.1.2) instead of the typical RMSE. In Figure 13 we see an estimation of the error caused by subsampling using the RMSE. The original image is a facade detail on the lower right part of the gure. The upper left graphic shows the error due to the width subsampling and the right one because the height. The lower left graphic shows simultaneous subsampling of width and height. We see that the error tends to increase too much slowly as we increase the subsampling level. This is a well-known problem of RMSE (see Zhou Wang et al. [73]). The dierence between one pixel and the corresponding subsampled and resampled pixel of a lower detail level will change slowly; the subsampled colour is interpolated using a bilineal lter and tends to be similar to the pixel with more level of detail. In fact the comparison is done in a locally manner and this is not a desirable property if we are trying to quantify the error of subsampling. So we clearly see that mean squared error does not distinguish well the critical decrease of detail and the perceptual impact that has on the user. More comparisons that illustrates this behaviour are shown in Section 10.1. Figure 13: RMSE error of the subsampling of a facade detail 7.2.3 Human visual system metric compression In order to improve the sensitivity of the RMSE metric we focused on the HVS-based metrics (see Section 1.3). Our human visual system metric is based on the paper of Yee et al. [78] that describes a perceptually based image comparison process that can be used to tell when images are perceptually identical even though they contain imperceptible dierences. Their technique has shown much utility in the 32 production testing of rendering software and focus on the VDP (see Section 1.3.2). The VDP gives the per-pixel probability of detection given two images to be compared and a set of viewing conditions. Daly's model takes into account three factors of the Human Visual System (HVS) that reduce the sensitivity to error. The rst, amplitude non-linearity, states that the sensitivity of the HVS to contrast changes decreases with increasing light levels. This means that humans are more likely to notice a change of a particular magnitude at low light conditions than the same change in a brighter environment. Secondly, the sensitivity decreases with increasing spatial frequency. For example, a needle is harder to spot in a haystack than on a white piece of paper due to the higher spatial frequency of the haystack. Finally, the last eect, masking, takes into account the variations in sensitivity due to the signal content of the background. Yee et al. [78] also use an abridged version of the VDP in the same way as Ramasubramanian et al. [63] in which they drop the orientation computation when calculating spatial frequencies and extend VDP by including the colour domain in computing the dierences. Figure 14: Framework of the CIELAB colour model We are assuming that the reference image and the image to be compared are in the RGB colour space, so the rst step will be the conversion of the images into XY Z and CIELAB space. XY Z is a colour space where Y represents the luminance of a pixel and X , Z are colour coordinates. CIELAB is a colour space designed to be perceptually uniform, where the Euclidean distance between two colours corresponds to perceptual distance (see Figure 14). L also represents luminance and A , B are colour coordinates This conversion step is described in Glassner [32]. To compute the threshold elevation factor F , or how much tolerance to error is increased a spatial frequency hierarchy is constructed from the Y channel of the reference image. This step is eciently computed using the Laplacian pyramid of Burt and Adelson [7]. The pyramid enables to compute the spatial frequencies present the image to determine how much sensitivity to contrast changes decreases with increasing frequency. The pyramid is constructed by convolving the luminance Y channel with a separable lter. Following Ramasubramanian et al. [63] we compute the normalized Contrast Sensitivity Function (CSF) multiplied by the masking function given in [16] to obtain the combined threshold elevation factor, F . We compute some of the intermediate variables from the eld of view ( fov ) and the image width with the following from Ward et al. [43]: pixelsPerDegree =width ×π 360 tan fov 2 cyclesPerDegree =pixelsPerDegree 2 Where fov is the horizontal eld of view in radians, width is the number of pixels across the screen. The top level of the Laplacian pyramid corresponds to frequencies at cycles per degree and each level 33 thereafter is half the frequency of the preceding level. Typical values for fov and width are discussed in the next section. The CSF is computed as a function of cycles per degree and luminance. Finally two tests are performed to know if the images are perceptually dierent. If the dierence of luminance between two corresponding pixels in the reference and test images is greater than a threshold, then the rst test fails. The threshold is dened by the average of pixels in a one degree radius from the Y channel of the reference image. The second test is performed on the A and B channels of the reference and test images using a scale factor that turns o the colour test in the mesopic and scotopic luminance ranges (nigh time light levels) where colour vision starts to degrade. We have done some modications in the original algorithm of Yee et al. [78] to adapt it for our requirements. We do not want to decide only if two images are dierent or not as we want to quantify this dierence. So we take the total number of pixels that failed the HVSE test and divide it by the total number of pixels of the image giving us a value between 0 and 1. Then a value of 0 means that the images are identical and 1 that are totally dierent in terms of human perception. Figure 15: HVSE error of the subsampling of a facade detail In Figure 15 we see an estimation of the error caused by subsampling using the HVSE with the same presentation scheme as used in Figure 13. The luminance for the HVS calculations has been established at a default 100cmd−2 . It is important to notice that the y axis of Figure 15has more error range than the y axis of Figure 13. As we see HVSE has more sensitivity to the eect of subsampling compared with RMSE in all the three tests and is more reactive to the increase of subsampling. As we have more range of error with HVSE it also means that we have more resolution and furthermore it is designed to react better with the human visual system conditions. So we decided to use HVSE for our compression scheme based on visual tolerance, although it is slower than the classical RMSE. In Section 10.1 we show more examples of this low RMSE sensivity. 34 7.3 Texture atlas packing We need to pack a set of rectangular textures with varying sizes into a single texture atlas. The size of a texture atlas must be a power of two to make an ecient use of texture hardware memory. We use a Binary Space Partition [70] to dene the space occupied by each input texture. An overview of our bin packing is shown in Algorithm 3. The input parameters are a collection of textures, an area precision (meters per pixel) and visual metric tolerance. We rst sort the input textures from the biggest to the smallest. This is a common step also used by strip bin packing [21] to optimize the occupied space. The next step, consist in predicting the minimum size of texture atlas and increase it while we do not have enough space. Finally we optimize the size of the inserted textures growing them progressively. In the next sections we will explain in detail each of these mentioned steps. Algorithm 3 Texture atlas bin packing Sort textures from biggest to smallest Calculate the minimum size of texture atlas valid_size = Insert all the textures in the atlas while (not valid_size) do Increase size of atlas valid_size = Insert all the textures in the atlas end while Optimize inserted textures 7.3.1 Predicting the minimum size of texture atlas We dene the initial size of the texture atlas taking in account the sum of all the sizes of input textures. Let I=i1, i2, ..., in be the input set of textures. The initial width and heigh are dened as: α= log2  n X j=1 iwidthj×iheightj  width = 2[α 2]height = 2α−[α 2] This formula returns a width and height potency of two and minimum size to contain the input textures. To increase the size of the texture atlas to the next greater valid size, we just sum one unit to α and update the corresponding widht and height. 7.3.2 Texture atlas binary tree A node of the texture atlas binary tree denes a rectangular region of the texture atlas. The root of the tree denes the whole texture space. If a node is a leaf, it may be either occupied by a single texture or unoccupied. If not, has two child nodes that overlap all the space of the parent node (see Figure 16). We call the insert function (see Algorithm 4) passing it the root node and the width and height of the texture atlas. If the texture is too small we just return. We accept if it ts perfectly on the node. Otherwise we split the node in the direction (by width or height) that provides more space for the input image and recursively call the insert function. So the insertion time takes O(log(n)) . 35 Figure 16: Binary tree structure Algorithm 4 Inserting an image function insert (nod) if node is empty and is a leaf then if is too small then return end if if is just right then accept node and return end if split the node in the direction with more space insert (node.left) else insert (node.left) insert (node.right) end if 7.3.3 Optimizing texture space We also optimize the occupied space of input textures after we have inserted them on the hierarchy. Since we have the restriction to only deal with texture sizes power of two, a considerable amount of unused space may appear. The optimization process has two steps explained below. First we perform a binary search taking the lower bound as the current size of each inserted textures and the upper bound the maximum size of the texture. We just iterate trying to optimize the stretch and obtain the maximum occupied space (see Algorithm 6). Then for each pair of leafs of the BSP tree, in the case we have one lled with a texture and the other one empty, we just expand the lled one to occupy the empty space (see Algorithm 5). This enables us to obtain a nal 100% occupation of the texture atlas. Packing results are described in Section 10.2. 36 Algorithm 5 Filling the space between leafs function ll_leaf_space (node) if node has leafs then if right node is empty and left node is lled then Expand left node to occupy also right node else if left node is empty and right node is lled then Expand right node to occupy also left node end if else ll_leaf_space (node.left) ll_leaf_space (node.right) end if Algorithm 6 Optimizing texture stretch repeat for each texture do New texture size equals (lower bound size + upper bound size ) / 2 end for Insert stretched textures to atlas for each texture do if valid atlas then Update texture lower bound else Update texture upper bound end if end for until not convergence of lower and upper bound 37 8 Rendering optimized texture atlases 8.1 Texture wrapping Once we have all the textures packed into a single texture atlas we want an ecient method to wrap each self-repeating texture onto the geometry. Furthermore we want to support mipmaps: a pre-calculated, optimized collections of images that accompany a main texture, intended to increase rendering speed and reduce aliasing artifacts [76]. Our method is based on the use of an specialized texture coordinate that compactly represents the repetitive textures. In addition we add a border to each packed texture in order to transparently support mipmapping. In the next subsections we will present rst the process of mapping and compression of the original textures, the real-time decompression, the developed way to use mipmapping and nally the requirements to adapt the wrapping using DTXC compression. 8.1.1 Mapping of the texture coordinates We have tested several ways to encode the texture coordinates of the charts packed into a texture atlas. For any chart we have the next constraints (all the dimensions are in the normalized range [0,1] ): 1. Origin of the chart O 2. Size of the chart S Our texture atlases support periodic texture tiling by mimicking OpenGL's GL_REPEAT wrapping mode. Since all the charts are rectangular, this support can be eciently implemented on a fragment shader with minimum processing overhead. Suppose that, in the input model, a primitive had assigned a periodic texture T . After packing, image T occupies a certain rectangular region of the texture atlas. Let O , S be the origin and the size of T in the texture atlas, in normalized coordinates (see Figure 17). Typically, texture atlas construction implies replacing the local (s, t) coordinates of the primitive by global (s0, t0) coordinates to reect the new parameterization. In our texture atlases all charts are axis-aligned rectangles, so conversion to global coordinates can be done using this equation, s0 t0=Sx0Ox 0SyOy  s t 1  Figure 17: Packed texture coordinates on the atlas Unfortunately, the above conversion from local to global coordinates is valid only for input (s, t) coordinates in the range [0,1] , which is not the case for tiled textures. Therefore we let the application 38 Encoding of (O, S) Memory Space App ⇒ GPU Vertex Program VBO compatibility Option 1 uniform vec4 4 oats/T 4 oats/T none No Option 2 attribute vec4 4 oats/T 12 oats/T copy vec4 to varying Yes Option 3 As part of s,t coords none none decode s,t,origin,size Yes Table 1: Space and processing overheads of the three options considered for tiling periodic images keep the input coordinates (s, t) in local space. During rasterization, these local coordinates will be interpolated on a per-fragment basis. We then let the fragment shader perform the conversion to global coordinates using this straightforward formula, s0 t0=Sx0Ox 0SyOy  fract (s) fract (t) 1  (2) where now (s, t) are per-fragment interpolated values. We are multiplying the fractional part of original textures by the chart size and then adding the oset of the origin. The new coordinates (s0, t0) can be used to query the value on the atlas associated with the original coordinates (s, t) . This local transformation can be easily integrated using the programmable rendering pipeline. We just need to transform in the fragment shader the (s, t) coordinates and use them for the texture lookup. The algorithm 7 of the appendix shows the simple GLSL shader code of the texture mapping using the mapping function of Equation 2. With the standard texture lookup functions the implicit level of detail is selected as follows: for a texture that is not mip-mapped, the texture is used directly but if it is mip-mapped and running in a fragment shader, the LOD computed by the implementation is used to do the texture lookup. If it is mip-mapped and running on the vertex shader, then the base texture is used. But that is not valid using a texture atlas because we are referring a local coordinate for each chart and we need to specify the derivatives using the local coordinates. So we enable the extension GL_ARB_shader_texture_lod in order to use the function texture2DGrad that makes a texture lookup with explicit gradients (visit www.opengl.org/registry/doc/GLSLangSpec.Full.1.40.05.pdf for more information). We have explored three dierent options for passing the tuple (O, S) to the fragment shader (see table 1). In the following discussion we use GLSL terminology. A rst option that suggests itself is to encode (O, S) in a vec4 uniform variable that the application must send for each textured primitive. This implies an overhead of storing and transmitting 4 oats per triangle. Unfortunately, the current OpenGL specication does not support binding uniform variables to buer objects, i.e., uniforms cannot be modied in a vertex array. Therefore this approach is not compatible with using Vertex Buer Objects (VBOs) for rendering groups of primitives, which is the most ecient rendering mode in current graphics hardware. A second option is to send (O, S) data as attributes . The main advantage is that attributes can be bound to buer objects and hence the option is compatible with VBOs. The memory requirements for the application are the same as in the previous option. The transmission overhead, though, depends on the rendering mode. For VBOs, the attribute must be specied on a per-corner basis (OpenGL only supports a single index buer for vertex-arrays). This leads to a transmission overhead of 12 oats per triangle. The third option we considered attempts to minimize space and transmission overheads (see Section 8.1.2). A key observation is that texture coordinates are represented in 32-bit single precision oatingpoint format. However, the maximum texture size supported by state-of-the-art graphics hardware is 4096 × 4096. Addressing a texel on such a texture requires only 12 bits. Therefore, we can use the unused bits to encode (O, S) data. In our implementation, each (s, t) coordinate is replaced by the 39 referring to the original textures, and the other referring to the texture atlas of the leaf node: we only use one set of compressed textures (see Section 8.1.2) per atlas. In the Figure 23 we see an example of a texture atlas tree using a bin-tree hierarchy. In the upper level N we have a texture atlas containing the subsampled textures of the level N−1 . As we see, this system provides a level of detail technique that tries to minimize the texture batching lack. We also see that the total number of texture atlas required for a quadtree with deep n is Pn i=0 4i . For each node we store a value that denes the area precision (meters/texel) of the associated texture atlas. In the preprocessing stage, where we build each texture atlas, we use this area precision to scale the charts to an appropriate dimension. We rst dene the area precision of the leaf nodes of the texture atlas tree and then recursively set the upper levels with a lower area precision. Let L∈[1..Nr] be the current level in the atlas hierarchy (where L= 1 refers to the leaf nodes and L=Nr to the global root node), λl the area precision selected for the level 1 and λ(L) a function that returns the area precision for a given level L . We set this function as: λ(L) = αL−1λl Where α > 1 is a scale factor of the subsampling force. The clever selection of the deep tree N and the value of α is a key to achieve better visual results and performance. We also have to consider the mipmapping when selecting α : dierent mip-levels may be applied to a level L considering the area precision λ(L+ 1) of the upper level. For our implementation, we set α= 8 , Nr= 2 and λl= 0.05 . That means that the highest precision is set to 0.05 m/texel and we do not subdivide more than two levels on the quadtree. The α factor progressively subsamples lower resolution levels multiplying by eight the area precision. Buchholz and Döllner also add a texture border area (see Section 21) to the required texture area to avoid mixing adjacent textures in downsampled versions of the texture atlas. But for their implementation they use a constant border width of eight texels guaranteeing the avoidance of texture pollution for the rst three down-sampling levels. Indeed, that supposes heavy waste of memory. So we decided to minimize the amount of memory used for the mipmapping, and designed an adaptive scheme capable to use texture atlas with dierent mip-levels. We will need more mip-levels in the texture atlas with highest area precision than for example in the texture atlas of the parent node, where in our implementation reaches a 3.2 meters/texel area precision. Let Mip (L) be the number of mip-levels associated to a level L of the tree, we can limit the necessary number of mip-levels seeing how the mipmapping subsampled is done: the reduction is done dividing by two the dimensions of the texture atlas. So we dene Mip (L) as: Mip (L) = (0L=N log2(α)−1L<N For the node with lowest resolution we do not need any mipmap. For the next nodes with more precision, Mip (L) is dened by the scale factor between the lower and upper level of resolution. We see that this scale is in fact the scale factor α=λ(L+1) λ(L) . So in our case we have a xed requirement on the number of mip-levels for all the levels ( Mip (L)=2 ) except for the lowest resolution level. So we are storing the pyramid of subsampled texture atlas explicitly in the quadtree hierarchy and implicitly in the mip-levels associated to each texture atlas. Table 2 shows the resulting λ(L) values associated by each L level, and the mip-level deep Mip (L) used. Table 2: Area precision and mip-level associated to each atlas tree level of our implementation L λ (L) (m/texel) M(L) 0 0.05 2 1 0.4 2 2 3.2 0 46 Indeed, we have seen that is enough to assign Mip (1) = 1 for the middle level, because the ltering artifacts are less noticeable than in the highest resolution level, where we use two mip-levels. 8.2.2 Building rendering The rendering is performed by a top-down traversal of the texture atlas tree. For each traversed node we perform a view frustum test: if the bounding box is completely outside the view frustum the node is skipped. If it is visible, we compute the point of the bounding box node nearest to the viewer and the distance d to this point. This information is used to calculate the screen projection Sproj given an area precision λ . For simplicity, we assume identical scale factors for both screen axes (see Figure 24). The screen projection of a line segment of the length world viewed from the distance d has maximum size if it is oriented orthogonal to the viewing direction. Let w be the viewport widht, and f the eld of view angle in the y direction, we obtain a projection factor: Sproj =λw 2dtan f 2 (5) If Sproj is less or equal than a texture resolution threshold tres (texel/pixel), the texture atlas of the current level of resolution is binded and used to wrap the textures. The texture resolution is chosen in a way that the texel-per-pixel ratio is always near to one ( tres = 1 ) in order that the amount of necessary texture data remains diminished. However the texel-per-screen pixel ratio can be increased to decrease the texture quality and increase the performance. Figure 24: Screen projection factor scheme The quadtree subdivision guarantees that for a given maximum deep, we also have a maximum texture binding switches. In general for a deep n the maximum texture batches is from the order of 4n . So if we have two maximum levels of deep of our quadtree, the maximum number of texture batches is only sixteen. In some applications with several textures it means a very signicant performance gain. Furthermore, for huge environments this batching bound is rarely reached because it only occurs when we are seeing all the scene and we require the maximum resolution for each node. 8.2.3 Terrain visualization We render the terrain using aerial photos projected on a planar surface. We use a regular partition subdivision of the terrain in tiles. For each tile we have associated a collection of photos with dierent resolutions that represents the tile region. To increase the performance, we use a quadtree where the leafs are the tiles and the root represents the whole terrain. The rendering is performed by a top-down traversal of the tile tree. As with building rendering (see Section 8.2.2) for each traversed node we perform a view frustum test and discard it if is completely outside from the view frustum. When we reach the visible leafs, we have to select the appropriate resolution of the texture. We also use the Sproj (see equation 5) with λ= 1 as we want to determine the screen projection of one meter of the 47 tile at the minimum distance d . Let tlenght be the length of the tile and vy the vertical component of the vector joining the viewer and the nearest point of the tile. Then, the required resolution Sres in pixels is dened as: Sres =Sproj tlenghtvy The value Sres give the required resolution for a distance and viewer orientation. To take advantage of the graphical pipeline we recommend to use power-of two textures to represent the dierent levels of detail of each tile. In our implementation, we used for the highest level of detail a resolution of 512 ×512 and the successive downsampled versions until the 32 ×32 resolution. In the Figure 25 we can see a simple 2D scheme of the level of detail used in terrain rendering. The nearest tiles use higher resolution tiles and as we get far lower resolution textures are used. Figure 25: Terrain rendering LOD example Highest to lowest resolution: blue, orange, green and purple One advantage to load separately each resolution version of a tile (instead to store implicitly in a mipmap pyramid) is that at each rendering time we only load the necessary texture tiles. We use a simple texture cache scheme that loads onto the memory the used texture tiles and unloads them when the cache reaches a predened maximum amount of memory or number of texture units. 48 Part V Results 9 Test specications 9.1 Test model The model we used to test our technique covers an area of 234.4 km2 of Barcelona. The Tables 3 and 4 show the geometry and texture information respectively of the test model. The Figure 26 shows a set of thumbnails of the facade textures. Table 3: Test model geometry information Triangles 3,266,469 Vertices 6,307,109 Buildings 93,111 Building blocks 13.879 Terrain area 108.43 km2 Total surface area (facades+ceilings) 234.4 km2 Table 4: Test model texture information Number of distinct textures 23,939 Memory space without compression 18 GB (3 bytes/texel) Memory space with DXT1 compression 3 GB (0.5 bytes/texel) Memory space with JPEG compression 0.5 GB (36:1) Average resolution 0.5 cm2 /texel Needed texture memory space for all the city withouth wrapping 4.2 Tera texels Needed memory space for all the city without compression 12.6 TB (3 bytes/texel) Needed memory space for all the city with DXT1 compression 2.1 TB (0.5 bytes/texel) Figure 26: Thumbnails of a set of Teleatlas textures 49 9.2 Hardware tested The hardware used for all the tests was: Table 5: Hardware specications Graphics card Nvidia Geforce GTX 260 CPU Intel Core 2 Quad 2.33 Ghz RAM memory 3.25 GB 50 10 Space compression Space compression results analyzes the image dowmsampling and compression of a set of eight test images. Also tests the compression achieved by the test model varying the tolerance and the error metric. The specication of the test images are follows: Table 6: Test image specications Name Dimensions Snapshot Window 512x512 (a) Rocktile 500x375 (b) Bricktile 499x366 (c) Fabrictile 400x300 (d) Textureatlas 400x400 (e) Crayons 516x341 (f) Boat 500x336 (g) Aerialphoto 521x512 (h) 51 10.1 Image downsampling 10.1.1 Downsampling function of test images The next gures show the associated downsampling function of each test image. The vertical coordinate indicates the metric error obtained and the horitzontal one the downsampling direction (width, height and both). The root mean square error is denoted by a red line and the human visual system metric by a green line. The original test image is shown on the lower right region of the gures. Figure 27: Window downsampling function Figure 28: Rocktile downsampling function 52 Figure 29: Bricktile downsampling function Figure 30: Fabrictile downsampling function 53 Figure 31: Textureatlas downsampling function Figure 32: Crayons downsampling function 54 Figure 33: Boat downsampling function Figure 34: Aerial photo downsampling function As said in Section 7.2, we see that HVSE has more sensitivity to the eect of downsampling compared with RMSE. That is a desirable property because we want to distinguish between dierent tolerance levels. RMSE poorly reacts to the downsampling also with a reduction of 90% or greater. However we also see that HVSE have in some cases high sensitivity applying a little downsampling. That may be a restriction if we dene error thresholds not greater than the initial minimum threshold. Per example, in the Figure 30 only reducing by 1% the width and height we obtain more than 50% of error so if we do not have an error threshold greater we will not have any compression. In the Figure 55 Figure 44: Rocktile reconstruction using HVSE 62 Figure 45: Bricktile reconstruction using HVSE 63 Figure 46: Fabrictile reconstruction using HVSE 64 Figure 47: Textureatlas reconstruction using HVSE 65 Figure 48: Crayons reconstruction using HVSE 66 Figure 49: Boat reconstruction using HVSE 67 Figure 50: Aerialphoto reconstruction using HVSE 68 We use dierent L values for the tests of this section and Section 10.1.2 because RMSE slowly reacts to the downsampling and have less error tolerance resolution. As we see, because HVSE has more sensitivity to the downsampling it provides more resolution in the range of error metric tolerance. That is also clearly illustrated in Section 10.1.1. Compared with RMSE, that downsamples to a 1x1 chart until it reaches the 20% error tolerance, we have more range using HVSE. In some cases, the compression starts at tolerance error levels greater than 30-40% (e.g. in the Figure 50), so HVS seems to be more restrictive in the initial steps of the userdened error tolerance. This happens when the images contain more visual perceptual information (see Section 7.2.3 for detailed explanation of the criteria). We also detect that the stretching is sometimes anisotropic depending on the downsampling direction (e.g. in the Figure 45) meaning that the downsampling process distincts between the amount of information provided separately by width and height. 10.1.4 Test images compression results The next tables show for each test image the compression ratios achieved by the image downsampling thanks to the matching to view conditions and image saliency. We consider that each image project on a space of 20x15 meters. Each row identiers denote:  View size : size after the match to view conditions (see Section 7.1).  View CR : compression ratio due the match to view conditions.  Visual size : size after the saliency matching.  Visual CR : compression ratio with respect to view size.  Total CR : total compression ratio achieved. Window compression results 0.05 meter/texel View size 400x300 View CR 2.18:1 RMSE HVSE 5% 10% 20% 10% 20% 30% 40% 50% Visual size 350x75 12x1 1x1 398x298 398x298 398x298 225x290 100x103 Visual CR 4.57:1 10000:1 120000:1 1.01:1 1.01:1 1.01:1 1.83:1 11.65:1 Total CR 9.98:1 21845:1 262144:1 2.21:1 2.21:1 2.21:1 4.01:1 25.45:1 0.4 meter/texel View size 50x37 View CR 141.69:1 RMSE HVSE 5% 10% 20% 10% 20% 30% 40% 50% Visual size 43x18 6x1 1x1 48x35 48x35 48x35 48x18 37x5 Visual CR 2.39:1 308.33:1 1850:1 1.10:1 1.10:1 1.10:1 2.14:1 10:1 Total CR 338.68:1 43960:1 262144:1 156:1 156:1 156:1 303:1 1416:1 69 3.2 meter/texel View size 6x4 View CR 10922.7:1 RMSE HVSE 5% 10% 20% 10% 20% 30% 40% 50% Visual size 6x4 6x4 3x4 6x4 4x4 4x3 4x2 4x2 Visual CR 1:1 1:1 2:1 1:1 1.5:1 2:1 3:1 3:1 Total CR 10922:1 10922:1 21845:1 10922:1 16384:1 21845:1 32768:1 32768:1 Rocktile compression results 0.05 meter/texel View size 400x300 View CR 1.56:1 RMSE HVSE 5% 10% 20% 10% 20% 30% 40% 50% Visual size 375x298 56x93 1x1 362x262 201x126 104x63 62x30 39x12 Visual CR 1.07:1 23:1 120000:1 1.26:1 4.73:1 18.31:1 64.51:1 256.4:1 Total CR 1.67:1 36:1 187500:1 1.97:1 7.40:1 28.61:1 100.8:1 400:1 0.4 meter/texel View size 50x37 View CR 101.35:1 RMSE HVSE 5% 10% 20% 10% 20% 30% 40% 50% Visual size 48x35 25x18 1x1 48x35 48x35 43x35 37x18 6x13 Visual CR 1.10:1 4.11:1 1850:1 1.1:1 1.1:1 1.22:1 2.77:1 23.71 Total CR 111.6:1 416:1 187500:1 111.6:1 111.6:1 124.58:1 281.5:1 2403.85:1 3.2 meter/texel View size 6x4 View CR 7812.5:1 RMSE HVSE 5% 10% 20% 10% 20% 30% 40% 50% Visual size 6x4 6x4 3x4 6x4 6x4 3x2 1x2 1x2 Visual CR 1:1 1:1 2 1:1 1:1 4:1 12:1 12:1 Total CR 7812.5:1 7812.5:1 15625:1 7812.5:1 7812.5:1 31250:1 93750:1 93750:1 Bricktile compression results 0.05 meter/texel View size 400x300 View CR 1.52:1 RMSE HVSE 5% 10% 20% 10% 20% 30% 40% 50% Visual size 25x150 1x1 1x1 312x298 150x253 73x164 40x103 21x58 Visual CR 32:1 120000:1 120000:1 1.29:1 3.16:1 10.02:1 29.12:1 98.52:1 Total CR 48.1:1 182634:1 182634:1 1.96:1 4.81:1 15.25:1 44.32:1 149.94:1 70 0.4 meter/texel View size 50x37 View CR 98.72:1 RMSE HVSE 5% 10% 20% 10% 20% 30% 40% 50% Visual size 1x18 1x1 1x1 48x35 48x35 37x35 3x35 1x1 Visual CR 102.7:1 1850:1 1850:1 1.1:1 1.1:1 1.42:1 17.61:1 1850:1 Total CR 10146:1 182634:1 182634:1 108.71:1 108.71:1 141:1 1739:1 182634:1 3.2 meter/texel View size 6x4 View CR 7609.75:1 RMSE HVSE 5% 10% 20% 10% 20% 30% 40% 50% Visual size 6x4 6x4 1x4 6x4 1x4 1x1 1x1 1x1 Visual CR 1:1 1:1 6:1 1:1 6:1 24:1 24:1 24:1 Total CR 7609.75:1 7609.75:1 45658:1 7609:1 45658:1 182634:1 182634:1 182634:1 Fabrictile compression results 0.05 meter/texel View size 400x300 View CR 1:1 RMSE HVSE 5% 10% 20% 10% 20% 30% 40% 50% Visual size 225x187 1x9 1x1 398x298 398x298 398x298 343x248 243x154 Visual CR 2.85:1 13333:1 120000:1 1.01:1 1.01:1 1.01:1 1:1.41 3.2:1 Total CR 2.85:1 13333:1 120000:1 1.01:1 1.01:1 1.01:1 1:1.41 3.2:1 0.4 meter/texel View size 50x37 View CR 64.86:1 RMSE HVSE 5% 10% 20% 10% 20% 30% 40% 50% Visual size 25x18 1x4 1x1 48x35 48x35 48x35 48x35 48x35 Visual CR 4.11:1 462.5:1 1850:1 1.1:1 1.1:1 1.1:1 1.1:1 1.1:1 Total CR 4.11:1 30000:1 120000:1 71.4:1 71.4:1 71.4:1 71.4:1 71.4:1 3.2 meter/texel View size 6x4 View CR 5000:1 RMSE HVSE 5% 10% 20% 10% 20% 30% 40% 50% Visual size 6x4 6x4 3x4 6x3 4x4 4x3 4x3 4x3 Visual CR 1:1 1:1 2:1 1:1 1.5:1 2:1 2:1 2:1 Total CR 5000:1 5000:1 10000:1 5000:1 7500:1 10000:1 10000:1 10000:1 71 Figure 53: Texture set 3 packing Figure 54: Texture set 4 packing 78 Figure 55: Texture set 5 packing The Table 14 and Figure 56 shows for each texture set the occupancy of the packing of each of the four methods. We see that the best option is the optimized and stretched, obtaining always a 100% coverage of the atlas. Figure 56: Texture packing results 79 Table 14: Texture set packing occupancy Texture set 1 2 3 4 5 Resolution 2048x2048 2048x2048 4096x4096 4096x4096 4096x4096 Number of subtextures 192 378 1107 1689 2897 meters/texel 0.02 0.03 0.03 0.04 0.05 Not optimized / not stretched 72.37% 81.85% 75.56% 83.65% 92.20% Not optimized / stretched 78.14% 85.44% 77.96% 85.58% 94.32% Optimized / not stretched 89.48% 95.29% 95.34% 96.36% 96.96% Optimized / stretched 100% 100% 100% 100% 100% 80 10.3 Encoding texture chart coordinates We have tested the three chart encoding options listed in Table 1 of Section 8.1.1. We rendered the whole test model (see Section 9.1) to extract the results shown on the Figure 15. The vertices per second are measured using a viewport of 1×1 with the camera facing the whole geometrical dense city. The frames per seconds are measured with the maximum size of the viewport (in our case 1440 ×900 ) and facing the whole city. Finally, the fragments per second are measured rendering one building and facing a textured facade with a maximum size of the viewport. Since Option 1 in Table 1 does not have VBO support we adapted the rendering scheme to use VBO to make it comparable with the other two options. We introduced the additional condition to have the same chart per vertex buer. This increases the number of required VBO buers and the fragmentation reducing the performance. The results are better than we predicted. The option that uses packed coordinates (Option 3) have the highest vertices/s and frames/s rate although it have to decompress each vertex information (see Section 8.1.3). The Option 2 do not have any decompression step but has 20.76% and 23.67% less vertices/s and frames/s rate respectively. The option 1 fails with both intensive geometry tests but has the best fragments/s rate because it has the simplest fragment shader. So we see that the option 3 has more performance reducing the memory bandwidth instead it have an additional decompression cost per vertex. Table 15: Chart encoding performance (for more information of the encoding techniques see Table 1) Encoding technique Vertices/s Fragments/s Frames/s Option 1 44,032,002 1,570,752,000 14.57 Option 2 436,739,971 1,382,832,000 132.37 Option 3 527,426,950 1,362,096,000 163.71 Figure 57: Chart encoding performance (vertices/s) 81 Figure 58: Chart encoding performance (fragments/s) Figure 59: Chart encoding performance (frames/s) 82 11 Time Performance To evaluate the time performance we have dened a walkthrough of the city going from far to a close view of a building. We show the results for each rendering technique. When we do not use texture atlas, we tried to load the original textures but it was just imposible to load all of them so we switched to a subsampled version with 256x256 and DXT1 compression for the results provided in this section. We do not use visual improvements (see Section VII) and disable terrain rendering to just evaluate the texture atlas rendering. The Figure 61 shows the evolution of the framerate during the walk. The snapshots show the evolution of the walkthrough in steps of two seconds. Table 16: Resulting framerate for each technique (walkthrough) Technique Minimum FPS Maximum FPS Average FPS Encoding option 1 20 30.36 24.63 Encoding option 2 136 210.16 174.55 Encoding option 3 158 251.5 206.89 VBO / No texture atlas 10.3 14.22 12.34 Inmediate / No texture atlas 1.16 1.59 1.16 Figure 60: Resulting framerate for each technique (walkthrough) 83 Figure 61: Framerate evolution of walkthrough As in Section 10.3, we see that the encoding option 3 has the best framerate, followed by the encoding option 2. Both have similar evolution during the walkthrough. However, the encoding option 1 fails in the test (obtains FPS nearly the other two options that do not use texture atlas) because the heavy VBO fragmentation. Comparing the average FPS of the encoding option 2 and the technique that use VBO without texture atlas, we have an speed-up factor of 17, very signicant in a real-time rendering system. 84 12 Selected snapshots The next gures are selected snapshots of the city using the visual improvements described at Section VII and enabling terrain rendering. Figure 62: Barcelona snapshot 1 Figure 63: Barcelona snapshot 2 85 Figure 64: Barcelona snapshot 3 Figure 65: Barcelona snapshot 4 86 Figure 66: Barcelona snapshot 5 Figure 67: Barcelona snapshot 6 87 [35] Lewis E. Hitchner and Michael W. McGreevy. Methods for user-based reduction of model complexity for virtual planetary exploration. Proc. SPIE , 1913:622636, 1993. [36] Hugues Hoppe. Optimization of mesh locality for transparent vertex caching. ACM SIGGRAPH , pages 269276, 1999. [37] Arnaud E. Jacquin. Image coding based on a fractal theory of iterated contractive image. IEEE Transactions on Image Processing, vol. 1, issue 1, pp. 18-30 , 1:1830, 1992. [38] Alexei A. Efros James Hays, Marius Leordeanu and Yanxi Liu. Discovering texture regularity as a higher-order correspondence problem. ECCV , 3952:522535, 2006. [39] Nebojsa Jojic, Brendan J. Frey, and Anitha Kannan. Epitomic analysis of appearance and shape. In ICCV '03: Proceedings of the Ninth IEEE International Conference on Computer Vision , page 34, Washington, DC, USA, 2003. IEEE Computer Society. [40] A. J. Ahumada Jr. Simplied vision models for image quality assessment. SID International Symposium Digest of Technical Papers , 27:397400, 1996. [41] G. Knittel, A. Schilling, A. Kugler, and W. Strasser. Hardware for superior texture performance. Computers & Graphics , 20:475481, 1996. [42] Ali Lakhia. Ecient interactive rendering of detailed models with hierarchical levels of detail. In 3DPVT '04: Proceedings of the 3D Data Processing, Visualization, and Transmission, 2nd International Symposium , pages 275282, Washington, DC, USA, 2004. IEEE Computer Society. [43] Gregory Ward Larson, Holly Rushmeier, and Christine Piatko. A visibility matching tone reproduction operator for high dynamic range scenes. IEEE Transactions on Visualization and Computer Graphics , 3(4):291306, 1997. [44] Sylvain Lefebvre. Filtered Tilemaps (in Shader X6) , chapter ., page (to appear). Shader X6. Charles River Media, 2008. [45] Sylvain Lefebvre and Carsten Dachsbacher. Tiletrees. In I3D '07: Proceedings of the 2007 symposium on Interactive 3D graphics and games , pages 2531, New York, NY, USA, 2007. ACM. [46] Sylvain Lefebvre, Jerome Darbon, and Fabrice Neyret. Unied texture management for arbitrary meshes. Technical report, INRIA, 2004. [47] Aaron E. Lefohn, Shubhabrata Sengupta, Joe Kniss, Robert Strzodka, and John D. Owens. Glift: Generic, ecient, random-access gpu data structures. ACM Trans. Graph. , 25(1):6099, 2006. [48] Joshua Levenberg. Fast view-dependent level-of-detail rendering using cached geometry. In VIS '02: Proceedings of the conference on Visualization '02 , pages 259266, Washington, DC, USA, 2002. IEEE Computer Society. [49] Bruno Lévy, Sylvain Petitjean, Nicolas Ray, and Jérome Maillot. Least squares conformal maps for automatic texture atlas generation. ACM Trans. Graph. , 21(3):362371, 2002. [50] M. Leyton. Symmetry, Causality, Mind . The MIT Press, 1992. [51] Wen-Chieh Lin, James H. Hays, Chenyu Wu, Vivek Kwatra, and Yanxi Liu. A comparison study of four texture synthesis algorithms on regular and near-regular textures. Technical Report CMURI-TR-04-01, Robotics Institute, Carnegie Mellon University, Pittsburgh, PA, January 2004. [52] Peter Lindstrom, David Koller, William Ribarsky, Larry F. Hodges, Nick Faust, and Gregory A. Turner. Real-time, continuous level of detail rendering of height elds. In SIGGRAPH '96: Proceedings of the 23rd annual conference on Computer graphics and interactive techniques , pages 109118, New York, NY, USA, 1996. ACM. 94 [53] Andrea Lodi, Silvano Martello, and Michele Monaci. Two-dimensional packing problems: A survey. European Journal of Operational Research , 141(2):241252, September 2002. [54] Frank Losasso and Hugues Hoppe. Geometry clipmaps: terrain rendering using nested regular grids. In SIGGRAPH '04: ACM SIGGRAPH 2004 Papers , pages 769776, New York, NY, USA, 2004. ACM. [55] J. L. Mannos and D. J. Sakrison. The eects of a visual delity criterion on the encoding of images. IEEE Transactions on Information Theory , 20:522, 1974. [56] Silvano Martello, Michele Monaci, and Daniele Vigo. An exact approach to the strip-packing problem. INFORMS J. on Computing , 15(3):310319, 2003. [57] W. Jr. Miller. Symmetry Groups and Their Applications . Academic Press: New York, 1972. [58] R.E. Gomory P.C. Gilmore. A linear programming approach to the cutting stock problem. Operations Research , 9:849859, 1961. [59] Ken Perlin. An image synthesizer. In SIGGRAPH '85: Proceedings of the 12th annual conference on Computer graphics and interactive techniques , pages 287296, New York, NY, USA, 1985. ACM. [60] Larry F. Hodges William Ribarsky Nick Faust Peter Lindstrom, David Koller and Gregory Turner. Level-of-detail management for real-time rendering of phototextured terrain. Technical report, Georgia Institute of Technology, 1995. [61] Paul Heckbert Pixar and Paul S. Heckbert. Survey of texture mapping. IEEE Computer Graphics and Applications , 6:5667, 1986. [62] Budirijanto Purnomo, Jonathan D. Cohen, and Subodh Kumar. Seamless texture atlases. In SGP '04: Proceedings of the 2004 Eurographics/ACM SIGGRAPH symposium on Geometry processing , pages 6574, New York, NY, USA, 2004. ACM. [63] Mahesh Ramasubramanian, Sumanta N. Pattanaik, and Donald P. Greenberg. A perceptually based physical error metric for realistic image synthesis. In SIGGRAPH '99: Proceedings of the 26th annual conference on Computer graphics and interactive techniques , pages 7382, New York, NY, USA, 1999. ACM Press/Addison-Wesley Publishing Co. [64] A. Ravishankar Rao and Gerald L. Lohse. Identifying high level features of texture perception. CVGIP: Graph. Models Image Process. , 55(3):218233, 1993. [65] Holly E. Rushmeier, Gregory J. Ward, Christine D. Piatko, Phil Sanders, and Bert Rust. Comparing real and synthetic images: Some ideas about metrics. In Rendering Techniques , pages 8291, 1995. [66] Marc Soucy, Guy Godin, and Marc Rioux. A texture-mapping approach for the compression of colored 3d triangulations. The Visual Computer , 12(10):503514, 1996. [67] J.C Stevens and S.S Stevens. Brightness function: Eects of adaptation. Journal of the Optical Society of America , 53:375385, 1963. [68] Christopher C. Tanner, Christopher J. Migdal, and Michael T. Jones. The clipmap: a virtual mipmap. In SIGGRAPH '98: Proceedings of the 25th annual conference on Computer graphics and interactive techniques , pages 151158, New York, NY, USA, 1998. ACM. [69] Marco Tarini, Kai Hormann, Paolo Cignoni, and Claudio Montani. Polycube-maps. In In Proceedings of SIGGRAPH 2004 , pages 853860, 2004. 95 [70] William C. Thibault and Bruce F. Naylor. Set operations on polyhedra using binary space partitioning trees. SIGGRAPH Comput. Graph. , 21(4):153162, 1987. [71] Jack Tumblin and Holly Rushmeier. Tone reproduction for realistic images. IEEE Computer Graphics and Applications , 13(6):4248, 1993. [72] Huamin Wang, Yonatan Wexler, Eyal Ofek, and Hugues Hoppe. Factoring repeated content within and among images. In SIGGRAPH '08: ACM SIGGRAPH 2008 papers , pages 110, New York, NY, USA, 2008. ACM. [73] Zhou Wang and Alan C. Bovik. Mean Squared Error: Love It or Leave It? IEEE Signal Processing Magazine, 1998. [74] Gregory J. Ward. The radiance lighting simulation and rendering system. In SIGGRAPH '94: Proceedings of the 21st annual conference on Computer graphics and interactive techniques , pages 459472, New York, NY, USA, 1994. ACM. [75] Li-Yi Wei. Tile-based texture mapping on graphics hardware. In HWWS '04: Proceedings of the ACM SIGGRAPH/EUROGRAPHICS conference on Graphics hardware , pages 5563, New York, NY, USA, 2004. ACM. [76] Lance Williams. Pyramidal parametrics. SIGGRAPH Comput. Graph. , 17(3):111, 1983. [77] Wen-Chieh Lin Yanxi Liu and James H. Hays. Near-regular texture analysis and manipulation. ACM SIGGRAPH , 23, 2004. [78] Yangli Hector Yee and Anna Newman. A perceptual metric for production testing. In SIGGRAPH '04: ACM SIGGRAPH 2004 Sketches , page 121, New York, NY, USA, 2004. ACM. [79] Eugene Zhang, Konstantin Mischaikow, and Greg Turk. Feature-based surface parameterization and texture mapping. ACM Trans. Graph. , 24(1):127, 2005. [80] Hualin Zhou, Min Chen, and Mike F. Webster. Comparative evaluation of visualization and experimental results using image comparison metrics. In VIS '02: Proceedings of the conference on Visualization '02 , pages 315322, Washington, DC, USA, 2002. IEEE Computer Society. [81] Jacob Ziv and Abraham Lempel. Compression of individual sequences via variable-rate coding. IEEE Transactions on Information Theory , 24:530536, 1978. 96