Fluid rendering method and apparatus, computer program product, and electronic device

By pre-computing and discretizing the fluid morphology, constructing a static mesh, and using dynamic UV coordinates for texture sampling, the computational cost and visual realism issues in rendering viscous fluid splashes are resolved, achieving efficient fluid rendering effects.

CN122368280APending Publication Date: 2026-07-10NETEASE (SHANGHAI) NETWORK CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
NETEASE (SHANGHAI) NETWORK CO LTD
Filing Date
2026-04-07
Publication Date
2026-07-10

Smart Images

  • Figure CN122368280A_ABST
    Figure CN122368280A_ABST
Patent Text Reader

Abstract

This disclosure relates to the field of computer technology, specifically to a fluid rendering method and apparatus, computer program product, and electronic device. The fluid rendering method includes: acquiring boundary data of a target container, the fluid source of the fluid to be rendered, fluid surface properties, and dynamic field data; performing fluid calculations based on the boundary data, fluid source, and dynamic field data to generate fluid mesh data, and determining a static mesh based on the fluid mesh data; constructing a first dynamic UV coordinate system based on the basic UV coordinates of the static mesh; sampling a normal texture map based on the first dynamic UV coordinate system to obtain a first sampling result, and constructing a second dynamic UV coordinate system; performing a disparity offset on the second dynamic UV coordinate system to obtain a disparity-offset second dynamic UV coordinate system; sampling a mask texture map based on the disparity-offset second dynamic UV coordinate system to obtain a second sampling result; and rendering the fluid to be rendered based on the fluid surface properties and the sampling results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and more specifically, to a fluid rendering method and apparatus, computer program products, and electronic devices. Background Technology

[0002] In modern 3D game development and virtual reality applications, fluid effects (such as water flow, blood, and juice splatter) are key elements in creating highly immersive scenes. Unlike rigid body rendering, fluids have complex topological changes, semi-transparent optical properties, and non-linear motion trajectories caused by surface tension. Especially for viscous fluids such as "juice" or "sweet drinks," they need to visually represent a specific sense of thickness, high light reflectivity, and the shape of the broken droplets.

[0003] Currently, rendering effects for viscous fluid splashes requires the engine to calculate and smooth particle hydrodynamics in real time during runtime, consuming significant computing power and causing a sharp drop in frame rate. Furthermore, it's difficult to achieve high-precision viscous fluid details on mobile devices. Another approach involves baking pre-rendered fluid animations into 2D texture atlases and playing them in the game scene using bulletin board technology—playing the animation on a flat surface that always faces the camera. However, this method cannot correctly respond to multi-angle lighting in the scene and cannot present the three-dimensional spatial structure of the fluid splashes, resulting in low visual realism and negatively impacting the overall effect of the fluid splashing effects.

[0004] It should be noted that the information in the background section above is only used to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention

[0005] The purpose of this disclosure is to provide a fluid rendering method and apparatus, computer program product and electronic device, thereby overcoming at least to some extent the defects of the related technologies and improving the dynamic rendering effect of the fluid to be rendered being sprayed out of the container.

[0006] Other features and advantages of this disclosure will become apparent from the following detailed description, or may be learned in part from practice of this disclosure.

[0007] According to one aspect of this disclosure, a fluid rendering method is provided, comprising: acquiring boundary data of a target container, a fluid source of a fluid to be rendered, fluid surface properties, and dynamic field data, wherein the fluid source is used to determine the three-dimensional spatial emission domain corresponding to the fluid to be rendered, and the dynamic field data characterizes the force field acting on fluid particles in the fluid to be rendered; performing fluid calculation based on the boundary data, fluid source, and dynamic field data to generate fluid mesh data, and determining a static mesh based on the fluid mesh data; constructing a first dynamic UV coordinate based on the basic UV coordinate of the static mesh, and sampling a normal texture map based on the first dynamic UV coordinate to obtain a first sampling result, the first sampling result being used for normal reconstruction; constructing a second dynamic UV coordinate based on the basic UV coordinate of the static mesh, performing a disparity offset on the second dynamic UV coordinate to obtain a disparity-offset second dynamic UV coordinate, and sampling a mask texture map based on the disparity-offset second dynamic UV coordinate to obtain a second sampling result; and rendering the dynamic effect of the fluid splashing from the target container based on the fluid surface properties, the first sampling result, and the second sampling result.

[0008] In one exemplary embodiment of this disclosure, the dynamic field data includes a basic driving force, a directional guiding force, and a random perturbation force; wherein, the basic driving force is used to apply a vector force toward the target direction to the fluid to be rendered, the directional guiding force is used to define the force field path of the fluid to be rendered ejected from the target container, and the random perturbation force is used to apply a perturbation to the fluid velocity field of the fluid to be rendered; fluid calculation is performed based on boundary data, fluid source, and dynamic field data to generate fluid mesh data, and a static mesh is determined based on the fluid mesh data, including: calculating the position and velocity of fluid particles of the fluid to be rendered based on boundary data, fluid source, basic driving force, directional guiding force, and random perturbation force; generating fluid mesh data based on the position and velocity of fluid particles and preset fluid physical optical properties; and reconstructing the fluid mesh data to obtain a static mesh.

[0009] In one exemplary embodiment of this disclosure, determining a static mesh based on fluid network data includes: voxel resampling of the fluid network data to obtain a first intermediate mesh; performing surface reduction processing on the first intermediate mesh based on the surface curvature of the first intermediate mesh to obtain a second intermediate mesh; recalculating the vertex normals of the second intermediate mesh using a normal smoothing threshold to obtain a third intermediate mesh; and mapping the third intermediate mesh to a two-dimensional texture space to obtain a static mesh.

[0010] In one exemplary embodiment of this disclosure, a first dynamic UV coordinate is constructed based on the base UV coordinates of a static mesh, and the normal texture map is sampled according to the first dynamic UV coordinate to obtain a first sampling result, including: determining a first offset based on the current time variable and a preset two-dimensional flow vector; determining the first dynamic UV coordinate based on the first offset and the base UV coordinate; and sampling the normal texture map based on the first dynamic UV coordinate to obtain the first sampling result.

[0011] In one exemplary embodiment of this disclosure, a second dynamic UV coordinate is constructed based on the base UV coordinates of a static mesh. The second dynamic UV coordinate is then subjected to parallax offset to obtain the parallax-offset second dynamic UV coordinate. The mask texture map is then sampled based on the parallax-offset second dynamic UV coordinate to obtain a second sampling result. This includes: determining a second offset based on the current time variable and a preset velocity vector; determining the second dynamic UV coordinate based on the base UV coordinates, a first repetition density, and the second offset, where the first repetition density controls the repetition density of the mask texture on the surface; offsetting the second dynamic UV coordinate based on the camera's view vector and depth intensity to obtain the parallax-offset second dynamic UV coordinate; and sampling the mask texture map based on the parallax-offset second dynamic UV coordinate to obtain the second sampling result.

[0012] In one exemplary embodiment of this disclosure, rendering the dynamic effect of the fluid splashing from the target container based on fluid surface properties, a first sampling result, and a second sampling result includes: reconstructing normals based on the first sampling result to obtain an updated three-dimensional normal vector, the updated three-dimensional normal vector being used for lighting calculation; determining a light-emitting region mask based on the second sampling result and preset self-illuminating color data; and rendering the dynamic effect of the fluid splashing from the target container based on fluid surface properties, the updated three-dimensional normal vector, and the light-emitting region mask.

[0013] In one exemplary embodiment of this disclosure, the method further includes: determining target texture coordinates based on a current time variable, a preset velocity vector, base UV coordinates, and a second repetition density, wherein the second repetition density is used to control the repetition density of the displacement texture on the surface; sampling the coordinate texture map using the target texture coordinates to obtain dynamic grayscale data; calculating the vertex offset of vertices in the static mesh based on the dynamic grayscale data, and combining the vertex offset with the world position offset corresponding to the vertex to obtain a target offset, wherein the target offset is used to determine the final rendering position of the vertex; and rendering the dynamic effect of the fluid splashing from the target container based on fluid surface properties, updated 3D normal vectors, luminous region masking, and the target offset.

