Smoke effect generation method and device and electronic equipment
By converting the smoke model into a volume object and establishing a target force field, combining the control of the central axis and tangent velocity, the problem of difficulty in precise control of smoke fluid movement in the prior art is solved, and more precise smoke morphology control and customized special effects are achieved.
Patent Information
- Application Number
- CN202411457094.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-16
- Publication Date
- 2025-02-25
AI Technical Summary
The prior art is difficult to accurately control the movement of smoke fluid, resulting in the inability to perfectly achieve the customized floating effect of users.
By obtaining a smoke model with a target shape, converting it into a volume object, establishing a target force field to guide the fluid movement, and extracting the axis in the model to determine the tangent velocity, fusing the tangent velocity with the fluid velocity to control the fluid movement.
It realizes more precise control of the movement of smoke fluid, so that the fluid can better achieve the target form that users want, and improves the customized ability of smoke special effects.
Smart Images

Figure CN119516068A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of data rendering, and in particular to a method, device and electronic device for generating smoke effects. Background Art
[0002] Smoke and fluid effects are common special effects in film, television, and CG (Computer Graphics). They can be used to achieve conventional effects such as explosion smoke, and can also create a smoke effect that flows along a specified curve or require a fluid effect that is close to the shape of a character model. In the related art, the method of creating smoke and fluid effects usually uses a model as an emission source, manually creates some guide lines, and then uses the gascurveforce node in DOP to control the movement of the fluid; among them, DOP is a dynamic simulation module in Houdini, which can complete the dynamics of smoke, fluid, rigid body, line segment, etc. However, this method cannot achieve more precise control of fluid movement. When the constraint value is too small, the fluid will partially deviate from the track during the solution process. If the constraint strength is increased, the fluid may be overly constrained on the guide line, losing the original natural shape of the fluid, and thus failing to achieve a more perfect customized floating effect. Summary of the invention
[0003] The purpose of the present disclosure is to provide a method, device and electronic device for generating a smoke effect, so as to more accurately control the flow of a fluid and allow the fluid to better achieve the smoke form desired by the user.
[0004] In a first aspect, the present disclosure provides a method for generating a smoke effect, the method comprising: obtaining a smoke model having a target shape, and converting the smoke model into a volume object; creating a target force field based on the volume object, and directing a fluid emitted by a preset emission source toward the volume object through the target force field; determining a central axis of the smoke model based on the volume object, and determining a tangent velocity of each point on the central axis; determining a flow velocity of the target fluid based on the tangent velocity and an original velocity of the target fluid within a preset range around the central axis; generating a smoke effect matching the target shape according to the flow velocity of the target fluid and flow morphology constraints on the target fluid.
[0005] In a second aspect, the present disclosure provides a device for generating a smoke effect, the device comprising: a volume conversion module, used to obtain a smoke model having a target shape and convert the smoke model into a volume object; a fluid motion module, used to create a target force field based on the volume object, and to guide the fluid emitted by a preset emission source to the volume object through the target force field; a speed determination module, used to determine the central axis of the smoke model based on the volume object, and to determine the tangent speed of each point on the central axis; a speed adjustment module, used to determine the flow speed of the target fluid based on the tangent speed and the original speed of the target fluid within a preset range around the central axis; an effect generation module, used to generate a smoke effect matching the target shape according to the flow speed of the target fluid and the flow morphology constraints on the target fluid.
[0006] In a third aspect, the present disclosure provides an electronic device, which includes a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the above-mentioned method for generating smoke effects.
[0007] In a fourth aspect, the present disclosure provides a computer-readable storage medium storing computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the above-mentioned method for generating smoke effects.
[0008] The embodiments of the present disclosure bring the following beneficial effects:
[0009] The present disclosure provides a method, device and electronic device for generating a smoke effect. First, a smoke model with a target shape is obtained, and the smoke model is converted into a volume object; then a target force field is created based on the volume object, and the fluid emitted by a preset emission source is directed to the volume object through the target force field; then the central axis of the smoke model is determined based on the volume object, and the tangent speed of each point on the central axis is determined; based on the tangent speed and the original speed of the target fluid within a preset range around the central axis, the flow speed of the target fluid is determined; then, according to the flow speed of the target fluid and the flow form constraints on the target fluid, a smoke effect matching the target shape is generated. This method directs the fluid to the volume object of the target shape by establishing a target force field, then extracts the central axis of the model and determines the tangent speed of the central axis, and fuses the tangent speed with the fluid speed to control the movement of the fluid, so that the movement of the fluid can be more accurately controlled, and the fluid can better achieve the target form desired by the user.
[0010] Other features and advantages of the present disclosure will be set forth in the following description, or some features and advantages may be inferred or unambiguously determined from the description, or may be learned by implementing the above-mentioned technology of the present disclosure.
[0011] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, the following specifically cites preferred implementation modes and describes them in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the specific embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0013] Figure 1 A flow chart of a method for generating a smoke effect provided by an embodiment of the present disclosure;
[0014] Figure 2 A schematic diagram of a target model provided in an embodiment of the present disclosure;
[0015] Figure 3 A schematic diagram of a volume object corresponding to a target model provided in an embodiment of the present disclosure;
[0016] Figure 4 A schematic diagram of a central axis of a smoke model provided in an embodiment of the present disclosure;
[0017] Figure 5 A schematic diagram of extracting a central axis of a smoke model provided by an embodiment of the present disclosure;
[0018] Figure 6 A schematic diagram of fluid movement provided in an embodiment of the present disclosure;
[0019] Figure 7 Schematic diagram of multiple smoke models provided for embodiments of the present disclosure;
[0020] Figure 8 A schematic diagram of constraining the shape of smoke provided by an embodiment of the present disclosure;
[0021] Fig. 9 A schematic diagram of the structure of a device for generating a smoke effect provided in an embodiment of the present disclosure;
[0022] Fig.10 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0023] In order to make the purpose, technical solutions and advantages of the embodiments of the present disclosure clearer, the technical solutions 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 part of the embodiments of the present disclosure, rather than all the embodiments. The components of the embodiments of the present disclosure described and shown in the drawings here can be arranged and designed in various different configurations.
[0024] Therefore, the following detailed description of the embodiments of the present disclosure provided in the accompanying drawings is not intended to limit the scope of the present disclosure claimed for protection, but merely represents selected embodiments of the present disclosure. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present disclosure.
[0025] In order to facilitate understanding of the embodiment of the present invention, a method for generating a smoke effect provided by the embodiment of the present invention is first introduced in detail. Figure 1 As shown, the method comprises the following specific steps:
[0026] Step S102: acquiring a smoke model having a target shape, and converting the smoke model into a volume object.
[0027] In the specific implementation, if the user wants to obtain a target-shaped smoke effect, he first needs to obtain the smoke model of the target shape, then convert the smoke model into a volume object, and import the volume object into the fluid solver, so as to subsequently generate the target-shaped smoke effect in the fluid solver. Among them, the smoke model is a three-dimensional model, and the target shape corresponding to the smoke model can be determined according to R&D requirements. For example, the target shape can be a flame shape or the shape of a certain character. The fluid solver can be the dynamics simulation module (DOP for short) in Houdini, which can complete the dynamics solution of smoke, fluid, rigid body, line segment, etc.
[0028] Usually, models are composed of points, lines, and surfaces. A model can be split into surfaces of different sizes connected together. A volume object can be understood as a model composed of small cube voxels piled up one by one. These voxels constitute the shape of a model, and the fineness of the model is determined by the size of the voxels. In a specific embodiment, the smoke model corresponding to the polygonal mesh can be converted into a volume object using the volume from polygons node in Houdini; the smoke model can also be converted into a volume object by adding voxels to the smoke model.
[0029] like Figure 2 FIG. 1 is a schematic diagram of a target model provided by an embodiment of the present invention. Figure 2 The target model in is a flame model with a floating shape. Figure 3 The figure shows a schematic diagram of a volume object corresponding to a target model provided by an embodiment of the present invention. The volume object is used as the shape of smoke simulation and can constrain the general shape of the fluid during the fluid solution process.
[0030] Step S104: creating a target force field based on the volume object, and guiding the fluid emitted by the preset emission source to the volume object through the target force field.
[0031] In specific implementation, in Houdini, the Volume Source node can be used to import the volume object into the fluid solver, and then a target force field is created in the fluid calculator, which applies a force in the target direction, which is usually in the direction of the volume object, so that the fluid emitted by the preset emission source moves toward the volume object. Among them, the position of the preset emission source and the amount of fluid emitted can be determined according to user needs or R&D rules, and are not specifically limited here.
[0032] In a specific embodiment, GasTargetForce can be created in a fluid solver as a target force field, wherein GasTargetForce is a microsolver that applies force to a target object. It will construct a force field in the fluid solver to direct the smoke fluid toward a volume object with a target shape. GasTargetForce constructs a target force field outside the volume object to apply a force to the external fluid, which is proportional to the density and is in the target direction.
[0033] Step S106, determining the central axis of the smoke model based on the volume object, and determining the tangent speed of each point on the central axis.
[0034] In the specific implementation, there are many ways to extract the central axis of the smoke model, for example, distance transformation, topology contraction or skeleton extraction. After the central axis is extracted, the central axis is introduced into the fluid solver, and the tangent velocity corresponding to each point on the central axis is collected through the point cloud. Among them, the central axis can have many applications, including UV (texture coordinates), growth solution and bone generation. Figure 4 FIG. 1 is a schematic diagram of a central axis of a smoke model provided by an embodiment of the present invention. Figure 4 The line inside the smoke model is the central axis of the smoke model.
[0035] Step S108, determining the flow velocity of the target fluid based on the tangential velocity and the original velocity of the target fluid within a preset range around the central axis.
[0036] In specific implementation, the above preset range can be determined according to research and development needs. For example, the preset range can be a range of a specified distance from the central axis, and the specified distance can be 0.2 meters or 0.3 meters, etc. Specifically, the fluid emitted by the preset emission source and located within the preset range around the central axis can be determined as the target fluid, and then the tangent velocity corresponding to each point on the central axis can be merged with the original velocity of the target fluid to control the movement of the target fluid. Among them, the original velocity of the target fluid can be the initial velocity when the preset emission source emits the target fluid or the velocity after the initial velocity decays, and it can also be the velocity obtained by combining the attenuated initial velocity with the target force field, which can be determined according to research and development needs.
[0037] Step S110 , generating a smoke effect matching the target shape according to the flow velocity of the target fluid and the flow shape constraint on the target fluid.
[0038] The above-mentioned constraint on the flow form of the target fluid can be to make the flow form of the target fluid the same or similar to the target shape, thereby ensuring that the smoke shape of the smoke effect finally generated is the target shape required by the user. Specifically, in Houdini, the constraint of the fluid form can be achieved by adding a gasmatchfield node in the fluid solver. The fluid solver can perform fluid solving through the added nodes and referenced information, thereby generating a smoke effect with a target shape.
[0039] The above-mentioned method for generating smoke effects guides the fluid to the volume object of the target shape by establishing a target force field, then extracts the central axis of the model and determines the tangent speed of the central axis, and combines the tangent speed with the fluid speed to control the fluid movement, thereby more accurately controlling the movement of the fluid and allowing the fluid to better achieve the target shape desired by the user.
[0040] The following embodiments are used to describe the method of determining the center axis of the model.
[0041] Specifically, the specific process of determining the central axis of the smoke model based on the volume object can be implemented through the following steps 10-12:
[0042] Step 10: compare the volume object with the smoke model, determine the first vertex in the smoke model that is outside the volume object, and retain the first vertex.
[0043] In specific implementation, after converting the smoke model into a volume object, the volume object needs to be compared with the smoke model. When the points of the sharper parts of the smoke model are outside the volume object, these points are fixed and used as the end points of the central axis. Among them, the points of the sharper parts of the smoke model outside the volume object are also the first vertices mentioned above. Here, the sharper parts are usually the sharper parts of the smoke model, such as the hand tips of the character model or the claws of the biological model.
[0044] It should be noted that after the smoke model is converted into a volume object, due to the low resolution corresponding to the volume object, the sharper parts of the smoke model may not have corresponding voxels, so the points of the sharper parts of the smoke model may be located outside the volume object.
[0045] Step 11: Move the second vertex in the smoke model that is located within the volume object toward the inside of the smoke model to obtain the moved second vertex.
[0046] The second vertex is the vertex in the smoke model except the first vertex. The second vertex will continue to shrink toward the inside of the smoke model until the smoke model is shrunk to a structure close to a linear structure, thereby obtaining the moved second vertex.
[0047] In an optional embodiment, the specific process of obtaining the moved second vertex includes: for each second vertex in the smoke model located within the volume object, determining the gradient direction corresponding to the second vertex, and controlling the second vertex to move toward the gradient direction; wherein the gradient direction is the normal direction of the smoke model from the outside to the inside corresponding to the position of the second vertex; if the second vertex moves to a shape of the smoke model that is close to a line, stop moving the second vertex to obtain the moved second vertex.
[0048] In a specific implementation, the gradient direction corresponding to the second vertex is perpendicular to the model surface where the second vertex is located and points from the outside of the model to the inside of the model. The second vertex will continue to move along the corresponding gradient direction until the shape of the shrunk smoke model is close to a linear position.
[0049] Step 12, merge the first vertex and the moved second vertex to obtain the central axis of the smoke model.
[0050] In specific implementation, the first vertex and the moved second vertex can be connected in sequence, and the connected line can be determined as the central axis of the smoke model; the first vertex and the moved second vertex can also be fused at similar points, and the fused vertices can be connected in sequence to obtain the central axis of the smoke model.
[0051] In a specific embodiment, the specific process of fusing the first vertex and the moved second vertex to obtain the central axis of the smoke model may include: determining the distance between each two vertices in the first vertex and the moved second vertex, and fusing the third vertex whose distance is less than a preset distance threshold into a target vertex; determining the fourth vertex other than the third vertex in the first vertex and the moved second vertex, and connecting the target vertex and the fourth vertex in sequence to obtain the central axis of the smoke model.
[0052] In practical applications, the preset distance threshold can be determined according to research and development requirements. After obtaining the first vertex and the moved second vertex, the vertices with similar distances can be stitched together, and the stitched vertex is determined as the target vertex. Then, according to the model structure of the smoke model, the target vertex and the unstitched vertex (equivalent to the fourth vertex) are sequentially connected to obtain a connecting line, which is determined as the central axis of the smoke model.
[0053] like Figure 5 FIG. 1 is a schematic diagram of extracting a central axis of a smoke model provided by an embodiment of the present invention. Figure 5 The character model in the first image is a smoke model. First, let the smoke model be converted to VDB (Volume Data Base, volume data structure, equivalent to the above-mentioned volume object) in a loop, smooth and shrink it, and then use VDB to compare with the original smoke model. When the points of the sharper parts of the smoke model are outside the VDB, fix these points and use them as endpoints. The rest of the model is used through the vdbadvectpoints node to let the smoke model continue to shrink inward. After repeated loop calculations, the target model will be shrunk to a nearly linear structure. Then convert the final structure into a line, and then sew the adjacent vertices together and fuse the points multiple times to completely convert the smoke model into a line that diverges from the center point of the model and connects the endpoints, that is, Figure 5 The line in the third image is the central axis of the smoke model.
[0054] It should be noted that the vdbadvectpoints node is used to move the VDB (Volume Data Base) along the direction of the vector field. This node uses the velocity field to drive the points in the VDB to achieve dynamic deformation or movement of the VDB.
[0055] The following embodiments are used to describe a method for determining a tangential velocity corresponding to a central axis and a method for determining a fluid velocity.
[0056] Specifically, the specific process of determining the tangent velocity of each point on the central axis may include: searching for the tangent velocity of each point on the central axis through the point cloud; wherein the point on the central axis is the target point in the point cloud, and the normal velocity corresponding to the target point is the same as the tangent velocity of the point on the central axis.
[0057] In specific implementation, point cloud is a data set of points in space. In vex language, it is used to first use pcopen to obtain the attribute data of each point in the point cloud file, and then use pcfilter to filter out the attribute data required by the user. Specifically, point cloud can be understood as a folder full of data. Point cloud file is a three-dimensional data structure composed of a large number of points, in which each point usually includes the information of each point in 3D space, including the most basic information such as position, color, normal vector, speed, etc.
[0058] In practical applications, the central axis of the smoke model can be determined as the guide line of the smoke, and the guide line can be placed in a space where a large number of points are set. Then, the tangent direction of the point on the guide line is obtained through the point falling on the guide line, and the tangent direction is used as the normal direction of the point (the normal direction is an attribute with direction and size), and the position corresponding to the normal direction and the point is recorded in the point cloud file. Among them, the corresponding tangent speed can be obtained through the tangent direction. For example, the tangent direction can be directly determined as the tangent speed, or the tangent direction can be converted into the tangent speed through a preset function.
[0059] In an optional embodiment, a pcopen node can be used to open a point cloud file (the point cloud file contains the position information and direction information of the points set on the guide curve, etc.) and queue the access to the points contained therein, and then a pcfilter node can be used to open the point cloud file, and the points of the point cloud are obtained to obtain the filter value, thereby filtering out the required normal direction of each point. Among them, the normal direction of the point cloud point is the tangent direction on the obtained guide line, and the purpose is to allow the fluid to flow along the tangent direction of the guide line.
[0060] Furthermore, the specific process of determining the flow velocity of the target fluid based on the tangential velocity and the original velocity of the target fluid within a preset range around the central axis can be achieved through the following steps 20-22:
[0061] Step 20: If the fluid emitted by the emission source moves to a preset range around the central axis, the fluid emitted by the emission source is determined as the target fluid.
[0062] Step 21, determining a target point on the central axis that matches the target fluid, and determining the tangential velocity corresponding to the target point as the tangential velocity corresponding to the target fluid.
[0063] In specific implementation, the point on the central axis that is closest to the target fluid can be determined as the target point, or the point on the central axis that is less than a preset value from the target fluid can be determined as the target point. Other methods can also be used to determine the target point, which can be determined specifically according to research and development needs.
[0064] Step 22: Based on the fluid properties, the tangential velocity corresponding to the target fluid and the original velocity of the target fluid are fused to obtain the flow velocity of the target fluid.
[0065] When the tangent velocity of the target point on the central axis is obtained in the fluid solver, it is also necessary to perform a velocity fusion between the original fluid movement velocity (equivalent to the above-mentioned original velocity) and the tangent velocity. The size of the fusion can be controlled by the fluid's density, temperature, fuel and other attribute data, and the specific details need to be determined according to user needs.
[0066] In a specific embodiment, the above-mentioned fluid properties include fluid density; based on this, the above-mentioned specific process of performing velocity fusion on the tangential velocity corresponding to the target fluid and the original velocity of the target fluid based on the fluid properties to obtain the flow velocity of the target fluid may include: if the fluid density corresponding to the target fluid is greater than a preset density threshold, the flow velocity of the target fluid is determined as the original velocity of the target fluid; if the fluid velocity corresponding to the target fluid is not greater than the preset density threshold, the flow velocity of the target fluid is determined based on the tangential velocity corresponding to the target fluid. Specifically, the above-mentioned preset density threshold can be determined according to research and development requirements, for example, the preset density threshold can be 10 or 15, etc.
[0067] In actual applications, the closer the distance to the preset emission source, the greater the fluid density, and the farther the distance to the preset emission source, the smaller the fluid density. The position of the preset emission source can be set according to user needs. When the user wants to control the fluid speed by fluid density, when the fluid density is between 0 and 20, the user needs the fluid to be controlled by the original speed where the density is greater than 10 (here 10 is equivalent to the above-mentioned preset density threshold), and the fluid is controlled by the tangent speed of the central axis where the density is less than or equal to 10. Figure 6 FIG. 1 is a schematic diagram of a fluid movement provided by an embodiment of the present invention. Figure 6 The curve in the figure is equivalent to the central axis. When the fluid density is less than 10, the fluid will be affected by the central axis, while the part greater than 10 will not be affected by the central axis and will continue to float upward in the original direction.
[0068] In a specific embodiment, when the fluid density is less than or equal to 10, it is necessary to map the fluid density to between 0 and 1, and then use the ramp curve to gently control the specific force that affects the fluid. It can be understood that after mapping the fluid density value to between 0 and 1, it is mapped to the ramp curve, and the affected part is controlled by adjusting the shape of the curve. For example, the fluid density of 3 to 10 is mapped to 0 to 1, and the result of the part of the fluid with a density less than 3 is 0 (that is, it is not affected by the curve), the part of the fluid with a density of 3 to 10 is gradually affected by the curve from 0 to 70%, and the part of the fluid with a density of more than 10 is 70% affected by the curve.
[0069] The above method uses the extracted central axis of the smoke model and the point cloud sampling central axis method to comprehensively control the movement of the fluid, which can produce a more controllable smoke shape.
[0070] The following embodiments are used to describe the method of constraining the smoke pattern.
[0071] Specifically, the specific process of constraining the flow morphology of the target fluid may include: resampling the volume object to construct a specified field; wherein the shape of the specified field matches the volume object, and the accuracy and size of the specified field match the target force field; and constraining the flow morphology of the target fluid through the specified field.
[0072] In a specific implementation, the volume object can be resampled to obtain a specified field that matches the target shape corresponding to the volume object. The accuracy and size of the specified field match the pre-created target force field, so that the movement of the fluid can be constrained to the target shape through the specified field.
[0073] In a specific embodiment, a gasmatchfield node can be added to the fluid solver to resample the volumetric object to ensure that it has the same resolution and size as the solving fluid. The gasmatchfield node is a microsolver that reconstructs the size and resolution of the fluid to match the reference fluid. The node will create, resize, and resample as needed to ensure that the volumetric object of the target shape exists as a field with the same resolution and size as the reference field.
[0074] Furthermore, the above-mentioned smoke model includes multiple; the specific process of converting the smoke model into a volume object includes: converting the multiple smoke models into volume objects respectively, and obtaining the volume object corresponding to each smoke model.
[0075] like Figure 7 FIG. 1 is a schematic diagram of multiple smoke models provided by an embodiment of the present invention. Figure 7The letter A in the figure is used as the preset emission source, and the letters B, C, and N are used as smoke models. Then these four models are converted into volumes and introduced into the fluid calculator through volumeSource in turn. At the same time, GasTargetForce is created as the target force field to guide the fluid emitted by the preset emission source to the smoke model through the target force field.
[0076] Then, the volume object corresponding to each smoke model is resampled using GasMatchField, and the action time frame of the volume object corresponding to each smoke model is determined, so that the corresponding target volume object is controlled to act when the action time frame is reached, so that the flow form of the target fluid is constrained within the shape corresponding to the target volume object. The above action time frame is the time for the shape to change to the volume object corresponding to the corresponding smoke model.
[0077] For example, K (for example, K is 40) frames are sequentially determined to change to Figure 7 The action time of target shapes B, C, and N in the figure is: the first 40 frames are the launch time of A, 40-80 frames are the deformation time of A to B, 80-120 frames are the deformation time of B to C, and 120-160 frames are the deformation time of C to B. Figure 8 The figure shows a schematic diagram of the shape constraint on smoke. Figure 8 The diagram shows that after the emission source A emits particles, the smoke gradually changes from shape B to shape N over time. In order to achieve the effect of smoke changing from letters ABCN, it is necessary to set key frames for the Activation (which can be understood as whether it is activated) of several smoke models. For example, in the first frame, the emission source letter A starts to be solved, and the target shapes BCN are all in a silent state (Activation is 0). At the 40th frame, if you want A to change to the shape of B, you need to set ActivationK of B to 1 at the 400th frame. At this time, the smoke flows like target B and finally forms B, and so on.
[0078] Compared with the prior art method of using gascurveforce to control the movement of the fluid, the advantage of the above method is that the use of GasTargetForce can better constrain the shape of the fluid, and at the same time, the method of extracting the central axis of the model and the central axis of the point cloud sampling can be used to comprehensively control the movement of the fluid, which can produce a more controllable smoke shape.
[0079] Corresponding to the above method embodiment, the embodiment of the present invention also provides a device for generating a smoke effect, such as Fig. 9 As shown, the device comprises:
[0080] The volume conversion module 90 is used to obtain a smoke model with a target shape and convert the smoke model into a volume object.
[0081] The fluid motion module 91 is used to create a target force field based on the volume object, and guide the fluid emitted by the preset emission source to the volume object through the target force field.
[0082] The speed determination module 92 is used to determine the central axis of the smoke model based on the volume object, and determine the tangent speed of each point on the central axis.
[0083] The speed adjustment module 93 is used to determine the flow speed of the target fluid based on the tangential speed and the original speed of the target fluid within a preset range around the central axis.
[0084] The effect generation module 94 is used to generate a smoke effect matching the target shape according to the flow velocity of the target fluid and the flow shape constraints on the target fluid.
[0085] The above-mentioned smoke effect generating device guides the fluid to the volume object of the target shape by establishing a target force field, then extracts the central axis of the model and determines the tangent speed of the central axis, and combines the tangent speed with the fluid speed to control the fluid movement, thereby more accurately controlling the movement of the fluid and allowing the fluid to better achieve the target shape desired by the user.
[0086] Specifically, the speed determination module 92 is used to: compare the volume object with the smoke model, determine the first vertex in the smoke model that is located outside the volume object, and retain the first vertex; move the second vertex in the smoke model that is located inside the volume object toward the inside of the smoke model to obtain the moved second vertex; merge the first vertex and the moved second vertex to obtain the central axis of the smoke model.
[0087] Furthermore, the speed determination module 92 is used to: determine the gradient direction corresponding to each second vertex in the smoke model within the volume object, and control the second vertex to move in the gradient direction; wherein the gradient direction is the normal direction of the smoke model from the outside to the inside corresponding to the position of the second vertex; if the second vertex moves to a shape close to a line of the smoke model, stop moving the second vertex to obtain the moved second vertex.
[0088] Furthermore, the above-mentioned speed determination module 92 is also used to: determine the distance between each two vertices in the first vertex and the second vertex after movement, and merge the third vertex whose distance is less than a preset distance threshold into a target vertex; determine the fourth vertex other than the third vertex in the first vertex and the second vertex after movement, and connect the target vertex and the fourth vertex in sequence to obtain the central axis of the smoke model.
[0089] Furthermore, the speed determination module 92 is also used to: search for the tangent speed of each point on the central axis through the point cloud; wherein the point on the central axis is the target point in the point cloud, and the normal speed corresponding to the target point is the same as the tangent speed of the point on the central axis.
[0090] Furthermore, the above-mentioned speed adjustment module 93 is used to: if the fluid emitted by the emission source moves to a preset range around the central axis, determine the fluid emitted by the emission source as the target fluid; determine a target point on the central axis that matches the target fluid, and determine the tangent speed corresponding to the target point as the tangent speed corresponding to the target fluid; based on the fluid properties, perform speed fusion on the tangent speed corresponding to the target fluid and the original speed of the target fluid to obtain the flow speed of the target fluid.
[0091] Furthermore, the above-mentioned fluid properties include fluid density; based on this, the above-mentioned speed adjustment module 93 is also used to: if the fluid density corresponding to the target fluid is greater than a preset density threshold, determine the flow speed of the target fluid as the original speed of the target fluid; if the fluid speed corresponding to the target fluid is not greater than the preset density threshold, determine the flow speed of the target fluid based on the tangential speed corresponding to the target fluid.
[0092] Furthermore, the above-mentioned flow morphology constraint on the target fluid includes: resampling the volume object to construct a specified field; wherein the shape of the specified field matches the volume object, and the accuracy and size of the specified field match the target force field; and constraining the flow morphology of the target fluid through the specified field.
[0093] Furthermore, the above-mentioned smoke model includes multiple; the above-mentioned volume conversion module 90 is used to: convert multiple smoke models into volume objects respectively, and obtain the volume object corresponding to each smoke model; based on this, the above-mentioned device also includes a time frame determination module, which is used to: after resampling the volume object and constructing the specified field, determine the action time frame of the volume object corresponding to each smoke model, so as to control the corresponding target volume object to take effect when the action time frame is reached, so that the flow shape of the target fluid is constrained within the shape corresponding to the target volume object.
[0094] The device for generating smoke effect provided in the embodiment of the present disclosure has the same implementation principle and technical effects as those in the aforementioned method embodiment. For the sake of brief description, for matters not mentioned in the device embodiment, reference may be made to the corresponding contents in the aforementioned method embodiment.
[0095] The present disclosure also provides an electronic device, such as Fig.10 As shown, the electronic device includes a processor and a memory, the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the above-mentioned method for generating smoke effects.
[0096] Specifically, the above-mentioned method for generating the smoke effect includes: obtaining a smoke model with a target shape and converting the smoke model into a volume object; creating a target force field based on the volume object, and guiding the fluid emitted by a preset emission source to the volume object through the target force field; determining the central axis of the smoke model based on the volume object, and determining the tangent speed of each point on the central axis; determining the flow speed of the target fluid based on the tangent speed and the original speed of the target fluid within a preset range around the central axis; generating a smoke effect matching the target shape according to the flow speed of the target fluid and the flow morphology constraints on the target fluid.
[0097] The above-mentioned method for generating smoke effects guides the fluid to the volume object of the target shape by establishing a target force field, then extracts the central axis of the model and determines the tangent speed of the central axis, and combines the tangent speed with the fluid speed to control the fluid movement, thereby more accurately controlling the movement of the fluid and allowing the fluid to better achieve the target shape desired by the user.
[0098] In an optional embodiment, the above-mentioned step of determining the central axis of the smoke model based on the volume object includes: comparing the volume object with the smoke model, determining the first vertex in the smoke model that is located outside the volume object, and retaining the first vertex; moving the second vertex in the smoke model that is located inside the volume object toward the inside of the smoke model to obtain the moved second vertex; and fusing the first vertex and the moved second vertex to obtain the central axis of the smoke model.
[0099] In an optional embodiment, the step of moving the second vertex in the smoke model located within the volume object toward the inside of the smoke model to obtain the moved second vertex includes: for each second vertex in the smoke model located within the volume object, determining the gradient direction corresponding to the second vertex, and controlling the second vertex to move toward the gradient direction; wherein the gradient direction is the normal direction of the smoke model from the outside to the inside corresponding to the position of the second vertex; if the second vertex moves to a shape of the smoke model that is close to a line, stop moving the second vertex to obtain the moved second vertex.
[0100] In an optional embodiment, the step of fusing the first vertex and the moved second vertex to obtain the central axis of the smoke model includes: determining the distance between each two vertices in the first vertex and the moved second vertex, and fusing the third vertex whose distance is less than a preset distance threshold into a target vertex; determining the fourth vertex other than the third vertex in the first vertex and the moved second vertex, and connecting the target vertex and the fourth vertex in sequence to obtain the central axis of the smoke model.
[0101] In an optional embodiment, the above-mentioned step of determining the tangent velocity of each point on the central axis includes: searching for the tangent velocity of each point on the central axis through the point cloud; wherein, the point on the central axis is the target point in the point cloud, and the normal velocity corresponding to the target point is the same as the tangent velocity of the point on the central axis.
[0102] In an optional embodiment, the step of determining the flow velocity of the target fluid based on the tangential velocity and the original velocity of the target fluid within a preset range around the central axis includes: if the fluid emitted by the emission source moves to within the preset range around the central axis, determining the fluid emitted by the emission source as the target fluid; determining a target point on the central axis that matches the target fluid, and determining the tangential velocity corresponding to the target point as the tangential velocity corresponding to the target fluid; and performing velocity fusion on the tangential velocity corresponding to the target fluid and the original velocity of the target fluid based on the fluid properties to obtain the flow velocity of the target fluid.
[0103] In an optional embodiment, the above-mentioned fluid properties include fluid density; the above-mentioned step of performing velocity fusion on the tangential velocity corresponding to the target fluid and the original velocity of the target fluid based on the fluid properties to obtain the flow velocity of the target fluid includes: if the fluid density corresponding to the target fluid is greater than a preset density threshold, determining the flow velocity of the target fluid as the original velocity of the target fluid; if the fluid velocity corresponding to the target fluid is not greater than the preset density threshold, determining the flow velocity of the target fluid based on the tangential velocity corresponding to the target fluid.
[0104] In an optional embodiment, the above-mentioned flow morphology constraint on the target fluid includes: resampling the volume object to construct a specified field; wherein the shape of the specified field matches the volume object, and the accuracy and size of the specified field match the target force field; and the flow morphology of the target fluid is constrained by the specified field.
[0105] In an optional embodiment, the smoke model includes multiple smoke models; the step of converting the smoke model into a volume object includes: converting the multiple smoke models into volume objects respectively to obtain a volume object corresponding to each smoke model. Based on this, after the volume object is resampled and the designated field is constructed, the method further includes: determining the action time frame of the volume object corresponding to each smoke model, so as to control the corresponding target volume object to act when the action time frame is reached, so that the flow form of the target fluid is constrained within the shape corresponding to the target volume object.
[0106] Further, Fig.10 The electronic device shown further includes a bus 102 and a communication interface 103 , and the processor 101 , the communication interface 103 and the memory 100 are connected via the bus 102 .
[0107] The memory 100 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 103 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used. The bus 102 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.10 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0108] The processor 101 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 101. The above processor 101 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The disclosed methods, steps and logic block diagrams in the embodiments of the present disclosure can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present disclosure can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 100, and the processor 101 reads the information in the memory 100 and completes the steps of the method of the above embodiment in combination with its hardware.
[0109] The embodiment of the present disclosure also provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the above-mentioned method for generating the smoke effect. The specific implementation can be found in the method embodiment, which will not be repeated here.
[0110] Specifically, the above-mentioned method for generating the smoke effect includes: obtaining a smoke model with a target shape and converting the smoke model into a volume object; creating a target force field based on the volume object, and guiding the fluid emitted by a preset emission source to the volume object through the target force field; determining the central axis of the smoke model based on the volume object, and determining the tangent speed of each point on the central axis; determining the flow speed of the target fluid based on the tangent speed and the original speed of the target fluid within a preset range around the central axis; generating a smoke effect matching the target shape according to the flow speed of the target fluid and the flow morphology constraints on the target fluid.
[0111] The above-mentioned method for generating smoke effects guides the fluid to the volume object of the target shape by establishing a target force field, then extracts the central axis of the model and determines the tangent speed of the central axis, and combines the tangent speed with the fluid speed to control the fluid movement, thereby more accurately controlling the movement of the fluid and allowing the fluid to better achieve the target shape desired by the user.
[0112] In an optional embodiment, the above-mentioned step of determining the central axis of the smoke model based on the volume object includes: comparing the volume object with the smoke model, determining the first vertex in the smoke model that is located outside the volume object, and retaining the first vertex; moving the second vertex in the smoke model that is located inside the volume object toward the inside of the smoke model to obtain the moved second vertex; and fusing the first vertex and the moved second vertex to obtain the central axis of the smoke model.
[0113] In an optional embodiment, the step of moving the second vertex in the smoke model located within the volume object toward the inside of the smoke model to obtain the moved second vertex includes: for each second vertex in the smoke model located within the volume object, determining the gradient direction corresponding to the second vertex, and controlling the second vertex to move toward the gradient direction; wherein the gradient direction is the normal direction of the smoke model from the outside to the inside corresponding to the position of the second vertex; if the second vertex moves to a shape of the smoke model that is close to a line, stop moving the second vertex to obtain the moved second vertex.
[0114] In an optional embodiment, the step of fusing the first vertex and the moved second vertex to obtain the central axis of the smoke model includes: determining the distance between each two vertices in the first vertex and the moved second vertex, and fusing the third vertex whose distance is less than a preset distance threshold into a target vertex; determining the fourth vertex other than the third vertex in the first vertex and the moved second vertex, and connecting the target vertex and the fourth vertex in sequence to obtain the central axis of the smoke model.
[0115] In an optional embodiment, the above-mentioned step of determining the tangent velocity of each point on the central axis includes: searching for the tangent velocity of each point on the central axis through the point cloud; wherein, the point on the central axis is the target point in the point cloud, and the normal velocity corresponding to the target point is the same as the tangent velocity of the point on the central axis.
[0116] In an optional embodiment, the step of determining the flow velocity of the target fluid based on the tangential velocity and the original velocity of the target fluid within a preset range around the central axis includes: if the fluid emitted by the emission source moves to within the preset range around the central axis, determining the fluid emitted by the emission source as the target fluid; determining a target point on the central axis that matches the target fluid, and determining the tangential velocity corresponding to the target point as the tangential velocity corresponding to the target fluid; and performing velocity fusion on the tangential velocity corresponding to the target fluid and the original velocity of the target fluid based on the fluid properties to obtain the flow velocity of the target fluid.
[0117] In an optional embodiment, the above-mentioned fluid properties include fluid density; the above-mentioned step of performing velocity fusion on the tangential velocity corresponding to the target fluid and the original velocity of the target fluid based on the fluid properties to obtain the flow velocity of the target fluid includes: if the fluid density corresponding to the target fluid is greater than a preset density threshold, determining the flow velocity of the target fluid as the original velocity of the target fluid; if the fluid velocity corresponding to the target fluid is not greater than the preset density threshold, determining the flow velocity of the target fluid based on the tangential velocity corresponding to the target fluid.
[0118] In an optional embodiment, the above-mentioned flow morphology constraint on the target fluid includes: resampling the volume object to construct a specified field; wherein the shape of the specified field matches the volume object, and the accuracy and size of the specified field match the target force field; and the flow morphology of the target fluid is constrained by the specified field.
[0119] In an optional embodiment, the smoke model includes multiple smoke models; the step of converting the smoke model into a volume object includes: converting the multiple smoke models into volume objects respectively to obtain a volume object corresponding to each smoke model. Based on this, after the volume object is resampled and the designated field is constructed, the method further includes: determining the action time frame of the volume object corresponding to each smoke model, so as to control the corresponding target volume object to act when the action time frame is reached, so that the flow form of the target fluid is constrained within the shape corresponding to the target volume object.
[0120] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a terminal device, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0121] In the description of the present disclosure, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present disclosure and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation of the present disclosure. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
[0122] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present disclosure, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. A method for generating a smoke effect, characterized in that: The method comprises: Acquire a smoke model having a target shape, and convert the smoke model into a volume object; Creating a target force field based on the volume object, and directing the fluid emitted by a preset emission source toward the volume object through the target force field; Determine the central axis of the smoke model based on the volume object, and determine the tangent speed of each point on the central axis; Determining the flow velocity of the target fluid based on the tangential velocity and the original velocity of the target fluid within a preset range around the central axis; A smoke effect matching the target shape is generated according to the flow velocity of the target fluid and the flow shape constraint on the target fluid.
2. The method according to claim 1, characterized in that The step of determining the central axis of the smoke model based on the volume object comprises: Comparing the volume object with the smoke model, determining a first vertex in the smoke model that is outside the volume object, and retaining the first vertex; Moving a second vertex in the smoke model that is located within the volume object toward the inside of the smoke model to obtain a moved second vertex; The first vertex and the moved second vertex are merged to obtain the central axis of the smoke model.
3. The method according to claim 2, characterized in that The step of moving the second vertex in the smoke model located within the volume object toward the inside of the smoke model to obtain the moved second vertex comprises: For each second vertex in the smoke model located within the volume object, determine a gradient direction corresponding to the second vertex, and control the second vertex to move toward the gradient direction; wherein the gradient direction is a normal direction corresponding to the position of the second vertex pointing from the outside to the inside of the smoke model; If the second vertex is moved until the shape of the smoke model is close to a line, the movement of the second vertex is stopped to obtain the moved second vertex.
4. The method according to claim 2, characterized in that: The step of fusing the first vertex and the moved second vertex to obtain the central axis of the smoke model includes: Determine the distance between each two vertices of the first vertex and the moved second vertex, and merge the third vertices whose distance is less than a preset distance threshold into a target vertex; A fourth vertex other than the third vertex is determined between the first vertex and the moved second vertex, and the target vertex and the fourth vertex are sequentially connected to obtain a central axis of the smoke model.
5. The method according to claim 1, characterized in that The step of determining the tangential velocity of each point on the central axis comprises: The tangent speed of each point on the central axis is searched through the point cloud; wherein the point on the central axis is the target point in the point cloud, and the normal speed corresponding to the target point is the same as the tangent speed of the point on the central axis.
6. The method according to claim 1, characterized in that The step of determining the flow velocity of the target fluid based on the tangential velocity and the original velocity of the target fluid within a preset range around the central axis comprises: If the fluid emitted by the emission source moves into the preset range around the central axis, the fluid emitted by the emission source is determined as the target fluid; Determine a target point on the central axis that matches the target fluid, and determine the tangential velocity corresponding to the target point as the tangential velocity corresponding to the target fluid; Based on the fluid properties, the tangential velocity corresponding to the target fluid and the original velocity of the target fluid are fused to obtain the flow velocity of the target fluid.
7. The method according to claim 6, characterized in that The fluid properties include fluid density; The step of performing velocity fusion on the tangential velocity corresponding to the target fluid and the original velocity of the target fluid based on the fluid properties to obtain the flow velocity of the target fluid comprises: If the fluid density corresponding to the target fluid is greater than a preset density threshold, determining the flow velocity of the target fluid as the original velocity of the target fluid; If the fluid velocity corresponding to the target fluid is not greater than the preset density threshold, the flow velocity of the target fluid is determined based on the tangential velocity corresponding to the target fluid.
8. The method according to claim 1, characterized in that: The flow pattern constraint on the target fluid includes: Resampling the volume object to construct a specified field; wherein the shape of the specified field matches the volume object, and the accuracy and size of the specified field match the target force field; The flow pattern of the target fluid is constrained by the designated field.
9. The method according to claim 8, characterized in that The smoke model includes a plurality of smoke models; the step of converting the smoke model into a volume object includes: Convert the plurality of smoke models into volume objects respectively to obtain a volume object corresponding to each smoke model; After resampling the volume object and constructing the specified field, the method also includes: determining the action time frame of the volume object corresponding to each of the smoke models, so as to control the corresponding target volume object to take effect when the action time frame is reached, so that the flow shape of the target fluid is constrained within the shape corresponding to the target volume object.
10. A device for generating a smoke effect, characterized in that: The device comprises: A volume conversion module, used for acquiring a smoke model having a target shape and converting the smoke model into a volume object; A fluid motion module, used for creating a target force field based on the volume object, and guiding the fluid emitted by a preset emission source to the volume object through the target force field; A speed determination module, used to determine the central axis of the smoke model based on the volume object, and determine the tangent speed of each point on the central axis; a speed adjustment module, configured to determine the flow speed of the target fluid based on the tangential speed and the original speed of the target fluid within a preset range around the central axis; The effect generation module is used to generate a smoke effect matching the target shape according to the flow velocity of the target fluid and the flow shape constraint on the target fluid.
11. An electronic device, characterized in that: The electronic device comprises a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the method for generating the smoke effect according to any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the method for generating a smoke effect according to any one of claims 1 to 9.