Underwater robot simulation water body rendering optimization method, system and equipment

By using a custom depth channel and Fresnel effect-controlled water rendering method, the problems of underwater optical distortion and water surface-water body separation in the virtual simulation platform were solved, achieving efficient underwater visual realism and optical consistency.

CN121482238APending Publication Date: 2026-02-06BEIJING INST OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511797491.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-02
Publication Date
2026-02-06

AI Technical Summary

Technical Problem

Existing virtual simulation platforms suffer from problems such as excessive resource consumption, redundant configuration, lack of underwater visual representation, and fragmented scene in underwater robot simulation, resulting in low simulation efficiency and poor visual realism.

Method used

The underwater surface of the water body is modeled using a custom depth channel and material blending, with opacity controlled by the Fresnel effect. The water body rendering effect is optimized through depth fog calculation and optical separation masking, achieving visual realism when looking upwards from underwater and optical consistency between the water surface and the water body.

Benefits of technology

It enhances the visual realism of underwater upward observation, eliminates the sense of separation at the junction of underwater and water surface, balances rendering efficiency and visual realism, and optimizes the water rendering effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121482238A_ABST
    Figure CN121482238A_ABST
Patent Text Reader

Abstract

The invention discloses an underwater robot simulation water body rendering optimization method, system and device, and relates to the technical field of underwater robot virtual simulation, and the method comprises the steps: responding to an underwater robot simulation water body rendering instruction, and creating a single-layer water material coloring model to construct a water surface effect picture. And setting a post-processing volume consistent with the underwater area space, and constructing a water body effect picture. And creating a lower surface of the water body, and controlling the opaqueness based on the Fresnel effect to obtain the custom depth. And comparing the scene depth with the self-defined depth in the post-processing material, taking a minimum value, and performing depth fog calculation according to the minimum value to obtain a visual effect picture which is transparent near the water surface and atomized far away from the water surface. And creating an optical separation mask, performing Y-axis pixel offset and average processing on the customized depth output of the optical separation mask, forming a transition area effect picture, and finally determining an optimized water body rendering effect, thereby getting rid of hardware resources, and giving consideration to rendering efficiency and visual authenticity.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of underwater robot virtual simulation, in particular to an underwater robot simulation water body rendering optimization method, system and device. BACKGROUND

[0002] In the actual research and development and testing process of small underwater robots, it is severely dependent on entity experiments, however, such experiments have several significant limitations. First, the economic cost is high, which is manifested as the expensive rental fee of experimental sites such as water pools or lakes, and the periodic maintenance of water quality and experimental equipment, resulting in a single test cost of thousands of yuan. Second, the experimental operation is extremely inconvenient, which is limited by the opening time of the site and the natural weather conditions, and the debugging process needs the on-site cooperation of professional personnel, and a single fault diagnosis often takes several hours to several days, which seriously slows down the research and development progress. Third, the equipment is at high risk of damage, and problems such as water corrosion, underwater collision or communication signal loss can easily cause damage to the robot equipment, thereby generating additional maintenance expenses.

[0003] In order to overcome the disadvantages of the above-mentioned entity experiments, virtual simulation technology has become a potential alternative. However, the existing virtual simulation platform, especially its water body rendering part, still has obvious defects, which makes it difficult to effectively replace entity experiments, which is specifically manifested in the following aspects: 1. Excessive resource consumption. The current mainstream commercial water body rendering plug-in, such as the Water plug-in built-in UE5 engine, usually requires not less than 6GB of video memory when its advanced features are enabled, which makes it difficult for ordinary workstations to run stably, and frequent freezing or even crashing occurs, which seriously affects the simulation efficiency.

[0004] 2. Redundancy in configuration. Existing commercial plug-ins usually integrate heavy modules such as ocean simulation and complex wave physics, but for the common still water experimental scene of small underwater robots, the above-mentioned modules are redundant, which not only cannot improve the simulation effect, but also causes unnecessary computational resource overhead.

[0005] 3. Lack of underwater visual performance. Existing solutions focus on optimizing the visual effect of observing underwater from above the water surface, but there is a serious lack of simulation of the optical phenomenon of observing upward from underwater, such as the inability to realistically reproduce the refraction distortion effect of water surface ripples on the scene above the water. This defect directly leads to the serious distortion of the simulation images collected by the underwater robot camera, which reduces the credibility of the environment perception algorithm based on vision.

[0006] 4. Obvious fragmentation of the scene. Due to the limitations of the rendering method, there is a harsh color step mutation at the junction of the water surface and the water body, which destroys the optical consistency of the entire underwater environment, and greatly reduces the immersion and authenticity of the simulation environment.

[0007] Therefore, there is an urgent need for a water body rendering optimization method that can break away from hardware resources and balance rendering efficiency and visual reality. SUMMARY

[0008] The purpose of the present application is to provide an underwater robot simulation water body rendering optimization method, system and device, which can solve the problems of underwater optical effect distortion and water surface-water body split in existing virtual simulation platforms, break away from hardware resources and balance rendering efficiency and visual reality.