[0014] In one exemplary embodiment of this disclosure, calculating the vertex offset of a vertex in a static mesh based on dynamic grayscale data includes: superimposing dynamic grayscale data onto the vertex normal vector of the vertex to obtain an intermediate offset, and obtaining a first vertex offset based on the intermediate offset and a first displacement intensity; determining a second vertex offset based on the vertex normal vector and a second displacement intensity; and linearly interpolating the first vertex offset and the second vertex offset based on a hybrid weight to obtain the vertex offset amount; wherein the first displacement intensity is used to control the perturbation amplitude of the vertex offset driven by noise texture, and the second displacement intensity is used to control the vertex expansion or contraction amplitude along the vertex normal direction.

[0015] In one exemplary embodiment of this disclosure, the method further includes mapping a static mesh from a simulation coordinate space to a game world coordinate space.

[0016] According to one aspect of this disclosure, a fluid rendering apparatus is provided, comprising: a data acquisition module, configured to acquire boundary data of a target container, a fluid source of a fluid to be rendered, fluid surface properties, and dynamic field data, wherein the fluid source is used to determine the three-dimensional spatial emission domain corresponding to the fluid to be rendered, and the dynamic field data characterizes the force field acting on fluid particles in the fluid to be rendered; a model determination module, configured to perform fluid calculations based on the container boundary data, the fluid source, and the dynamic field data to generate fluid mesh data, and to determine a static mesh based on the fluid mesh data; a first sampling module, configured to construct a first dynamic UV coordinate based on the basic UV coordinates of the static mesh, and to sample the normal texture map based on the first dynamic UV coordinate to obtain a first sampling result, wherein the first sampling result is used for normal reconstruction; a second sampling module, configured to construct a second dynamic UV coordinate based on the basic UV coordinates of the static mesh, to perform disparity offset on the second dynamic UV coordinate to obtain a disparity-offset second dynamic UV coordinate, and to sample the mask texture map based on the disparity-offset second dynamic UV coordinate to obtain a second sampling result; and a rendering processing module, configured to render the dynamic effect of the fluid to be rendered being splashed from the target container based on the fluid surface properties, the first sampling result, and the second sampling result.

[0017] According to one aspect of this disclosure, a computer program product is provided, comprising a computer program that, when executed by a processor, implements any of the above methods.

[0018] According to one aspect of this disclosure, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform any of the above methods by executing the executable instructions.

[0019] The fluid rendering method in the exemplary embodiments of this disclosure acquires boundary data of the target container, fluid source of the fluid to be rendered, fluid surface properties, and dynamic field data. The fluid source is used to determine the three-dimensional spatial emission domain corresponding to the fluid to be rendered, and the dynamic field data characterizes the force field acting on the fluid particles in the fluid to be rendered. Fluid calculation is performed based on the boundary data, fluid source, and dynamic field data to generate fluid mesh data, and a static mesh is determined based on the fluid mesh data. A first dynamic UV coordinate is constructed based on the basic UV coordinates of the static mesh, and the normal texture map is sampled based on the first dynamic UV coordinate to obtain a first sampling result, which is used for normal reconstruction. A second dynamic UV coordinate is constructed based on the basic UV coordinates of the static mesh, and the second dynamic UV coordinate is disparity offset to obtain the disparity offset second dynamic UV coordinate. The mask texture map is sampled based on the disparity offset second dynamic UV coordinate to obtain a second sampling result. The dynamic effect of the fluid splashing from the target container is rendered based on the fluid surface properties, the first sampling result, and the second sampling result.

[0020] On the one hand, by introducing dynamic field data for fluid calculation and sampling textures after parallax offset using dynamic UV coordinates, the irregular motion of fluid particles under external forces can be simulated, thereby generating a dynamic visual effect of fluid splashing out of a container, enhancing the realism and detail of fluid motion. On the other hand, by constructing a first dynamic UV coordinate to sample the normal texture, normal reconstruction is achieved, which can realistically represent the subtle bumps and gloss changes on the fluid surface; at the same time, by combining a second dynamic UV coordinate with parallax offset to sample the mask texture, the sense of flow in different areas of the fluid (including the fluid interior) can be precisely controlled, and more parallax three-dimensional details are added, making the surface of the splashed fluid present a rich sense of layering. In addition, based on a static mesh, complex dynamic effects are achieved only by constructing dynamic UV coordinates and performing texture sampling, rather than performing complex physical deformation calculations on the 3D mesh in real time. This significantly reduces the computational overhead of fluid simulation and rendering while ensuring visual dynamic effects, thus improving rendering efficiency.

[0021] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0022] The above and other objects, features, and advantages of this disclosure will become readily apparent from the following detailed description of exemplary embodiments, taken in conjunction with the accompanying drawings. Several embodiments of this disclosure are illustrated in the drawings by way of example and not limitation.

[0023] Figure 1 An application environment according to an exemplary embodiment of this disclosure is shown.

[0024] Figure 2 A flowchart of a virtual fluid rendering method according to an exemplary embodiment of the present disclosure is shown.

[0025] Figure 3 A flowchart illustrating an implementation of determining a static mesh according to an exemplary embodiment of the present disclosure is shown.

[0026] Figure 4 A flowchart illustrating an implementation of determining a static mesh through a reconstruction process according to an exemplary embodiment of the present disclosure is shown.

[0027] Figure 5 A schematic diagram comparing a fluid mesh data before and after voxel resampling is shown, according to an exemplary embodiment of the present disclosure.

[0028] Figure 6 A schematic diagram of a third intermediate grid according to an exemplary embodiment of the present disclosure is shown.

[0029] Figure 7 A schematic diagram of obtaining a static mesh according to an exemplary embodiment of the present disclosure is shown.

[0030] Figure 8 A flowchart illustrating an implementation method for obtaining first dynamic UV coordinates and first sampling results according to an exemplary embodiment of the present disclosure is shown.

[0031] Figure 9 A flowchart illustrating an implementation method for obtaining second dynamic UV coordinates and second sampling results according to an exemplary embodiment of the present disclosure is shown.

[0032] Figure 10 A flowchart illustrating an implementation of rendering a fluid to be rendered according to an exemplary embodiment of the present disclosure is shown.

[0033] Figure 11 A schematic diagram illustrating the visualization effect of an updated three-dimensional normal according to an exemplary embodiment of the present disclosure is shown.

[0034] Figure 12 A flowchart illustrating a schematic diagram of a light-emitting area mask according to an exemplary embodiment of the present disclosure is shown.

[0035] Figure 13 A flowchart illustrating a vertex deformation-based rendering method according to an exemplary embodiment of the present disclosure is shown.

[0036] Figure 14 A schematic diagram of a vertex offset intensity according to an exemplary embodiment of the present disclosure is shown.

[0037] Figure 15A schematic diagram illustrating the effect of a yellow liquid splashing from a target container according to an exemplary embodiment of the present disclosure is shown.

[0038] Figure 16 A schematic diagram of the composition of a virtual fluid rendering apparatus according to an exemplary embodiment of the present disclosure is shown.

[0039] Figure 17 A block diagram of an electronic device according to an exemplary embodiment of the present disclosure is shown.

[0040] In the accompanying drawings, the same or corresponding reference numerals indicate the same or corresponding parts. Detailed Implementation

[0041] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be more comprehensive and complete, and will fully convey the concept of exemplary embodiments to those skilled in the art. The same reference numerals in the drawings denote the same or similar structures, and therefore their detailed description will be omitted.

[0042] Furthermore, the described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. Numerous specific details are provided in the following description to give a thorough understanding of embodiments of this disclosure. However, those skilled in the art will recognize that the technical solutions of this disclosure can be practiced without one or more of the specific details described, or other methods, components, apparatuses, steps, etc., can be employed. In other instances, well-known structures, methods, apparatuses, implementations, or operations are not shown or described in detail to avoid obscuring various aspects of this disclosure.

[0043] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, or in one or more software-hardened modules, or in different network and / or processor devices and / or microcontroller devices.

[0044] Currently, rendering effects for viscous fluid splashes requires the engine to calculate and smooth particle fluid dynamics in real time during runtime, consuming significant computing power and causing a sharp drop in frame rate. Furthermore, it's difficult to achieve high-precision viscous fluid details on mobile devices. Another approach involves baking pre-rendered fluid animations into 2D texture atlases and playing them in the game scene using bulletin board technology—playing the animation on a flat surface that always faces the camera. However, this method cannot correctly respond to multi-angle lighting in the scene and cannot present the three-dimensional spatial structure of the fluid splashes, resulting in low visual realism and negatively impacting the overall effect of the fluid splashing effects.

