## 2 Methods
### Ray Casting Algorithm Optimized with Early Ray Termination and Adaptive Sampling Methods  
Technically, there are many well-established direct volume rendering algorithms that have seen extensive applications in visualization research, including ray casting [33; 34], shear-warp [35], texture slicing [36], and splatting [37]. Among these, ray casting, which is based on image sequences [38], is one of the most widely used volume rendering algorithms due to its intuitive nature, straightforward implementation, and capability to produce high-quality visual effects. Thus, we employ it as the core algorithm to visualize the ocean scalar fields. The fundamental principle of the ray casting algorithm applied in this study is as follows:  
First, for each pixel on the image plane, a ray is emitted from the viewpoint in the direction towards the pixel and traverses the three-dimensional volume data. Next, equidistant sampling is performed along the ray with a fixed step size \(\Delta t\), as described in Equation (3), where \(p_{i}\) represents the texture coordinates of the \(i\)-th sampling point, and \(p_{start}\) indicates the texture coordinates of the entry point where the ray intersects the volume. Additionally, \(\overset{\rightarrow}{d}\) denotes the direction of the ray, and \(t_{i}\) represents the distance traversed by the ray within the volume. Subsequently, each sampling point's voxel value can be obtained by interpolation based on the calculated texture coordinates and the volume texture, which stores the volume data. The color and opacity values of the sampling point are then determined according to the voxel value using a specific color mapping method. \[\left\{ \begin{array}{l}p_{i}=p_{start}+t_{i}\overset{\rightarrow}{d}\\ t_{i}=i\Delta t\end{array} \right. \tag{3}\]  
Finally, each pixel's color and opacity values are composited based on the color and opacity values of the sampling points in a front-to-back order, as described in Equation (4). Specifically, \(C_{i}\) represents the color value of the \(i\)-th sampling point, and \(A_{i}\) denotes its opacity value. The accumulated color and opacity values at the \(i\)-th sampling point are represented as \(C_{i}^{\Delta}\) and \(A_{i}^{\Delta}\), respectively, whereas \(C_{i-1}^{\Delta}\) and \(A_{i-1}^{\Delta}\) represent the accumulated values at the previous sampling point. For each pixel, the sampling and calculation processes are completed once the ray finishes traversing the entire volume data completely, generating the color and opacity of the current pixel and ultimately resulting in the final rendered image. \[\left\{ \begin{array}{l}C_{i}^{\Delta}=\left(1-A_{i-1}^{\Delta}\right)\cdot A _{i}C_{i}+C_{i-1}^{\Delta}\\ A_{i}^{\Delta}=\left(1-A_{i-1}^{\Delta}\right)\cdot A_{i}+A_{i-1}^{\Delta} \end{array} \right. \tag{4}\]  
Although the ray casting algorithm offers many advantages, it has limitations in terms of performance. On the one hand, interpolation involving a large number of numerical operations is employed during rendering, significantly increasing the complexity of computations. Moreover, whenever the viewpoint changes, such as zooming in, zooming out, or panning in the volume rendering viewer, the sampling and calculation processes need to be re-executed to generate the updated volume rendering result, which requires a substantial computational overhead. As a result, the efficiency of real-time rendering may be affected, particularly in interactive applications. Therefore, researchers have proposed various optimization methods to reduce the computation and memory overhead, such as early ray termination [39], adaptive sampling [40], and octree [41; 42]. To achieve a smoother and more real-time visualization, we employ several methods to improve the efficiency of the ray casting algorithm in this study. The early ray termination method is first utilized as it is an efficient, straightforward, and easy-to-integrate optimization strategy.