[0009] To achieve the above-mentioned purpose, the present application provides the following solutions: In a first aspect, the present application provides an underwater robot simulation water body rendering optimization method, comprising: responding to an underwater robot simulation water body rendering instruction; based on the underwater robot simulation water body rendering instruction, creating a single-layer water material shading model to construct a water surface effect picture; the water surface effect picture includes: ripple, light absorption and refraction effect picture; setting a post-processing volume consistent with the underwater area space to construct a water body effect picture; the water body effect picture includes: water body depth fog effect picture and water body dark corner effect picture; creating a water body lower surface with a custom depth channel enabled and a material mixing model of semi-transparent; controlling the opacity of the water body lower surface based on the Fresnel effect to obtain the custom depth of the water body lower surface; comparing the scene depth with the custom depth of the water body lower surface in the post-processing material to select the minimum value; based on the minimum value, performing depth fog calculation to obtain a near-water surface area transparent visual effect picture and a far-water surface area fogging visual effect picture; creating an optical separation mask with a custom depth channel enabled and synchronized motion with the camera view; in the post-processing material, performing Y-axis direction pixel offset on the custom depth output information of the optical separation mask; performing average processing on the custom depth output information of the pixel offset optical separation mask to obtain a transition area effect picture; based on the water surface effect picture, the water body effect picture, the near-water surface area transparent visual effect picture, the far-water surface area fogging visual effect picture and the transition area effect picture, determining the optimized water body rendering effect picture.

[0010] Optionally, based on the underwater robot simulation water body rendering instruction, a single-layer water material shading model is created to construct a water surface effect picture, specifically comprising: The water surface normal map resource in the single-layer water material shading model is used to load two independent water surface normal maps in parallel, and fusion operation is performed on the water surface normal maps to obtain a ripple effect picture. The light absorption coefficient interface in the single-layer water material shading model is used to set the attenuation characteristics of the water body to light energy to obtain a light absorption effect picture. In the single-layer water material shading model, a refraction parameter is set to obtain a refraction effect picture.

[0011] Optionally, in the single-layer water material shading model, a refraction parameter is set to obtain a refraction effect picture, specifically including: When the water surface ripple is not involved, the refraction parameter is set to a standard refractive index of the water body, and the refraction effect picture is obtained based on the standard refractive index of the water body; When the water surface ripple is involved, the refraction parameter is set to a time-varying refractive index, and the refraction effect picture is obtained based on the time-varying refractive index.

[0012] Optionally, the post-processing volume consistent with the underwater area space is set to construct a water body effect picture, specifically including: Based on the post-processing volume, a rendering pipeline interface is called to obtain the Euclidean distance from the current pixel point to the camera lens; A clear-fuzzy critical distance parameter is preset; Based on the Euclidean distance and the preset clear-fuzzy critical distance parameter, a linear interpolation synthesized fog effect color is determined; Based on the linear interpolation synthesized fog effect color, a water depth fog effect picture is determined; Based on the post-processing volume, the screen UV coordinate range is converted; Based on the converted UV coordinate range, the square value of the Euclidean distance of the screen pixel point to the screen center is calculated; Based on the square value of the Euclidean distance of the screen pixel point to the screen center and the water depth fog effect picture, the pixel color after adjusting the lightness and darkness is synthesized to obtain a water body dark corner effect picture.

[0013] Optionally, the opacity of the water body lower surface is controlled based on the Fresnel effect to obtain a custom depth of the water body lower surface, specifically including: A Fresnel expression node is called to calculate the dot product of the water body lower surface normal vector and the camera observation direction vector to obtain a first attenuation factor; The first attenuation factor is inverted, and the inverted first attenuation factor is input to the opacity channel to obtain the opacity; Based on the opacity, the custom depth value of the water body lower surface is obtained.

[0014] Optionally, the water bottom surface self-defined depth value is obtained based on the opacity, and specifically includes: At a first threshold distance of the camera from the water surface, when the water bottom surface normal vector is directly opposite the camera observation direction, the water bottom surface self-defined depth is zero; At a second threshold distance of the camera from the water surface, when the water bottom surface normal vector is perpendicular to the camera observation direction, the water bottom surface self-defined depth is maximum.

[0015] Optionally, the optical separation mask moving synchronously with the camera field of view is created, and specifically includes: A cube is created as the optical separation mask; the optical separation mask is sized to fit the camera pyramid, the optical separation mask completely wraps the camera field of view, and the optical separation mask moves synchronously with the camera.

[0016] Optionally, in the post-processing material, the self-defined depth output information of the optical separation mask is subjected to Y-axis direction pixel offset; and the self-defined depth output information of the pixel offset optical separation mask is subjected to average processing to obtain a transition region effect picture, and specifically includes: Based on the self-defined depth output information of the optical separation mask, the UV coordinates of the self-defined depth output information are obtained; Based on the UV coordinates, the Y coordinate value domain is limited; Based on the limited Y coordinate value domain, the original pixel points are subjected to L times of offset sampling in the positive and negative directions along the Y axis, respectively; The pixel values of the original sampling points and the pixel values of the sampling points subjected to L times of offset sampling in the positive and negative directions along the Y axis are subjected to arithmetic average processing; Based on the pixel values of the arithmetic average processing, a transition region effect picture is generated.

