Method, device, electronic device and readable storage medium for generating fluid interaction effect

By generating and splicing fluid models, and generating mask diagrams with surface and depth distance field data for fluid model replacement, the problem of inactivity of fluid interaction in the prior art is solved, and efficient and real-time fluid interaction effect is achieved.

CN119770980APending Publication Date: 2025-04-08NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510032289.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-08
Publication Date
2025-04-08

AI Technical Summary

Technical Problem

The prior art is difficult to achieve real-time interaction between fluids and the surrounding environment and players, and the interaction effect achieved through Flowmap maps cannot respond to player behavior or environmental changes, resulting in low production efficiency and poor results.

Method used

By responding to the rendering instructions, a fluid primitive model is generated and spliced ​​into a fluid model, the surface distance field data and depth distance field data of the virtual object and the fluid model are obtained, the preset fluid texture map is mapped and it is set to move over time, the wake waveform and the surrounding waveform mask map are generated, and the fluid model is replaced, and the dynamic interaction effect between the virtual object and the fluid model is finally realized.

Benefits of technology

Real-time dynamic interaction between fluid and the surrounding environment and players is achieved, real-time performance and performance are ensured, configuration is simplified, and the production efficiency of fluid interaction is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119770980A_ABST
    Figure CN119770980A_ABST
Patent Text Reader

Abstract

The present disclosure provides a method, device, electronic device and readable storage medium for generating a fluid interaction effect. The method comprises: generating a fluid primitive model according to the size of a virtual object in response to a rendering instruction for the fluid interaction effect; obtaining a fluid model based on the fluid primitive model by splicing; obtaining surface distance field data and depth distance field data corresponding to the interaction between the virtual object and the fluid model in a virtual scene; mapping a preset fluid texture map to the fluid model, and setting the preset fluid texture map to move on the surface of the fluid model over time; generating a wake waveform mask map and a bypass waveform mask map corresponding to the interaction between the virtual object and the fluid model in the virtual scene according to the surface distance field data and the depth distance field data; displacing the fluid model according to the preset displacement map, the wake waveform mask map and the bypass waveform mask map; rendering and displaying the virtual object and the displaced fluid model to obtain the fluid interaction effect between the virtual object and the fluid model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a method, device, electronic device and readable storage medium for generating fluid interaction effects. Background Art

[0002] In order to enhance the realism and immersion of the game and enable players to better experience the in-game environment, fluid effects are usually simulated and displayed in games. For example, computer graphics technology is used to simulate and display the dynamic behavior and visual effects of fluids such as water, smoke, fire, and magma in three-dimensional space. When simulating and displaying the dynamic behavior and visual effects of fluids, a series of plane graphics (i.e., "patches") can be used to create fluids, and the created fluids can be covered in the scenes and terrain shapes of fluid effects. In order to make a series of plane graphics look like real fluids, special material maps are applied. These material maps can simulate the feeling of flow, such as water ripples or the slow flow of lava.

[0003] In order to simulate more delicate and realistic fluid effects, the interaction between the fluid and the surrounding environment and the player is usually involved. For example, when the fluid encounters obstacles (such as stones or bridge pillars), how to correctly bypass these obstacles instead of simply penetrating them; if there is a dynamically changing terrain in the game environment (such as sand accumulation or erosion), how does the fluid change its flow direction and shape accordingly; and when the player controls the character model to enter the water, ripples will be generated. At present, in game development, the interaction effects between the fluid and the surrounding environment and the player are pre-customized using Flowmap textures, that is, the places where the fluid interacts with the surrounding environment and the player are drawn in the Flowmap texture. The Flowmap texture is applied in the game to realize the interaction between the fluid and the surrounding environment and the player. However, when the interaction between the fluid and the surrounding environment and the player is realized through the Flowmap texture, the interaction in the flowmap texture is determined before the game is run. During the game, the flowmap texture cannot respond to the player's behavior or the changes in the environment around the fluid to realize real-time interaction. If a corresponding flowmap texture is made separately for each area that requires a fluid effect, it will take a lot of time and human resources, and the production efficiency is low. Summary of the invention

[0004] The present disclosure provides a method, device, electronic device and readable storage medium for generating fluid interaction effects to solve or at least partially solve the above-mentioned problems.

[0005] In a first aspect, an embodiment of the present disclosure provides a method for generating a fluid interaction effect, the method comprising:

[0006] In response to a rendering instruction for a fluid interaction effect, a fluid primitive model is generated according to a size of a virtual object;

[0007] Based on the fluid primitive models, a fluid model is obtained by splicing;

[0008] Acquire surface distance field data and depth distance field data corresponding to the virtual object interacting with the fluid model in the virtual scene;

[0009] Mapping a preset fluid texture map to the fluid model, and setting the preset fluid texture map to move on the surface of the fluid model over time;

[0010] Generate, according to the surface distance field data and the depth distance field data, a wake waveform mask image and a bypass waveform mask image corresponding to the virtual object and the fluid model interacting in the virtual scene;

[0011] Displacing the fluid model according to a preset displacement map, the wake waveform mask map, and the bypass waveform mask map;

[0012] The virtual object and the replaced fluid model are rendered and displayed to obtain a fluid interaction effect between the virtual object and the fluid model.

[0013] In a second aspect, an embodiment of the present disclosure further provides a device for generating a fluid interaction effect, the device comprising:

[0014] A primitive model generation module, for generating a fluid primitive model according to the size of the virtual object in response to a rendering instruction for a fluid interaction effect;

[0015] A model splicing module, used for splicing the fluid primitive model to obtain a fluid model;

[0016] A data acquisition module, used to acquire surface distance field data and depth distance field data corresponding to the interaction between the virtual object and the fluid model in the virtual scene;

[0017] A texture mapping module, used for mapping a preset fluid texture map to the fluid model, and setting the preset fluid texture map to move on the surface of the fluid model over time;

[0018] A mask map generation module, configured to generate a wake waveform mask map and a bypass waveform mask map corresponding to the interaction between the virtual object and the fluid model in the virtual scene according to the surface distance field data and the depth distance field data;

[0019] A model replacement module, used for replacing the fluid model according to a preset replacement map, the wake waveform mask map and the bypass waveform mask map;

[0020] A rendering and display module is used to render and display the virtual object and the replaced fluid model to obtain a fluid interaction effect between the virtual object and the fluid model.

[0021] In a third aspect, an embodiment of the present disclosure further provides an electronic device, including:

[0022] Processor; and

[0023] The memory is used to store a data processing program. After the electronic device is powered on and the program is run by the processor, the following steps are performed:

[0024] In response to a rendering instruction for a fluid interaction effect, a fluid primitive model is generated according to a size of a virtual object;

[0025] Based on the fluid primitive models, a fluid model is obtained by splicing;