[0045] Based on one or more of the above-mentioned problems, an exemplary embodiment of this disclosure provides a fluid rendering method that improves the rendering effect of the dynamic effect of the fluid splashing out of the target container by pre-computing and discretizing the fluid morphology, constructing dynamic UV coordinates based on the constructed static mesh, and performing texture sampling.

[0046] It should be noted that the methods of the exemplary embodiments of this disclosure can be applied to the fields of 3D visualization, virtual simulation and interactive entertainment that require real-time and efficient simulation of the dynamic effects of fluids (especially liquids) splashing and spraying out of containers, and no specific limitations are imposed thereon.

[0047] The fluid rendering method provided in the exemplary embodiments of this disclosure can be applied to, for example... Figure 1 The application environment shown is illustrated. Terminal 101 communicates with server 102 via a network. A data storage system can store the data that server 102 needs to process. The data storage system can be integrated onto server 102, or it can be located in the cloud or on another network server.

[0048] In one exemplary embodiment, the provided fluid rendering method can be executed by server 102, and the corresponding fluid rendering apparatus is disposed in server 102. Correspondingly, in this manner executed by server 102, server 102 can begin executing the steps of the technical solution of the exemplary embodiment of this disclosure in response to a triggering command, wherein the triggering command can be sent by a terminal used by a user, or can be triggered locally by the server in response to some automated event.

[0049] Server 102 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. Server 102 can execute background tasks.

[0050] Furthermore, in another exemplary embodiment, terminal 101 may also have similar functions to server 102, thereby executing the fluid rendering method provided by the exemplary embodiments of this disclosure. Terminal 101 may be a smartphone, tablet, laptop, desktop computer, IoT device, or portable wearable device. IoT devices may include smart TVs and smart in-vehicle devices, etc. Portable wearable devices may include smartwatches, head-mounted devices, etc. Terminal 101 may also be referred to as a mobile terminal, terminal device, mobile device, etc., and the exemplary embodiments of this disclosure do not limit the type of terminal 101.

[0051] Furthermore, the technical solutions of the exemplary embodiments of this disclosure can also be executed collaboratively by terminal 101 and server 102. In this collaborative execution method, some steps of the technical solutions provided in the exemplary embodiments of this disclosure are executed by terminal 101, while other steps are executed by server 102. In this collaborative execution method, the steps executed by terminal 101 and server 102 respectively can be dynamically adjusted according to actual conditions, and no special restrictions are placed on this. Terminal 101 and server 102 can be directly or indirectly connected via wireless communication, and no special restrictions are placed on this in the exemplary embodiments of this disclosure.

[0052] refer to Figure 2 The diagram shown is a flowchart of a fluid rendering method according to an exemplary embodiment of this disclosure. Figure 2 As shown, the fluid rendering method includes steps S210 to S250, as detailed below: In step S210, the boundary data of the target container, the fluid source of the fluid to be rendered, the fluid surface properties, and the dynamic field data are obtained. The fluid source is used to determine the three-dimensional spatial emission domain corresponding to the fluid to be rendered, and the dynamic field data characterizes the force field acting on the fluid particles in the fluid to be rendered.

[0053] In an exemplary embodiment of this disclosure, the boundary data of the target container is physical constraint information used to limit the range of fluid movement, such as the three-dimensional model data of the container and boundaries that the fluid cannot cross. Specifically, to simulate realistic physical interaction, the container boundaries of the fluid can be determined first. This can be achieved by acquiring the three-dimensional mesh data of the target container, calculating the mesh normals and volume, and establishing rigid body collision boundaries, thus obtaining the boundary data. The boundary data ensures that subsequently generated fluid particles cannot penetrate the model surface and can produce a clustered jet effect based on the shape of the bottle opening.

[0054] For example, in actual implementation, three-dimensional mesh data such as the target container can be loaded through the data interface of the simulation system, and then the three-dimensional mesh data can be input into the expansion processor to establish rigid body collision boundaries.

[0055] The fluid source of the fluid to be rendered refers to the three-dimensional spatial emission domain determined based on the input geometric data (i.e., the initial volume data of the fluid). It is not a static object, but a dynamic logical region used to define the legal spatial coordinate range for fluid particles generated in the simulation system. The geometric surface or volume of this region determines the initial position distribution of the particles. In practice, the initial position and shape of the fluid generation can be defined first. A basic geometry (such as a sphere or cylinder) can be created as the initial volume of the fluid, and then transmitted to the emission controller of the simulation system, thereby converting it into a fluid source capable of generating particles. This disclosure allows setting various data through relevant functional nodes of the simulation system (e.g., Liquigen), without specifying particular functional nodes, which will not be repeated hereafter.

[0056] Fluid surface properties are material parameters that determine the final rendered visual appearance of a fluid, such as refractive index, transparency, and color. In practice, fluid surface properties can be set through the appearance definition module of the simulation system. It is worth noting that this disclosure uses the example of a yellow, transparent liquid splashing from a bottle for illustration.

[0057] Dynamic field data is a collection of forces influencing the motion of fluid particles. This data includes fundamental driving forces, directional guiding forces, and random perturbation forces. The fundamental driving forces apply a vector force towards the target direction to the fluid to be rendered; this is the primary energy source for fluid motion. The target direction can be a fixed direction in the world coordinate system (e.g., upward spray) or a dynamically changing direction, such as tracking a moving target point. This disclosure allows for pre-setting the target direction according to actual rendering requirements. Directional guiding forces define the force field path of the fluid ejected from the target container, requiring the fluid to move along a specific spatial trajectory; this can exist in the form of a "guiding field." Random perturbation forces apply perturbations to the fluid velocity field of the fluid to be rendered; these can be high-frequency perturbations applied to the fluid velocity field based on noise algorithms or random functions.

[0058] In practical implementation, the above three force fields can also be applied using the functional modules of the simulation system. Taking the splashing of yellow transparent liquid from a bottle as an example, a continuous upward vector force can be applied through the constant force module to simulate the basic thrust brought about by gas expansion or to counteract gravity. A force field path from the bottom of the bottle to the mouth can be defined through the linear force module to guide the fluid to move at high speed along a specific axis to form a jet. Furthermore, noise can be introduced through the turbulence force module to perturb the fluid velocity field at high frequency, simulating the chaotic feeling produced by splashing, avoiding an overly smooth water flow, and enhancing the texture.

[0059] Alternatively, the basic driving force can be obtained through real-time physics calculations or determined based on animation keyframe data. The directional guiding force can be determined by hand-drawn spline curves, while the random perturbation force can be based on preset noise textures or dynamic noise generated in real time by the GPU (Graphics Processing Unit).

[0060] In step S220, fluid calculations are performed based on boundary data, fluid source and dynamic field data to generate fluid mesh data, and static mesh is determined based on the fluid network data.

[0061] In the exemplary embodiments of this disclosure, fluid solving is performed according to a particle hydrodynamics algorithm to simulate the motion of a fluid under given conditions. In practice, the solver can receive boundary data, fluid source, and dynamic field data for solving, resulting in disordered, discrete particles, and thereby generating dynamic fluid mesh data. The fluid mesh data is an intermediate product generated by the fluid solving process, used to describe the geometric data of the fluid surface, such as vertex coordinates, normals, and possible velocity field information. The static mesh is a standardized, real-time asset with a fixed topology, optimized and processed for final rendering, and can be rendered in a rendering engine.

[0062] It is worth noting that step S220 can use an offline solver to perform offline calculations, thereby eliminating the overhead of physical simulation during runtime.

[0063] In step S230, a first dynamic UV coordinate is constructed based on the basic UV coordinate of the static mesh, and the normal texture map is sampled according to the first dynamic UV coordinate to obtain a first sampling result. The first sampling result is used for normal reconstruction.

[0064] In the exemplary embodiments of this disclosure, the first dynamic UV coordinates are new UV coordinates calculated in real time based on the base UV coordinates during rendering and used for this sampling. This can be understood as the first dynamic UV coordinates representing the physical basis of the continuous, linear sliding of the texture on the model surface. The normal texture map is a texture that stores perturbation information of the normal direction of the model surface. The first sampling result is grayscale data (as height data) obtained by sampling the normal texture map, which can be converted into a normal vector by calling a normal reconstruction algorithm.