[0017] In a second aspect, the present application provides an underwater robot simulation water body rendering optimization system, including: A water body rendering instruction corresponding module is configured to respond to an underwater robot simulation water body rendering instruction; A water surface effect picture construction module is configured to create a single-layer water material shading model based on the underwater robot simulation water body rendering instruction, and construct a water surface effect picture; the water surface effect picture includes a wave effect picture, a light absorption and refraction effect picture, and the like; A water body effect picture construction module is configured to set a post-processing volume consistent with the underwater area space, and construct a water body effect picture; the water body effect picture includes a water body depth fog effect picture and a water body dark corner effect picture; The underwater water surface visual effect picture module is configured to create a water body lower surface with a custom depth channel enabled and a material mixing model being semi-transparent, control opacity of the water body lower surface based on the Fresnel effect to obtain a custom depth of the water body lower surface, compare scene depth and the custom depth of the water body lower surface in a post-processing material to select a minimum value, and perform depth fog calculation based on the minimum value to obtain a visual effect picture of a near-water surface area being transparent and a visual effect picture of a far-water surface area being fogged. The water body water surface connection line visual effect picture construction module is configured to create an optical separation mask with a custom depth channel enabled and moving synchronously with a camera field of view, perform Y-axis direction pixel offset on custom depth output information of the optical separation mask in a post-processing material, and perform average processing on the custom depth output information of the pixel offset optical separation mask to obtain a transition area effect picture. The optimized water body rendering effect picture determination module is configured to determine an optimized water body rendering effect picture based on the water surface effect picture, the water body effect picture, the visual effect picture of the near-water surface area being transparent, the visual effect picture of the far-water surface area being fogged, and the transition area effect picture.

[0018] In a third aspect, the present application provides a computer device, comprising a memory, a processor, a computer program stored in the memory and executable on the processor, and the processor executes the computer program to implement the steps of the underwater robot simulation water body rendering optimization method in any one of the above aspects.

[0019] According to the specific embodiments provided in the present application, the present application has the following technical effects: This application provides a method, system, and device for optimizing underwater robot simulation water body rendering. It involves creating a semi-transparent underwater surface with a custom depth channel enabled and a material blending model; controlling the opacity of the underwater surface based on the Fresnel effect to obtain a custom depth; comparing the scene depth with the custom depth of the underwater surface in post-processing materials and selecting the minimum value; and performing depth fog calculation based on this minimum value to obtain a visually transparent near-water surface area and a fogged visually appealing far-water surface area, thus improving the realism of underwater upward-viewing vision. Through a dynamic depth comparison mechanism combined with the Fresnel effect, it achieves simulation of water surface refraction from an underwater perspective, enabling... The transparency error of the water surface area is reduced, and the fogging transition of the distant water surface is natural. An optical separation mask with a custom depth channel enabled and synchronized with the camera's field of view is created. In the post-processing material, the custom depth output information of the optical separation mask is pixel-shifted in the Y-axis direction. The custom depth output information of the optical separation mask after pixel shifting is averaged to obtain the transition area effect, which optimizes the optical consistency between the water surface and the water body. Based on the gradient technology of the custom depth channel, the color level change at the boundary is processed by the geometric mask synchronization system, eliminating the sense of discontinuity at the junction of underwater and water surface, achieving a smooth transition, eliminating hardware resources, and balancing rendering efficiency and visual realism. Attached Figure Description

[0020] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0021] Figure 1 A flowchart illustrating a robot-simulated water body rendering optimization method provided in an embodiment of this application; Figure 2 for Figure 1 A detailed flowchart of step 9 in the middle section; Figure 3 A functional module diagram of an underwater robot simulation water body rendering optimization system provided in an embodiment of this application; Figure 4 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation

[0022] With reference to the drawings and embodiments below, the technical solutions in the embodiments of the present application will be described clearly and completely. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of the present application.

[0023] The above purposes, features and advantages of the present application will be more apparent and understandable. The present application will be described in further detail below with reference to the drawings and specific embodiments.

[0024] In an exemplary embodiment, as shown in Figure 1 An underwater robot simulation water body rendering optimization method is provided, which is executed by a computer device, specifically by a terminal or a server, or by a terminal and a server together. The method comprises the following steps: Step 1: responding to an underwater robot simulation water body rendering instruction.

[0025] Step 2: based on the underwater robot simulation water body rendering instruction, creating a single-layer water material shading model to construct a water surface effect picture; the water surface effect picture comprises: a ripple effect picture, a light absorption and refraction effect picture.

[0026] Specifically, based on the underwater robot simulation water body rendering instruction, a single-layer water material shading model is created to construct a water surface effect picture, which specifically comprises: two sets of independent water surface normal map are loaded in parallel using the water surface normal map resource in the single-layer water material shading model (SingelLayerWater material shading model), and fusion operation is performed on the water surface normal map to obtain a ripple effect picture; the light absorption coefficient interface in the single-layer water material shading model is used to set the attenuation characteristics of water body to light energy to obtain a light absorption effect picture; the refraction parameter in the single-layer water material shading model is set to obtain a refraction effect picture.

[0027] Specifically, in the present embodiment, the refraction parameter in the single-layer water material shading model is set to obtain a refraction effect picture, which specifically comprises: when the water surface ripple is not involved, the refraction parameter is set to the standard refractive index of water body, and the refraction effect picture is obtained based on the standard refractive index of water body; when the water surface ripple is involved, the refraction parameter is set to time-varying refractive index, and the refraction effect picture is obtained based on the time-varying refractive index.

[0028] In the present embodiment, when constructing the ripple effect picture: Based on the water surface normal map resource built-in the engine, periodic flow sampling is realized through a space-time coordinate transformation node (Panner Node), and the input parameters of the node include: a texture coordinate space vector , system time variable , ripple propagation direction two-dimensional vector . Wherein, the texture coordinate space vector is obtained through the "TexCoord" node; the system time variable is obtained through the "Time" node; the ripple propagation direction vector is a user-defined input two-dimensional vector, and the ripple propagation direction vectors of the two sets of independent water surface normal maps are and .

