The Implementation of a WebGPU-Based Volume Rendering Framework for Interactive Visualization of Ocean Scalar Data
Abstract
:1. Introduction
2. Methods
2.1. Preprocessing of Regular and Irregular Gridded Ocean Scalar Data
- Data interpolation: Concerning the first dataset, interpolation in the vertical direction is necessary due to its nonuniform depth intervals. We utilize the spline interpolation method to interpolate the data in the depth range from 0 m to −2000 m with a 5 m interval, resulting in a total of 401 vertical layers. Similarly, horizontal interpolation is required for the second dataset. The cubic spline interpolation method is employed to generate regular latitude and longitude grids, and the horizontal grid size of each depth layer is 300 × 300 after interpolation, containing a total of 90,000 data points.
- Volume texture generation: Volume textures, also known as 3D textures, are generally used to store volume data, enabling color mapping during volume rendering. Volume textures are a logical extension of traditional 2D textures. Whereas a 2D texture is typically a picture that provides surface color information for a 3D model, a volume texture is composed of multiple 2D textures grouped together to describe three-dimensional spatial data. Volume textures are particularly well suited for shader programming as they can be efficiently accessed and manipulated in shaders, and their sizes are compact enough to conserve memory resources consumed during the visualization process. Therefore, in this study, we ultimately process the data into volume textures. To generate the volume texture, the data in each JSON file are first organized into a three-dimensional array with a shape of (Nlongitude, Nlatitude, Ndepth), where N represents the number of data layers in each corresponding dimension. After mapping the data values to the range of 0 to 255, the data are subsequently converted into a RAW file since the RAW image format is one of the most commonly used volume texture file formats. The data mapping process is illustrated in Equation (2), where v represents the original data value, v′ represents the mapped data value, and vmin and vmax denote the minimum and maximum data values, respectively.
2.2. Ray Casting Algorithm Optimized with Early Ray Termination and Adaptive Sampling Methods
2.3. Interactive Visual Analysis Tools for Real-Time Rendering
- Data source selection and switching: In oceanographic research, the data required for visualization are often diverse and complex, often necessitating frequent switching between different data sources for analysis. This tool pre-loads a list of all available datasets, allowing users to quickly switch between them by simply selecting the desired data source from a dropdown menu.
- Basic rendering parameter setting: This feature allows for a dynamic adjustment of key rendering parameters, including the sampling step size in the ray casting algorithm and transparency, either by using the mouse-controlled sliders or by directly entering values through the keyboard to enhance the visual representation of the data. Users can also modify the colorbar through a dropdown menu.
- Bounding box and axes overlaying: To allow intuitive spatial references for the data’s distribution, users can overlay the volume rendering result with the bounding box, as well as horizontal (latitude and longitude) and vertical (depth) axes through checkboxes. The inclusion of the bounding box helps to visually frame the dataset, while the axes enable users to easily understand the position of the data within the geographic coordinate system.
- Volume cutting: The framework provides a volume cutting feature that allows users to slice the 3D data along coordinate axes, enabling a detailed examination of specific regions or layers within the volume, which is particularly useful for analyzing complex structures or features that may not be immediately visible in the full three-dimensional representation.
- Spatial data filtering based on value: This tool helps users focus on specific regions of interest (ROI) by adjusting the minimum and maximum scalar field values, thereby filtering out the non-relevant data and displaying the relevant portion, enabling a more targeted analysis of ocean variables.
- Time-series animation playback: This feature is especially useful for representing the dynamic processes and changes in ocean environmental phenomena over time. Users can specify a time range of interest and visualize the corresponding time-varying volume data in an animation format.
2.4. Implementation of WebGPU-Based Volume Rendering Framework with Babylon.js
- Data preprocessing and loading: The data preprocessing tasks are conducted using Python scripts, which run on the server side and are automatically triggered when new datasets are available. The conversion from NetCDF files to JSON files is first performed using the netCDF4 library. Then, after the JSON files are initially read using the NumPy library, the PyProj library is employed to transform the coordinates of the ocean acoustic field forecast dataset from the UTM coordinate system to the WGS84 coordinate system. Data interpolation for both datasets is then carried out using the SciPy library. Finally, using the NumPy library, all datasets are reorganized into RAW files, which serve as volume textures for subsequent rendering. Specifically, the processed files are dynamically retrieved on demand according to front-end requests without the need to load all data from the server at once.
- Initialization of the volume rendering viewer: First, a blank canvas is established as the carrier for displaying the rendering results, and the WebGPU engine is initialized. A 3D scene is then constructed to serve as the container for all graphic objects, with the engine handling the task of rendering them. To facilitate a flexible exploration of the volume rendering results from different viewpoints, a camera is created in the scene and configured to support the rotation, zooming, and panning of the results through interactive actions such as mouse drags and keyboard inputs. Additionally, detailed legend information, including elements such as the title, colorbar, unit, and numerical labels, is also attached to the viewer, providing contextual information for the data visualization.
- Building vertex and fragment shaders: WGSL is employed to build vertex and fragment shaders for volume rendering, and a corresponding material is generated based on these shaders. In the vertex shader, coordinates are transformed from the local system to the global system, and the direction vector between the viewpoint and each position is calculated and passed to the fragment shader. In the fragment shader, for each pixel, a ray originating from the viewpoint, with its direction determined by the input direction vector, traverses the volume data. Next, the entry and exit points where the ray intersected the volume are calculated, and adaptive sampling is performed from the entry point to the exit point along the ray. The basic sampling step size is initialized by users but is increased to 1.5 times the user-defined value when the ray enters the null-value region. The values of the sampling points are retrieved from the current volume texture and mapped to corresponding colors based on a color texture. Each pixel’s color and opacity values are continuously calculated until the accumulated opacity value exceeds the specified threshold of 0.98 or the ray reaches the exit point. Finally, a box mesh is created in the scene, with its material set to the customized material, generating the final volume rendering result.
- Integration of interactive visual analysis tools: The developed framework integrates a set of interactive visual analysis tools for an in-depth exploration of the multidimensional volume datasets, enabling a dynamic adjustment of multiple rendering parameters. When users interact with the tools, the framework maps the user inputs via sliders, dropdown menus, or checkboxes to corresponding rendering parameters and automatically updates the fragment shader with the new parameters, triggering real-time re-rendering. These tools encompass a range of functionalities, including data source selection and switching, a basic rendering parameter setting, bounding box and axes overlaying, volume cutting, spatial data filtering based on value, and time-series animation playback.
3. Results and Discussion
3.1. Visual Effects of Volume Rendering
3.2. Performance Analysis of Volume Rendering
4. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- Huang, D.; Zhao, D.; Wei, L.; Wang, Z.; Du, Y. Modeling and Analysis in Marine Big Data: Advances and Challenges. Math. Probl. Eng. 2015, 2015, 384742. [Google Scholar] [CrossRef]
- Wang, Y.; Li, F.; Zhang, B.; Li, X. Development of a component-based interactive visualization system for the analysis of ocean data. Big Earth Data 2022, 6, 219–235. [Google Scholar] [CrossRef]
- Buck, V.; Stäbler, F.; González, E.; Greinert, J. Digital Earth Viewer: A 4D Visualisation Platform for Geoscience Datasets. In Proceedings of the 9th Workshop on Visualisation in Environmental Sciences (EnvirVis), Virtual Event, Switzerland, 14 June 2021; The Eurographics Association: Eindhoven, The Netherlands, 2021; pp. 33–37. [Google Scholar]
- Liu, S.; Chen, G.; Yao, S.; Tian, F.; Liu, W. A framework for interactive visual analysis of heterogeneous marine data in an integrated problem solving environment. Comput. Geosci. 2017, 104, 20–28. [Google Scholar] [CrossRef]
- Zheng, H.; Shao, Q.; Chen, J.; Shan, Y.; Qin, X.; Ma, J.; Xu, X. LIC color texture enhancement algorithm for ocean vector field data based on HSV color mapping and cumulative distribution function. Acta Oceanol. Sin. 2022, 41, 171–180. [Google Scholar] [CrossRef]
- Shi, Q.; Ai, B.; Wen, Y.; Feng, W.; Yang, C.; Zhu, H. Particle System-Based Multi-Hierarchy Dynamic Visualization of Ocean Current Data. ISPRS Int. J. Geo-Inf. 2021, 10, 667. [Google Scholar] [CrossRef]
- Xie, C.; Li, M.; Wang, H.; Dong, J. A survey on visual analysis of ocean data. Vis. Inform. 2019, 3, 113–128. [Google Scholar] [CrossRef]
- Fang, G.; Wang, D.; Huang, H.; Chen, J. A WebGIS system on the base of satellite data processing system for marine application. In Proceedings of the Remote Sensing for Environmental Monitoring, GIS Applications, and Geology VII, Florence, Italy, 17–20 September 2007; pp. 562–570. [Google Scholar]
- Spondylidis, S.; Topouzelis, K.; Kavroudakis, D.; Vaitis, M. Mesoscale Ocean Feature Identification in the North Aegean Sea with the Use of Sentinel-3 Data. J. Mar. Sci. Eng. 2020, 8, 740. [Google Scholar] [CrossRef]
- Zhang, Y.; Li, G.; Yue, R.; Liu, J.; Shan, G. PEViz: An in situ progressive visual analytics system for ocean ensemble data. J. Vis. 2023, 26, 423–440. [Google Scholar] [CrossRef]
- Gao, X.; Zhang, T. Three dimensional visualization analysis for marine field data based on 3D-GIS. In Proceedings of the 6th International Symposium on Digital Earth: Models, Algorithms, and Virtual Reality, Beijing, China, 9–12 September 2009; pp. 331–337. [Google Scholar]
- Su, T.; Cao, Z.; Lv, Z.; Liu, C.; Li, X. Multi-Dimensional visualization of large-scale marine hydrological environmental data. Adv. Eng. Softw. 2016, 95, 7–15. [Google Scholar] [CrossRef]
- Xu, C.; Sun, G.; Liang, R. A survey of volume visualization techniques for feature enhancement. Vis. Inform. 2021, 5, 70–81. [Google Scholar] [CrossRef]
- El Seoud, M.S.A.; Mady, A.S. A comprehensive review on volume rendering techniques. In Proceedings of the 8th International Conference on Software and Information Engineering, Cairo, Egypt, 9–12 April 2019; pp. 126–131. [Google Scholar]
- Zhang, Q.; Eagleson, R.; Peters, T.M. Volume Visualization: A Technical Overview with a Focus on Medical Applications. J. Digit. Imaging 2011, 24, 640–664. [Google Scholar] [CrossRef] [PubMed]
- Liu, R.; Guo, H.; Yuan, X. Seismic structure extraction based on multi-scale sensitivity analysis. J. Vis. 2014, 17, 157–166. [Google Scholar] [CrossRef]
- Song, Y.; Ye, J.; Svakhine, N.; Lasher-Trapp, S.; Baldwin, M.; Ebert, D. An Atmospheric Visual Analysis and Exploration System. IEEE Trans. Vis. Comput. Graph. 2006, 12, 1157–1164. [Google Scholar] [CrossRef]
- Lv, T.; Fu, J.; Li, B. Design and Application of Multi-Dimensional Visualization System for Large-Scale Ocean Data. ISPRS Int. J. Geo-Inf. 2022, 11, 491. [Google Scholar] [CrossRef]
- Tian, F.; Mao, Q.; Zhang, Y.; Chen, G. i4Ocean: Transfer function-based interactive visualization of ocean temperature and salinity volume data. Int. J. Digit. Earth 2021, 14, 766–788. [Google Scholar] [CrossRef]
- Ates, O.; Appukuttan, S.; Fragnaud, H.; Fragnaud, C.; Davison, A.P. NeoViewer: Facilitating reuse of electrophysiology data through browser-based interactive visualization. SoftwareX 2024, 26, 101710. [Google Scholar] [CrossRef]
- Diblen, F.; Hendriks, L.; Stienen, B.; Caron, S.; Bakhshi, R.; Attema, J. Interactive Web-Based Visualization of Multidimensional Physical and Astronomical Data. Front. Big Data 2021, 4, 626998. [Google Scholar] [CrossRef]
- Chen, T.-T.; Sun, Y.-C.; Chu, W.-C.; Lien, C.-Y. BlueLight: An Open Source DICOM Viewer Using Low-Cost Computation Algorithm Implemented with JavaScript Using Advanced Medical Imaging Visualization. J. Digit. Imaging 2023, 36, 753–763. [Google Scholar] [CrossRef]
- Fan, D.; Liang, T.; He, H.; Guo, M.; Wang, M. Large-Scale Oceanic Dynamic Field Visualization Based on WebGL. IEEE Access 2023, 11, 82816–82829. [Google Scholar] [CrossRef]
- Lu, M.; Wang, X.; Liu, X.; Chen, M.; Bi, S.; Zhang, Y.; Lao, T. Web-Based real-time visualization of large-scale weather radar data using 3D tiles. Trans. GIS 2021, 25, 25–43. [Google Scholar] [CrossRef]
- Li, W.; Liang, C.; Yang, F.; Ai, B.; Shi, Q.; Lv, G. A Spherical Volume-Rendering Method of Ocean Scalar Data Based on Adaptive Ray Casting. ISPRS Int. J. Geo-Inf. 2023, 12, 153. [Google Scholar] [CrossRef]
- Liu, L.; Silver, D.; Bemis, K. Visualizing Three-Dimensional Ocean Eddies in Web Browsers. IEEE Access 2019, 7, 44734–44747. [Google Scholar] [CrossRef]
- Qin, R.; Feng, B.; Xu, Z.; Zhou, Y.; Liu, L.; Li, Y. Web-based 3D visualization framework for time-varying and large-volume oceanic forecasting data using open-source technologies. Environ. Model. Softw. 2021, 135, 104908. [Google Scholar] [CrossRef]
- Usta, Z. Webgpu: A New Graphic Api for 3D Webgis Applications. In Proceedings of the 8th International Conference on GeoInformation Advances, Istanbul, Turkey, 11–12 January 2024; pp. 377–382. [Google Scholar]
- Wang, Z.; Yang, L. Performance optimization methods for large scene in WebGL. In Proceedings of the 6th International Conference on Computer Information Science and Application Technology (CISAT 2023), Hangzhou, China, 26–28 May 2023; pp. 1360–1365. [Google Scholar]
- Chickerur, S.; Balannavar, S.; Hongekar, P.; Prerna, A.; Jituri, S. WebGL vs. WebGPU: A Performance Analysis for Web 3.0. Procedia Comput. Sci. 2024, 233, 919–928. [Google Scholar] [CrossRef]
- Yu, G.; Liu, C.; Fang, T.; Jia, J.; Lin, E.; He, Y.; Fu, S.; Wang, L.; Wei, L.; Huang, Q. A survey of real-time rendering on Web3D application. Virtual Real. Intell. Hardw. 2023, 5, 379–394. [Google Scholar] [CrossRef]
- Rew, R.; Davis, G. NetCDF: An interface for scientific data access. IEEE Comput. Graph. Appl. 1990, 10, 76–82. [Google Scholar] [CrossRef]
- Feng, C.; Qin, T.; Ai, B.; Ding, J.; Wu, T.; Yuan, M. Dynamic typhoon visualization based on the integration of vector and scalar fields. Front. Mar. Sci. 2024, 11, 1367702. [Google Scholar] [CrossRef]
- Jia, Z.; Chen, D.; Wang, B. Research on Improved Ray Casting Algorithm and Its Application in Three-Dimensional Reconstruction. Shock Vib. 2021, 2021, 8718523. [Google Scholar] [CrossRef]
- Qu, N.; Yan, Y.; Cheng, T.; Li, T.; Wang, Y. Construction of Underground 3D Visualization Model of Mining Engineering Based on Shear-Warp Volume Computer Rendering Technology. Mob. Inf. Syst. 2022, 2022, 8472472. [Google Scholar] [CrossRef]
- Zhang, X.; Yue, P.; Chen, Y.; Hu, L. An efficient dynamic volume rendering for large-scale meteorological data in a virtual globe. Comput. Geosci. 2019, 126, 1–8. [Google Scholar] [CrossRef]
- Ess, E.; Sun, Y. Visualizing 3D vector fields with splatted streamlines. In Proceedings of the Visualization and Data Analysis 2006, San Jose, CA, USA, 15–19 January 2006. [Google Scholar]
- Levoy, M. Display of surfaces from volume data. Comput. Des. 1988, 20, 29–37. [Google Scholar] [CrossRef]
- Weiler, M.; Kraus, M.; Merz, M.; Ertl, T. Hardware-Based ray casting for tetrahedral meshes. In Proceedings of the IEEE Conference on Visualization, Seattle, WA, USA, 19–24 October 2003; pp. 333–340. [Google Scholar]
- Wang, H.; Xu, G.; Pan, X.; Liu, Z.; Lan, R.; Luo, X.; Zhang, Y. A Novel Ray-Casting Algorithm Using Dynamic Adaptive Sampling. Wirel. Commun. Mob. Comput. 2020, 2020, 8822624. [Google Scholar] [CrossRef]
- Wang, J.; Bi, C.; Deng, L.; Wang, F.; Liu, Y.; Wang, Y. A composition-free parallel volume rendering method. J. Vis. 2021, 24, 531–544. [Google Scholar] [CrossRef]
- Jing, G.; Song, W. An octree ray casting algorithm based on multi-core cpus. In Proceedings of the International Symposium on Computer Science and Computational Technology, ISCSCT, Shanghai, China, 20–22 December 2008; pp. 783–787. [Google Scholar]
- Keil, J.; Edler, D.; Schmitt, T.; Dickmann, F. Creating Immersive Virtual Environments Based on Open Geospatial Data and Game Engines. KN J. Cartogr. Geogr. Inf. 2021, 71, 53–65. [Google Scholar] [CrossRef]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2025 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
Yu, J.; Qin, R.; Xu, Z. The Implementation of a WebGPU-Based Volume Rendering Framework for Interactive Visualization of Ocean Scalar Data. Appl. Sci. 2025, 15, 2782. https://doi.org/10.3390/app15052782
Yu J, Qin R, Xu Z. The Implementation of a WebGPU-Based Volume Rendering Framework for Interactive Visualization of Ocean Scalar Data. Applied Sciences. 2025; 15(5):2782. https://doi.org/10.3390/app15052782
Chicago/Turabian StyleYu, Jiaqi, Rufu Qin, and Zhounan Xu. 2025. "The Implementation of a WebGPU-Based Volume Rendering Framework for Interactive Visualization of Ocean Scalar Data" Applied Sciences 15, no. 5: 2782. https://doi.org/10.3390/app15052782
APA StyleYu, J., Qin, R., & Xu, Z. (2025). The Implementation of a WebGPU-Based Volume Rendering Framework for Interactive Visualization of Ocean Scalar Data. Applied Sciences, 15(5), 2782. https://doi.org/10.3390/app15052782