[0026] Acquire surface distance field data and depth distance field data corresponding to the virtual object interacting with the fluid model in the virtual scene;

[0027] Mapping a preset fluid texture map to the fluid model, and setting the preset fluid texture map to move on the surface of the fluid model over time;

[0028] Generate, according to the surface distance field data and the depth distance field data, a wake waveform mask image and a bypass waveform mask image corresponding to the virtual object and the fluid model interacting in the virtual scene;

[0029] Displacing the fluid model according to a preset displacement map, the wake waveform mask map, and the bypass waveform mask map;

[0030] The virtual object and the replaced fluid model are rendered and displayed to obtain a fluid interaction effect between the virtual object and the fluid model.

[0031] In a fourth aspect, the embodiments of the present disclosure further provide a computer-readable storage medium storing a data processing program, which is executed by a processor to perform the following steps:

[0032] In response to a rendering instruction for a fluid interaction effect, a fluid primitive model is generated according to a size of a virtual object;

[0033] Based on the fluid primitive models, a fluid model is obtained by splicing;

[0034] Acquire surface distance field data and depth distance field data corresponding to the virtual object interacting with the fluid model in the virtual scene;

[0035] Mapping a preset fluid texture map to the fluid model, and setting the preset fluid texture map to move on the surface of the fluid model over time;

[0036] Generate, according to the surface distance field data and the depth distance field data, a wake waveform mask image and a bypass waveform mask image corresponding to the virtual object and the fluid model interacting in the virtual scene;

[0037] Displacing the fluid model according to a preset displacement map, the wake waveform mask map, and the bypass waveform mask map;

[0038] The virtual object and the replaced fluid model are rendered and displayed to obtain a fluid interaction effect between the virtual object and the fluid model.

[0039] Compared with the prior art, the present invention has the following advantages:

[0040] The embodiment of the present disclosure provides a method for generating a fluid interaction effect. In response to a rendering instruction for the fluid interaction effect, a fluid primitive model is generated according to the size of a virtual object; a fluid model is obtained by splicing the fluid primitive model; surface distance field data and depth distance field data corresponding to the interaction between the virtual object and the fluid model in a virtual scene are obtained; a preset fluid texture map is mapped to the fluid model, and the preset fluid texture map is set to move on the surface of the fluid model over time; a wake waveform mask map and a flow waveform mask map corresponding to the interaction between the virtual object and the fluid model in the virtual scene are generated according to the surface distance field data and the depth distance field data; the fluid model is displaced according to the preset displacement map, the wake waveform mask map and the flow waveform mask map; the virtual object and the displaced fluid model are rendered and displayed to obtain the fluid interaction effect between the virtual object and the fluid model. In this method, the dynamic interaction effect between the virtual object and the fluid model can be generated in real time according to the interaction between the virtual object and the fluid model. The method ensures real-time performance, low performance consumption, simple configuration, good effect performance, and improved production efficiency of fluid interaction effects. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 is a schematic diagram of a fluid interaction effect between a virtual object and a fluid model provided by an embodiment of the present disclosure;

[0042] Figure 2 is a flow chart of a method for generating a fluid interaction effect provided by an embodiment of the present disclosure;

[0043] Figure 3 is a schematic diagram of an initial primitive model of a fluid provided by an embodiment of the present disclosure;

[0044] Figure 4 is a schematic diagram of a fluid primitive model provided by an embodiment of the present disclosure;

[0045] Figure 5 is a schematic diagram of a fluid primitive model provided by an embodiment of the present disclosure in a texture coordinate system;

[0046] Figure 6 is a schematic diagram of a fluid model provided by an embodiment of the present disclosure;

[0047] Figure 7 is a schematic diagram of a surface distance field map provided by an embodiment of the present disclosure;

[0048] Figure 8 is a schematic diagram of a depth distance field map provided by an embodiment of the present disclosure;

[0049] Fig. 9 is a schematic diagram of a ripple range provided by an embodiment of the present disclosure;

[0050] Fig.10 is a schematic diagram of a ripple waveform mask diagram provided by an embodiment of the present disclosure;

[0051] Fig.11 is a schematic diagram of a wake waveform mask diagram provided by an embodiment of the present disclosure;

[0052] Fig.12 is a schematic diagram of a flow waveform mask diagram provided by an embodiment of the present disclosure;

[0053] Fig.13 is a schematic diagram of a first flow velocity mask diagram provided by an embodiment of the present disclosure;

[0054] Fig.14 is a schematic diagram of a second flow velocity mask diagram provided by an embodiment of the present disclosure;

[0055] Fig.15 A structural block diagram of a device for generating fluid interaction effects provided in an embodiment of the present disclosure;

[0056] Fig.16 A structural block diagram of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0057] In order to enable those skilled in the art to better understand the scheme of the present disclosure, the technical scheme in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in the field without creative work should fall within the scope of protection of the present disclosure.

[0058] It should be noted that the terms "first", "second", "third", etc. in the claims, specifications and drawings of the present disclosure are used to distinguish similar objects and are not used to describe a specific order or sequence. The data used in this way are interchangeable where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including", "having" and their variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0059] To facilitate understanding, technical terms that may be involved in the embodiments of the present disclosure are first briefly introduced.

[0060] (1) Primitive model: In the field of computer graphics and 3D modeling, primitive model refers to the basic building blocks that constitute complex geometric shapes, such as triangles, quadrilaterals, etc.

[0061] (2) Fluid: Fluid usually refers to non-solid liquids or gases, such as water, oil, magma, etc. In games, fluid dynamic effects such as fluid movement effects (such as river flow, gas diffusion), interaction effects between fluid and objects (such as a river flowing through an object) can be simulated.

[0062] (3) UV mapping refers to the process of unfolding the surface of a three-dimensional model into a two-dimensional plane, and then mapping the texture image with the two-dimensional plane coordinates to facilitate mapping the texture image to the three-dimensional model.

[0063] (4) Surface distance field: The surface distance field defines the distance from each point in space to the nearest surface. This distance can be signed, where a positive value indicates that the point is outside the surface and a negative value indicates that the point is inside the surface.

[0064] (5) Depth distance field: A depth distance field is a distance field that is more specifically associated with depth information in an image or scene.

[0065] In order to enhance the realism and immersion of the game and enable players to better experience the in-game environment, fluid effects are usually simulated and displayed in games. For example, computer graphics technology is used to simulate and display the dynamic behavior and visual effects of fluids such as water, smoke, fire, and magma in three-dimensional space. When simulating and displaying the dynamic behavior and visual effects of fluids, a series of plane graphics (i.e., "patches") can be used to create fluids, and the created fluids can be covered in the scenes and terrain shapes of fluid effects. In order to make a series of plane graphics look like real fluids, special material maps are applied. These material maps can simulate the feeling of flow, such as water ripples or the slow flow of lava.