[0029] Two sets of independent water surface normal maps (NormalMap A / B) are loaded in parallel based on the water surface normal map resources built-in in the engine, and differentiated tiling parameters are set respectively: the tiling coefficient of the map A is , and the tiling coefficient of the map B is , wherein, . The tiling coefficient is used to describe the number of repetitions of the normal map on the material.

[0030] The two sets of map outputs are fused by a line angle mixing node (Blend Angle Corrected Normals), which respectively takes the RGB channels of the two normal maps as input, calculates the angle of the two RGB vectors, and then mixes to generate the final water ripple normal field , which represents the normal information of the water surface at different spatial positions on the water surface changing with time.

[0031] Specifically, in the present embodiment, when constructing the light absorption effect picture, in the material editor, the attenuation characteristics of the water body to the light energy are directly set through the light absorption coefficient interface (AbsorptionCoefficients) of the single layer water surface material node (Single Layer Water Material) built-in in the engine, so that the input of the light absorption coefficient interface satisfies: ; wherein, is the input of the light absorption coefficient interface (AbsorptionCoefficients); is the absorption coefficient; is the light absorption color; the Single Layer Water Material node changes the optical effect of the rendered water surface by user input parameters.

[0032] In the present embodiment, since the water surface is blue-green, the light absorption color is pink (RGB(0.72, 0.3, 0.3)).

[0033] Specifically, in the embodiment, when the refraction effect picture is constructed, the refraction parameter of the material system is directly used.

[0034] When the water surface ripples are not involved, only the water body standard refraction index parameter 1.033 needs to be configured to meet the optical simulation requirements.

[0035] When the water surface ripples are involved, the embodiment uses the distance field data from the water surface to the nearest object to drive the ripple effect, specifically including: Step 201: Call the distance field function DistanceToNearestSurface to obtain the vertical distance value of the current sampling point to the nearest object The distance field function DistanceToNearestSurface outputs the signed straight line distance from the current pixel point to the nearest object surface in real time by querying the global distance field of the scene. The maximum ripple influence range is set by the preset parameter RippleSize . RippleSize is the name of the custom constant input node in the material editor, and in the formula expression, it is represented as the parameter of the custom constant input node.

[0036] Step 202: Normalize the vertical distance value of the current sampling point to the nearest object: ; Wherein, The operation means that the value exceeding the interval [0, 1] is constrained to the boundary value, is the normalized vertical distance value of the current sampling point to the nearest object; is the maximum ripple influence range set by the preset parameter RippleSize; is the vertical distance value of the current sampling point to the nearest object.

[0037] Step 203: Perform an inverse operation on the normalized vertical distance value of the current sampling point to the nearest object to generate a second attenuation factor: ; Wherein, is the second attenuation factor; the second attenuation factor takes a large value in the near-water surface area, showing a strong ripple effect; and takes a small value in the far-water surface area, showing a weak ripple effect.

[0038] Step 204: Based on the second attenuation factor, introduce a system time variable to construct a time-varying refractive index: ; Wherein,​ is the refractive index at time t; is a linear interpolation function; is the base refractive index; is the maximum offset refractive index; is the angular frequency; is a ripple density parameter for controlling the number of phase shift periods.

[0039] The embodiment generates a periodic fluctuation between the base refractive index and the maximum offset refractive index by a dynamic interpolation method, simulates the visual distortion effect caused by ripples, and obtains a refractive effect picture.

[0040] Specifically, in the embodiment, the parameter values used to construct the water surface effect picture in step 2 are shown in the following table: Table 1 Parameter value table of water surface effect picture

[0041] Step 3: Set a post-processing volume consistent with the underwater area space to construct a water body effect picture; the water body effect picture includes a water body depth fog effect picture and a water body dark corner effect picture.

[0042] The depth fog effect picture in the embodiment means that the closer the scene distance to the lens, the clearer the line of sight, and the farther, the more blurred.

[0043] Specifically, the setting of the post-processing volume consistent with the underwater area space to construct the water body effect picture specifically includes: based on the post-processing volume, calling a rendering pipeline interface (SceneDepth) to obtain the Euclidean distance of a pixel point in the current three-dimensional scene to the camera lens ; a preset clear-fuzzy critical distance parameter ; determining a linear interpolation synthesized fog effect color based on the Euclidean distance and the preset clear-fuzzy critical distance parameter; determining a water body depth fog effect picture based on the linear interpolation synthesized fog effect color; converting the screen UV coordinate range based on the post-processing volume; calculating the square value of the Euclidean distance of the screen pixel point to the screen center based on the converted UV coordinate range; synthesizing the pixel color after adjusting the brightness and darkness based on the square value of the Euclidean distance of the screen pixel point to the screen center and the water body depth fog effect picture, to obtain a water body dark corner effect picture.

[0044] In the embodiment, when determining the water body depth fog effect picture, based on the post-processing volume, a rendering pipeline interface (SceneDepth) is called to obtain the Euclidean distance of a pixel point in the current three-dimensional scene to the camera lens Preset sharp-to-fuzzy critical distance parameter Based on the Euclidean distance and the preset clear-blur critical distance parameter, the fog effect color synthesized by linear interpolation is determined, specifically including: Based on the pixels in the current 3D scene Euclidean distance to camera lens and preset clear-to-fuzzy critical distance parameters Calculate screen pixels Normalized depth factor : ; Based on the screen pixels Normalized depth factor Applying power functions to enhance depth gradient differences: ; in This is the fog effect contrast adjustment factor. ; For screen pixels Enhanced depth gradient difference value.