[0065] In step S240, a second dynamic UV coordinate is constructed based on the basic UV coordinate of the static mesh. The second dynamic UV coordinate is then subjected to disparity offset to obtain the second dynamic UV coordinate after disparity offset. The mask texture map is then sampled based on the second dynamic UV coordinate after disparity offset to obtain the second sampling result.

[0066] In an exemplary embodiment of this disclosure, the second dynamic UV coordinates are also coordinates calculated in real time for texture sampling, used for subsequent sampling of mask textures. Similar to the first dynamic UV coordinates, the second dynamic UV coordinates can be constructed based on the base UV coordinates and incorporate time and velocity field dynamics to create a flow effect on the fluid surface (based on the first dynamic UV coordinates) and inside the fluid (based on the second dynamic UV coordinates). In contrast, the first dynamic UV is used for normal mapping to create a sense of surface unevenness and flow, while the second dynamic UV is used for mask mapping to control the position and shape of different material regions. Therefore, the construction parameters (such as flow velocity and direction) for both are independent. Parallax offset utilizes depth information to offset texture coordinates according to the viewing direction, thereby simulating the occlusion and perspective effects of a three-dimensional surface on a plane. This disclosure uses parallax offset to allow the mask to simulate truly attaching to an uneven fluid surface, rather than simply pasting onto a plane, thus creating a sense of depth. The mask texture map is a texture used to control the rendering effect area and weight, used to achieve rich visual layers.

[0067] In step S250, the dynamic effect of the fluid splashing out of the target container is rendered based on the fluid surface properties, the first sampling result, and the second sampling result.

[0068] In exemplary embodiments of this disclosure, rendering can be performed based on fluid surface properties, a first sampling result, and a second sampling result. For example, calculations can be performed for each pixel covered by the mesh through a calculation process in the fragment shader to output the final color and transparency of that pixel.

[0069] The fluid rendering method in the exemplary embodiments of this disclosure, on the one hand, simulates the irregular motion of fluid particles under external forces by introducing dynamic field data for fluid calculation and sampling the texture after parallax offset using dynamic UV coordinates. This generates a dynamic visual effect of fluid splashing out of a container, enhancing the realism and detail of fluid motion. On the other hand, by constructing a first dynamic UV coordinate to sample the normal texture, normal reconstruction is achieved, which can realistically represent the subtle bumps and gloss changes on the fluid surface. Simultaneously, by combining a second dynamic UV coordinate with parallax offset to sample the mask texture, the sense of flow in different areas of the fluid (including the fluid interior) can be precisely controlled, and more parallax three-dimensional details are added, making the splashed fluid surface present a rich sense of layering. Furthermore, based on a static mesh, complex dynamic effects are achieved only by constructing dynamic UV coordinates and performing texture sampling, rather than performing complex physical deformation calculations on the three-dimensional mesh in real time. This significantly reduces the computational overhead of fluid simulation and rendering while ensuring visual dynamic effects, thus improving rendering efficiency.

[0070] In one exemplary embodiment, an implementation method for determining a static mesh is also provided. For example... Figure 3 The process of performing fluid calculations based on the boundary data, the fluid source, and the dynamic field data to generate fluid mesh data, and determining the static mesh based on the fluid mesh data, may include: Step S310: Calculate the position and velocity of the fluid particles in the fluid to be rendered based on the boundary data, fluid source, basic driving force, directional guiding force, and random disturbance force.

[0071] In this process, the position and velocity of fluid particles are the basic, raw data output by the fluid solver. Position is the particle's coordinates in three-dimensional space, and velocity is the vector of particle motion. At this stage, the fluid is represented as a large number of discrete particles, each representing the mass, momentum, and energy of a small clump of fluid. Specifically, the motion of these particles is determined by composite position data. The fundamental driving force applies a constant acceleration to all particles, the directional guiding force applies a restoring force pointing towards the path based on the deviation of the particle's position from a preset path, and the random perturbation force adds a small random increment generated by a noise function to the particle's velocity vector at each time step. The noise function can be preset. Based on this, position determines the shape of the fluid, and velocity affects the fluid's motion trend.

[0072] Step S320: Generate fluid mesh data based on the position, velocity, and preset fluid physical optical properties of the fluid particles.

[0073] Fluid physical optical properties are physical properties related to optical performance that need to be considered when generating meshes from particles. When generating meshes, it's not enough to simply draw the outer shell based on particle density; the optical properties of the fluid material represented by the particles must also be considered, including refractive index, absorption coefficient, and scattering coefficient. In practice, functional nodes in the solution engine (such as the simulation module) can be used to generate fluid mesh data based on the position and velocity of the fluid particles and preset fluid physical optical properties.

[0074] Step S330: Reconstruct the fluid mesh data to obtain a static mesh.

[0075] Because the fluid mesh data calculated offline has problems such as topological fragmentation, excessive face count, and missing UV texture coordinates, it cannot be directly applied to the real-time rendering engine. Therefore, the fluid mesh data can be reconstructed to obtain a static mesh.

[0076] In one exemplary embodiment, an implementation method for determining a static mesh through a reconstruction process is provided. For example... Figure 4 Determining the static mesh based on the fluid network data may include: Step S410: Perform voxel resampling on the fluid mesh data to obtain the first intermediate mesh.

[0077] Voxel resampling addresses geometric voids and self-intersection errors in fluid simulations by using voxelized resampling to repair them, resulting in repaired volume data. This repaired volume data can then be inversely converted to a polygon mesh. The resulting first intermediate mesh is essentially an approximate extraction of the voxel surface; although coarse, its topology has become simpler and more regular. In practice, this can be implemented through functional modules within the engine. For example, ... Figure 5 The image shows a comparison diagram of fluid mesh data before and after voxel resampling.

[0078] Step S420: Based on the surface curvature of the first intermediate mesh, perform surface reduction processing on the first intermediate mesh to obtain the second intermediate mesh.

[0079] Surface curvature refers to the degree of surface bending; areas with high curvature have rich geometric details, while areas with low curvature have gentler geometric changes. By reducing the number of faces, the number of triangles and polygons in the mesh can be selectively reduced based on the degree of surface curvature, resulting in a second intermediate mesh. After face reduction, the number of faces is significantly reduced, but the mesh remains visually highly similar to the original mesh. In practical implementation, based on surface curvature, two points can be merged into one point by edge folding, thereby reducing the number of faces. This can be executed based on the corresponding functional nodes within the engine.

[0080] Optionally, a grid retention rate can be set, such as 20%, which allows 80% of redundant data to be removed by edge folding. This grid retention rate can be set according to actual needs.

[0081] Step S430: Recalculate the vertex normals of the second intermediate mesh using the normal smoothing threshold to obtain the third intermediate mesh.

[0082] Vertex normals are the normal vectors attached to the vertices of a mesh and used to calculate lighting during rendering. The normal smoothing threshold is an angle threshold; when calculating the normals of a vertex, only adjacent faces whose angle with the normal of the face containing the vertex is less than this threshold are considered. For example, a normal smoothing threshold of 180° can eliminate the sharp edges at polygon seams, simulating a seamless liquid surface from a lighting calculation perspective. Since fluid surfaces have both smooth and sharp features, by setting an appropriate threshold, the main body of the liquid can be smoothed while retaining the sharp details created by splashes and breakage, resulting in more realistic lighting effects.

[0083] In practice, vertex normals can be recalculated through corresponding functional modules within the engine to obtain the third intermediate mesh. For example, such as... Figure 6 The diagram shown is a schematic of a third intermediate grid.

[0084] Step S440: Map the third intermediate mesh to a two-dimensional texture space to obtain a static mesh.

[0085] By unfolding a third intermediate mesh onto a 2D plane and assigning a fixed set of 2D UV coordinates to each point on the mesh, a static mesh is obtained. This avoids the problem of missing UVs and provides a foundation for the accurate application of subsequent normal textures, foam maps, etc., to the model surface. This can be implemented through relevant functional nodes within the engine. For example, such as... Figure 7 The diagram shown illustrates one method of obtaining a static mesh.