[0066] In order to simulate more delicate and realistic fluid effects, the interaction between the fluid and the surrounding environment and the player is usually involved. For example, when the fluid encounters obstacles (such as stones or bridge pillars), how to correctly bypass these obstacles instead of simply penetrating them; if there is a dynamically changing terrain in the game environment (such as sand accumulation or erosion), how does the fluid change its flow direction and shape accordingly; and when the player controls the character model to enter the water, ripples will be generated. At present, in game development, the interaction effects between the fluid and the surrounding environment and the player are pre-customized using Flowmap textures, that is, the places where the fluid interacts with the surrounding environment and the player are drawn in the Flowmap texture. The Flowmap texture is applied in the game to realize the interaction between the fluid and the surrounding environment and the player. However, when the interaction between the fluid and the surrounding environment and the player is realized through the Flowmap texture, the interaction in the flowmap texture is determined before the game is run. During the game, the flowmap texture cannot respond to the player's behavior or the changes in the environment around the fluid to realize real-time interaction. If a corresponding flowmap texture is made separately for each area that requires a fluid effect, it will take a lot of time and human resources, and the production efficiency is low.

[0067] If you use special effects stacking to create a particle emitter that looks like real interaction, particle interpenetration will occur when fluid interaction occurs, and the effect will be relatively flat. You cannot interact at the fluid drop because the model will interpenetrate and the effect will be useless.

[0068] If a true fluid algorithm is used, calculations will be required for each frame, which will consume too much computer performance. If it is introduced into the game through a simplified iterative algorithm, the effect will be compromised.

[0069] In order to solve the above-mentioned problems in the related art, an embodiment of the present disclosure provides a method for generating a fluid interaction effect. The solution provided by the present disclosure can be run on a terminal device or a server. The terminal device can be a desktop computer, a laptop computer, a tablet computer, a mobile phone, etc., or other electronic devices, which are not specifically limited by the present disclosure. The server is used to provide background services for the client of the application in the terminal device. For example, the server can be the background server of the above-mentioned application. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), and basic cloud computing services such as big data and artificial intelligence platforms, which are not specifically limited by the present disclosure.

[0070] In an exemplary embodiment of the present disclosure, the method for generating a fluid interaction effect provided by the embodiment of the present disclosure can generate Figure 1 The virtual object shown ( Figure 1 The virtual object shown in the figure is a stone) and the fluid model ( Figure 1 The fluid model shown in is a river model, or water flow model) of dynamic interaction effect.

[0071] like Figure 2 FIG. 2 is a flow chart of a method for generating a fluid interaction effect provided by an embodiment of the present disclosure, the method comprising steps S201 to S207:

[0072] Step S201: In response to a rendering instruction for a fluid interaction effect, a fluid primitive model is generated according to the size of a virtual object.

[0073] In the embodiments of the present disclosure, the virtual object may include at least one of the following: a player character, a non-player character (NPC), a virtual object, and a virtual prop. When the virtual object interacts with the fluid, that is, when the virtual object appears in the fluid, the flow characteristics of the fluid will change, that is, the fluid will change under the influence of the virtual object. The embodiments provided by the present disclosure can simulate the change of the flow characteristics of the fluid under the influence of the virtual object.

[0074] In an optional embodiment, the step of generating a fluid primitive model according to the size of the virtual object may be implemented in the following manner:

[0075] Determine the minimum interaction unit distance based on the size of the virtual object;

[0076] In the initial primitive model of the fluid, model line segments are added at minimum interaction unit distances along a preset direction to obtain a fluid primitive model.

[0077] In this embodiment, the minimum interactive unit distance represents the smallest distance unit that can cause visual response to fluid changes, and the minimum interactive unit distance is related to the size of the virtual object. For example, the virtual object is a stone, the fluid is a river, and the diameter of the stone is 1 meter. If you want to make the ripples caused by the fluid flowing through the stone visible to the player, the ripples must be at least 10 centimeters wide. If the ripple width is only 1 centimeter, the player cannot see the ripples caused by the fluid flowing through the stone. The minimum interactive unit distance will determine the subsequent fineness of the displacement of the fluid model.