[0045] by As dynamic interpolation weights, the final pixel color is synthesized using the following formula: ; in, The color of the input screen pixel is used for post-processing without processing. It is a fog effect color. For screen pixels Fog effect color synthesized by linear interpolation.

[0046] In this embodiment, a gradient mask is generated based on the transformation of the screen UV coordinates to determine the water vignette effect. The process involves transforming the screen UV coordinate range based on the post-processing volume; calculating the square of the Euclidean distance from the screen pixel to the screen center based on the transformed UV coordinate range; and synthesizing the pixel colors with adjusted brightness based on the square of the Euclidean distance from the screen pixel to the screen center and the water depth fog effect. Specifically, this includes: In the UE, the UV coordinate range of the screen is [0,1], with the top left corner as the origin (0,0) and the bottom right corner as (1,1). A centering transformation converts the screen coordinate system to a range of [-0.5,0.5] with the screen center as the origin. Specifically, in this embodiment, the UV coordinates of screen pixels are obtained through the "ScreenPosition" node. Then, the centering transformation is achieved by subtracting 0.5 from the mathematical operation node "Subtract", as shown in the following formula: ; wherein, represents the centered transformed screen pixel point UV coordinate.

[0047] Based on the centered transformed screen pixel point UV coordinate , the Euclidean distance square value from the screen center is calculated: ; wherein, is the Euclidean distance square value from the screen center.

[0048] The inverse nonlinear processing is performed on the Euclidean distance square value from the screen center of the screen pixel point to generate a basic mask with center bright and edge dark, with a value range of [0.5, 1], a center value of 1, and a corner value of 0.5, and the formula is as follows: ; wherein, is the basic lightness adjustment factor of the screen pixel point .

[0049] The power function is applied to the basic lightness adjustment factor of the screen pixel point to enhance the lightness-contrast: ; wherein, is the final lightness adjustment factor of the screen pixel point , is an adjustable attenuation factor, when : the linear gradient is maintained; when : the edge darkening effect is enhanced; when : the dark corner intensity is weakened.

[0050] The pixel mixing is performed with as the interpolation weight to obtain the pixel color after adjusting the lightness: ; wherein is the full black reference color (RGB=(0, 0, 0)); is the color of the screen pixel point after adjusting the lightness; is the linear interpolation synthesized fog effect color of the screen pixel point .

[0051] The embodiment can realize the activation of the post-processing effect chain when the camera lens is located in the water medium, and the closing of the post-processing effect chain when the camera lens is located in the air medium. ​​

[0052] Step 4: Create the water bottom surface with Custom Depth enabled and the material blending model as semi-transparent.

[0053] Specifically, the normal information of the water bottom surface wave is generated using a normal map, and the production logic is consistent with the water top surface wave normal field.

[0054] Step 5: Control the opacity of the water bottom surface based on the Fresnel effect to obtain the custom depth of the water bottom surface, specifically including: calling a Fresnel expression node (Fresnel) to calculate the dot product of the water bottom surface normal vector and the camera observation direction vector to obtain a first attenuation factor; inversely processing the first attenuation factor and inputting the inversely processed first attenuation factor into the opacity channel to obtain the opacity; obtaining the custom depth value of the water bottom surface based on the opacity.

[0055] Specifically, the custom depth value of the water bottom surface is obtained based on the opacity, specifically including: at a first threshold distance of the camera from the water surface, at this time the water bottom surface normal vector is directly opposite the camera observation direction, and the custom depth of the water bottom surface is zero; at a second threshold distance of the camera from the water surface, at this time the water bottom surface normal vector is perpendicular to the camera observation direction, and the custom depth of the water bottom surface is maximum.

[0056] In this embodiment, the water bottom surface normal vector is obtained through a "Pixel Normal Ws" node, and the camera observation direction vector is obtained in real time during water rendering. The specific rules are: when the water bottom surface normal is directly opposite the camera, the output value is 0; when the water bottom surface normal is perpendicular to the camera, the output value is 1.

[0057] The output of the Fresnel expression node (Fresnel) is: ; wherein, is the first attenuation factor, is the water bottom surface normal vector, is the camera observation direction vector.

[0058] The first attenuation factor of the output of the Fresnel node is After the reverse processing, the opacity channel of the input material is input to affect the depth value in the custom depth channel, which is specifically embodied as follows: in the vicinity of the water surface, at this time the normal of the lower surface of the water body is directly opposite or close to the camera, the Fresnel output value is small, the value after reverse is large (close to 1), the material opacity is high, and in the custom depth channel, the effective depth value corresponding to the geometric position is obtained; in the far distance of the water surface, at this time the normal of the lower surface of the water body is close to perpendicular to the camera, the Fresnel output value is close to 1, the value after reverse is small (close to 0), the material is highly transparent, resulting in that in the custom depth channel, the depth value is invalid or infinite.

[0059] Step 6: Comparing the scene depth with the custom depth of the lower surface of the water body in the post-processing material, and selecting the minimum value.

[0060] Specifically, in the embodiment, a mathematical conditional (IF) expression node is called, the scene depth value (Scene Depth) of the rendering pipeline and the custom depth value (Custom Depth) are input into the IF node for comparison, and the IF node is configured to output the smaller depth value of the two. The minimum depth value output is used as the input depth of the subsequent depth fog.

[0061] Step 7: Based on the minimum value, the depth fog is calculated to obtain a visual effect picture of the near-water surface area being transparent and a visual effect picture of the far-water surface area being fogged.

