Method, apparatus, device, and storage medium for generating fluid
By generating fluid particle swarms based on preset curves and cross-sectional objects, and by utilizing curve constraints and morphological parameter adjustments, the control challenges in the generation process of fluids with special shapes are solved, achieving efficient and automated fluid generation and debugging.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NETEASE (HANGZHOU) NETWORK CO LTD
- Filing Date
- 2022-12-19
- Publication Date
- 2026-05-01
AI Technical Summary
Existing technologies struggle to efficiently generate fluids with special shapes, particularly in terms of controlling the fluid's shape and flow direction, resulting in a cumbersome and inefficient generation process.
By responding to the import commands of preset curves and cross-sectional objects, a fluid particle swarm is generated, and the particle shape is constrained based on the curve constraint force. Combined with the adjustment of shape parameters, the automatic generation and debugging of fluid is realized.
It enables rapid generation and debugging of fluids in different forms, simplifies operation steps, saves production time, improves the production efficiency of special-form fluids, and optimizes performance.
Smart Images

Figure CN115920386B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of rendering technology, and in particular to a method for generating fluid, a device for generating fluid, a corresponding electronic device, and a corresponding computer-readable storage medium. Background Technology
[0002] In game scenarios, in addition to regular fluids such as seas, lakes, and rivers, there is often a need for fluids with special shapes. Fluids with special shapes can refer to fluids that have special shapes and can move along arbitrary curves but are not affected by physical properties such as gravity. Examples include the skill and equipment effects of game characters, text effects, etc. Customized fluid effects with special shapes are generated in the game based on these special shapes.
[0003] In the related technologies for customizing the generation of fluids with special shapes, the main approach is based on the generated water flow objects and the generated vertex animations. However, this method of generating fluids with special shapes requires debugging and simulation while connecting dozens or even hundreds of nodes. It is difficult to control fluids with specific shapes (such as stylized fluids) and cannot meet the customization requirements of fluids with special shapes. Summary of the Invention
[0004] In view of the above problems, embodiments of the present invention are proposed to provide a method for generating fluid, a fluid generating apparatus, a corresponding electronic device, and a corresponding computer-readable storage medium to overcome or at least partially solve the above problems.
[0005] This invention discloses a method for generating fluids, applied to procedural modeling software, the method comprising:
[0006] In response to the import command of a preset curve and a cross-sectional object, a fluid particle swarm is generated; the cross-section of the cross-sectional object and the tangent direction of the preset curve are used to determine the particle shape of the fluid particle swarm.
[0007] Obtain the curve constraint force of the preset curve, constrain the particle morphology of the fluid particle group based on the curve constraint force, and determine the basic fluid morphology for the fluid.
[0008] In response to the instruction to adjust the morphological parameters of the basic fluid morphology, a target fluid morphology is obtained for the fluid.
[0009] This invention also discloses a fluid generation device for use in procedural modeling software, the device comprising:
[0010] The fluid particle swarm generation module is used to generate a fluid particle swarm in response to an import command for a preset curve and a cross-sectional object; the cross-section of the cross-sectional object and the tangent direction of the preset curve are used to determine the particle shape of the fluid particle swarm.
[0011] The basic fluid morphology determination module is used to obtain the curve constraint force of the preset curve, constrain the particle morphology of the fluid particle group based on the curve constraint force, and determine the basic fluid morphology for the fluid.
[0012] The target fluid shape generation module is used to obtain the target fluid shape for the fluid in response to the adjustment command of the shape parameters of the basic fluid shape.
[0013] This invention also discloses an electronic device, including: a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements any of the fluid generation methods.
[0014] This invention also discloses a computer-readable storage medium storing a computer program that, when executed by a processor, implements any of the fluid generation methods described above.
[0015] The embodiments of the present invention have the following advantages:
[0016] In this embodiment of the invention, in response to an import command for a preset curve and a cross-sectional object, the particle shape of the generated fluid particle swarm is determined based on the tangent direction of the imported preset curve and the cross-sectional shape of the imported cross-sectional object. The particle shape of the fluid particle swarm is constrained by the curve constraint force based on the preset curve, and the target fluid shape is obtained by adjusting the shape parameters. By automatically generating fluids with a fixed cross-sectional shape along the preset curve flow direction based on the imported preset curve and cross-sectional object, and by providing the ability to adjust various shape parameters, different fluid characteristics can be achieved, enabling the rapid generation and debugging of fluids with different shapes. Attached Figure Description
[0017] Figure 1 This is a flowchart illustrating the steps of an embodiment of a fluid generation method according to the present invention;
[0018] Figure 2 This is a flowchart illustrating the steps of another embodiment of the fluid generation method of the present invention;
[0019] Figure 3 This is an application scenario diagram of the generated fluid provided in the embodiments of the present invention;
[0020] Figures 4A to 4BThis is a schematic diagram illustrating the customized fluid morphology provided in an embodiment of the present invention;
[0021] Figures 5A to 5F This is a schematic diagram of fluid generation provided in an embodiment of the present invention;
[0022] Figure 6 This is a structural block diagram of an embodiment of a fluid generation device according to the present invention. Detailed Implementation
[0023] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0024] To facilitate understanding of the present invention by those skilled in the art, the terms or nouns involved in the following embodiments of the present invention are explained below:
[0025] Houdini is a 3D computer graphics software, specifically a procedural modeling software.
[0026] Node: refers to the node module in Houdini.
[0027] VAT: VertexAnimationTextures refers to a set of methods in Houdini used to output vertex dataset animations and triangle facets to texture maps for 3D models.
[0028] VEX: VectorExpressionLanguage, refers to a high-performance expression language in Houdini, used in many places in Houdini, such as writing shaders and calculating properties between nodes.
[0029] Python is an open-source, free, and general-purpose scripting programming language.
[0030] PerlinNoise refers to a type of gradient noise.
[0031] Shader: In computer graphics, a shader is primarily a computer program that was originally used for shading in 3D scenes to achieve the ability to produce appropriate levels of lightness and color in rendered images.
[0032] FBX: FilmBox, is a universal 3D file format.
[0033] 3D: 3 Dimensions.
[0034] Flip solution: refers to the node in Houdini used to implement fluid simulation, which can solve for fluids.
[0035] POP: ParticleOPeration, a particle editing module, subordinate to the dynamics editing module DOP (DynamicsOPeration), and is a type of special effects.
[0036] Mesh: refers to a curved surface, which is mainly composed of polygons. It approximates a curved surface and actually contains many folds. When the existing folds are subdivided enough, the surface formed by splicing them together will approach a true curved surface.
[0037] Special-form fluids can refer to fluids with special shapes that can move along arbitrary curves but are not affected by physical properties such as gravity. Examples include the skill and equipment effects of game characters, text effects, etc. Customized fluid effects with special shapes are generated in the game based on special-form three-dimensional structures.
[0038] In technologies related to the customized generation of fluids with special shapes, the main approach is based on the generated water flow objects and vertex animations. Typically, procedural modeling software (such as Houdini) or other 3D modeling software (such as Maya, 3ds Max, Realflow, etc.) simulates the fluid, and a separate fluid effects plugin is used to generate the water flow objects and vertex animations.
[0039] Specifically, taking the creation of special-shaped fluids in the 3D software Houdini as an example, suppose the fluid needs to flow along a curve from point A to point B while maintaining a general width and height, ensuring a continuous flow. This process requires connecting dozens or even hundreds of nodes and simultaneously debugging and simulating. In other words, it can only be generated by connecting nodes solved by Flip, which is not only slow and cumbersome, but also makes it difficult to control the flow direction and shape of the fluid, resulting in a high failure rate. Furthermore, if the generated fluid shape does not meet the requirements when generating vertex animation, it is necessary to go back to the first step and reimplement it. This is especially problematic when multiple fluids with different flow directions are generated simultaneously, leading to a significant waste of the creator's debugging time and low efficiency in generating pre-defined fluid shapes.
[0040] The core idea of this invention is to automatically generate fluids with fixed cross-sectional shapes that flow along preset curves based on imported preset curves and cross-sectional objects. Furthermore, by providing the ability to adjust various morphological parameters, different fluid characteristics can be achieved, enabling rapid generation and debugging of fluid shapes. This not only greatly simplifies the operation steps and saves production time, improving the efficiency of creating special-shaped fluids, but also enables fully automated batch processing of special-shaped fluids based on parameter adjustments. It is easy to implement, has good optimization performance, and low performance overhead. In addition, the obtained target fluid shape for special-shaped fluids can be automatically generated into a fluid surface and automatically output as a vertex animation texture, facilitating direct import into various game engines for subsequent use.
[0041] Reference Figure 1 The diagram illustrates a flowchart of an embodiment of a fluid generation method according to the present invention, which is applied to procedural modeling software and may specifically include the following steps:
[0042] Step 101: In response to the import command for the preset curve and cross-sectional object, generate a fluid particle swarm;
[0043] Special-form fluids refer to fluids with special shapes that can move along arbitrary curves but are not affected by physical properties such as gravity. Examples include the skill and equipment effects of game characters, text effects, etc. Customized fluid effects with special shapes can usually be generated in the game based on the special-form three-dimensional model.
[0044] To meet the customization requirements for fluids with specific morphologies, i.e., to pre-define the fluid morphology, preset curves and cross-sectional objects can be imported into procedural modeling software, such as Houdini. Based on these imported preset curves and cross-sectional objects, the particle morphology of the fluid particle swarm used to generate the fluid can be customized, thereby achieving customization of the generated fluid morphology. It should be noted that the preset curve can be any curve defined manually, and this embodiment of the invention does not impose any limitations on it.
[0045] In practical applications, the entire process of generating a pre-defined fluid shape can be achieved through workflow nodes in procedural modeling software or plugins. Primarily, this can be accomplished by responding to import commands for pre-defined curves and cross-sectional objects via logic nodes, automatically generating a swarm of fluid particles for customizing special fluid shapes. These import commands can be generated in response to the creator's import operation of pre-defined curves and cross-sectional objects, thus generating a swarm of fluid particles to enable customization of special fluid shapes.
[0046] Among them, a fluid particle swarm can be a collection of several fluid particles. Fluid particles can be the smallest physical particles used to generate fluids. They can be the basic particles in procedural modeling software. The particle form of the fluid particle swarm can be specifically represented by the particle motion of several fluid particles.
[0047] The imported preset curve can affect the particle motion of the fluid particle swarm. Specifically, the imported preset curve has a tangent direction, which can affect the trajectory of the particle motion. For example, it can be manifested as bending and deforming the velocity field of the fluid particle swarm along the preset curve.
[0048] Furthermore, the imported cross-sectional object's cross-section can be used to define the initial particle shape of a fluid particle swarm composed of several fluid particles. Specifically, the cross-sectional object can be directly converted into an emission source object, which is mainly used to emit fluid particles, that is, it can provide initial emission force for the fluid particles. The initial shape of the emission source object can be used to define the particle shape flowing along a preset curve, and this particle shape can have a fixed cross-sectional shape.
[0049] It should be noted that there are no restrictions on the imported preset curves and cross-sectional objects; any curve or cross-sectional object is acceptable. The preset curves can be curves pre-defined by the creator or extracted from feature curves in other models; this embodiment of the invention does not impose any limitations on this.
[0050] Step 102: Obtain the curve constraint force of the preset curve, constrain the particle morphology of the fluid particle group based on the curve constraint force, and determine the basic fluid morphology for the fluid.
[0051] The particle morphology of a fluid particle swarm can be represented by the particle motion of several fluid particles. Specifically, it can be determined based on the cross-section of the object and the tangent direction of the preset curve. The basic fluid morphology can be achieved by further simulating the effect of the particle motion. In the process of the fluid particle swarm moving, its trajectory is affected not only by the tangent direction of the preset curve, but also by the curve constraint force of the preset curve. The effect simulation is based on the influence caused by the curve constraint force.
[0052] At this point, the particle shape of the fluid particle swarm can be constrained based on the curve constraint force to determine the basic fluid shape for the fluid. That is, the basic fluid shape for the fluid can be equivalent to the particle shape after effect simulation.
[0053] Specifically, based on the curve constraint force, the particle morphology of the fluid particle swarm during particle motion can be calculated to obtain the basic fluid morphology.
[0054] Step 103: In response to the adjustment command of the morphological parameters of the basic fluid morphology, the target fluid morphology is obtained.
[0055] In one embodiment of the present invention, based on the obtained basic fluid morphology, it is also possible to control the fluid morphology at different cross-sections along the curve segment, thereby achieving different fluid cross-sectional morphologies and thus obtaining fluids with different morphologies. That is, by adjusting different morphology parameters, the specific morphology can be different under the same general curve and cross-sectional morphology; for example, adjusting the speed will result in different overall fluid morphologies of the generated fluid.
[0056] Specifically, the process can be implemented in response to adjustments to the morphological parameters of the basic fluid morphology. These adjustments can be based on interactive operations performed by the creator on the parameter control panel for the morphological parameters, or generated based on the creator's input of corresponding parameters into the parameter control panel. Alternatively, they can be implemented through automated adjustments performed by Houdini software based on pre-set initial parameters for the fluid particles. In other words, the production process can be automated or semi-automated, and this embodiment of the invention does not impose any limitations on this.
[0057] In this embodiment of the invention, in response to an import command for a preset curve and a cross-sectional object, the particle shape of the generated fluid particle swarm is determined based on the tangent direction of the imported preset curve and the cross-sectional shape of the imported cross-sectional object. The particle shape of the fluid particle swarm is constrained by the curve constraint force based on the preset curve, and the target fluid shape is obtained by adjusting the shape parameters. By automatically generating fluids with a fixed cross-sectional shape along the preset curve flow direction based on the imported preset curve and cross-sectional object, and by providing the ability to adjust various shape parameters, different fluid characteristics can be achieved, enabling the rapid generation and debugging of fluids with different shapes.
[0058] Reference Figure 2 The diagram illustrates a flowchart of another embodiment of the fluid generation method of the present invention, which is applied to procedural modeling software and may specifically include the following steps:
[0059] Step 201: In response to the import command for the preset curve and cross-sectional object, a fluid particle swarm is generated on the cross-section of the cross-sectional object with the tangential direction as the direction of fluid particle movement.
[0060] To meet the customization needs of fluids with special shapes, i.e., to preset the shape of the fluid, preset curves and cross-sectional objects can be imported into procedural modeling software, such as Houdini. Based on the imported preset curves and cross-sectional objects, the particle shape of the fluid particle swarm used to generate the fluid can be customized, thereby achieving customization of the generated fluid.
[0061] In practical applications, this can be achieved through process nodes in procedural modeling software or plugins. Specifically, logic nodes can respond to import commands for preset curves and cross-sectional objects, automatically generating fluid particle swarms for customized fluid shapes. The import commands can be generated in response to the creator's import operation of preset curves and cross-sectional objects. In other words, by responding to the creator's import operation of preset curves and cross-sectional objects, a fluid particle swarm can be generated, allowing for the customization of special fluids based on the generated fluid particle swarm.
[0062] A fluid particle swarm can be a collection of several fluid particles. Fluid particles can be the smallest physical particles used to generate fluids. They can be the basic particles in procedural modeling software. The particle form of a fluid particle swarm can be specifically represented by the particle motion of several fluid particles.
[0063] The imported preset curve can influence the particle motion of the fluid particle swarm. Specifically, the imported preset curve has a tangent direction, which can affect the trajectory of the particles. For example, it can manifest as bending and deforming the velocity field of the fluid particle swarm along the preset curve. Furthermore, the imported cross-sectional object can be used to define the initial particle shape of a fluid particle swarm composed of several fluid particles. Specifically, the cross-sectional object can be directly converted into a source object, which is mainly used to emit fluid particles, i.e., it can provide initial emission force for the fluid particles. Therefore, the initial shape of the source object can be used to define the particle shape flowing along the preset curve, and this particle shape can have a fixed cross-sectional shape.
[0064] In one embodiment of the present invention, the generation process of fluid particle swarm can be achieved by obtaining the tangent direction of a preset curve, converting the cross-sectional object into an emitting object, obtaining fluid particles through the emitting object, and using the tangent direction as the motion direction of the fluid particles on the cross-section of the cross-sectional object.
[0065] The imported preset curves can be curve groups, which can contain multiple preset curves. The shapes of the curves contained in the curve group can be the same or different. The shape of the curve can be determined based on parameters such as the number of bending nodes and the bending angle. When the number of bending nodes of the imported preset curves is more than one, each preset curve has multiple tangent directions. In this case, each preset curve will have at least one tangent direction. The tangent direction is mainly determined based on the bending nodes.
[0066] Specifically, a fluid particle swarm can be a collection of several fluid particles. It can refer to a number of fluid particles determined by the cross-section of an object. The number of fluid particles can be determined based on the surface area of the cross-section or the volume of the object (i.e., the interior of the object). In addition to the surface area of the cross-section determining the number of fluid particles, the object also has a certain volume. In this case, the number of fluid particles can also be determined based on the internal space within that volume.
[0067] In some embodiments of the present invention, before the fluid particles are emitted by the emitter and begin their particle motion, the initial parameters of the fluid particles can be adjusted and / or set. For example, the size, initial velocity, fluid tension, and viscosity of the fluid particles can be adjusted to influence their height and shape attributes through additional values. This allows for control over the customized requirements of the subsequently generated fluid, such as customized shape, trajectory, fluid velocity, fluid viscosity, fluid divergence state, and water foam generation. Furthermore, when adjusting the size of the fluid particles, the number of fluid particles emitted by the emitter can be determined by considering the surface of the cross-section or the interior of the cross-section object.
[0068] In practical applications, since each preset curve will have at least one tangent direction and may contain several fluid particles, several fluid particles on the surface or inside of the cross-sectional object can be moved according to the respective tangent directions of each preset curve when the fluid particles begin to move and / or during the movement process, thus obtaining a fluid particle swarm. It should be noted that when moving fluid particles along the imported preset curves, the surface or inside of the cross-sectional object can be divided into preset regions, and the movement trajectory of a portion of the fluid particle swarm corresponding to a region can be bent and deformed along the preset curve of the corresponding region or position. The specific method of region division is not limited in the embodiments of the present invention.
[0069] Step 202: Based on the curve constraint force, perform force calculation on the particle shape of each fluid particle in the fluid particle swarm to determine the basic fluid shape for the fluid.
[0070] In one embodiment of the present invention, the particle morphology of a fluid particle swarm can be represented by the particle motion of several fluid particles. The basic fluid morphology can be achieved by further simulating the effect of the particle motion. At this time, based on the curve constraint force, the particle morphology of the fluid particle swarm during the particle motion process can be calculated to obtain the basic fluid morphology of the fluid.
[0071] Specifically, the particle calculation for the particle morphology of a fluid particle swarm during particle motion is mainly manifested in the calculation of the forces acting on each fluid particle during particle motion, that is, the forces acting on each fluid particle will affect its fluid morphology.
[0072] Curve constraint forces can include central constraint forces, rotational forces, and the motion forces of the simulated liquid. Specifically, for each fluid particle moving along the curve, the central constraint force can be determined based on the difference between the particle's own position coordinates and the position coordinates of the nearest curve point. The rotational force can be determined based on the cross product of the tangent vector of the nearest curve point and the central force. The motion forces of the simulated liquid are mainly reflected in the generation of a noise function.
[0073] In practical applications, the resultant force of the central constraint force, rotational force, and simulated liquid motion force can be obtained. Then, based on the resultant force, the force calculation of the particle shape of each fluid particle in the fluid particle group is realized during the particle motion of the fluid particle group according to the tangent direction of the preset curve.
[0074] For example, fluid particles (swarms) can be equivalent to POP particles. After the fluid particles (swarms) are launched by the emitter, they can be moved along the tangent of the curve using popcurveforce in Houdini software. Then, popfluid and popwind can be added to the POP particles to simulate the effect of liquid churning by performing multiple nosie perturbations. Popfluid nodes can also be added to form the basic fluid shape. Then, popsolver can be used to solve the problem to form a moving particle swarm with shape, thus obtaining the basic fluid shape for the fluid.
[0075] Step 203: In response to the adjustment command of the morphological parameters of the basic fluid morphology, the target fluid morphology is obtained for the fluid.
[0076] Based on the obtained basic fluid morphology, it can also achieve different control of the fluid morphology at each cross section on the curve segment, so as to achieve different fluid cross section morphologies and thus obtain different fluid morphology effects.
[0077] Specifically, the process can be implemented in response to adjustments to the morphological parameters of the basic fluid morphology. These adjustments can be based on interactive operations performed by the creator on the parameter control panel for the morphological parameters, or generated based on the creator's input of corresponding parameters into the parameter control panel. Alternatively, they can be implemented through automated adjustments performed by Houdini software based on pre-set initial parameters for the fluid particles. In other words, the production process can be automated or semi-automated, and this embodiment of the invention does not impose any limitations on this.
[0078] In practical applications, the morphological parameters affecting the target fluid shape can include at least one of the following: flow velocity, density, and scaling of the cross-sectional shape at different locations. In response to adjustment commands for at least one of these parameters, the basic fluid shape can be adjusted accordingly to obtain the target fluid shape. This means that fully automated batch processing of fluids with special shapes can be achieved based on parameter adjustments. By providing the ability to adjust various morphological parameters, different fluid characteristic effects can be achieved, enabling the rapid generation and debugging of fluids with different shapes.
[0079] Step 204: Generate a fluid surface for the target fluid shape, and output the fluid surface as a vertex animation texture.
[0080] In some embodiments of the present invention, the obtained target fluid shape for a special fluid shape can be automatically generated into a fluid surface and automatically output as a vertex animation texture, which can be directly imported into various game engines for use.
[0081] Specifically, a fluid surface can be generated based on the target fluid shape, and the output based on the fluid surface can be a vertex animation texture. This involves acquiring the fluid surface, determining the vertex coordinate information of the fluid surface, storing the vertex coordinate information of the fluid surface as a texture map to obtain the vertex animation texture, and then outputting the vertex animation texture.
[0082] For example, a Python generation tool can be used to automatically generate a mesh for the target fluid shape. The generated mesh is the final output form, which is the object in which the fluid particles are transformed into the actual fluid shape. At this time, the generated mesh can be stored as a texture map according to the vertex coordinate information and automatically output as FBX and vertex animation textures, so as to store the information of the entire simulated fluid animation, which can be parsed and restored to vertex information for playback on different game engines later.
[0083] In this embodiment of the invention, in response to an import command for a preset curve and a cross-sectional object, the particle shape of the generated fluid particle swarm is determined based on the tangent direction of the imported preset curve and the cross-section of the imported cross-sectional object. The particle shape of the fluid particle swarm is constrained by the curve constraint force based on the preset curve, and the target fluid shape is obtained by adjusting the shape parameters. By automatically generating fluids with a fixed cross-sectional shape along the preset curve flow direction based on the imported preset curve and cross-sectional object, and by providing the ability to adjust various shape parameters, different fluid characteristics can be achieved, enabling the rapid generation and debugging of fluids with different shapes.
[0084] To facilitate a better understanding of the fluid generation method proposed in the embodiments of the present invention by those skilled in the art, the following application scenario diagram is provided for illustration:
[0085] Reference Figure 3 The diagram illustrates an application scenario of fluid generation provided by an embodiment of the present invention, involving procedural modeling software 310 and game engine 311. The vertex animation textures for the fluid output by the procedural modeling software 310 can be imported into the game engine 311 for application to the corresponding game scene according to actual needs.
[0086] It should be noted that procedural modeling software 310 may include software such as Houdini or other 3D modeling software (such as MAYA, 3dsmax, Realflow, etc.), and game engines 311 may include software such as Unreal, Unity, NeoX, etc.
[0087] For the procedural modeling software 310, specifically regarding the vertex animation texture output process for fluids, refer to... Figures 4A to 4B The diagram illustrates the customized fluid morphology provided by the embodiment of the present invention. The entire fluid generation process can be achieved through the process nodes of procedural modeling software or plugins. The production process can be automated or semi-automated. The embodiment of the present invention does not limit this.
[0088] In this embodiment of the invention, the generated fluid takes the generation of a water body model as an example. In the entire process of generating the fluid in the preset shape, the process nodes may involve node group tools and Python generation tools.
[0089] The node group tool is mainly used to automatically generate special-shaped fluids according to the node process after importing preset curves and cross-sectional objects. Specifically, it transforms the imported cross-sectional object into an emitter. After generating POP particles based on the cross-section of the cross-sectional object, the node tool will automatically bend and deform the velocity field of the water fluid particle group along the curve provided by the creator. At this time, the height and shape attributes of the fluid particles can also be affected by additional values to control the customized needs of the subsequently generated fluid, such as customized shape, trajectory, customized fluid speed, customized fluid viscosity, fluid divergence state, water foam generation, etc., which can be achieved by setting or adjusting parameters such as the size of the fluid particles, initial velocity, fluid tension and viscosity.
[0090] This Python generation tool is primarily used to automatically generate fluid surface meshes from specially shaped fluids and automatically output them as FBX and vertex animation textures. The entire process can be automated and can batch process the output of a large number of fluid shapes.
[0091] For procedural modeling software, such as Houdini, taking the generation of water models as an example, if the goal is to achieve functions such as covering white waves, controlling the density of water and wave holes, controlling the thickness of the wave head, and controlling the wave dispersion state and density, the process can be roughly divided into importing curves, importing / creating self-built emission shapes, automatic generation, and exporting VAT.
[0092] For example, feature lines can be extracted from other models, such as a model edge line from a water pipe model as a fluid conductor. This can be achieved by first importing the water pipe model into Houdini graphics software, and then extracting feature lines from the morphological model or directly using preset curves in Houdini graphics software.
[0093] like Figure 4A As shown, the basic fluid morphology can be obtained by reading curves and performing fluid morphology simulation based on curve constraints through the process nodes of procedural modeling software or plugins. Specifically, based on curve constraints, particle morphology calculations are performed on the particle morphology of the fluid particle swarm during particle motion to obtain the basic fluid morphology.
[0094] Among these, there are nodes that act on the particle's curvilinear motion, which can be called class nodes. Each class node is associated with multiple child nodes, and each child node is associated with the morphological data of its respective class's morphology sub-part. The morphological data is the initial object of the emission source. For example... Figure 4B As shown, it can be Figure 4AIn the child nodes of the curveflow, the morphological data of each type of node can be extracted as a whole, and the morphological data of each type can be combined into a complete water flow model, which is then associated with the overall water flow morphology node.
[0095] Specifically, this can be represented by obtaining the resultant force of the central constraint force, rotational force, and simulated liquid motion force. Then, based on the resultant force, the force calculation is performed on the particle shape of each fluid particle in the fluid particle swarm as the particle moves along the tangent direction of a preset curve. Specifically, for each fluid particle moving along the curve and undergoing bending deformation, the central constraint force can be determined based on the difference between the fluid particle's own position coordinates and the position coordinates of the nearest curve point. The rotational force can be determined based on the cross product of the tangent vector of the nearest curve point and the central force. The simulated liquid motion force can mainly be represented by the generation of a noise function.
[0096] For example, fluid particles (swarms) can be equivalent to POP particles. After the fluid particles (swarms) are launched by the emitter, they can be moved along the tangent of the curve using popcurveforce in Houdini software. Then, popfluid and popwind can be added to the POP particles to simulate the effect of liquid churning by performing multiple nosie perturbations. Popfluid nodes can also be added to form the basic fluid shape. Then, popsolver can be used to solve the problem to form a moving particle swarm with shape, thus obtaining the basic fluid shape for the fluid.
[0097] That is, at this time, based on such Figure 4A and Figure 4B The method shown can achieve based on, as Figure 5A The cross-sectional object and preset curve shown are generated as follows: Figure 5B The particles shown can then be used to calculate, as shown in the figure. Figure 5C The basic fluid state shown can be represented as follows: Figure 5D The diagram shows how to automatically generate a fluid surface mesh from basic fluid geometry. A local view of the mesh can be shown as follows. Figure 5E As shown. In one embodiment of the present invention, it may also be as follows: Figure 5F The instructions shown modify control parameters at the main node, such as the flow rate, density, and scaling of the cross-sectional shape at different locations of the response curve, to adjust the basic fluid morphology accordingly. Finally, the model cache can be exported, and the VAT can be exported to achieve the final output. The output VAT can contain FBX format files and texture maps storing position and color data.
[0098] In this embodiment of the invention, based on imported preset curves and cross-sectional objects, fluids flowing along preset curves and possessing fixed cross-sectional shapes can be automatically generated. Furthermore, by providing the ability to adjust various morphological parameters, different fluid characteristics can be achieved, enabling rapid generation and debugging of fluid shapes. This not only greatly simplifies the operation steps and saves production time, improving the efficiency of creating special-shaped fluids, but also enables fully automated batch processing of special-shaped fluids based on parameter adjustments. It is easy to implement, has good optimization performance, and low performance overhead. In addition, the obtained target fluid shape for special-shaped fluids can be automatically generated into a fluid surface and automatically output as vertex animation textures, facilitating direct import into various game engines for subsequent use.
[0099] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of the present invention are not limited to the described order of actions, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions involved are not necessarily essential to the embodiments of the present invention.
[0100] Reference Figure 6 The diagram illustrates a structural block diagram of an embodiment of a fluid generation device according to the present invention, which is applied to procedural modeling software and may specifically include the following modules:
[0101] The fluid particle swarm generation module 601 is used to generate a fluid particle swarm in response to an import command for a preset curve and a cross-sectional object; the cross-section of the cross-sectional object and the tangent direction of the preset curve are used to determine the particle shape of the fluid particle swarm.
[0102] The basic fluid morphology determination module 602 is used to obtain the curve constraint force of the preset curve, constrain the particle morphology of the fluid particle group based on the curve constraint force, and determine the basic fluid morphology for the fluid.
[0103] The target fluid shape generation module 603 is used to obtain a target fluid shape for the fluid in response to the adjustment command of the shape parameters of the basic fluid shape.
[0104] In one embodiment of the present invention, the fluid particle swarm generation module 601 may include the following sub-modules:
[0105] The fluid particle acquisition submodule is used to acquire the tangent direction of the preset curve, convert the cross-sectional object into an emission object, and acquire fluid particles through the emission object;
[0106] The fluid particle swarm generation submodule is used to generate a fluid particle swarm on the cross-section of the cross-section object with the tangential direction as the direction of motion of the fluid particles.
[0107] In one embodiment of the present invention, the preset curve includes multiple preset curves, each preset curve has at least one tangential direction, and the fluid particles include a plurality of fluid particles;
[0108] The fluid particle swarm generation submodule may include the following units:
[0109] A fluid particle swarm generation unit is used to generate a swarm of fluid particles on or inside the surface of the cross-sectional object. When the fluid particles begin to move and / or during the movement, they move according to the tangent directions of each preset curve to obtain a fluid particle swarm.
[0110] In one embodiment of the present invention, the curve constraint force includes a central constraint force, a rotational force, and a simulated liquid motion force; the basic fluid morphology determination module 602 may include the following sub-modules:
[0111] The resultant force acquisition submodule is used to acquire the resultant force of the central constraint force, rotational force, and motion force of the simulated liquid.
[0112] The force calculation submodule is used to perform force calculation on the particle shape of each fluid particle in the fluid particle group based on the resultant force during the particle motion of the fluid particle group along the tangent direction of the preset curve, so as to obtain the basic fluid shape of the fluid.
[0113] In one embodiment of the present invention, the morphological parameters include at least one of the curve's flow velocity, density, and scaling of the cross-sectional shape at different locations; the target fluid morphology generation module 603 may include the following sub-modules:
[0114] The morphological parameter adjustment submodule is used to adjust the basic fluid morphology in response to at least one of the adjustment commands for the flow velocity, density, and scaling of the cross-sectional shape at different positions of the curve, so as to obtain the target fluid morphology.
[0115] In one embodiment of the present invention, the device for generating a preset-form fluid provided in this embodiment may further include the following modules:
[0116] The vertex animation texture output module is used to generate a fluid surface from the target fluid shape for the fluid, and output the fluid surface as a vertex animation texture.
[0117] In one embodiment of the present invention, the vertex animation texture output module may include the following sub-modules:
[0118] The vertex coordinate information acquisition submodule is used to acquire the fluid surface and determine the vertex coordinate information of the fluid surface;
[0119] The vertex animation texture output submodule is used to store the vertex coordinate information of the fluid surface as a texture map to obtain vertex animation textures, and output the vertex animation textures.
[0120] In this embodiment of the invention, the device for generating a fluid with a preset shape can respond to an import command for a preset curve and a cross-sectional object. Based on the tangent direction of the imported preset curve and the cross-section of the imported cross-sectional object, it determines the particle shape of the generated fluid particle swarm. The particle shape of the fluid particle swarm is constrained by the curve constraint force based on the preset curve, and the target fluid shape is obtained by adjusting the shape parameters. By automatically generating fluids with a fixed cross-sectional shape flowing along the preset curve based on the imported preset curve and cross-sectional object, and by providing the ability to adjust various shape parameters, different fluid characteristics can be achieved, enabling rapid generation and adjustment of fluids with different shapes.
[0121] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.
[0122] This invention also provides an electronic device, comprising:
[0123] It includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When executed by the processor, the computer program implements the various processes of the above-described fluid generation method embodiments and achieves the same technical effects. To avoid repetition, it will not be described again here.
[0124] This invention also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the various processes of the above-described fluid generation method embodiments and achieves the same technical effects. To avoid repetition, it will not be described again here.
[0125] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0126] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, apparatus, or computer program products. Therefore, embodiments of the present invention can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of the present invention can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0127] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0128] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0129] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0130] Although preferred embodiments of the present invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present invention.
[0131] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.
[0132] The present invention has provided a detailed description of a fluid generation method, a fluid generation device, a corresponding electronic device, and a corresponding computer-readable storage medium. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A method for generating a fluid, characterized in that, The method, applied to procedural modeling software, includes: In response to the import command of a preset curve and a cross-sectional object, a fluid particle swarm is generated; the cross-section of the cross-sectional object and the tangent direction of the preset curve are used to determine the particle shape of the fluid particle swarm. Obtain the curve constraint force of the preset curve, constrain the particle shape of the fluid particle group based on the curve constraint force, and determine the basic fluid shape for the fluid. The curve constraint force includes the center constraint force, rotational force and simulated liquid motion force. In response to the instruction to adjust the morphological parameters of the basic fluid morphology, a target fluid morphology is obtained for the fluid. The generation of fluid particle swarms includes: Obtain the tangent direction of the preset curve, convert the cross-sectional object into an emission object, and obtain fluid particles through the emission object; A swarm of fluid particles is generated on the cross-section of the object with the tangential direction as the direction of motion of the fluid particles.
2. The method according to claim 1, characterized in that, The preset curve includes multiple preset curves, each preset curve has at least one tangential direction, and the fluid particles include a number of fluid particles; The process of generating a fluid particle swarm on the cross-section of the object, with the tangential direction as the direction of motion of the fluid particles, includes: Several fluid particles on or inside the surface of the cross-sectional object move according to the tangent directions of each preset curve when the fluid particles begin to move and / or during the movement process, thus obtaining a fluid particle group.
3. The method according to claim 1, characterized in that; The constraint of particle morphology on the fluid particle swarm based on the curve constraint force to determine the basic fluid morphology includes: Obtain the resultant force of the central constraint force, rotational force, and simulated liquid motion force; Based on the combined force, during the particle motion of the fluid particle group along the tangent direction of the preset curve, the force calculation is performed on the particle shape of each fluid particle in the fluid particle group to obtain the basic fluid shape of the fluid.
4. The method according to claim 1, characterized in that, The morphological parameters include at least one of the curve's flow velocity, density, and scaling of the cross-sectional shape at different locations; the response to the adjustment command of the morphological parameters of the basic fluid morphology to obtain the target fluid morphology includes: The adjustment command for at least one of the following—the flow velocity, density, and scaling of the cross-sectional shape at different locations—of the response curve is used to adjust the basic fluid morphology accordingly, thereby obtaining the target fluid morphology.
5. The method according to claim 1, characterized in that, The method further includes: The target fluid shape is used to generate a fluid surface, and the fluid surface is output as a vertex animation texture.
6. The method according to claim 1, characterized in that, The process of outputting vertex animation textures based on the fluid surface includes: Obtain the fluid surface and determine the vertex coordinate information of the fluid surface; The vertex coordinate information of the fluid surface is stored as a texture map to obtain a vertex animation texture, and the vertex animation texture is output.
7. A fluid generation device, characterized in that, The apparatus, used in procedural modeling software, includes: The fluid particle swarm generation module is used to generate a fluid particle swarm in response to an import command for a preset curve and a cross-sectional object; the cross-section of the cross-sectional object and the tangent direction of the preset curve are used to determine the particle shape of the fluid particle swarm. The basic fluid morphology determination module is used to obtain the curve constraint force of the preset curve, constrain the particle morphology of the fluid particle group based on the curve constraint force, and determine the basic fluid morphology for the fluid. The curve constraint force includes the center constraint force, rotational force and the motion force of the simulated liquid. The target fluid shape generation module is used to respond to the adjustment command of the shape parameters of the basic fluid shape to obtain the target fluid shape for the fluid. The fluid particle swarm generation module includes the following sub-modules: The fluid particle acquisition submodule is used to acquire the tangent direction of the preset curve, convert the cross-sectional object into an emission object, and acquire fluid particles through the emission object; The fluid particle swarm generation submodule is used to generate a fluid particle swarm on the cross-section of the cross-section object with the tangential direction as the direction of motion of the fluid particles.
8. An electronic device, characterized in that, include: A processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements the method of generating fluid as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, which, when executed by a processor, implements the method for generating fluid as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Method for establishing indoor smoke diffusion model
CN108536940A
Animation generation method, animation playing method and related devices
CN112037311A