Improved subsurface scattering-based ocean wave transparency rendering method and system
Patent Information
- Application Number
- CN202611367174.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-04
- Publication Date
- 2026-10-30
AI Technical Summary
[0011]为了解决上述技术问题,本发明目的在于提供一种基于改进次表面散射的海浪通透感渲染方法和系统,以水下场景的海面网格数据和光照参数作为输入,通过动态光照调整和波浪高度自适应机制,实时优化次表面散射效果,生成具有真实通透感的海浪渲染结果,解决目前水下场景渲染中计算效率低、动态适应性不足及真实感不强的问题
[0036]1、显著提升渲染效率,实现实时通透感模拟:
Smart Images

Figure CN123015899A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of computer graphics, real-time rendering, and marine environment simulation technology, specifically to a method and system for rendering the transparency of ocean waves based on improved subsurface scattering. Background Technology
[0002] The field of computer graphics and real-time rendering is dedicated to simulating highly realistic natural environments. Among these, the rendering of ocean scenes has attracted much attention due to its wide application in military simulation, virtual reality, ocean exploration, and gaming. The realistic simulation of ocean wave surfaces is key to enhancing user immersion, while the translucency of ocean waves—the semi-transparent effect that appears after light passes through and interacts with the water—is one of the core technical challenges.
[0003] The transparency of seawater physically originates from subsurface scattering (SSS) of light within the water medium. When light strikes the water surface, some is reflected and refracted at the surface, while some enters the water's interior. Inside, the light undergoes multiple absorption and scattering events, altering its intensity, color, and direction, and may eventually exit from other locations near the point of incidence. This process shapes the rich layers of light and shadow and color variations in seawater. For example, wave crests appear brighter and more transparent due to the thinner water layer, while wave troughs appear darker and deeper in color due to the thicker water layer and greater light attenuation. In underwater environments, light propagation is also significantly affected by depth and the inherent optical properties of the water (absorption and scattering coefficients), causing light intensity to decrease with depth and the color to typically shift towards blue-green.
[0004] Traditional surface lighting models, such as those based on the Phong or Blinn-Phong principles, and more complex models based on the Bidirectional Reflectance Distribution Function (BRDF), are primarily designed to describe the surface reflection characteristics of opaque materials. These models assume that the interaction between light and the material occurs only in an infinitely thin surface layer, failing to adequately simulate the complex process of light entering the medium, undergoing volume scattering, and then re-emerging. Therefore, they have fundamental limitations in representing the transparency of semi-transparent materials such as seawater.
[0005] To accurately describe light transmission in translucent materials, the Bidirectional Scattering Surface Reflectance Distribution Function (BSSRDF) was proposed. BSSRDF establishes the energy transfer relationship between any incident and outgoing light rays (involving different points on the surface) through integral calculations, accurately simulating subsurface scattering phenomena and generating highly physically realistic rendering effects. However, BSSRDF calculations involve complex volume and surface integrals, resulting in enormous computational costs, making it difficult to meet the performance requirements of real-time rendering applications (especially in underwater dynamic simulations or interactive applications that require maintaining a stable frame rate of 60 FPS or higher).
[0006] Given the computational bottleneck of accurate BSSRDF models, various SSS approximation algorithms have been developed in the real-time rendering field. These include thickness / depth-based approximations (simulating optical path length by calculating the depth difference between the front and back surfaces), texture space / pre-computation methods, backlighting / surround lighting simulation methods, and screen-space filtering post-processing. While modern rendering engines (such as Unreal Engine 4) offer advanced shader systems and post-processing pipelines, the implementation of subsurface scattering for specific underwater dynamic environments often still requires deep customization by developers. In summary, current real-time rendering technologies for simulating the transparency of ocean waves still have room for improvement in balancing computational efficiency, dynamic adaptability, and visual realism. Specifically, existing technologies have the following shortcomings:
[0007] The contradiction between high computational complexity and real-time performance: The physical models for accurately simulating subsurface scattering (SSS) (such as BSSRDF) require extremely large computational resources, making them difficult to apply to real-time underwater scene simulations that require high frame rates.
[0008] The approximation algorithm lacks dynamic adaptability: commonly used pre-computed texture or simple thickness estimation methods are difficult to respond in real time to rapid changes in wave morphology caused by factors such as wind; at the same time, the feedback on underwater depth and dynamic lighting (such as changes in the sun angle) is insufficient, resulting in distortion of the effect under different environmental conditions.
[0009] The simulation of back lighting is too simplistic: existing approximation methods handle the effect of light passing through the material from the back in a rather simple way, and fail to fully establish the physical relationship between the intensity of back lighting and the actual thickness of the water (wave height), the angle of incidence, and the surface normal.
[0010] The realism of the rendering needs to be improved: Due to oversimplification, real-time rendering has difficulty in presenting the visual contrast between "high transparency at the crest" and "deep depth at the trough" at the same time, and it cannot accurately reflect the color and intensity attenuation of light as the water depth increases, which affects the overall realism of the underwater scene. Summary of the Invention
[0011] To address the aforementioned technical problems, the present invention aims to provide a method and system for rendering ocean waves with improved subsurface scattering. Using sea surface mesh data and lighting parameters from an underwater scene as input, the method optimizes the subsurface scattering effect in real time through dynamic lighting adjustment and wave height adaptation mechanisms, generating ocean wave rendering results with realistic transparency. This solves the problems of low computational efficiency, insufficient dynamic adaptability, and weak realism in current underwater scene rendering.
[0012] This invention is achieved through the following technical solution:
[0013] A method for rendering the transparency of ocean waves based on improved subsurface scattering includes the following steps:
[0014] S1: Obtain the sea surface mesh data and real-time lighting parameters of the underwater scene, using the current vertex to be rendered as the execution unit. The sea surface mesh data includes the current vertex position, the current vertex normal, and the real-time wave height of the current vertex relative to the still water surface. The lighting parameters include the light source direction, light source intensity, line of sight direction, and the water depth at the corresponding position of the current vertex. Set the subsurface scattering transmittance coefficient and ambient lighting surround parameters.
[0015] S2: Based on the water depth, the water thickness value corresponding to the current vertex, the subsurface scattering transmittance coefficient, and the preset maximum water depth, calculate the subsurface scattering intensity of the current vertex; calculate the diffuse reflection component of the current vertex using the vertex normal, the light source direction, and the ambient lighting parameters; calculate the specular reflection component of the current vertex using the vertex normal, the light source direction, the viewing direction, and the preset specular index; combine the diffuse reflection component, the specular reflection component, and the subsurface scattering intensity to obtain the conventional ambient lighting component of the current vertex.
[0016] S3: Introduce a virtual backlight direction opposite to the light source direction, and combine it with the line of sight, the vertex normal and the preset subsurface offset rate to calculate the backlight intensity of the current vertex, which is used to simulate the physical effect of light passing through the back of the seawater.
[0017] S4: Based on the water depth and the preset maximum water depth, calculate the ambient light weight and subsurface scattering weight; based on the real-time wave height and the preset maximum wave height, dynamically adjust the subsurface scattering intensity to obtain the final subsurface scattering intensity; using the ambient light weight and the subsurface scattering weight, perform weighted fusion of the traditional ambient light component and the final subsurface scattering intensity, and superimpose the backlight intensity to obtain the final scene lighting component of the current vertex;
[0018] S5: Input the final scene lighting components into the rendering pipeline and combine them with the shader to generate the wave rendering result.
[0019] In S2, the method for obtaining the water thickness value corresponding to the current vertex includes: obtaining the front surface depth (frontDepth) and back surface depth (backDepth) of the wave at the current vertex location based on the real-time geometric shape of the real-time wave height, and calculating the depth difference between the front and back surfaces of the wave, using the following formula: , depth represents the thickness of the water body.
[0020] In S2, the formula for calculating the subsurface scattering intensity of the current vertex is: scattering represents the subsurface scattering intensity at the current vertex, depth represents the water thickness at the current vertex, C represents the subsurface scattering transmittance coefficient, and D represents the subsurface scattering transmittance coefficient. w D represents the depth of the water body. max This represents the preset maximum water depth, and exp is the natural exponential function.
[0021] In S2, the formula for calculating the diffuse reflection component is: diffuse represents the diffuse component. Represents the vertex normal. Indicates the direction of the light source; wrap represents the ambient lighting surround parameter. ;
[0022] The formula for calculating the specular reflection component is: Specular represents the specular component. Represents the vertex normal. Indicates the direction of the light source. Indicates the direction of the gaze; shininess indicates the preset highlight index.
[0023] The formula for calculating the traditional ambient light component of the current vertex is: , Indicates the traditional ambient light component. Indicates the intensity of the light source.
[0024] In S3, the formula for calculating the back illumination intensity is as follows: , Indicates the direction of the virtual light source on the back. Indicates the direction of the line of sight. Represents the vertex normal. Indicates the preset subsurface offset rate , Indicates the intensity of light illuminating the back side.
[0025] In S4, the calculation formulas for ambient lighting weight and subsurface scattering weight are as follows: , Indicates the ambient light weight. Indicates water depth. This indicates the preset maximum water depth. This represents the subsurface scattering weight.
[0026] In S4, the formula for calculating the final subsurface scattering intensity is: , Indicates the final subsurface scattering intensity. This represents the subsurface scattering intensity of the current vertex. This indicates the real-time wave height at the current vertex. This indicates the preset maximum wave height.
[0027] In S4, the formula for calculating the final scene lighting components of the current vertex is: + , This represents the final scene lighting components.
[0028] In S5, the wave rendering result is generated by combining the shader, including: using the shader of Unreal Engine 4 to render, the generated rendering result dynamically presents a transparent effect with high transparency of wave peaks and deep transparency of wave troughs, and the rendering frame rate is stably maintained above 60FPS.
[0029] On the other hand, a wave transparency rendering system based on improved subsurface scattering includes:
[0030] Acquisition and parameter setting module: used to acquire sea surface mesh data and real-time lighting parameters of the underwater scene, with the current vertex to be rendered as the execution unit. The sea surface mesh data includes the current vertex position, the current vertex normal, and the real-time wave height of the current vertex relative to the still water surface. The lighting parameters include the light source direction, light source intensity, line of sight direction, and the water depth at the corresponding position of the current vertex; and setting the subsurface scattering transmittance coefficient and ambient lighting surround parameters.
[0031] The subsurface scattering and ambient lighting calculation module is used to: calculate the subsurface scattering intensity of the current vertex based on the water depth, the water thickness value corresponding to the current vertex, the subsurface scattering transmittance coefficient, and the preset maximum water depth; calculate the diffuse reflection component of the current vertex using the vertex normal, the light source direction, and the ambient lighting surround parameters; calculate the specular reflection component of the current vertex using the vertex normal, the light source direction, the viewing direction, and the preset specular index; and combine the diffuse reflection component, the specular reflection component, and the subsurface scattering intensity to obtain the conventional ambient lighting component of the current vertex.
[0032] Backlighting Calculation Module: Used to introduce a virtual backlighting direction opposite to the light source direction, and combine it with the viewing direction, the vertex normal and the preset subsurface offset rate to calculate the backlighting intensity of the current vertex, which is used to simulate the physical effect of light passing through the back of the seawater.
[0033] Dynamic adjustment and fusion module: used to calculate ambient light weight and subsurface scattering weight based on the water depth and the preset maximum water depth; dynamically adjust the subsurface scattering intensity based on the real-time wave height and the preset maximum wave height to obtain the final subsurface scattering intensity; use the ambient light weight and the subsurface scattering weight to perform weighted fusion of the traditional ambient light component and the final subsurface scattering intensity, and superimpose the backlight intensity to obtain the final scene lighting component of the current vertex;
[0034] Rendering output module: Used to input the final scene lighting components into the rendering pipeline and combine them with shaders to generate wave rendering results.
[0035] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0036] 1. Significantly improves rendering efficiency and achieves real-time transparency simulation:
[0037] This invention approximates the subsurface scattering intensity using depth difference (depth = backDepth - frontDepth), replacing the extremely complex BSSRDF integral calculation. Combined with simplified calculations of the backlight virtual light source and final lighting fusion, the overall computational cost is significantly lower than that of an accurate physical model. This greatly reduces the computational overhead of simulating the transparency of seawater, enabling this method to run efficiently on modern graphics hardware (such as in the UE4 engine). It solves the problem of excessive computational cost and difficulty in real-time application of accurate models in existing technologies, and can stably maintain a high frame rate in target application scenarios (such as underwater simulation).
[0038] 2. Enhance real-time adaptability to dynamic marine environments:
[0039] The scattering intensity calculation in this invention is directly related to the depth difference obtained in real time through a depth buffer, which changes dynamically with the undulations of the waves. The calculation of scattering intensity and final illumination explicitly incorporates the influence factor of water depth. The final scattering effect is further adjusted using wave height. This allows the rendered wave transparency to respond in real time to dynamic changes in wave shape, changes in water depth due to changes in the viewpoint or scene, and changes in the direction of the light source. This solves the problem of insufficient adaptability to dynamic environments in existing approximation algorithms and improves the dynamic realism of the rendering results.
[0040] 3. Provides more realistic backlighting simulation:
[0041] This invention introduces a virtual backlight source, and its intensity calculation considers not only the viewing direction and the light source direction, but also the surface normal and an adjustable subsurface offset rate (δ). Compared to simple wrap lighting, this method can more meticulously simulate the scattering direction and intensity of light as it penetrates water, influenced by the surface orientation. This makes the effect of backlight transmission more physically intuitive, solves the problem of overly simplistic backlight simulation in existing technologies, and enhances the realism of the translucent texture.
[0042] 4. Significantly enhances the visual realism and layering of the waves' transparency:
[0043] By combining real-time depth difference calculations to determine the base scattering intensity and adjusting the final scattering effect using wave height, the optical performance of water bodies with different thicknesses can be better distinguished. By introducing a water depth factor to adjust the scattering intensity and performing depth-weighted mixing, the phenomenon of light attenuation with depth underwater is simulated. The final rendering result more realistically showcases the visual contrast between the relative transparency of wave crests (thin water layer, small depth) and the relative depth and significant light attenuation of wave troughs (thick water layer, large depth), while also reflecting the overall impact of water depth on transparency. This solves the problems of insufficient rendering layering and failure to fully represent wave morphology and water depth in existing technologies, resulting in a more realistic and detailed visual representation of ocean waves. Attached Figure Description
[0044] To more clearly illustrate the technical solutions of the exemplary embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly described below. It should be understood that the following drawings only show some embodiments of the present invention and should not be considered as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort. In the drawings:
[0045] Figure 1 This is a flowchart of a wave transparency rendering method based on improved subsurface scattering according to Embodiment 1 of the present invention;
[0046] Figure 2 This is a flowchart illustrating the adjustment of subsurface scattering intensity according to Embodiment 1 of the present invention;
[0047] Figure 3 This is a flowchart illustrating the calculation of back illumination intensity according to Embodiment 1 of the present invention;
[0048] Figure 4 This is a flowchart illustrating the final scene illumination component adjustment according to Embodiment 1 of the present invention;
[0049] Figure 5 This is a block diagram of the logical structure of a wave transparency rendering system based on improved subsurface scattering according to Embodiment 2 of the present invention. Detailed Implementation
[0050] To make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the embodiments and accompanying drawings. The illustrative embodiments and descriptions of the present invention are only used to explain the present invention and are not intended to limit the present invention.
[0051] Example 1
[0052] like Figure 1-4 As shown in the figure, the wave transparency rendering method based on improved subsurface scattering provided in this embodiment addresses the shortcomings of low computational efficiency, insufficient dynamic adaptability, and weak realism in existing underwater scene rendering. Using the sea surface mesh data and lighting parameters of the underwater scene as input, it optimizes the subsurface scattering effect in real time through dynamic lighting adjustment and wave height adaptive mechanisms, generating wave rendering results with realistic transparency. It is applicable to underwater exploration, marine virtual reality, and underwater scene simulation systems.
[0053] The hardware platform in this embodiment can be a rendering device with general graphics processing capabilities, such as a computer system based on the Unreal Engine 4.
[0054] The wave transparency rendering method based on improved subsurface scattering in this embodiment may include the following steps:
[0055] S1: Obtain the sea surface mesh data and real-time lighting parameters of the underwater scene, using the current vertex to be rendered as the execution unit. The sea surface mesh data includes the current vertex position. Current vertex normal Real-time wave height relative to the current peak and the still water surface Illumination parameters include the direction of the light source. Light source intensity Direction of sight Water depth at the current vertex position Set the subsurface scattering transmittance coefficient. and ambient lighting parameters Parameters can be manually adjusted according to specific style requirements.
[0056] This step involves obtaining initial rendering data and setting parameters. It avoids the complex volume integration calculations required by traditional, accurate BSSRDF models, providing necessary parallel data support for subsequent efficient real-time computation and laying the foundation for smooth rendering at over 60 FPS.
[0057] S2: Based on the water depth, the water thickness value corresponding to the current vertex, the subsurface scattering transmittance coefficient, and the preset maximum water depth, calculate the subsurface scattering intensity of the current vertex; calculate the diffuse reflection component of the current vertex using the vertex normal, the light source direction, and the ambient lighting parameters; calculate the specular reflection component of the current vertex using the vertex normal, the light source direction, the view direction, and the preset specular index; combine the diffuse reflection component, the specular reflection component, and the subsurface scattering intensity to obtain the conventional ambient lighting component of the current vertex.
[0058] This step involves calculating the basic subsurface scattering intensity and constructing conventional ambient lighting.
[0059] One method to obtain the water thickness value corresponding to the current vertex may be: based on the real-time geometry of the wave height, obtain the front surface depth (frontDepth) and back surface depth (backDepth) of the wave at the current vertex location, and calculate the depth difference between the front and back surfaces of the wave, using the following formula: 'depth' represents the water thickness. The water thickness value calculated through real-time ocean wave geometry can accurately match the dynamic changes in ocean wave shape, avoiding the errors caused by traditional fixed thickness estimation and ensuring the accuracy of subsurface scattering intensity calculation.
[0060] The formula for calculating the subsurface scattering intensity at the current vertex can be: scattering represents the subsurface scattering intensity at the current vertex, depth represents the water thickness at the current vertex, C represents the subsurface scattering transmittance coefficient, and D represents the subsurface scattering transmittance coefficient. w D represents the depth of the water body. max The preset maximum water depth is represented by exp, which is a natural exponential function used to dynamically adjust the scattering intensity to adapt to changes in wave height. By introducing the water depth and the preset maximum water depth to correct the basic subsurface scattering intensity, the algorithm can adapt to the light transmission attenuation characteristics of different sea depths, thus improving its adaptability to dynamic marine environments.
[0061] The formula for calculating the diffuse reflection component is as follows: diffuse represents the diffuse reflection component. Represents the vertex normal. Indicates the direction of the light source; wrap represents the ambient lighting surround parameter. The formula for calculating the specular reflection component is as follows: , Specular represents the specular component. Represents the vertex normal. Indicates the direction of the light source. This indicates the viewing direction, and `shininess` represents the preset specular index. By introducing ambient lighting parameters to correct traditional diffuse reflection calculations, it effectively simulates the transmission and scattering of light at the edge of a thin layer of water in ocean waves. This effectively improves the harshness of flat, black areas in backlit regions, giving the waves a rich, physically accurate sense of light and shadow and transparency. The entire calculation process adds only one manually adjustable parameter, resulting in a simple structure that allows for flexible adjustment of the transparency level according to different rendering styles.
[0062] The formula for calculating the traditional ambient lighting component of the current vertex can be: , Indicates the traditional ambient light component. This represents the intensity of the light source. It incorporates subsurface scattering into the traditional classical lighting model, and the overall calculation involves only simple vector and exponential operations, resulting in low computational complexity. It requires no additional preprocessing steps or complex offline caching data, thus meeting the efficiency requirements of real-time rendering.
[0063] The obtained traditional ambient lighting components have initially reflected the light transmission characteristics of the waves, providing an accurate calculation basis for the final generation of realistic and transparent wave rendering results.
[0064] S3: Introducing a virtual backlight direction opposite to the light source direction, and combining the viewing direction, vertex normal, and preset subsurface offset rate, calculates the backlight intensity of the current vertex to simulate the physical effect of light passing through the back of seawater. The virtual backlight direction is the opposite of the light source direction, and the normal offset term simulates the scattering direction shift of light within the medium.
[0065] This step involves introducing a virtual backlight source to calculate the back-transmitted light. The formula for calculating the back-light intensity is as follows: , Indicates the intensity of light on the back side, one Indicates the direction of the virtual light source on the back. Indicates the direction of the line of sight. Represents the vertex normal. This indicates the preset subsurface offset rate. This controls the direction and intensity of light scattering from the back.
[0066] By introducing a virtual light source, the calculation process for back-view transmitted lighting is simplified. There is no need to perform complex path tracing calculations for the multiple scattering processes of light inside the seawater. While maintaining extremely low computational complexity, it accurately reproduces the physical effect of light illuminating the water from the back after passing through the waves. This not only solves the problem of the overall dark back of the waves and lack of transparency and layering in traditional real-time wave rendering, but also adapts to the dynamically changing wave mesh vertex information and updates the back-view lighting intensity in real time with the movement of the wave shape, effectively ensuring the real-time performance and realism of the overall rendering.
[0067] S4: Based on the water depth and the preset maximum water depth, calculate the ambient light weight and subsurface scattering weight; based on the real-time wave height and the preset maximum wave height, dynamically adjust the subsurface scattering intensity to obtain the final subsurface scattering intensity; using the ambient light weight and the subsurface scattering weight, perform weighted fusion of the traditional ambient light component and the final subsurface scattering intensity, and superimpose the backlight intensity to obtain the final scene lighting component of the current vertex.
[0068] This step involves dynamic weight fusion, dynamically adjusting the lighting and scattering effects.
[0069] The formulas for calculating ambient lighting weight and subsurface scattering weight are as follows: ,
[0070] Indicates the ambient light weight. Indicates water depth. This indicates the preset maximum water depth. This represents the subsurface scattering weight. The formula for calculating the final subsurface scattering intensity is: , Indicates the final subsurface scattering intensity. This represents the subsurface scattering intensity of the current vertex. This indicates the real-time wave height at the current vertex. This indicates the preset maximum wave height. By adaptively allocating the weight ratio of ambient light and subsurface scattering based on water depth, it conforms to the optical principle that ambient reflection dominates in shallow waters and subsurface light transmission is more significant in deep waters, naturally distinguishing the light levels at different depths. The introduction of real-time wave height dynamically adjusts the subsurface scattering intensity, matching the real physical characteristics of thinner and more transparent waves at the crest, making the dynamic changes in the transparency of the waves more consistent with real visual patterns.
[0071] The formula for calculating the final scene lighting components of the current vertex can be: + , This represents the final scene lighting components. During final blending, the backlighting component is superimposed, further enhancing the light and shadow levels as light penetrates the waves, avoiding similar transparency across waves of different depths and shapes. All calculations are linear operations based on vertex parameters, resulting in low computational complexity and fully meeting the efficiency requirements for real-time rendering of dynamic waves.
[0072] S5: The final scene lighting components Input the rendering pipeline and combine it with shaders to generate the wave rendering result.
[0073] This step generates the rendering result. Unreal Engine 4 shaders can be used for rendering, dynamically presenting a transparent effect with high transparency at wave peaks and deep troughs, while maintaining a stable frame rate above 60 FPS. Leveraging low-complexity shader calculations, high-frame-rate real-time rendering (above 60 FPS) can be stably achieved in mainstream graphics pipelines. In terms of visual presentation, it accurately simulates the dominant reflection in shallow to medium water environments and the enhanced subsurface scattering in deep water, resulting in realistic light and shadow levels with high transparency at wave peaks and deep troughs, effectively solving the problem of homogenized transparency in traditional rendering.
[0074] Example
[0075] Implemented using Unreal Engine 4 (UE4), the specific steps are as follows:
[0076] For a 20km x 20km underwater scene area, including dynamic ocean waves and underwater lighting effects, the observation point is located 10m below the water surface at (000, 10000, -10), and the light source is sunlight, directed from [location missing]. ,strength Preset maximum water depth Preset maximum wave height m.
[0077] Acquire underwater scene sea surface mesh data and lighting parameters, load the sea surface mesh data through UE4, and the area range is [missing information]. It contains approximately 10 million triangles, and the vertex data includes position... normal line Wave height Illumination parameters include the direction of the light source. ,strength Water depth Set the subsurface scattering transmittance coefficient. Ambient lighting parameters Data is transmitted through UE4. The wave height is dynamically generated by the noise function.
[0078] Calculate traditional ambient lighting components based on vertex normals and the direction of the light source Calculate the diffuse and specular reflection components. Using the normal to a certain vertex... For example:
[0079] ;
[0080] Since diffuse must be non-negative, we take... Direction of gaze Calculate highlights:
[0081] ;
[0082] Assuming scattering = 1.0 (calculated in subsequent steps), the ambient light component is: .
[0083] This vertex is located in a dark area and requires subsequent scattering components to supplement its brightness.
[0084] Calculate the adaptive depth value for wave height, taking a certain vertex as an example, wave height The depth difference before and after is calculated using the UE4 depth buffer: .
[0085] Combined with water depth m, light attenuation coefficient Maximum depth Calculate the scattering intensity: .
[0086] Generate a thickness map and dynamically adjust the scattering intensity.
[0087] 1000 cluster centers were generated after clustering. ,For example The mean is: .
[0088] Introducing a back-side virtual light source to calculate subsurface scattering; introducing the direction of the back-side virtual light source. Direction of gaze normal Offset Calculate the back illumination intensity:
[0089] .
[0090] Backlight intensity This indicates a weak scattering effect.
[0091] Dynamically adjust lighting and scattering effects according to water depth Maximum depth Calculate the weights:
[0092] ;
[0093] Combined with wave height Maximum height Adjusting scattering intensity: scattering scattering ;
[0094] Blending of light components: .
[0095] Real-time rendering of the transparent wave effect: The Color final is input into the UE4 shader, and the wave effect is rendered in combination with the material system. The wave crests are highly transparent, and the troughs are deep, with the frame rate maintained above 60 FPS. The rendering area covers [(9000, 9000, -20), (11000, 11000, 0)] to present a realistic and transparent effect.
[0096] Key parameters of the example:
[0097] Parameter name Parameter value <![CDATA[ D1]]> Scene range [(0,0,-100),(20000,20000,0)] <![CDATA[D2]]> Observation point location (10000, 10000, -10) <![CDATA[X0]]> Light source direction (0.5, 0.5, -0.7) <![CDATA[Y0]]> <![CDATA[Water depth D w =10m]]> <![CDATA[X B ]]> <![CDATA[Maximum wave height H max =2m]]> <![CDATA[Y B ]]> Light transmittance coefficient C = 0.1
[0098] Calculate the scattering intensity at a certain vertex. .
[0099] Calculate the final illumination component of a vertex. , .
[0100] This embodiment achieves efficient real-time subsurface scattering simulation. While avoiding the use of computationally expensive, precise BSSRDF models, an optimized subsurface scattering (SSS) calculation method was developed. This method effectively simulates the core physical processes of seawater transparency while meeting real-time rendering performance requirements (e.g., ≥60 FPS). It enhances the rendering's adaptability to dynamic environments, enabling the rendering effect of sea wave transparency to respond accurately and in real-time to dynamically changing environmental factors, including wave height variations with time and external forces, changes in water depth caused by changes in the viewpoint or scene, and changes in dynamic light sources, ensuring that the rendering results remain consistent with the environmental conditions. It improves the physical realism of backlighting simulation by designing a more physically sound and computationally feasible backlighting simulation mechanism. This mechanism reflects the interaction between the intensity of backlight transmitted light and the actual water thickness, surface normal, and lighting / viewing direction, thus more realistically representing the effect of light penetrating water. The visual realism of the waves' transparency has been enhanced. Through the improved SSS algorithm and dynamic adjustment mechanism, the visual fidelity of the rendering results has been significantly improved. In particular, it can clearly distinguish and realistically display the high transparency of the wave crest area due to the thinner water body, as well as the deep appearance of the wave trough area due to the thicker water body and the more significant light attenuation. It also accurately reflects the impact of water depth on the overall lighting and scattering intensity.
[0101] Alternative solution:
[0102] 1. Alternative basis for subsurface scattering (SSS) intensity calculation:
[0103] Screen-space thickness approximation: This method estimates the water thickness corresponding to a pixel by sampling the depth buffer multiple times in screen space (e.g., along the normal or view direction), instead of relying on the difference between the front and back depth buffers. This avoids additional rendering passes, but its accuracy is affected by screen resolution and sampling strategy.
[0104] 2. Alternative methods for simulating backlighting:
[0105] Simple Wrap Lighting with Thickness Modulation: It directly uses traditional wrap lighting, but modulates its intensity or range of influence (the wrap value itself) according to the calculated depth or scattering value, making the "light transmission" effect of thick areas weaker.
[0106] Screen-space scattering / blurring: Instead of calculating explicit backlighting, it applies a variable-radius blur (such as Gaussian blur) to the lighting result (or a specific lighting component) in screen space. The blur radius is determined by the pixel's depth. This simulates the effect of light spreading more widely in thin areas.
[0107] Normal perturbation / blurring: Based on the water body thickness (depth), the surface normal used for lighting calculations is perturbed or blurred to a certain extent to simulate the change in the outgoing direction of light caused by scattering when light penetrates near the surface, indirectly affecting the lighting calculation results and producing a soft sense of light transmission.
[0108] In contrast, the preferred technical solution of this embodiment fully overcomes the shortcomings of the aforementioned alternatives. This embodiment preferably utilizes thickness map generation based on the depth difference of real-time sea surface mesh vertices, and employs a back-side virtual light source dot product method with offset rate, which can achieve pixel-level geometric fitting without loss of screen space precision or blur artifacts, and the computational overhead remains extremely low.
[0109] Example 2
[0110] like Figure 5 As shown, this embodiment provides a wave transparency rendering system based on improved subsurface scattering, which corresponds one-to-one with the wave transparency rendering method based on improved subsurface scattering in Embodiment 1. It is used to implement the wave transparency rendering method based on improved subsurface scattering in Embodiment 1 and may include:
[0111] Acquisition and parameter setting module: used to acquire sea surface mesh data and real-time lighting parameters of the underwater scene, with the current vertex to be rendered as the execution unit. The sea surface mesh data includes the current vertex position, the current vertex normal and the real-time wave height of the current vertex relative to the still water surface. The lighting parameters include the light source direction, light source intensity, line of sight direction and the water depth at the corresponding position of the current vertex; and setting the subsurface scattering transmittance coefficient and ambient lighting surround parameters.
[0112] The subsurface scattering and ambient lighting calculation module is used to calculate the subsurface scattering intensity of the current vertex based on the water depth, the water thickness value corresponding to the current vertex, the subsurface scattering transmittance coefficient, and the preset maximum water depth; calculate the diffuse reflection component of the current vertex using the vertex normal, the light source direction, and the ambient lighting surround parameters; calculate the specular reflection component of the current vertex using the vertex normal, the light source direction, the viewing direction, and the preset specular index; and combine the diffuse reflection component, the specular reflection component, and the subsurface scattering intensity to obtain the conventional ambient lighting component of the current vertex.
[0113] This module employs a dual adaptive subsurface scattering intensity calculation based on both wave height and water depth. By combining real-time acquired depth differences and overall water depth, the basic scattering intensity is calculated, ensuring that the scattering effect simultaneously responds to both instantaneous wave morphology and the water depth at the location.
[0114] use Alternatively, a function that reflects both depth difference and water depth can be used to calculate the real-time SSS (Subsurface Scattering) intensity.
[0115] Backlighting Calculation Module: This module is used to introduce a virtual backlighting direction opposite to the light source direction, and, in combination with the viewing direction, the vertex normal, and the preset subsurface offset rate, calculate the backlighting intensity of the current vertex to simulate the physical effect of light passing through the back of seawater.
[0116] This module introduces a controllable offset virtual backlight simulation. This is achieved through a specific backlighting calculation method (I... back The effective direction of the virtual backlight is adjusted by using the surface normal and an adjustable offset rate (δ), thereby allowing for more precise control over the intensity and directionality of the backlight transmitted.
[0117] That is, to utilize Alternatively, a formula that includes normals and controllable offset parameters can be used to calculate the backlight contribution.
[0118] Dynamic adjustment and fusion module: used to calculate ambient light weight and subsurface scattering weight based on the water depth and the preset maximum water depth; dynamically adjust the subsurface scattering intensity based on the real-time wave height and the preset maximum wave height to obtain the final subsurface scattering intensity; use the ambient light weight and the subsurface scattering weight to perform weighted fusion of the traditional ambient light component and the final subsurface scattering intensity, and superimpose the backlight intensity to obtain the final scene lighting component of the current vertex.
[0119] Light component mixing is performed using a weight based on water depth, and the SSS intensity is dynamically adjusted according to the real-time wave height.
[0120] This module implements dynamic lighting fusion and adjustment based on water depth weights and wave height. The final color is achieved by dynamically mixing ambient light and subsurface scattering components using weights based on water depth, and then superimposing the backlight intensity; furthermore, the final intensity of the scattering component is further modulated by the real-time wave height. adjusted This enhances the visual distinction between peaks and troughs.
[0121] Rendering output module: Used to input the final scene lighting components into the rendering pipeline and combine them with shaders to generate wave rendering results.
[0122] The system in this embodiment is applied to real-time rendering of the transparency of ocean waves. That is, through the coordinated operation of the above modules, it achieves efficient, dynamically adaptable, and visually rich rendering of the transparency of ocean waves.
[0123] Example 3
[0124] An electronic device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the wave transparency rendering method based on improved subsurface scattering described in Embodiment 1.
[0125] Example 4
[0126] A computer-readable storage medium comprising a computer program, which, when executed by a processor, implements the steps of the wave transparency rendering method based on improved subsurface scattering described in Embodiment 1.
[0127] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for rendering the transparency of ocean waves based on improved subsurface scattering, characterized in that, Includes the following steps: S1: Obtain the sea surface mesh data and real-time lighting parameters of the underwater scene, using the current vertex to be rendered as the execution unit. The sea surface mesh data includes the current vertex position, the current vertex normal, and the real-time wave height of the current vertex relative to the still water surface. The lighting parameters include the light source direction, light source intensity, line of sight direction, and the water depth at the corresponding position of the current vertex. Set the subsurface scattering transmittance coefficient and ambient lighting surround parameters. S2: Calculate the subsurface scattering intensity of the current vertex based on the water depth, the water thickness value corresponding to the current vertex, the subsurface scattering transmittance coefficient, and the preset maximum water depth. The diffuse component of the current vertex is calculated using the vertex normal, the light source direction, and the ambient lighting parameters. The specular reflection component of the current vertex is calculated using the vertex normal, the light source direction, the viewing direction, and the preset specular index. The diffuse reflection component, the specular reflection component, and the subsurface scattering intensity are combined to obtain the conventional ambient lighting component of the current vertex. S3: Introduce a virtual backlight direction opposite to the light source direction, and combine it with the line of sight, the vertex normal and the preset subsurface offset rate to calculate the backlight intensity of the current vertex, which is used to simulate the physical effect of light passing through the back of the seawater. S4: Based on the water depth and the preset maximum water depth, calculate the ambient light weight and subsurface scattering weight; Based on the real-time wave height and the preset maximum wave height, the subsurface scattering intensity is dynamically adjusted to obtain the final subsurface scattering intensity; using the ambient lighting weight and the subsurface scattering weight, the traditional ambient lighting component and the final subsurface scattering intensity are weighted and fused, and the backlighting intensity is superimposed to obtain the final scene lighting component of the current vertex. S5: Input the final scene lighting components into the rendering pipeline and combine them with the shader to generate the wave rendering result.
2. The wave transparency rendering method based on improved subsurface scattering as described in claim 1, characterized in that, In S2, the method for obtaining the water thickness value corresponding to the current vertex includes: obtaining the front surface depth (frontDepth) and back surface depth (backDepth) of the wave at the current vertex location based on the real-time geometric shape of the real-time wave height, and calculating the depth difference between the front and back surfaces of the wave, using the following formula: , depth represents the thickness of the water body.
3. The wave transparency rendering method based on improved subsurface scattering as described in claim 1, characterized in that, In S2, the formula for calculating the subsurface scattering intensity of the current vertex is: scattering represents the subsurface scattering intensity at the current vertex, depth represents the water thickness at the current vertex, C represents the subsurface scattering transmittance coefficient, and D represents the subsurface scattering transmittance coefficient. w D represents the depth of the water body. max This represents the preset maximum water depth, and exp is the natural exponential function.
4. The wave transparency rendering method based on improved subsurface scattering as described in claim 3, characterized in that, In S2, the formula for calculating the diffuse reflection component is: diffuse represents the diffuse component. Represents the vertex normal. Indicates the direction of the light source; wrap represents the ambient lighting surround parameter. ; The formula for calculating the specular reflection component is: , Specular represents the specular component. Represents the vertex normal. Indicates the direction of the light source. Indicates the direction of the gaze; shininess indicates the preset highlight index. The formula for calculating the traditional ambient light component of the current vertex is: , Indicates the traditional ambient light component. Indicates the intensity of the light source.
5. The wave transparency rendering method based on improved subsurface scattering as described in claim 1, characterized in that, In S3, the formula for calculating the back illumination intensity is as follows: ,one Indicates the direction of the virtual light source on the back. Indicates the direction of the line of sight. Represents the vertex normal. This indicates the preset subsurface offset rate. , Indicates the intensity of light illuminating the back side.
6. The wave transparency rendering method based on improved subsurface scattering as described in claim 5, characterized in that, In S4, the calculation formulas for ambient lighting weight and subsurface scattering weight are as follows: , Indicates the ambient light weight. Indicates water depth. This indicates the preset maximum water depth. This represents the subsurface scattering weight.
7. The wave transparency rendering method based on improved subsurface scattering as described in claim 6, characterized in that, In S4, the formula for calculating the final subsurface scattering intensity is: , Indicates the final subsurface scattering intensity. This represents the subsurface scattering intensity of the current vertex. This indicates the real-time wave height at the current vertex. This indicates the preset maximum wave height.
8. The wave transparency rendering method based on improved subsurface scattering as described in claim 7, characterized in that, In S4, the formula for calculating the final scene lighting components of the current vertex is: + , This represents the final scene lighting components.
9. The wave transparency rendering method based on improved subsurface scattering as described in claim 1, characterized in that, In S5, the wave rendering result is generated by combining the shader, including: using the shader of Unreal Engine 4 to render, the generated rendering result dynamically presents a transparent effect with high transparency of wave peaks and deep transparency of wave troughs, and the rendering frame rate is stably maintained above 60FPS.
10. A wave transparency rendering system based on improved subsurface scattering, characterized in that, include: Acquisition and parameter setting module: used to acquire sea surface mesh data and real-time lighting parameters of the underwater scene, with the current vertex to be rendered as the execution unit. The sea surface mesh data includes the current vertex position, the current vertex normal, and the real-time wave height of the current vertex relative to the still water surface. The lighting parameters include the light source direction, light source intensity, line of sight direction, and the water depth at the corresponding position of the current vertex; and setting the subsurface scattering transmittance coefficient and ambient lighting surround parameters. Subsurface scattering and ambient lighting calculation module: used to calculate the subsurface scattering intensity of the current vertex based on the water depth, the water thickness value corresponding to the current vertex, the subsurface scattering transmittance coefficient, and the preset maximum water depth; The diffuse component of the current vertex is calculated using the vertex normal, the light source direction, and the ambient lighting parameters. The specular reflection component of the current vertex is calculated using the vertex normal, the light source direction, the viewing direction, and the preset specular index. The diffuse reflection component, the specular reflection component, and the subsurface scattering intensity are combined to obtain the conventional ambient lighting component of the current vertex. Backlighting Calculation Module: Used to introduce a virtual backlighting direction opposite to the light source direction, and combine it with the viewing direction, the vertex normal and the preset subsurface offset rate to calculate the backlighting intensity of the current vertex, which is used to simulate the physical effect of light passing through the back of the seawater. Dynamic adjustment and fusion module: used to calculate ambient light weight and subsurface scattering weight based on the water depth and the preset maximum water depth; Based on the real-time wave height and the preset maximum wave height, the subsurface scattering intensity is dynamically adjusted to obtain the final subsurface scattering intensity; using the ambient lighting weight and the subsurface scattering weight, the traditional ambient lighting component and the final subsurface scattering intensity are weighted and fused, and the backlighting intensity is superimposed to obtain the final scene lighting component of the current vertex. Rendering output module: Used to input the final scene lighting components into the rendering pipeline and combine them with shaders to generate wave rendering results.