[0062] In the embodiment, the water surface near the camera lens is valid (less than the scene depth) due to the custom depth value, and the smaller value is selected and input into the depth fog processing. Since it is less than the activation threshold of the depth fog effect, the area presents a transparent and clear effect; the water surface far from the camera lens is invalid / infinite due to the custom depth value, and the scene depth (usually also a large value far away) is selected as the smaller value to input the depth fog processing, which is greater than the effective range threshold of the depth fog effect, resulting in that the area presents a completely fogged and turbid effect, which is perfectly integrated with the water environment.

[0063] Step 8: An optical separation mask that is enabled with the custom depth channel and moves synchronously with the camera view is created.

[0064] Specifically, the optical separation mask that moves synchronously with the camera view includes: creating a cube as an optical separation mask; the optical separation mask is sized to fit the camera cone, the optical separation mask completely wraps the camera view, and the optical separation mask moves synchronously with the camera.

[0065] In the embodiment, first, a cube is created as an optical separation mask using a three-dimensional modeling software (such as 3ds Max), the mask size is adapted to the rendering camera cone, and the following conditions are met: ; in, This refers to the volume of the masking space. This refers to the camera space volume, ensuring that the mask completely covers the camera's field of view and activating a custom depth for the mask geometry.

[0066] Subsequently, a mask-camera synchronized motion system is implemented in the blueprint class, including position synchronization and orientation synchronization, so that the planar coordinates of the mask are kept consistent with the camera in real time, and the rotation angle of the mask around the Z-axis is kept consistent with the camera in real time.

[0067] Implementation method: In the "Event Graph" of the Blueprint class, the "Get Actor Location" node obtains the mask and camera position information respectively, the "Get Actor Rotation" node obtains the camera rotation information, and the "Set Actor Location" node sets the mask position information. The x and y channel outputs of "Get Actor Location-camera" and the z channel output of "Get Actor Location-mask" are used as inputs to the "Set Actor Location" node to achieve position synchronization. The "Set Actor Rotation" node sets the mask rotation information, and the z channel output of "Get Actor Rotation-camera" is used as the z channel input of "Set Actor Rotation" to achieve rotation synchronization around the z axis.

[0068] The synchronization of the mask and camera positions can be represented as: ; in, For the masking position, This indicates the camera's location.

[0069] The orientation synchronization of the mask and the camera can be represented as: ; in, For masking The attitude angle of the axis, Around the camera The attitude angle of the axis.

[0070] Based on the location of the mask "Directional coordinates and camera location" "Using the coordinates of the direction, establish a water interface recognition function:" ; in, a coordinate value in a "z" direction of a location of the camera, a coordinate value in a "z" direction of a location of the camera, a preset threshold value, the camera is completely underwater, a parameter of "camera and water surface height difference" in the material parameter set is modified from "1" to "0", a rendering mode conversion is triggered, a mask effect is closed, and only a post-processing effect of an underwater area is displayed.

[0071] Step 9: In the post-processing material, the custom depth output information of the optical separation mask is offset in the Y-axis direction; the custom depth output information of the optical separation mask after the pixel offset is averaged to obtain a transition area effect picture, as shown in Figure 2 specifically includes: based on the custom depth output information of the optical separation mask, obtaining UV coordinates of the custom depth output information; based on the UV coordinates, limiting a Y coordinate value domain; based on the limited Y coordinate value domain, performing L times offset sampling in the positive and negative directions of the Y-axis on the original pixel points respectively; performing arithmetic average processing on the pixel values of the original sampling points and the sampling points after the L times offset sampling in the positive and negative directions of the Y-axis; based on the pixel values after the arithmetic average processing, generating a transition area effect picture.

[0072] Specifically, the output after the arithmetic average processing in the embodiment is an output result in which the upper half is white, the lower half is black, and the middle is gray. Subsequently, the R channel of the output result is extracted, 1-x inverse processing is performed, the inverse result is multiplied by the original red channel value to form a transition area, the output value is multiplied by the height difference identification parameter and subjected to amplitude limiting processing to serve as a mixing coefficient performing final pixel mixing to generate a transition area effect picture, which is expressed by the following formula: wherein, is a final pixel mixing result, is a "camera and water surface height difference" state identification parameter, and takes a value of 0 or 1.

[0073] The embodiment realizes the water body up-down separation effect by using the custom depth channel, that is, the part above the water surface displays the originally rendered effect, and the part below the water surface displays the underwater post-processing effect.

[0074] Step 10: Based on the water surface effect picture, the water body effect picture, the visual effect picture of the near-water surface area transparency, the visual effect picture of the far-water surface area fogging, and the transition area effect picture, an optimized water body rendering effect picture is determined.

[0075] ​​Based on the same inventive concept, the embodiments of the present application also provide an underwater robot simulation water body rendering optimization system for implementing the above-mentioned underwater robot simulation water body rendering optimization method. The implementation scheme for solving the problem provided by the system is similar to the implementation scheme described in the above method, and therefore the specific limitations in one or more underwater robot simulation water body rendering optimization system embodiments provided below can refer to the limitations of the underwater robot simulation water body rendering optimization method described above, which will not be repeated here.

[0076] In one exemplary embodiment, as shown in Figure 3 An underwater robot simulation water body rendering optimization system is provided, including: a water body rendering instruction corresponding module, a water surface effect picture construction module, a water body effect picture construction module, an underwater looking at water visual effect picture module, a water body water surface connection line visual effect picture construction module, and an optimized water body rendering effect picture determination module.