[0086] This disclosure forcibly converts the original fluid mesh into a voxelized mesh through voxel resampling, providing a clean and stable geometric foundation for subsequent processing. By using surface curvature-based facet reduction, the number of mesh faces is reduced while maintaining a high degree of visual shape preservation, achieving a balance between lightweight design and shape preservation. Introducing a normal smoothing threshold for vertex normal recalculation allows for the differentiation between smooth surfaces and sharp edges during lighting calculations, resulting in a final rendered fluid surface that possesses both a smooth texture and retains necessary hard-edge details, enhancing visual realism. Furthermore, mapping the optimized mesh to a 2D texture space provides the foundation for subsequent construction of the first and second dynamic UVs, normal sampling, and parallax offset, ensuring the coherence and accuracy of texture animation.

[0087] In one exemplary embodiment, an implementation method for obtaining the first dynamic UV coordinates and the first sampling result is also provided. For example... Figure 8 Based on the basic UV coordinates of the static mesh, a first dynamic UV coordinate system is constructed, and the normal texture map is sampled according to the first dynamic UV coordinate system to obtain a first sampling result, which may include: Step S810: Determine the first offset based on the current time variable and the preset two-dimensional flow vector.

[0088] Step S820: Determine the first dynamic UV coordinates based on the first offset and the base UV coordinates.

[0089] Step S830: Sample the normal texture map based on the first dynamic UV coordinates to obtain the first sampling result.

[0090] The current time variable is a continuously increasing value and the driving force behind the dynamic effects. Because the time variable is continuously increasing, the offsets built upon it also change continuously, producing a smooth effect. In practice, in shader programming, time is passed from the CPU to the GPU as a unified variable, or a built-in time variable can be used. The preset 2D flow vector is a pre-defined 2D vector used to control the direction and speed of texture flow. The direction of the vector determines the direction of texture flow in UV space, and the length of the vector determines the flow speed. The longer the vector, the greater the change in UV coordinates per unit time, and the faster the texture flows. The 2D flow vector can be set according to actual needs. For example, for a river, a flow vector pointing downstream can be preset; for a cola splash, the dominant flow direction can be preset based on the overall direction of the splash.

[0091] Specifically, the first offset can be obtained by calculating the product of the current time variable and the preset two-dimensional flow vector. Then, the first offset is superimposed on the base UV coordinates to obtain the first dynamic UV coordinates. Based on this, the base UV coordinates of each point on the mesh surface continuously move in the direction of the two-dimensional flow vector over time. When the texture is sampled using these constantly changing coordinates, the texture pattern will produce a visual effect of continuously sliding in a specific direction on the model surface.

[0092] This disclosure generates an offset by multiplying the current time variable with a preset two-dimensional flow vector, and then superimposing it onto the base UV coordinates, so that the normal texture continuously slides along the preset direction on the fluid surface, providing a basis for subsequent rendering to visually present the micro-undulation details that flow over time.

[0093] In one exemplary embodiment, an implementation method for obtaining the second dynamic UV coordinates and the second sampling result is also provided. For example... Figure 9 A second dynamic UV coordinate system is constructed based on the basic UV coordinates of the static mesh. This second dynamic UV coordinate system is then subjected to disparity offset to obtain the disparity-offset second dynamic UV coordinate system. Finally, the mask texture map is sampled based on these disparity-offset second dynamic UV coordinate systems to obtain a second sampling result, which may include: Step S910: Determine the second offset based on the current time variable and the preset velocity vector.

[0094] The preset velocity vector is a pre-defined two-dimensional vector used to control the direction and base velocity of the mask texture flowing on the fluid surface. Specifically, the flow vector in the first dynamic UV primarily drives the normal texture to represent the flow of surface ripples, while the velocity vector here primarily drives the mask texture to control the movement of material areas such as bubbles and water splashes. The directions and velocities of both can be independent.

[0095] In practice, the current time variable can be multiplied by the velocity vector to obtain the second offset. Based on this, the texture coordinates will continue to slide in the X or Y axis direction over time, thus producing a smooth and continuous fluid motion effect on the model surface.

[0096] Step S920: Determine the second dynamic UV coordinates based on the base UV coordinates, the first repeat density, and the second offset. The first repeat density is used to control the repeat density of the mask texture on the surface.

[0097] The first repetition density is a scalar value used to control the number of times the mask texture repeats on the mesh surface; essentially, it scales the base UV coordinates. A higher density value means the texture repeats more times per unit area, resulting in a finer texture pattern; a lower density value means a sparser and larger texture pattern. It can be manually set by artists, allowing them to control the visual scale of the mask texture independently of the mesh's base UV layout. In practice, the base UV coordinates can be multiplied by the first repetition density, and then a second offset can be added to obtain the second dynamic UV coordinates.

[0098] Step S930: Based on the camera's line-of-sight vector and depth intensity, offset the second dynamic UV coordinates to obtain the second dynamic UV coordinates after parallax offset.

[0099] The camera view vector is a 3D unit vector pointing from the currently rendered pixel to the camera position. Depth intensity controls the magnitude of the parallax offset. The second dynamic UV coordinates can be warped and offset based on the camera view vector and depth intensity to obtain the parallax-off second dynamic UV coordinates. In practice, pixel-level warping and offset can be performed using in-engine nodes. Essentially, this involves pushing and pulling the texture based on height information; that is, when the camera's viewpoint moves, the visual texture position will shift relative to the viewpoint, creating a pseudo-3D effect where the 2D plane appears concave or internally suspended, breaking the flatness of traditional textures.

[0100] Step S940: Sample the mask texture map according to the second dynamic UV coordinates after parallax offset to obtain the second sampling result.

[0101] Finally, the mask texture map can be sampled using the second dynamic UV coordinates after parallax offset to obtain the luminous area mask, i.e., the second sampling result.

[0102] This disclosure uses a combination of UV translation and parallax mapping to simulate a flowing surface with a three-dimensional undulation effect through shader algorithms without increasing the number of geometric faces of the model, thus avoiding the artificial feel of planar textures.

[0103] In one exemplary embodiment, an implementation method for rendering the fluid to be rendered is also provided. For example... Figure 10 Rendering the dynamic effect of the fluid being splashed out of the target container based on the fluid surface properties, the first sampling result, and the second sampling result may include: Step S1010: Reconstruct the normals based on the first sampling result to obtain the updated three-dimensional normal vectors, which are then used for lighting calculations.

[0104] The updated 3D normal vectors, after decoding and reconstruction, are pixel-by-pixel surface normal directions used for final lighting calculations. In practice, this conversion can be performed by calling a normal reconstruction algorithm through a function node within the engine. After obtaining the updated 3D normal vectors, these vectors replace the original geometric normals in lighting calculations, thus visually revealing microscopic undulations in the originally smooth model surface that flow over time. This not only realistically simulates the dynamic ripples on a liquid surface caused by tension but also significantly saves computational resources, avoiding the performance waste of using high-density meshes to represent microscopic fluid details.

[0105] For example, such as Figure 11 The image shown is a schematic diagram illustrating the updated 3D normal.

[0106] Step S1020: Determine the luminous area mask based on the second sampling result and the preset self-illuminating color data.

[0107] The luminescent area mask is a grayscale image generated based on the second sampling result, used to control the self-illumination effect of different areas on the fluid surface. The second sampling result can be directly multiplied by preset self-illuminating color data to obtain the luminescent area mask. In practice, the obtained second sampling result can be connected to the material's self-illuminating port to obtain the luminescent area mask. Based on this, colored luminescent surfaces with both continuous flow dynamics and parallax stereoscopic details can be synthesized, efficiently simulating the visual texture of fluids or energy layers. For example, as shown... Figure 12 The diagram shown is a schematic of a light-emitting area mask.

[0108] Step S1030: Render the dynamic effect of the fluid splashing out of the target container based on the fluid surface properties, the updated 3D normal vector, and the luminous region mask.

[0109] Ultimately, the dynamic effect of the fluid splashing from the target container can be rendered based on the fluid surface properties, the updated 3D normal vector, and the luminous region mask. Specifically, the fluid surface properties are combined with the mask information to obtain combined material parameters. These combined material parameters and the updated 3D normal vector are then fed into the lighting model to calculate diffuse and specular reflections to obtain the lighting calculation results. Finally, the color values ​​stored in the luminous region mask are directly added to the lighting calculation results to obtain the final pixel color written to the buffer frame, which is the dynamic effect of the fluid splashing from the target container displayed on the screen.

