Size-Adaptive Texture Atlas Generation and Remapping for 3D Urban Building Models
Abstract
:1. Introduction
2. System Framework
- (1)
- Extract model data and classify the textures. The textures and geometric mesh are extracted from the model, and all the textures are classified into non-tiled textures and tiled textures;
- (2)
- Set the maximum texture size and pack all the textures. The maximum supported rendering texture size is acquired according to the graphics processing unit card, and all the textures are packed into one or more texture atlases by the improved lowest horizontal search and simulated annealing algorithms;
- (3)
- Remap the texture atlases onto the geometric mesh. For the triangle with the original non-tiled texture, the new texture coordinates in the texture atlases can be calculated and set to the mesh directly. However, for the triangle with the original tiled texture, the corresponding mesh triangle is clipped into many unit triangles, and each one is remapped using texture mapping as the triangle with the original non-tiled texture;
- (4)
- Export the new model with the texture atlases.
3. Methodology
3.1. Texture Atlas Generation
3.1.1. Multi-Texture Packing
- (1)
- Traverse the height value of all the textures and sort them in descending order. For textures with the same height, sort them in descending order based on the width value;
- (2)
- Get the maximum supported atlas size and create a blank image. The initial size is set to be the maximum supported texture size, such as 4096;
- (3)
- Set the initial horizontal line and iteratively insert the textures into the atlas. The height of the first horizontal line is set to be the height of the first sorted texture. For the i-th texture Ti, it is inserted into the atlas if possible. Otherwise, other textures are checked and inserted into the atlas. is used to update the packing state, where T stands for the unpacked textures and A stands for the texture atlases;
- (4)
- If no texture can be inserted into the current strip, the height of the horizontal line is updated. It is equal to the horizontal height plus the height of the current texture to be merged. Then the processing step goes to step 3 to constitute another stripe;
- (5)
- If the atlas cannot be inserted and the unpacked texture exists, a new blank atlas is created. Then, the processing step goes to step 2 to constitute another atlas;
- (6)
- The height of the last atlas is set to be the height of the horizontal line;
- (7)
- Export the texture atlases.
3.1.2. Atlas Optimization
- (1)
- Attain the packed texture atlases by the lowest horizontal search algorithm as the initial solution X0;
- (2)
- Randomly swap the orders of two textures in step 1 in Section 3.1.1, pack the textures using the lowest horizontal search algorithm, and attain the current solution X1;
- (3)
- Calculate the value difference . If , X1 is accepted as a more optimal solution for texture packing. Otherwise, check . If this is true, X1 is accepted and set to . If this is not true, proceed to step 4;
- (4)
- Set and repeat steps 2 and 3 until ;
- (5)
- Export the optimal texture atlases.
3.2. Texture Atlas Remapping
3.2.1. Non-Tiled Texture Remapping
3.2.2. Tiled Texture Remapping
Rectangle Clipping
- (1)
- Extract the geometric coordinates and original texture coordinates of each vertex in the triangle;
- (2)
- In the 2D texture coordinate system, the unit rectangle is used iteratively to cut triangle abc. It is clipped into many small triangles. The texture coordinate of each new vertex can be calculated, which is described as . The vertex p is the created vertex in the 2D texture coordinate system, and the texture coordinate corresponding to the original texture can be divided into two cases;
- (a)
- The vertex p is located inside triangle abc, so the texture coordinate of vertex p corresponding to the original texture can be calculated:
- (b)
- The vertex p is located on the edge of triangle abc. Assuming that vertex p is located on the edge ab, it can be divided into two situations. One situation is that vertex p is located on the m-th column line, so the texture coordinate of vertex p corresponding to the original texture can be calculated as follows:
- (3)
- Calculate the geometric coordinates of the created vertices. The geometric coordinates of the created vertices are described as . As we know, the 2D texture coordinates can be projected to the 3D Cartesian coordinate system to calculate the geometric coordinates, with geometric vertex P corresponding to texture vertex p. A Bursa-Wolf Seven-Parameter Transformation [28] is applied to compute the geometric coordinates of the new vertices. The geometric coordinates of vertex P can be calculated as follows:
Texture Mapping
4. Experiment and Discussion
4.1. Experimental Results
- (1)
- Extract the urban scene from the Max file;
- (2)
- Split the scene into many individual building models and convert them into OBJ format;
- (3)
- Pack the multi-textures into the texture atlases and remap them onto the geometric mesh for each building model;
- (4)
- Convert the models into GLB format and organize them by the 3DTiles format;
- (5)
- Load and render the urban scene in Cesium.
4.2. Discussion
5. Conclusions and Future Work
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- Lv, Z.; Li, X.; Wang, W.; Zhang, B.; Hu, J.; Feng, S. Government affairs service platform for smart city. Future Gener. Comput. Syst. 2018, 81, 443–451. [Google Scholar] [CrossRef]
- Zhang, X.; Zhong, M.; Liu, S.; Zheng, L.; Chen, Y. Template-Based 3D Road Modeling for Generating Large-Scale Virtual Road Network Environment. ISPRS Int. J. Geo-Inf. 2019, 8, 364. [Google Scholar] [CrossRef] [Green Version]
- Hu, Z.; Guo, J.; Zhang, X. Three-Dimensional (3D) Parametric Modeling and Organization for Web-Based Visualization of City-Scale Pipe Network. ISPRS Int. J. Geo-Inf. 2020, 9, 623. [Google Scholar] [CrossRef]
- Zhang, L.; Han, C.; Zhang, L.; Zhang, X.; Li, J. Web-based visualization of large 3D urban building models. Int. J. Digit. Earth 2014, 7, 53–67. [Google Scholar] [CrossRef]
- Martinez, J.; Andujar, C. Space-optimized texture atlases for 3d scenes with per-polygon textures. In Proceedings of the 2010 18th Pacific Conference on Computer Graphics and Applications, Hangzhou, China, 25–27 September 2010; pp. 14–23. [Google Scholar]
- Campomanes-Álvarez, B.R.; Cordon, O.; Damas, S. Evolutionary multi-objective optimization for mesh simplification of 3D open models. Integr. Comput. Aided Eng. 2013, 20, 375–390. [Google Scholar] [CrossRef] [Green Version]
- Yi, R.; Liu, Y.-J.; He, Y. Delaunay mesh simplification with differential evolution. ACM Trans. Graph. 2018, 37, 1–12. [Google Scholar] [CrossRef]
- Huang, J.; Wang, X.; Wang, J. Mesh simplification algorithm based on edge curvature metrics and local optimization. Int. J. Modeling Simul. Sci. Comput. 2020, 11, 1950042. [Google Scholar] [CrossRef] [Green Version]
- Li, Q.; Sun, X.; Yang, B.; Jiang, S. Geometric structure simplification of 3D building models. ISPRS J. Photogramm. Remote Sens. 2013, 84, 100–113. [Google Scholar] [CrossRef]
- Xie, J.; Zhang, L.; Li, J.; Wang, H.; Yang, L. Automatic simplification and visualization of 3D urban building models. Int. J. Appl. Earth Obs. Geoinf. 2012, 18, 222–231. [Google Scholar] [CrossRef]
- Li, M.; Nan, L. Feature-preserving 3D mesh simplification for urban buildings. ISPRS J. Photogramm. Remote Sens. 2021, 173, 135–150. [Google Scholar] [CrossRef]
- Google/Draco. Available online: https://github.com/google/draco (accessed on 6 October 2021).
- Campisi, P.; Hatzinakos, D.; Neri, A. A perceptually lossless, model-based, texture compression technique. IEEE Trans. Image Process. 2000, 9, 1325–1336. [Google Scholar] [CrossRef] [PubMed]
- Pagés, R.; Arnaldo, S.; Morán, F.; Berjón, D. Composition of Texture Atlases for 3D Mesh Multi-texturing. In Proceedings of the Eurographics Italian Chapter Conference, Genova, Italy, 18–19 November 2010; pp. 123–128. [Google Scholar]
- Dai, X.; Xiong, H.; Gong, J. A multi-texture automatic merging approach for the 3D city models. Geomat. Inf. Sci. Wuhan Univ. 2015, 40, 347–352. [Google Scholar]
- Wynn, C. Opengl Render-to-Texture; GDC, NVIDIA Corporation: San Jose, CA, USA, 2002. [Google Scholar]
- Dessein, A.; Smith, W.A.; Wilson, R.C.; Hancock, E.R. Seamless texture stitching on a 3D mesh by poisson blending in patches. In Proceedings of the 2014 IEEE International Conference on Image Processing (ICIP), Paris, France, 27–30 October 2014; pp. 2031–2035. [Google Scholar]
- Liang, J.; Gong, J.; Li, W.; Ibrahim, A.N. A visualization-oriented 3D method for efficient computation of urban solar radiation based on 3D–2D surface mapping. Int. J. Geogr. Inf. Sci. 2014, 28, 780–798. [Google Scholar] [CrossRef]
- Kováč, O.; Mihalík, J. Lossless encoding of 3D human head model textures. Acta Electrotech. Et Inform. 2015, 15, 18–23. [Google Scholar] [CrossRef]
- Zhiqiang, D.; Pan, L.; Xiaoling, Z.; Yeting, Z.; Yixuan, Z. Texture Optimization Methodology for 3D Building Based on Super Face. Geomat. Inf. Sci. Wuhan Univ. 2014, 39, 1401–1405. [Google Scholar]
- Lodi, A.; Martello, S.; Monaci, M. Two-dimensional packing problems: A survey. Eur. J. Oper. Res. 2002, 141, 241–252. [Google Scholar] [CrossRef]
- Christensen, H.I.; Khan, A.; Pokutta, S.; Tetali, P. Approximation and online algorithms for multidimensional bin packing: A survey. Comput. Sci. Rev. 2017, 24, 63–79. [Google Scholar] [CrossRef]
- Adamaszek, A.; Wiese, A. A quasi-PTAS for the two-dimensional geometric knapsack problem. In Proceedings of the Twenty-Sixth Annual ACM-SIAM Symposium on Discrete Algorithms, Oregon, USA, 5–7 January 2014; pp. 1491–1505. [Google Scholar]
- Gálvez, W.; Grandoni, F.; Heydrich, S.; Ingala, S.; Khan, A.; Wiese, A. Approximating geometric knapsack via L-packings. In Proceedings of the 2017 IEEE 58th Annual Symposium on Foundations of Computer Science (FOCS), Berkeley, CA, USA, 15–17 October 2017; pp. 260–271. [Google Scholar]
- Gálvez, W.; Grandoni, F.; Khan, A.; Ramírez-Romero, D.; Wiese, A. Improved Approximation Algorithms for 2-Dimensional Knapsack: Packing into Multiple L-Shapes, Spirals, and More. arXiv 2021, arXiv:2103.10406. [Google Scholar]
- Liu, H.; Zhou, J.; Wu, X.; Yuan, P. Optimization algorithm for rectangle packing problem based on varied-factor genetic algorithm and lowest front-line strategy. In Proceedings of the 2014 IEEE Congress on Evolutionary Computation (CEC), Beijing, China, 6–11 July 2014; pp. 352–357. [Google Scholar]
- Dowsland, K.A.; Thompson, J. Simulated annealing. In Handbook of Natural Computing; Springer-Verlag: Berlin/Heidelberg, Germany, 2012; pp. 1623–1655. [Google Scholar]
- Harvey, B.R. Transformation of 3D co-ordinates. Aust. Surv. 1986, 33, 105–125. [Google Scholar] [CrossRef]
- Schulze, T.; Gessler, A.; Kulling, K.; Nadlinger, D.; Klein, J.; Sibly, M.; Gubisch, M. Open Asset Import Library (Assimp). Computer Software. Available online: https://github.com/assimp/assimp (accessed on 6 October 2021).
- 3D Tiles Specification. Available online: https://github.com/CesiumGS/3d-tiles/tree/main/specification (accessed on 6 October 2021).
- Liu, F.; Zhang, H.; Hu, Y.; Guo, X.; Zhu, Z.; Jia, J.; Zhu, H. Cesium Based Lightweight WebBIM Technology for Smart City Visualization Management. In Proceedings of the International Conference on Inforatmion technology in Geo-Engineering, Guimarães, Portugal, 29 September–2 October 2019; pp. 84–95. [Google Scholar]
- Khronos Group Inc. KTX File Format Specification 2.0. Available online: https://github.khronos.org/KTX-Specification/ktxspec_v2.html (accessed on 6 October 2021).
Model Name | Texture Processing | Texture Number | Vertex Number | Draco Compressed File Size (MB) |
---|---|---|---|---|
HB15b085 | Original | 16 | 541 | 1.82 |
Packed | 1 | 4659 | 0.54 | |
HB15b121 | Original | 37 | 19,500 | 5.04 |
Packed | 2 | 36,779 | 1.08 | |
HB15b001 | Original | 95 | 4372 | 5.14 |
Packed | 4 | 47,585 | 2.57 |
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |
© 2021 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Zhang, X.; Liu, W.; Liu, B.; Zhao, X.; Hu, Z. Size-Adaptive Texture Atlas Generation and Remapping for 3D Urban Building Models. ISPRS Int. J. Geo-Inf. 2021, 10, 798. https://doi.org/10.3390/ijgi10120798
Zhang X, Liu W, Liu B, Zhao X, Hu Z. Size-Adaptive Texture Atlas Generation and Remapping for 3D Urban Building Models. ISPRS International Journal of Geo-Information. 2021; 10(12):798. https://doi.org/10.3390/ijgi10120798
Chicago/Turabian StyleZhang, Xuequan, Wei Liu, Bing Liu, Xin Zhao, and Zihe Hu. 2021. "Size-Adaptive Texture Atlas Generation and Remapping for 3D Urban Building Models" ISPRS International Journal of Geo-Information 10, no. 12: 798. https://doi.org/10.3390/ijgi10120798
APA StyleZhang, X., Liu, W., Liu, B., Zhao, X., & Hu, Z. (2021). Size-Adaptive Texture Atlas Generation and Remapping for 3D Urban Building Models. ISPRS International Journal of Geo-Information, 10(12), 798. https://doi.org/10.3390/ijgi10120798