[0077] The water body rendering instruction corresponding module is used to respond to the underwater robot simulation water body rendering instruction.

[0078] The water surface effect picture construction module is used to create a single-layer water material shading model based on the underwater robot simulation water body rendering instruction, and construct a water surface effect picture; the water surface effect picture includes: a ripple, a light absorption and refraction effect picture.

[0079] The water body effect picture construction module is used to set a post-processing volume consistent with the underwater area space, and construct a water body effect picture; the water body effect picture includes: a water body depth fog effect picture and a water body dark corner effect picture.

[0080] The underwater looking at water visual effect picture module is used to create a water body lower surface with a custom depth channel enabled and a material mixing model being semi-transparent; is also used to control the opacity of the water body lower surface based on the Fresnel effect to obtain a custom depth of the water body lower surface; is also used to compare the scene depth with the custom depth of the water body lower surface in the post-processing material, and select the minimum value; is also used to perform depth fog calculation based on the minimum value to obtain a visual effect picture of a near-water surface region being transparent and a far-water surface region being fogged.

[0081] The water body water surface connection line visual effect picture construction module is used to create an optical separation mask with a custom depth channel enabled and moving synchronously with the camera view; is also used to perform Y-axis direction pixel offset on the custom depth output information of the optical separation mask in the post-processing material; is also used to perform average processing on the custom depth output information of the pixel offset optical separation mask to obtain a transition region effect picture.

[0082] The optimized water body rendering effect picture determination module is configured to determine the optimized water body rendering effect picture based on the water surface effect picture, the water body effect picture, the visual effect picture of the near-water surface area transparency, the visual effect picture of the far-water surface area fogging, and the transition area effect picture.

[0083] In an exemplary embodiment, a computer device is provided, which can be a server or a terminal, and an internal structure diagram thereof can be as shown in Figure 4 The computer device includes a processor, a memory, an input / output interface (I / O), and a communication interface. The processor, the memory, and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operating system and the computer program in the non-volatile storage medium to run. The database of the computer device is configured to store underwater robot simulation water body rendering optimization data. The input / output interface of the computer device is configured to exchange information between the processor and external devices. The communication interface of the computer device is configured to communicate with external terminals through a network connection. The computer program is executed by the processor to implement an underwater robot simulation water body rendering optimization method.

[0084] The present application simplifies the rendering pipeline, is independent of commercial water body plug-ins, reduces the video memory requirement from ≥6GB to ≤3GB, adapts to ordinary workstations (video memory 4GB), improves the stability of the simulation platform, reduces the video memory resource, and realizes compatibility optimization. Through a deep dynamic comparison mechanism combined with the Fresnel effect, the water surface refraction simulation of the underwater viewing angle is realized, the water surface area transparency error is ≤5%, the far-water surface fogging is natural, and the underwater upward observation visual reality is improved. The rendering pipeline of the present application can be seamlessly integrated into the physical engine of the virtual simulation platform to accelerate the underwater robot algorithm verification process.

[0085] Those skilled in the art can understand that Figure 4 The structure shown in the figure is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different component arrangement. In an exemplary embodiment, a computer device is provided, which includes a memory and a processor, the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.

[0086] Any technical features in the above embodiments can be combined, and for the sake of brevity, not all possible combinations are described above, however, it should be understood that the application encompasses all possible combinations of the technical features described above.

[0087] The principles and implementation manners of the present application are described herein by using specific examples, and the above embodiments are only used to help understand the method of the present application and its core idea; meanwhile, according to the idea of the present application, the specific implementation manners and application scopes will be changed by those skilled in the art. In conclusion, the content of the present specification should not be understood as a limitation of the present application.

Claims

1. A method for optimizing underwater robot simulation water body rendering, characterized in that, The underwater robot simulation water body rendering optimization method includes: Respond to underwater robot simulation water body rendering commands; Based on the underwater robot's simulated water rendering instructions, a single-layer water material shading model is created to construct a water surface effect image; the water surface effect image includes: ripples, light absorption and refraction effects. Set a post-processing volume consistent with the underwater area space to construct a water effect image; the water effect image includes: water depth fog effect image and water dark corner effect image; Create a semi-transparent underwater surface with a custom depth channel enabled and material blending model; The opacity of the lower surface of the water body is controlled based on the Fresnel effect to obtain a custom depth of the lower surface of the water body; In the post-processing material, compare the scene depth with the custom depth of the water body's lower surface and select the minimum value; Based on the minimum value, depth fog is calculated to obtain a visual effect of transparency in the near-water area and a visual effect of fogging in the far-water area. Create an optically separated mask that enables a custom depth channel and moves in sync with the camera's field of view; In the post-processing material, the custom depth output information of the optical separation mask is pixel-shifted in the Y-axis direction; the pixel-shifted custom depth output information of the optical separation mask is averaged to obtain the transition area effect image; Based on the water surface effect image, water body effect image, transparent visual effect image of the near water surface area, fogged visual effect image of the far water surface area, and transition area effect image, the optimized water body rendering effect image is determined.

2. The underwater robot simulation water body rendering optimization method according to claim 1, characterized in that, Based on the underwater robot's simulated water rendering instructions, a single-layer water material shading model is created to construct the water surface effect image, specifically including: Two independent water surface normal maps are loaded in parallel using the water surface normal map resources in the single-layer water material shading model, and the water surface normal maps are fused to obtain the ripple effect image. By using the light absorption coefficient interface in the single-layer water material coloring model to set the attenuation characteristics of water body to light energy, the light absorption effect image is obtained; By setting refraction parameters in the single-layer water material coloring model, a refraction effect image is obtained.