[0110] This disclosure decodes the first sampling result into an updated 3D normal vector through normal reconstruction, providing precise per-pixel surface direction for lighting calculations. By combining the second sampling result with preset self-illuminating color data, an illuminating region mask is generated, which can control the self-illuminating effect of different areas of the fluid surface. The combination of fluid surface properties, the updated 3D normal vector, and the illuminating region mask is fed into the lighting model for comprehensive calculation, so that the final rendered image maintains the correctness of macroscopic materials while possessing the realism of microscopic details.

[0111] In one exemplary embodiment, a rendering method based on vertex deformation is also provided. For example... Figure 13 This method also includes: Step S1310: Determine the target texture coordinates based on the current time variable, the preset velocity vector, the basic UV coordinates, and the second repetition density. The second repetition density is used to control the repetition density of the displacement texture on the surface.

[0112] The second repetition density is a parameter used to control the number of times the displacement texture repeats on the mesh surface, determining the size of the waves or bumps on the fluid surface. For example, to simulate large, gentle swells, a lower repetition density can be set; to simulate tiny bumps formed by small splashes of water, a higher repetition density can be set. The target texture coordinates are the UV coordinates ultimately used to sample the displacement texture after dynamic offset and density control.

[0113] Specifically, the product of the base UV coordinates and the second repetition density can be obtained and superimposed with the product of the current time variable and the preset velocity vector to obtain the target texture coordinates, which are the scrolling texture coordinates.

[0114] Step S1320: Sample the coordinate texture map using the target texture coordinates to obtain dynamic grayscale data.

[0115] The R channel of the target texture coordinate sampling coordinate texture map can be used to obtain real-time dynamic grayscale data.

[0116] Step S1330: Calculate the vertex offset of the vertex in the static mesh based on the dynamic grayscale data, and combine the vertex offset with the world position offset corresponding to the vertex to obtain the target offset. The target offset is used to determine the final rendering position of the vertex.

[0117] Vertex offset is calculated based on dynamic grayscale data to determine the offset of vertices in a static mesh. The world position offset corresponding to a vertex is a more macroscopic offset, such as the "World Position Offset" within the engine. Combining the vertex offset with the corresponding world position offset yields the target offset. This ensures that vertices move with the overall fluid flow while also exhibiting local undulations and deformations relative to the mesh surface.

[0118] Optionally, calculating the vertex offset of a vertex in a static mesh based on dynamic grayscale data may include: First, the dynamic grayscale data is superimposed onto the vertex normal vector to obtain the intermediate offset, and the first vertex offset is obtained based on the intermediate offset and the first displacement intensity.

[0119] Then, the offset of the second vertex is determined based on the vertex normal vector and the second displacement intensity.

[0120] Finally, based on the mixed weights, the first vertex offset and the second vertex offset are linearly interpolated to obtain the vertex offset.

[0121] The first displacement intensity is used to control the perturbation amplitude of vertex offset driven by noise texture, and the second displacement intensity is used to control the amplitude of vertex expansion or contraction along the vertex normal direction.

[0122] Specifically, the vertex normal vector is the direction vector attached to each vertex of the mesh. The first displacement intensity controls the magnitude of the vertex offset driven by dynamic grayscale data (i.e., noise texture). Higher intensity results in more severe surface undulations caused by the texture pattern; lower intensity results in weaker undulations. This can be understood as the amplitude of surface turbulence or detail fluctuations in a fluid. The second displacement intensity controls the magnitude of overall expansion or contraction along the vertex normal direction. This intensity is not linked to the texture but directly moves the vertex along the normal direction, thus simulating fluid volume changes and overall shape adjustments. Therefore, the first displacement intensity produces local, high-frequency, position-dependent detail deformation, while the second displacement intensity produces global, low-frequency, uniform basic deformation. The blending weight is a scalar value used for linear interpolation between the first and second vertex offsets, ranging from [0,1]. When the blending weight approaches 0, it represents strong dynamic perturbations driven by noise; when it approaches 1, it represents stable static normal extrusion. Linear interpolation can be performed using the lerp operation without special restrictions.

[0123] In practice, the intermediate offset can be multiplied by the first displacement intensity to obtain the first vertex offset. This not only utilizes the normal direction but also introduces direct interference from texture values, causing irregular distortions and fluctuations on the model surface. Multiplying the vertex normal vector by the static second displacement intensity yields the second vertex offset. This step simulates the model's uniform expansion or contraction along the normal direction, providing stable volume support. For example, as shown... Figure 14 This is a schematic diagram of a vertex offset intensity.

[0124] This example independently controls the amplitude of high-frequency perturbations driven by noise textures through the first displacement intensity, and independently controls the amplitude of overall low-frequency deformation along the normal direction through the second displacement intensity. It can adjust the detail richness and basic volume change separately without interfering with each other. It also combines texture-driven detail perturbations and geometry-driven basic deformations, so that the fluid surface has both random natural undulations and overall shape changes that conform to physical laws, which is beneficial to improving the rendering effect.

[0125] Step S1340: Render the dynamic effect of the fluid splashing out of the target container based on the fluid surface properties, the updated 3D normal vector, the luminous region mask, and the target offset.

[0126] Ultimately, the dynamic effect of the fluid splashing out of the target container can be rendered based on the fluid surface properties, the updated 3D normal vector, the luminous region mask, and the target offset.

[0127] This disclosure combines vertex offset with world position offset to obtain target offset, ensuring that vertices move with the fluid as a whole while also undergoing independent deformation relative to the surface locally. This achieves visual unity between macroscopic motion and microscopic details, avoiding the stiffness of static meshes when displayed for extended periods.

[0128] In one exemplary embodiment, the static mesh can also be mapped from the simulation coordinate space to the game world coordinate space.

[0129] The game world coordinate space is a global, unified three-dimensional coordinate system used by the entire game scene or 3D application, while the simulation coordinate space is an independent, local coordinate system used when performing fluid physics simulation calculations.

[0130] In practice, all vertices of the model can be traversed to obtain their world coordinates (X, Y, Z). Then, the minimum and maximum values ​​of the X, Y, and Z axes are found, resulting in the bounding box from (minX, minY, minZ) to (maxX, maxY, maxZ). Furthermore, using the Y-axis as a reference, the coordinates of the lowest point are (any X, minY, any Z). For a fluid model, the lowest point is the area where the fluid contacts the bottom of the target container. This means aligning the lowest point of the model's bottom with the origin of the world coordinate system (the Y=0 plane). The offset can be calculated, such as offsetY = 0 - minY. A translation matrix can then be applied to all vertices of the model: new vertex coordinates = original vertex coordinates + (0, offsetY, 0). After translation, the Y-coordinate of the lowest point of the model becomes 0, and the entire model is lifted onto the ground. Finally, the model's axis is moved to the world origin (0,0,0). Optionally, the model can be scaled according to the unit standard of the target engine to obtain a cleaned and standardized static mesh, thus mapping the static mesh from the simulation coordinate space to the game world coordinate space, such as... Figure 15 The diagram shows the effect of a yellow liquid being sprayed from a target container according to this disclosure.

[0131] This disclosure uses spatial mapping to precisely place the fluid mesh generated in the simulation space into a specified location in the game world. It serves as a bridge connecting offline simulation and real-time rendering, ensuring that assets are applicable in the engine and scene.

[0132] In an exemplary embodiment of this disclosure, a fluid rendering apparatus is also provided. (See reference...) Figure 16 As shown, the fluid rendering device 1600 may include a data acquisition module 1610, a model determination module 1620, a first sampling module 1630, a second sampling module 1640, and a rendering processing module 1650. Specifically: The data acquisition module 1610 is used to acquire the boundary data of the target container, the fluid source of the fluid to be rendered, the fluid surface properties, and the dynamic field data. The fluid source is used to determine the three-dimensional spatial emission domain corresponding to the fluid to be rendered, and the dynamic field data characterizes the force field acting on the fluid particles in the fluid to be rendered. The model determination module 1620 is used to perform fluid calculations based on the container boundary data, fluid source, and dynamic field data, generate fluid mesh data, and determine the static mesh based on the fluid mesh data. The first sampling module 1630 is used to construct the first dynamic UV coordinates based on the basic UV coordinates of the static mesh, and determine the static UV coordinates based on the first dynamic UV coordinates. The V-coordinate is used to sample the normal texture map to obtain the first sampling result, which is used for normal reconstruction. The second sampling module 1640 is used to construct the second dynamic UV coordinate based on the basic UV coordinate of the static mesh, perform parallax offset on the second dynamic UV coordinate to obtain the parallax offset second dynamic UV coordinate, and sample the mask texture map according to the parallax offset second dynamic UV coordinate to obtain the second sampling result. The rendering processing module 1650 is used to render the dynamic effect of the fluid splashing from the target container according to the fluid surface properties, the first sampling result and the second sampling result.