[0078] The fluid initial primitive model may be a two-dimensional patch model, such as a square two-dimensional patch model, a rectangular two-dimensional patch model, etc. The size of the fluid initial primitive model may be determined according to the width of the fluid model to be generated. For example, the side length of the square fluid initial primitive model may be equal to the middle value of the width of the fluid model to be generated. For example, if the middle value of the width of the river model to be generated is 2 meters, then the size of the square fluid initial primitive model (such as Figure 3 The side length of the frame (as shown) can be 1 meter.

[0079] Then, a model line segment can be added to the fluid initial primitive model along the preset direction at every minimum interaction unit distance, thereby obtaining the fluid primitive model. Figure 3 The side length of the fluid initial primitive model is 1 meter, the minimum interaction unit distance is 10 centimeters, and a model line segment is added every 10 centimeters along the preset direction in the fluid initial primitive model. The fluid initial primitive model can be divided into 10 rectangles with a width of 10 centimeters and a length of 1 meter, as shown in Figure 4 As shown, the initial primitive model of the fluid is finely divided, and the finely divided fluid primitive model is obtained. Figure 5 A schematic diagram of the fluid primitive model in the texture coordinate system is shown, wherein the size of the fluid primitive model (i.e., the size of the initial fluid primitive model) is used for designing UV, that is, the size of the fluid primitive model just occupies the value range of the U coordinate value and the V coordinate value of [0,1]. When the fluid primitive models are spliced ​​to form a fluid model, the fluid primitive model can be scaled according to the actual required fluid model size.

[0080] Step S202: obtaining a fluid model based on the fluid primitive models.

[0081] In this step, the fluid model can be obtained by splicing and scaling the fluid primitive models.

[0082] In an optional embodiment, this step can be implemented in the following manner: splicing the fluid primitive model along a preset fluid curve, and scaling the fluid primitive model according to the curvature scaling value of the preset fluid curve to obtain a fluid model, wherein the direction of the model line segments added to the fluid primitive model is perpendicular to the width direction of the fluid model.

[0083] In this embodiment, the preset fluid curve can be used as the central axis of the fluid model, and multiple fluid primitive models are spliced ​​along the preset fluid curve. When splicing, it is necessary to ensure that the direction of the model line segment added in the fluid primitive model is perpendicular to the width direction of the fluid model. In this way, the length of the model line segment can be adjusted to achieve fine control of the fluid primitive model in the length direction of the fluid model, and the curvature change can be more in line with the preset fluid curve. For example, the side length of a square fluid primitive model is 1 meter, and the required width of the river model is 2 meters. The side length of each fluid primitive model in the width direction of the river model can be enlarged to twice the original, and the side length of each fluid primitive model in the length direction of the river model can be adjusted by adjusting the length of the model line segment so that the side length of each fluid primitive model in the length direction of the river model fits the curvature of the preset fluid curve. Thus, by splicing and scaling multiple fluid primitive models, the following can be obtained. Figure 6 The river model shown.

[0084] Step S203: Acquire surface distance field data and depth distance field data corresponding to the interaction between the virtual object and the fluid model in the virtual scene.

[0085] The virtual object and the fluid model can be placed in the virtual scene, and the virtual object is located in the fluid model, that is, the virtual object and the fluid model interact in the virtual scene. In this step, the corresponding surface distance field data and depth distance field data in this case can be obtained through the RT renderer, and the surface distance field map is rendered based on the surface distance field data, and the depth distance field map is rendered based on the depth distance field data. In the following, in the steps where the surface distance field data is needed, the surface distance field map can be used, and in the steps where the depth distance field data is needed, the depth distance field map can be used.

[0086] For example, the surface distance field data and depth distance field data corresponding to the stone A, stone B and stone C in the river model can be obtained, and the surface distance field map rendered based on the surface distance field data is as follows: Figure 7 As shown, the depth distance field map obtained by rendering based on the depth distance field data is as follows Figure 8 shown.

[0087] Step S204: Mapping the preset fluid texture map to the fluid model, and setting the preset fluid texture map to move on the surface of the fluid model over time.

[0088] In this step, after the fluid model is obtained by splicing, texture mapping can be performed on the fluid model, and the texture of the fluid model can be set to change over time, so as to achieve the fluid flow effect. The preset fluid texture map can be determined based on the material properties of the fluid represented by the fluid model. For example, a river model uses a fluid texture map with water properties as the preset fluid texture map, and a magma model uses a fluid texture map with magma properties as the preset fluid texture map.

[0089] In an optional embodiment, this step can be implemented in the following way:

[0090] Determine the xy value of the fluid model in the world space as the UV value of the fluid model in the texture space, obtain the mapping coordinates of the fluid model in the texture space, and map the preset fluid texture map to the fluid model according to the mapping coordinates;

[0091] Set the flow speed of the preset fluid texture map on the surface of the fluid model along with the game process time according to the xy value of the fluid model in the world space, the scaling ratio of the preset fluid texture map mapped to the fluid model, the game process time, the speed change intensity corresponding to the game process time and the normalized value of the fluid flow direction of the fluid model.

[0092] In this embodiment, the UV flow offset method is not used to move the preset fluid texture map on the surface of the generated fluid model. Instead, a world mapping method is introduced to avoid UV seams, and there is no need to worry about the UV texture stretching problem caused by the stretching, enlarging and shrinking of the fluid primitive model. In this embodiment, the xy value of the fluid model in the world space (denoted as W (x,y) ) is determined as the UV value of the fluid model in the texture space for texture mapping. The fluid flow direction is obtained by converting the tangent space to the world space. Because the basis for generating the fluid model is to splice and generate along the x-axis of the preset fluid curve, the curvature of the x-axis of the preset fluid curve is taken as the fluid flow direction, and the vector Q is used. (x,0,0) , where x can be 1 or -1, representing the positive flow of the fluid and the reverse flow of the fluid. In this embodiment, the flow speed Su of the preset fluid texture map on the surface of the fluid model with the game process time can be determined by the following formula, where Su is a vector with direction.

[0093] Su=W (x,y) / K + P*time*V

[0094] Among them, K represents the scaling ratio of the preset fluid texture map mapped to the fluid model, time represents the game process time, which will be accumulated all the time, P represents the speed change intensity corresponding to the game process time, P is related to the game process time, and V represents the fluid flow direction Q of the fluid model (x,0,0) The normalized value of .

[0095] In this way, the flow direction and flow speed values ​​of the preset fluid texture map on the surface of the fluid model as the game progresses can be obtained.

[0096] Step S205: Generate a wake waveform mask image and a bypass waveform mask image corresponding to the interaction between the virtual object and the fluid model in the virtual scene according to the surface distance field data and the depth distance field data.

[0097] In this step, the wake waveform mask and the bypass waveform mask corresponding to the interaction between the virtual object and the fluid model in the virtual scene can be generated according to the surface distance field data and the depth distance field data, wherein the wake waveform mask is used to characterize the fluctuations generated on the back water surface of the virtual object when the fluid model flows through the virtual object, and the bypass waveform mask is used to characterize the fluctuations generated on the front water surface and both sides (except the back water surface) of the virtual object when the fluid model flows through the virtual object.

[0098] In an optional embodiment, this step S205 can be implemented by the following steps S2051 to S2053.

[0099] Step S2051: Generate a ripple waveform mask image corresponding to the interaction between the virtual object and the fluid model in the virtual scene according to the surface distance field data.

[0100] In this step, based on the surface distance field data, we can first simulate the ripple waveform mask corresponding to the interaction between the virtual object and the fluid model in the virtual scene, where the ripple waveform mask is used to characterize the ripples generated by the virtual object in the fluid model, and the ripple waveform mask is used to assist in generating the flow waveform mask.

[0101] In an optional embodiment, step S2051 may be implemented in the following manner:

[0102] Determine, based on the surface distance field data and a preset distance threshold, a ripple range corresponding to the interaction between the virtual object and the fluid model in the virtual scene;

[0103] According to the ripple range, the preset fluctuation frequency and the game process time, a ripple waveform mask corresponding to the interaction between the virtual object and the fluid model in the virtual scene is generated.

[0104] In this embodiment, firstly, the ripple range F(a) corresponding to the interaction between the virtual object and the fluid model in the virtual scene can be determined according to the surface distance field data T(d) and the preset distance threshold u by the following formula.

[0105] F (a) =T (d) / u

[0106] The size of the ripple range can be controlled by presetting the distance threshold u. Fig. 9 (a) and Fig. 9 (b) shows the corresponding ripple ranges (see the black-gray gradient part outside the white circle) when the preset distance threshold u takes different values ​​and the stone B and stone C interact with the fluid model in the virtual scene.

[0107] Then, according to the ripple range F(a), the preset fluctuation frequency M and the game process time Time(t), the following formula can be used to generate the corresponding ripple waveform mask when the virtual object interacts with the fluid model in the virtual scene.

[0108] F (b) =F (a) *(F (a)+abs(sin M*Time (t) )

[0109] Wherein, abs is the absolute value operator, and F(b) is the ripple waveform mask image, which represents the aftermath generated by the ripple rebound within the ripple range F(a).

[0110] like Fig.10 (a) and Fig.10 (b) shows the ripple waveform mask diagram when the preset distance threshold u takes different values ​​(see the black and white part outside the white circle).

[0111] Step S2052: Generate a wake waveform mask corresponding to the interaction between the virtual object and the fluid model in the virtual scene according to the depth distance field data.

[0112] This step can be used to simulate the wake effect on the back surface of the virtual object when the virtual object interacts with the fluid model in the virtual scene.

[0113] In an optional embodiment, step S2052 may be implemented in the following manner:

[0114] The depth distance field data T(s) is converted from the world space to the local space of the fluid model (i.e., the model space of the fluid model), and the fluid flow direction Q of the fluid model is converted to (x,0,0) Convert from tangent space to the local space of the fluid model;

[0115] According to the converted depth distance field data T(sw), the converted fluid flow direction K(x, 0, 0) and the first preset range value N, a wake waveform mask corresponding to the interaction between the virtual object and the fluid model in the virtual scene is generated.

[0116] In this embodiment, the wake waveform mask F(c) corresponding to the interaction between the virtual object and the fluid model in the virtual scene can be generated by the following formula based on the converted depth distance field data T(sw), the converted fluid flow direction K(x, 0, 0) and the first preset range value N.

[0117] I (x,y,z) =T (sw) *K (x,0,0)

[0118] F (c) =(I .x +I .y )-N

[0119] Among them, I(x, y, z) is the fluid flow direction in the gradient space, Ix is the x component of I(x, y, z), and Iy is the y component of I(x, y, z).

[0120] like Fig.11 As shown, the wake waveform mask corresponding to the interaction between the virtual object (two white circles) and the fluid model in the virtual scene is shown, wherein the wake waveform is shown in FIG. Fig.11 The dark gray part outside the white circle.

[0121] Step S2053: Generate a flow waveform mask corresponding to the interaction between the virtual object and the fluid model in the virtual scene according to the ripple waveform mask and the wake waveform mask.

[0122] This step can be used to simulate the flow effect around the water surface and both sides of the virtual object when the virtual object interacts with the fluid model in the virtual scene.

[0123] In an optional embodiment, step S2053 can be implemented in the following manner: subtract the mask value of the ripple waveform mask image F(b) from the mask value of the wake waveform mask image F(c) to obtain the flow waveform mask image F(h) corresponding to the interaction between the virtual object and the fluid model in the virtual scene, and the formula is as follows.

[0124] F (h) =F (b) -F (c)

[0125] In this embodiment, the wake waveform portion may be removed from the ripple waveforms to obtain the corresponding flow waveform when the virtual object and the fluid model interact in the virtual scene.

[0126] like Fig.12 As shown, the flow waveform mask corresponding to the interaction between the virtual object (two white circles) and the fluid model in the virtual scene is shown, wherein the flow waveform is shown in FIG. Fig.12 The black and white part outside the white circle.

[0127] Step S206: Displace the fluid model according to the preset displacement map, the wake waveform mask map and the bypass waveform mask map.

[0128] Model displacement is to adjust the vertex position of the model according to a displacement map, that is, to displace the vertices of the model to simulate real details and shape changes. Model displacement technology will actually modify the geometric shape of the model and create a concave and convex effect by moving the vertices. Among them, the displacement map is a grayscale image, and the grayscale value of the grayscale image is used to represent the height value of the model surface. According to the height value, the vertices of the model can be moved so that the model vertices show a concave and convex effect that matches the height value. In model displacement, the range and intensity of the displacement map on the model surface can be controlled by the mask map.

[0129] In this step, the displacement map used to displace the fluid model is a preset displacement map, and the mask map used to control the scope and intensity of the preset displacement map on the surface of the fluid model includes a wake waveform mask map and a flow waveform mask map. By controlling the scope (controlled by the mask graphic) and intensity (controlled by the mask value) of the preset displacement map on the surface of the fluid model through the wake waveform mask map, the wake wave effect on the back of the virtual object when the virtual object interacts with the fluid model in the virtual scene can be simulated; by controlling the scope and intensity of the preset displacement map on the surface of the fluid model through the flow waveform mask map, the flow wave effect on the front surface and both sides of the virtual object when the virtual object interacts with the fluid model in the virtual scene can be simulated. Among them, the degree of fineness of the displacement of the fluid model depends on the minimum interaction unit distance of the primitive model.

[0130] Step S207: Rendering and displaying the virtual object and the replaced fluid model to obtain a fluid interaction effect between the virtual object and the fluid model.

[0131] In this step, the virtual object and the displaced fluid model may be rendered and displayed, so that the fluid interaction effect between the virtual object and the fluid model may be presented in a graphical user interface, thereby simulating the dynamic interaction between the virtual object and the fluid model.

[0132] In an optional embodiment, the method for generating the fluid interaction effect may further include the following step S208: generating a first flow velocity mask diagram characterizing the accelerated flow effect at the fluid drop of the fluid model according to the vertex tangent direction of the fluid model, the fluid flow direction of the fluid model and a preset intensity.

[0133] Accordingly, the above step S206 can be implemented in the following manner: displacing the fluid model according to the preset displacement map, the wake waveform mask map, the bypass waveform mask map and the first flow velocity mask map.

[0134] In this embodiment, the vertex tangent direction TG of the fluid model can be (x,y,z) , the fluid flow direction Q of the fluid model (x, 0 ,0) and the preset strength S, the first flow velocity mask F(e) representing the accelerated flow effect at the fluid drop of the fluid model is generated by the following formula, as Fig.13 shown.

[0135] F (e) =TG. z *Q .x *S

[0136] Among them, TG.z is TG (x,y,z) The z component of Qx is Q (x,0,0) The x-component of .

[0137] The tangent direction of a vertex of the fluid model is significantly different from the fluid flow direction at the vertex, indicating that the vertex is a location with a large fluid drop. According to the above formula, the mask value corresponding to the vertex in the first flow velocity mask diagram will be larger, and the displacement of the vertex will be larger when the fluid model is displaced, which is manifested as a stronger fluctuation at the vertex, which is a visual manifestation of the accelerated flow of the fluid. Therefore, through this embodiment, the accelerated flow effect at the fluid drop of the fluid model can be simulated through the first flow velocity mask diagram.

[0138] In an optional embodiment, the method for generating the fluid interaction effect may further include the following step S209: generating a second flow velocity mask diagram characterizing the flow velocity transition effect from the middle to the edge of the fluid model based on the edge information of the fluid model, the sine value of the edge transition curvature of the fluid model and a second preset range value.

[0139] Accordingly, the above step S206 can be implemented in the following manner: the fluid model is displaced according to the preset displacement map, the wake waveform mask map, the bypass waveform mask map and the second flow velocity mask map.

[0140] In this embodiment, the edge information UV of the fluid model can be used. G, the sine value sin(x) of the edge transition curvature x of the fluid model and the second preset range value W, generate a second flow velocity mask F(d) representing the flow velocity transition effect from the middle to the edge of the fluid model, as shown in Fig.14 shown.

[0141] F(d)=UV. G *sin(x)*W

[0142] Among them, the UV of the fluid model has two channels, R and G. The R channel represents the vertical direction and the G channel represents the horizontal direction. If the UV of the primitive model is placed horizontally, then the G channel data of the fluid model UV can be extracted here to determine the edge of the fluid model. Similarly, if the UV of the primitive model is placed vertically, then the R channel data of the fluid model UV can be extracted here to determine the edge of the fluid model.

[0143] Through this embodiment, the second flow velocity mask diagram can be used to simulate the flow velocity transition effect in which the flow velocity of the fluid in the fluid model gradually slows down from the middle to the edge.

[0144] In an optional embodiment, the method for generating the fluid interaction effect includes both the above-mentioned steps S208 and S209, and the above-mentioned step S206 can be implemented in the following manner: displacing the fluid model according to a preset displacement map, a wake waveform mask map, a flow waveform mask map, a first flow velocity mask map, and a second flow velocity mask map.

[0145] In this embodiment, the mask map used to control the range and intensity of action of the preset displacement map on the surface of the fluid model includes, in addition to the wake waveform mask map and the flow around waveform mask map, a first flow velocity mask map and a second flow velocity mask map. In this way, on the basis of the wake wave effect and the flow around wave effect, the accelerated flow effect at the fluid drop of the fluid model and the flow velocity transition effect in which the flow velocity of the fluid model gradually slows down from the middle to the edge can also be superimposed.

[0146] The exemplary embodiments of the present disclosure solve a series of problems faced in fluid interaction, such as the direction, speed, interaction range, edge movement, slope movement, etc. of the relevant fluid movement in automated fluid interaction, and this programmatically customized adaptive fluid interaction effect can be generated in real time, and has the advantages of being able to be quickly applied and simple to configure, thereby improving the efficiency of producing fluid dynamic interaction effects.

[0147] The embodiment of the present disclosure provides a method for generating a fluid interaction effect. In response to a rendering instruction for the fluid interaction effect, a fluid primitive model is generated according to the size of a virtual object; a fluid model is obtained by splicing the fluid primitive model; surface distance field data and depth distance field data corresponding to the interaction between the virtual object and the fluid model in a virtual scene are obtained; a preset fluid texture map is mapped to the fluid model, and the preset fluid texture map is set to move on the surface of the fluid model over time; a wake waveform mask map and a flow waveform mask map corresponding to the interaction between the virtual object and the fluid model in the virtual scene are generated according to the surface distance field data and the depth distance field data; the fluid model is displaced according to the preset displacement map, the wake waveform mask map and the flow waveform mask map; the virtual object and the displaced fluid model are rendered and displayed to obtain the fluid interaction effect between the virtual object and the fluid model. In this method, the dynamic interaction effect between the virtual object and the fluid model can be generated in real time according to the interaction between the virtual object and the fluid model. The method ensures real-time performance, low performance consumption, simple configuration, good effect performance, and improved production efficiency of fluid interaction effects.

[0148] Corresponding to the method for generating fluid interaction effects provided in the embodiment of the present disclosure, the embodiment of the present disclosure also provides a device for generating fluid interaction effects, such as Fig.15 As shown, the device 1600 includes:

[0149] The primitive model generation module 1601 is used to generate a fluid primitive model according to the size of the virtual object in response to a rendering instruction for a fluid interaction effect;

[0150] A model splicing module 1602, used for splicing the fluid primitive models to obtain a fluid model;

[0151] A data acquisition module 1603 is used to acquire surface distance field data and depth distance field data corresponding to the interaction between the virtual object and the fluid model in the virtual scene;

[0152] The texture mapping module 1604 is used to map a preset fluid texture map to the fluid model, and set the preset fluid texture map to move on the surface of the fluid model over time;

[0153] A mask map generating module 1605 is used to generate a wake waveform mask map and a bypass waveform mask map corresponding to the interaction between the virtual object and the fluid model in the virtual scene according to the surface distance field data and the depth distance field data;

[0154] A model replacement module 1606, configured to replace the fluid model according to a preset replacement map, the wake waveform mask map and the bypass waveform mask map;

[0155] The rendering and display module 1607 is used to render and display the virtual object and the replaced fluid model to obtain the fluid interaction effect of the virtual object and the fluid model.

[0156] In an optional embodiment, generating, according to the surface distance field data and the depth distance field data, a wake waveform mask image and a bypass waveform mask image corresponding to the interaction between the virtual object and the fluid model in the virtual scene, comprises:

[0157] generating, according to the surface distance field data, a ripple waveform mask image corresponding to the interaction between the virtual object and the fluid model in the virtual scene;

[0158] generating, according to the depth distance field data, a wake waveform mask image corresponding to the interaction between the virtual object and the fluid model in the virtual scene;

[0159] A flow waveform mask corresponding to the interaction between the virtual object and the fluid model in the virtual scene is generated according to the ripple waveform mask and the wake waveform mask.

[0160] In an optional embodiment, generating, according to the surface distance field data, a ripple waveform mask image corresponding to the interaction between the virtual object and the fluid model in the virtual scene, comprises:

[0161] determining, according to the surface distance field data and a preset distance threshold, a ripple range corresponding to the interaction between the virtual object and the fluid model in the virtual scene;

[0162] According to the ripple range, the preset fluctuation frequency and the game process time, a ripple waveform mask image corresponding to the interaction between the virtual object and the fluid model in the virtual scene is generated.

[0163] In an optional embodiment, generating, according to the depth distance field data, a wake waveform mask image corresponding to the interaction between the virtual object and the fluid model in the virtual scene, comprises:

[0164] Converting the depth distance field data from world space to local space of the fluid model, and converting the fluid flow direction of the fluid model from tangent space to local space of the fluid model;

[0165] A wake waveform mask image corresponding to the interaction between the virtual object and the fluid model in the virtual scene is generated according to the converted depth distance field data, the converted fluid flow direction and the first preset range value.

[0166] In an optional embodiment, generating, according to the ripple waveform mask and the wake waveform mask, a flow waveform mask corresponding to the interaction between the virtual object and the fluid model in the virtual scene, comprises:

[0167] The mask value of the ripple waveform mask image is subtracted from the mask value of the wake waveform mask image to obtain a flow waveform mask image corresponding to the interaction between the virtual object and the fluid model in the virtual scene.

[0168] In an optional embodiment, the device is further used for:

[0169] Generate a first flow velocity mask diagram representing the accelerated flow effect at the fluid drop of the fluid model according to the vertex tangent direction of the fluid model, the fluid flow direction of the fluid model and a preset strength;

[0170] The step of displacing the fluid model according to the preset displacement map, the wake waveform mask map and the bypass waveform mask map comprises:

[0171] The fluid model is displaced according to a preset displacement map, the wake waveform mask map, the flow waveform mask map and the first flow velocity mask map.

[0172] In an optional embodiment, the device is further used for:

[0173] Generate a second flow velocity mask diagram representing the flow velocity transition effect from the middle to the edge of the fluid model according to the edge information of the fluid model, the sine value of the edge transition curvature of the fluid model and the second preset range value;

[0174] The step of displacing the fluid model according to the preset displacement map, the wake waveform mask map and the bypass waveform mask map comprises:

[0175] The fluid model is displaced according to a preset displacement map, the wake waveform mask map, the flow waveform mask map and the second flow velocity mask map.

[0176] In an optional embodiment, mapping the preset fluid texture map to the fluid model, and setting the preset fluid texture map to move on the surface of the fluid model over time, includes:

[0177] Determine the xy value of the fluid model in the world space as the UV value of the fluid model in the texture space, obtain the mapping coordinates of the fluid model in the texture space, and map the preset fluid texture map to the fluid model according to the mapping coordinates;

[0178] According to the xy value of the fluid model in the world space, the scaling ratio of the preset fluid texture map mapped to the fluid model, the game process time, the speed change intensity corresponding to the game process time and the normalized value of the fluid flow direction of the fluid model, the flow speed of the preset fluid texture map on the surface of the fluid model is set along with the game process time.

[0179] In an optional embodiment, generating a fluid primitive model according to the size of the virtual object includes:

[0180] Determine the minimum interaction unit distance based on the size of the virtual object;

[0181] In the initial primitive model of the fluid, model line segments are added along a preset direction at intervals of the minimum interaction unit distance to obtain a fluid primitive model.

[0182] In an optional embodiment, the step of obtaining a fluid model based on the fluid primitive models includes:

[0183] The fluid primitive model is spliced ​​along a preset fluid curve, and the fluid primitive model is scaled according to the curvature scaling value of the preset fluid curve to obtain a fluid model, wherein the direction of the model line segment added in the fluid primitive model is perpendicular to the width direction of the fluid model.

[0184] Corresponding to the method for generating fluid interaction effects provided in the embodiment of the present disclosure, the embodiment of the present disclosure also provides an electronic device. Fig.16 As shown, the electronic device includes: a processor 1701; and a memory 1702, which is used to store a program of a method for generating a fluid interaction effect. After the electronic device is powered on and the program storing the method for generating a fluid interaction effect is run by the processor, the following steps are performed:

[0185] In response to a rendering instruction for a fluid interaction effect, a fluid primitive model is generated according to a size of a virtual object;

[0186] Based on the fluid primitive models, a fluid model is obtained by splicing;

[0187] Acquire surface distance field data and depth distance field data corresponding to the virtual object interacting with the fluid model in the virtual scene;

[0188] Mapping a preset fluid texture map to the fluid model, and setting the preset fluid texture map to move on the surface of the fluid model over time;

[0189] Generate, according to the surface distance field data and the depth distance field data, a wake waveform mask image and a bypass waveform mask image corresponding to the virtual object and the fluid model interacting in the virtual scene;

[0190] Displacing the fluid model according to a preset displacement map, the wake waveform mask map, and the bypass waveform mask map;

[0191] The virtual object and the replaced fluid model are rendered and displayed to obtain a fluid interaction effect between the virtual object and the fluid model.

[0192] Corresponding to the method for generating a fluid interaction effect provided in the embodiment of the present disclosure, the embodiment of the present disclosure further provides a computer-readable storage medium storing a program for the method for generating a fluid interaction effect, the program being executed by a processor to perform the following steps:

[0193] In response to a rendering instruction for a fluid interaction effect, a fluid primitive model is generated according to a size of a virtual object;

[0194] Based on the fluid primitive models, a fluid model is obtained by splicing;

[0195] Acquire surface distance field data and depth distance field data corresponding to the virtual object interacting with the fluid model in the virtual scene;

[0196] Mapping a preset fluid texture map to the fluid model, and setting the preset fluid texture map to move on the surface of the fluid model over time;

[0197] Generate, according to the surface distance field data and the depth distance field data, a wake waveform mask image and a bypass waveform mask image corresponding to the virtual object and the fluid model interacting in the virtual scene;

[0198] Displacing the fluid model according to a preset displacement map, the wake waveform mask map, and the bypass waveform mask map;

[0199] The virtual object and the replaced fluid model are rendered and displayed to obtain a fluid interaction effect between the virtual object and the fluid model.

[0200] Corresponding to the method for generating fluid interaction effects provided in the embodiment of the present disclosure, the embodiment of the present disclosure further provides a computer program product, the program product comprising: a computer program, the computer program is stored in a readable storage medium, at least one processor of the electronic device can read the computer program from the readable storage medium, and at least one processor executes the computer program so that the electronic device performs the following steps:

[0201] In response to a rendering instruction for a fluid interaction effect, a fluid primitive model is generated according to a size of a virtual object;

[0202] Based on the fluid primitive models, a fluid model is obtained by splicing;

[0203] Acquire surface distance field data and depth distance field data corresponding to the virtual object interacting with the fluid model in the virtual scene;

[0204] Mapping a preset fluid texture map to the fluid model, and setting the preset fluid texture map to move on the surface of the fluid model over time;

[0205] Generate, according to the surface distance field data and the depth distance field data, a wake waveform mask image and a bypass waveform mask image corresponding to the virtual object and the fluid model interacting in the virtual scene;

[0206] Displacing the fluid model according to a preset displacement map, the wake waveform mask map, and the bypass waveform mask map;

[0207] The virtual object and the replaced fluid model are rendered and displayed to obtain a fluid interaction effect between the virtual object and the fluid model.

[0208] It should be noted that for the detailed description of the apparatus, electronic device, computer-readable storage medium, and computer program product provided in the embodiments of the present disclosure, reference can be made to the relevant description of the method in the embodiments of the present disclosure, which will not be repeated here.

[0209] Although the present disclosure is disclosed as above in the form of a preferred embodiment, it is not intended to limit the present disclosure. Any person skilled in the art may make possible changes and modifications without departing from the spirit and scope of the present disclosure. Therefore, the scope of protection of the present disclosure shall be based on the scope defined by the claims of the present disclosure.

[0210] In the several embodiments provided in the present disclosure, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation, such as multiple modules can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or modules, which can be electrical, mechanical or other forms.

[0211] The above-mentioned integrated module implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium, including a number of instructions for enabling an electronic device (which can be a personal computer, a server, or a network device, etc.) or a processor (English: processor) to perform some steps of the method described in each embodiment of the present disclosure.

[0212] It should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the invention may be directly implemented as being executed by a hardware processor, or may be implemented by a combination of hardware and software modules in the processor.

[0213] The memory may include a high-speed RAM memory, and may also include a non-volatile storage NVM, such as at least one disk memory, and may also be a USB flash drive, a mobile hard disk, a read-only memory, a magnetic disk or an optical disk, etc.

[0214] The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of the present disclosure is not limited to only one bus or one type of bus.

[0215] The above storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The storage medium can be any available medium that can be accessed by a general or special purpose computer.

[0216] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.

[0217] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present disclosure, rather than to limit them. Although the present disclosure has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present disclosure.

Claims

1. A method for generating a fluid interaction effect, characterized in that: The method comprises: In response to a rendering instruction for a fluid interaction effect, a fluid primitive model is generated according to a size of a virtual object; Based on the fluid primitive models, a fluid model is obtained by splicing; Acquire surface distance field data and depth distance field data corresponding to the virtual object interacting with the fluid model in the virtual scene; Mapping a preset fluid texture map to the fluid model, and setting the preset fluid texture map to move on the surface of the fluid model over time; generating, according to the surface distance field data and the depth distance field data, a wake waveform mask image and a bypass waveform mask image corresponding to the interaction between the virtual object and the fluid model in the virtual scene; Displacing the fluid model according to a preset displacement map, the wake waveform mask map, and the bypass waveform mask map; The virtual object and the replaced fluid model are rendered and displayed to obtain a fluid interaction effect between the virtual object and the fluid model.

2. The method according to claim 1, characterized in that The step of generating, according to the surface distance field data and the depth distance field data, a wake waveform mask diagram and a flow waveform mask diagram corresponding to the interaction between the virtual object and the fluid model in the virtual scene, comprises: generating, according to the surface distance field data, a ripple waveform mask image corresponding to the interaction between the virtual object and the fluid model in the virtual scene; generating, according to the depth distance field data, a wake waveform mask image corresponding to the interaction between the virtual object and the fluid model in the virtual scene; A flow waveform mask corresponding to the interaction between the virtual object and the fluid model in the virtual scene is generated according to the ripple waveform mask and the wake waveform mask.

3. The method according to claim 1, characterized in that The step of generating, according to the surface distance field data, a ripple waveform mask image corresponding to the interaction between the virtual object and the fluid model in the virtual scene, comprises: determining, according to the surface distance field data and a preset distance threshold, a ripple range corresponding to the interaction between the virtual object and the fluid model in the virtual scene; According to the ripple range, the preset fluctuation frequency and the game process time, a ripple waveform mask image corresponding to the interaction between the virtual object and the fluid model in the virtual scene is generated.

4. The method according to claim 1, characterized in that The step of generating, according to the depth distance field data, a wake waveform mask image corresponding to the interaction between the virtual object and the fluid model in the virtual scene, comprises: Converting the depth distance field data from world space to local space of the fluid model, and converting the fluid flow direction of the fluid model from tangent space to local space of the fluid model; A wake waveform mask image corresponding to the interaction between the virtual object and the fluid model in the virtual scene is generated according to the converted depth distance field data, the converted fluid flow direction and the first preset range value.

5. The method according to claim 1, characterized in that The step of generating, according to the ripple waveform mask and the wake waveform mask, a flow waveform mask corresponding to the interaction between the virtual object and the fluid model in the virtual scene, comprises: The mask value of the ripple waveform mask image is subtracted from the mask value of the wake waveform mask image to obtain a flow waveform mask image corresponding to the interaction between the virtual object and the fluid model in the virtual scene.

6. The method according to claim 1, characterized in that The method further comprises: Generate a first flow velocity mask diagram representing the accelerated flow effect at the fluid drop of the fluid model according to the vertex tangent direction of the fluid model, the fluid flow direction of the fluid model and a preset strength; The step of displacing the fluid model according to the preset displacement map, the wake waveform mask map and the bypass waveform mask map comprises: The fluid model is displaced according to a preset displacement map, the wake waveform mask map, the flow waveform mask map and the first flow velocity mask map.

7. The method according to claim 1, characterized in that The method further comprises: Generate a second flow velocity mask diagram representing the flow velocity transition effect from the middle to the edge of the fluid model according to the edge information of the fluid model, the sine value of the edge transition curvature of the fluid model and the second preset range value; The step of displacing the fluid model according to the preset displacement map, the wake waveform mask map and the bypass waveform mask map comprises: The fluid model is displaced according to a preset displacement map, the wake waveform mask map, the flow waveform mask map and the second flow velocity mask map.

8. The method according to claim 1, characterized in that The step of mapping the preset fluid texture map to the fluid model and setting the preset fluid texture map to move on the surface of the fluid model over time includes: Determine the xy value of the fluid model in the world space as the UV value of the fluid model in the texture space, obtain the mapping coordinates of the fluid model in the texture space, and map the preset fluid texture map to the fluid model according to the mapping coordinates; According to the xy value of the fluid model in the world space, the scaling ratio of the preset fluid texture map mapped to the fluid model, the game process time, the speed change intensity corresponding to the game process time and the normalized value of the fluid flow direction of the fluid model, the flow speed of the preset fluid texture map on the surface of the fluid model is set along with the game process time.

9. The method according to claim 1, characterized in that: The step of generating a fluid primitive model according to the size of the virtual object comprises: Determine the minimum interaction unit distance based on the size of the virtual object; In the initial primitive model of the fluid, model line segments are added along a preset direction at intervals of the minimum interaction unit distance to obtain a fluid primitive model.

10. The method according to claim 9, characterized in that The step of obtaining a fluid model based on the fluid primitive models comprises: The fluid primitive model is spliced ​​along a preset fluid curve, and the fluid primitive model is scaled according to the curvature scaling value of the preset fluid curve to obtain a fluid model, wherein the direction of the model line segment added in the fluid primitive model is perpendicular to the width direction of the fluid model.

11. A device for generating fluid interaction effects, characterized in that: The device comprises: A primitive model generation module, for generating a fluid primitive model according to the size of the virtual object in response to a rendering instruction for a fluid interaction effect; A model splicing module, used for splicing the fluid primitive model to obtain a fluid model; A data acquisition module, used to acquire surface distance field data and depth distance field data corresponding to the interaction between the virtual object and the fluid model in the virtual scene; A texture mapping module, used for mapping a preset fluid texture map to the fluid model, and setting the preset fluid texture map to move on the surface of the fluid model over time; A mask map generation module, configured to generate a wake waveform mask map and a bypass waveform mask map corresponding to the interaction between the virtual object and the fluid model in the virtual scene according to the surface distance field data and the depth distance field data; A model replacement module, used for replacing the fluid model according to a preset replacement map, the wake waveform mask map and the bypass waveform mask map; A rendering and display module is used to render and display the virtual object and the replaced fluid model to obtain a fluid interaction effect between the virtual object and the fluid model.

12. An electronic device, characterized in that: include: processor; as well as The memory is used to store a data processing program. After the electronic device is powered on and the program is run by the processor, the method according to any one of claims 1 to 10 is executed.

13. A computer-readable storage medium, characterized in that: A data processing program is stored, and the program is run by a processor to execute the method according to any one of claims 1 to 10.