3. The underwater robot simulation water body rendering optimization method according to claim 2, characterized in that, In the single-layer water material coloring model, refraction parameters are set to obtain a refraction effect image, specifically including: When water ripples are not involved, the refraction parameters are set to the standard refractive index of the water body, and the refraction effect image is obtained based on the standard refractive index of the water body. When water ripples are involved, the refraction parameter is set to a time-varying refractive index, and the refraction effect image is obtained based on the time-varying refractive index.

4. The underwater robot simulation water body rendering optimization method according to claim 1, characterized in that, The post-processing volume, which is set to be consistent with the underwater area space, is used to construct the water effect image, specifically including: Based on the post-processing volume, the rendering pipeline interface is invoked to obtain the Euclidean distance from the current pixel to the camera lens. Preset sharpness-blur threshold distance parameters; Based on the Euclidean distance and the preset clear-blur critical distance parameter, the fog effect color synthesized by linear interpolation is determined; Based on the fog effect color synthesized by the linear interpolation, the water depth fog effect image is determined; Based on the post-processing volume, the screen UV coordinate range is transformed; Calculate the square of the Euclidean distance from the screen pixel to the screen center based on the transformed UV coordinate range; Based on the square of the Euclidean distance from the screen pixel to the center of the screen and the water depth fog effect, the pixel colors after adjusting the brightness are synthesized to obtain the water vignetting effect.

5. The underwater robot simulation water body rendering optimization method according to claim 1, characterized in that, The method of controlling the opacity of the lower surface of the water body based on the Fresnel effect to obtain a custom depth of the lower surface of the water body specifically includes: Call the Fresnel expression node to calculate the dot product of the water body's lower surface normal vector and the camera's viewing direction vector to obtain the first attenuation factor; The first attenuation factor is inverted, and the inverted first attenuation factor is input into the opacity channel to obtain the opacity. The custom depth value of the lower surface of the water body is obtained based on the opacity.

6. The underwater robot simulation water body rendering optimization method according to claim 5, characterized in that, The custom depth value of the lower surface of the water body is obtained based on the opacity, specifically including: At the point where the camera is at the first threshold distance from the water surface, the normal vector of the lower surface of the water body is facing the direction of the camera's observation, and the custom depth of the lower surface of the water body is zero. At the second threshold distance between the camera and the water surface, the normal vector of the lower surface of the water body is perpendicular to the camera's viewing direction, and the custom depth of the lower surface of the water body is at its maximum.

7. The underwater robot simulation water body rendering optimization method according to claim 1, characterized in that, The creation of the optically separated mask that moves in sync with the camera's field of view specifically includes: A cube is created as an optical separation mask; the size of the optical separation mask is adapted to the camera cone, the optical separation mask completely covers the camera's field of view, and the optical separation mask moves synchronously with the camera.

8. The underwater robot simulation water body rendering optimization method according to claim 1, characterized in that, In the post-processing material, the custom depth output information of the optical separation mask is offset by pixels in the Y-axis direction; The transition region effect image is obtained by averaging the custom depth output information of the optical separation mask after pixel offset, specifically including: Based on the custom depth output information of the optical separation mask, obtain the UV coordinates of the custom depth output information; Based on the UV coordinates, the range of Y coordinate values ​​is limited; Based on the defined Y coordinate range, the original pixel is offset and sampled L times along the positive and negative Y axes respectively. The pixel values ​​of the original sampling points are averaged with the pixel values ​​of the sampling points that have undergone L offset samplings along the positive and negative directions of the Y-axis, respectively. The transition area effect image is generated based on the pixel values ​​processed by the arithmetic mean.

9. An underwater robot simulation water body rendering optimization system, characterized in that, The underwater robot simulation water body rendering optimization system includes: The water body rendering command response module is used to respond to underwater robot simulation water body rendering commands; The water surface effect rendering module is used to create a single-layer water material shading model based on the underwater robot's simulated water rendering instructions, and to construct the water surface effect rendering; the water surface effect rendering includes: ripples, light absorption and refraction effects. The water effect image construction module is used to set a post-processing volume consistent with the underwater area space to construct the water effect image; the water effect image includes: water depth fog effect image and water dark corner effect image. The underwater view above water visual effect module is used to create a water surface with a custom depth channel enabled and a semi-transparent material blending model; it is also used to control the opacity of the water surface based on the Fresnel effect to obtain the custom depth of the water surface; it is also used to compare the scene depth with the custom depth of the water surface in the post-processing material and select the minimum value; it is also used to perform depth fog calculation based on the minimum value to obtain a visual effect image with a transparent near-water surface area and a fogged visual effect image with a far-water surface area. The water surface transition line visual effect image construction module is used to create an optical separation mask that enables a custom depth channel and moves synchronously with the camera's field of view; it is also used to perform pixel offsetting on the custom depth output information of the optical separation mask in the Y-axis direction in the post-processing material; and it is also used to perform averaging processing on the custom depth output information of the optical separation mask after pixel offset to obtain the transition area effect image. The optimized water body rendering effect determination module is used to determine the optimized water body rendering effect based on the water surface effect image, the water body effect image, the transparent visual effect image of the near water surface area, the fogged visual effect image of the far water surface area, and the transition area effect image.

10. A computer device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor executes the computer program to implement the underwater robot simulation water body rendering optimization method according to any one of claims 1-8.