[0133] In one exemplary embodiment of this disclosure, the dynamic field data includes a basic driving force, a directional guiding force, and a random perturbation force; wherein, the basic driving force is used to apply a vector force toward the target direction to the fluid to be rendered, the directional guiding force is used to define the force field path of the fluid to be rendered ejected from the target container, and the random perturbation force is used to apply a perturbation to the fluid velocity field of the fluid to be rendered; fluid calculation is performed based on boundary data, fluid source, and dynamic field data to generate fluid mesh data, and a static mesh is determined based on the fluid mesh data, including: calculating the position and velocity of fluid particles of the fluid to be rendered based on boundary data, fluid source, basic driving force, directional guiding force, and random perturbation force; generating fluid mesh data based on the position and velocity of fluid particles and preset fluid physical optical properties; and reconstructing the fluid mesh data to obtain a static mesh.

[0134] In one exemplary embodiment of this disclosure, determining a static mesh based on fluid network data includes: voxel resampling of the fluid network data to obtain a first intermediate mesh; performing surface reduction processing on the first intermediate mesh based on the surface curvature of the first intermediate mesh to obtain a second intermediate mesh; recalculating the vertex normals of the second intermediate mesh using a normal smoothing threshold to obtain a third intermediate mesh; and mapping the third intermediate mesh to a two-dimensional texture space to obtain a static mesh.

[0135] In one exemplary embodiment of this disclosure, a first dynamic UV coordinate is constructed based on the base UV coordinates of a static mesh, and the normal texture map is sampled according to the first dynamic UV coordinate to obtain a first sampling result, including: determining a first offset based on the current time variable and a preset two-dimensional flow vector; determining the first dynamic UV coordinate based on the first offset and the base UV coordinate; and sampling the normal texture map based on the first dynamic UV coordinate to obtain the first sampling result.

[0136] In one exemplary embodiment of this disclosure, a second dynamic UV coordinate is constructed based on the base UV coordinates of a static mesh. The second dynamic UV coordinate is then subjected to parallax offset to obtain the parallax-offset second dynamic UV coordinate. The mask texture map is then sampled based on the parallax-offset second dynamic UV coordinate to obtain a second sampling result. This includes: determining a second offset based on the current time variable and a preset velocity vector; determining the second dynamic UV coordinate based on the base UV coordinates, a first repetition density, and the second offset, where the first repetition density controls the repetition density of the mask texture on the surface; offsetting the second dynamic UV coordinate based on the camera's view vector and depth intensity to obtain the parallax-offset second dynamic UV coordinate; and sampling the mask texture map based on the parallax-offset second dynamic UV coordinate to obtain the second sampling result.

[0137] In one exemplary embodiment of this disclosure, rendering the dynamic effect of the fluid splashing from the target container based on fluid surface properties, a first sampling result, and a second sampling result includes: reconstructing normals based on the first sampling result to obtain an updated three-dimensional normal vector, the updated three-dimensional normal vector being used for lighting calculation; determining a light-emitting region mask based on the second sampling result and preset self-illuminating color data; and rendering the dynamic effect of the fluid splashing from the target container based on fluid surface properties, the updated three-dimensional normal vector, and the light-emitting region mask.

[0138] In one exemplary embodiment of this disclosure, the rendering processing module 1650 is further configured to perform: determining target texture coordinates based on the current time variable, a preset velocity vector, base UV coordinates, and a second repetition density, wherein the second repetition density is used to control the repetition density of the displacement texture on the surface; sampling the coordinate texture map using the target texture coordinates to obtain dynamic grayscale data; calculating the vertex offset of the vertices in the static mesh based on the dynamic grayscale data, and combining the vertex offset with the world position offset corresponding to the vertex to obtain the target offset, wherein the target offset is used to determine the final rendering position of the vertex; and rendering the dynamic effect of the fluid splashing out of the target container based on the fluid surface properties, the updated three-dimensional normal vector, the luminous region mask, and the target offset.

[0139] In one exemplary embodiment of this disclosure, calculating the vertex offset of a vertex in a static mesh based on dynamic grayscale data includes: superimposing dynamic grayscale data onto the vertex normal vector of the vertex to obtain an intermediate offset, and obtaining a first vertex offset based on the intermediate offset and a first displacement intensity; determining a second vertex offset based on the vertex normal vector and a second displacement intensity; and linearly interpolating the first vertex offset and the second vertex offset based on a hybrid weight to obtain the vertex offset amount; wherein the first displacement intensity is used to control the perturbation amplitude of the vertex offset driven by noise texture, and the second displacement intensity is used to control the vertex expansion or contraction amplitude along the vertex normal direction.

[0140] In one exemplary embodiment of this disclosure, the model determination module 1620 is further configured to perform: mapping a static mesh from the simulation coordinate space to the game world coordinate space.

[0141] Since the details of the various functional modules of the fluid rendering apparatus of the exemplary embodiments of this disclosure have been described in the exemplary embodiments of the fluid rendering method described above, they will not be repeated here.

[0142] It should be noted that although several modules or units of the fluid rendering apparatus have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.

[0143] Exemplary embodiments of this disclosure also provide a computer program product. The computer program product includes a computer program that, when executed by a processor, implements the fluid rendering method described above.

[0144] In one implementation, the computer program product can be a tangible product containing a computer program, such as a computer-readable storage medium storing the computer program. The readable storage medium can be a storage medium based on electrical, magnetic, optical, electromagnetic, infrared, or other signals, including but not limited to: random access memory (RAM), read-only memory (ROM), magnetic tape, floppy disk, flash memory, hard disk drive (HDD), solid-state drive (SSD), etc. For example, the computer program product can be implemented as a non-volatile storage medium storing a computer program, such as read-only memory, NAND flash memory, etc.

[0145] In one implementation, the computer program product can be an intangible product containing a computer program. For example, the computer program product can be implemented as a virtual digital product, such as an executable file, installation package, or other digital file storing the computer program.

[0146] Computer program code can be written in one or more programming languages. Examples of programming languages ​​include C, Java, and C++. Program code can execute entirely on the user's computing device, partially on the user's computing device, or as a standalone software package. It can also execute partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, such as a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via an internet connection provided by a mobile network operator).

[0147] Computer programs can be carried or transmitted via signals such as electrical, magnetic, optical, electromagnetic, and infrared rays. Electronic devices can convert the signals carrying computer programs into digital signals, thereby running the computer programs. When a computer program runs on an electronic device, its code is used to cause the electronic device to execute (more specifically, to execute by the processor of the electronic device) the method steps of various exemplary embodiments of this disclosure, such as the fluid rendering method described above.

[0148] Furthermore, in exemplary embodiments of this disclosure, an electronic device capable of implementing the above-described methods is also provided. Those skilled in the art will understand that various aspects of this disclosure can be implemented as systems, methods, or program products. Therefore, various aspects of this disclosure can be specifically implemented as: entirely hardware embodiments, entirely software embodiments (including firmware, microcode, etc.), or embodiments combining hardware and software aspects, collectively referred to herein as "circuit," "module," or "system."

[0149] The following reference Figure 17 To describe an electronic device 1700 according to such an embodiment of the present disclosure. Figure 17 The electronic device 1700 shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments disclosed herein.

[0150] like Figure 17 As shown, the electronic device 1700 is presented in the form of a general-purpose computing device. The components of the electronic device 1700 may include, but are not limited to: at least one processing unit 1710, at least one storage unit 1720, a bus 1730 connecting different system components (including storage unit 1720 and processing unit 1710), and a display unit 1740.

[0151] The storage unit stores program code that can be executed by the processing unit 1710, causing the processing unit 1710 to perform the steps described in the "Exemplary Methods" section above, according to various exemplary embodiments of this disclosure.

[0152] Storage unit 1720 may include readable media in the form of volatile storage units, such as random access memory (RAM) 1721 and / or cache memory 1722, and may further include read-only memory (ROM) 1723.

[0153] Storage unit 1720 may also include a program / utility 1724 having a set (at least one) program module 1725, such program module 1725 including but not limited to: operating system, one or more application programs, other program modules and program data, each or some combination of these examples may include an implementation of a network environment.

[0154] Bus 1730 can represent one or more of several types of bus structures, including memory cell bus or memory cell controller, peripheral bus, graphics acceleration port, processing unit, or local bus using any of the multiple bus structures.

[0155] Electronic device 1700 can also communicate with one or more external devices 1800 (e.g., keyboard, pointing device, Bluetooth device, etc.), one or more devices that enable a user to interact with electronic device 1700, and / or any device that enables electronic device 1700 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 1750. Furthermore, electronic device 1700 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 17170. As shown, network adapter 17170 communicates with other modules of electronic device 1700 via bus 1730. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 1700, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0156] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the methods according to the embodiments of this disclosure.

[0157] Furthermore, the above figures are merely illustrative of the processes included in the method according to exemplary embodiments of this disclosure and are not intended to be limiting. It is readily understood that the processes shown in the above figures do not indicate or limit the temporal order of these processes. Additionally, it is readily understood that these processes may be executed synchronously or asynchronously, for example, in multiple modules.

[0158] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and embodiments are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the claims.

Claims

1. A fluid rendering method, characterized in that, include: The boundary data of the target container, the fluid source of the fluid to be rendered, the fluid surface properties, and the dynamic field data are obtained. The fluid source is used to determine the three-dimensional spatial emission domain corresponding to the fluid to be rendered, and the dynamic field data characterizes the force field acting on the fluid particles in the fluid to be rendered. Fluid calculations are performed based on the boundary data, the fluid source, and the dynamic field data to generate fluid mesh data, and a static mesh is determined based on the fluid network data. A first dynamic UV coordinate is constructed based on the basic UV coordinates of the static mesh, and the normal texture map is sampled according to the first dynamic UV coordinate to obtain a first sampling result. The first sampling result is used for normal reconstruction. A second dynamic UV coordinate is constructed based on the basic UV coordinates of the static mesh. The second dynamic UV coordinate is then subjected to disparity offset to obtain the disparity-offset second dynamic UV coordinate. The mask texture map is then sampled based on the disparity-offset second dynamic UV coordinate to obtain a second sampling result. Based on the fluid surface properties, the first sampling result, and the second sampling result, the dynamic effect of the fluid to be rendered being splashed out of the target container is rendered.

2. The method according to claim 1, characterized in that, The dynamic field data includes basic driving force, directional guiding force, and random perturbation force; wherein, the basic driving force is used to apply a vector force toward the target direction to the fluid to be rendered, the directional guiding force is used to define the force field path of the fluid to be rendered ejected from the target container, and the random perturbation force is used to perturb the fluid velocity field of the fluid to be rendered. The step of performing fluid calculations based on the boundary data, the fluid source, and the dynamic field data to generate fluid mesh data, and determining the static mesh based on the fluid mesh data, includes: Based on the boundary data, the fluid source, the basic driving force, the directional guiding force, and the random disturbance force, calculate the position and velocity of the fluid particles in the fluid to be rendered; The fluid mesh data is generated based on the position and velocity of the fluid particles and the preset fluid physical optical properties. The fluid mesh data is reconstructed to obtain the static mesh.

3. The method according to claim 2, characterized in that, The step of determining the static mesh based on the fluid network data includes: The fluid mesh data is resampled using voxels to obtain a first intermediate mesh; Based on the surface curvature of the first intermediate mesh, the first intermediate mesh is subjected to a surface reduction process to obtain the second intermediate mesh; The vertex normals of the second intermediate mesh are recalculated using a normal smoothing threshold to obtain the third intermediate mesh; The third intermediate mesh is mapped to a two-dimensional texture space to obtain the static mesh.

4. The method according to claim 1, characterized in that, The first dynamic UV coordinates are constructed based on the basic UV coordinates of the static mesh, and the normal texture map is sampled according to the first dynamic UV coordinates to obtain a first sampling result, including: Determine the first offset based on the current time variable and the preset two-dimensional flow vector; The first dynamic UV coordinates are determined based on the first offset and the base UV coordinates; The normal texture map is sampled based on the first dynamic UV coordinates to obtain the first sampling result.

5. The method according to claim 1, characterized in that, The second dynamic UV coordinates are constructed based on the static mesh's base UV coordinates. A disparity offset is applied to the second dynamic UV coordinates to obtain the disparity-offset second dynamic UV coordinates. The mask texture map is then sampled based on the disparity-offset second dynamic UV coordinates to obtain a second sampling result, including: The second offset is determined based on the current time variable and the preset velocity vector; The second dynamic UV coordinates are determined based on the base UV coordinates, the first repetition density, and the second offset, wherein the first repetition density is used to control the repetition density of the mask texture on the surface. Based on the camera's line-of-sight vector and depth intensity, the second dynamic UV coordinates are offset to obtain the second dynamic UV coordinates after the parallax offset. The mask texture map is sampled based on the second dynamic UV coordinates after the parallax offset to obtain the second sampling result.

6. The method according to claim 1, characterized in that, The step of rendering the dynamic effect of the fluid being splashed out of the target container based on the fluid surface properties, the first sampling result, and the second sampling result includes: Based on the first sampling result, normals are reconstructed to obtain updated three-dimensional normal vectors, which are used for lighting calculations. Based on the second sampling result and the preset self-illuminating color data, determine the luminous area mask; Based on the fluid surface properties, the updated 3D normal vector, and the luminous region mask, the dynamic effect of the fluid being splashed out of the target container is rendered.

7. The method according to claim 6, characterized in that, The method further includes: The target texture coordinates are determined based on the current time variable, the preset velocity vector, the basic UV coordinates, and the second repetition density. The second repetition density is used to control the repetition density of the displacement texture on the surface. The coordinate texture map is sampled using the target texture coordinates to obtain dynamic grayscale data; The vertex offset of the vertex in the static mesh is calculated based on the dynamic grayscale data, and the vertex offset is combined with the world position offset corresponding to the vertex to obtain the target offset. The target offset is used to determine the final rendering position of the vertex. Based on the fluid surface properties, the updated 3D normal vector, the luminous area mask, and the target offset, the dynamic effect of the fluid being splashed out of the target container is rendered.

8. The method according to claim 7, characterized in that, The step of calculating the vertex offset of the vertices in the static mesh based on the dynamic grayscale data includes: The dynamic grayscale data is superimposed onto the vertex normal vector of the vertex to obtain the intermediate offset, and the first vertex offset is obtained based on the intermediate offset and the first displacement intensity. The offset of the second vertex is determined based on the vertex normal vector and the second displacement intensity. Based on the hybrid weights, the first vertex offset and the second vertex offset are linearly interpolated to obtain the vertex offset amount of the vertex; Wherein, the first displacement intensity is used to control the disturbance amplitude of vertex offset driven by noise texture, and the second displacement intensity is used to control the amplitude of vertex expansion or contraction along the vertex normal direction.

9. A fluid rendering apparatus, characterized in that, The device includes: The data acquisition module is used to acquire the boundary data of the target container, the fluid source of the fluid to be rendered, the fluid surface properties, and the dynamic field data. The fluid source is used to determine the three-dimensional spatial emission domain corresponding to the fluid to be rendered, and the dynamic field data characterizes the force field acting on the fluid particles in the fluid to be rendered. The model determination module is used to perform fluid calculations based on the container boundary data, the fluid source, and the dynamic field data, generate fluid mesh data, and determine the static mesh based on the fluid network data. The first sampling module is used to construct a first dynamic UV coordinate based on the basic UV coordinate of the static mesh, and to sample the normal texture map according to the first dynamic UV coordinate to obtain a first sampling result. The first sampling result is used for normal reconstruction. The second sampling module is used to construct a second dynamic UV coordinate based on the basic UV coordinate of the static mesh, perform parallax offset on the second dynamic UV coordinate to obtain the parallax offset second dynamic UV coordinate, and sample the mask texture map according to the parallax offset second dynamic UV coordinate to obtain the second sampling result. The rendering processing module is used to render the dynamic effect of the fluid to be rendered being sprayed out of the target container based on the fluid surface properties, the first sampling result, and the second sampling result.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method described in any one of claims 1 to 8.

11. An electronic device, characterized in that, include: processor; as well as Memory for storing the executable instructions of the processor; The processor is configured to perform the method of any one of claims 1 to 8 by executing the executable instructions.