Methods and apparatus for generating fluid special effects, computer storage media, electronic devices
By acquiring line groups in three-dimensional space and generating columnar lines through rotation, twisting, and deformation, the problem of low efficiency in fluid effect generation in existing technologies is solved, and high efficiency in fluid effect model generation is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-16
- Publication Date
- 2026-03-10
AI Technical Summary
Existing technologies are inefficient and slow in generating fluid effects.
The process involves acquiring a group of lines in 3D space, rotating and twisting the group of lines along a specified direction to generate columnar lines with width, rendering an initial fluid effect model, and finally generating the target fluid effect.
The process of generating fluid effects models has been simplified, and the efficiency of fluid effects model generation has been improved.
Smart Images

Figure CN116271817B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and more specifically, to a method and apparatus for generating fluid effects, a computer-readable storage medium, and an electronic device. Background Technology
[0002] In game design and special effects production, it is necessary to simulate fluid effects such as water waves and splashes.
[0003] In related technologies, when simulating fluid effects such as water waves and splashes, the main approach is to determine a virtual force field in three-dimensional space, perform fluid calculations on the virtual fluid based on the virtual force field, calculate the flow of particles through physical simulation, and finally transform the particles into a model to form the final fluid effect.
[0004] However, the existing technologies for generating fluid effects are slow and inefficient. Therefore, a new method for generating fluid effects is needed.
[0005] It should be noted that the information in the background section above is only used to enhance the understanding of the background of the present invention, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention
[0006] This disclosure provides a method for generating fluid effects, a device for generating fluid effects, a computer-readable storage medium, and an electronic device, thereby overcoming, to at least a certain extent, the problem of low efficiency in generating fluid effects in related technologies due to limitations and defects in related technologies.
[0007] According to one aspect of this disclosure, a method for generating fluid special effects is provided, comprising:
[0008] Obtain a group of lines in three-dimensional space, wherein the group of lines comprises multiple lines arranged along a specified direction;
[0009] The target line is obtained by rotating, twisting and deforming the lines in the line group along the specified direction.
[0010] Based on the target lines, generate columnar lines with width, and obtain the initial fluid effect model through the columnar lines with width;
[0011] The initial fluid effect model is rendered to obtain the target fluid effect.
[0012] According to one aspect of this disclosure, a fluid effects generation apparatus is provided, comprising:
[0013] A line group acquisition module is used to acquire line groups in three-dimensional space, wherein the line group includes multiple lines arranged along a specified direction;
[0014] The line deformation module is used to rotate and twist the lines in the line group along the specified direction to obtain the target line.
[0015] The fluid effects model generation module is used to generate a columnar line with width based on the target line, and to obtain an initial fluid effects model through the columnar line with width.
[0016] The fluid effects generation module is used to render the initial fluid effects model to obtain the target fluid effects.
[0017] According to one aspect of this disclosure, a computer storage medium is provided that stores a computer program thereon, which, when executed by a processor, implements the fluid effects generation method described in any of the exemplary embodiments above.
[0018] According to one aspect of this disclosure, an electronic device is provided, comprising:
[0019] Processor; and
[0020] Memory for storing the executable instructions of the processor;
[0021] The processor is configured to execute the fluid effects generation method described in any of the above exemplary embodiments by executing the executable instructions.
[0022] This disclosure provides a method for generating fluid effects, which involves acquiring a group of lines in three-dimensional space, the group comprising multiple lines arranged along a specified direction; rotating and twisting the lines in the group along the specified direction to obtain target lines; generating columnar lines with width based on the target lines; obtaining an initial fluid effect model using the columnar lines; and rendering the initial fluid effect model to obtain the target fluid effect. On one hand, acquiring a group of lines in three-dimensional space, rotating and twisting the group to obtain target lines, generating columnar lines based on the target lines, and obtaining an initial fluid effect model from the columnar lines simplifies the fluid effect model generation process and improves the efficiency of fluid effect model generation. On the other hand, after generating the initial fluid effect model, obtaining the target fluid effect based on the initial fluid effect model further improves the efficiency of fluid effect generation.
[0023] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit the invention. Attached Figure Description
[0024] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention. It is obvious that the drawings described below are merely some embodiments of the invention, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.
[0025] Figure 1 The flowchart illustrates a method for generating fluid effects according to an example embodiment of the present disclosure.
[0026] Figure 2 The flowchart illustrates a method for generating random points in three-dimensional space according to an exemplary embodiment of the present disclosure.
[0027] Figure 3 A schematic diagram of a generated circular model according to an exemplary embodiment of the present disclosure is shown.
[0028] Figure 4 The illustration schematically shows a diagram of uniformly distributed random points generated in a circular model according to an exemplary embodiment of the present disclosure.
[0029] Figure 5 The illustration shows a schematic diagram of a random point in three-dimensional space according to an exemplary embodiment of the present disclosure.
[0030] Figure 6 The flowchart illustrates a method for obtaining a line group based on multiple preset lines, random points, and relationships, according to an example embodiment of the present disclosure.
[0031] Figure 7 The schematic diagram illustrates a method flowchart for rotating and twisting each line in a line group to obtain a first deformed line group based on a specified direction, according to an example embodiment of the present disclosure.
[0032] Figure 8 (a) schematically illustrates a schematic diagram of a line group according to an exemplary embodiment of the present disclosure.
[0033] Figure 8 (b) schematically illustrates a diagram of a group of twisted lines according to an exemplary embodiment of the present disclosure.
[0034] Figure 8 (c) schematically illustrates a first deformed line group according to an exemplary embodiment of the present disclosure.
[0035] Figure 9 The flowchart illustrates a method for linearly deforming each line in a first deformable line group to obtain a target line according to an exemplary embodiment of the present disclosure.
[0036] Figure 10 The flowchart illustrates a method for generating bar-shaped lines with width based on target lines according to an exemplary embodiment of the present disclosure.
[0037] Figure 11 The flowchart schematically illustrates a method for generating fluid effects after widening a target line into a columnar line with width, according to an exemplary embodiment of the present disclosure.
[0038] Figure 12 The diagram schematically illustrates a method flowchart for obtaining an initial fluid effect model using bar lines of width, according to an exemplary embodiment of the present disclosure.
[0039] Figure 13 The diagram illustrates a vertex in a columnar model according to an exemplary embodiment of the present disclosure.
[0040] Figure 14 The illustration schematically shows a first fluid effect model generated according to an example embodiment of the present disclosure.
[0041] Figure 15 The flowchart illustrates a method for transforming initial model mesh data to obtain target model mesh data according to an example embodiment of the present disclosure.
[0042] Figure 16 The illustration shows a schematic diagram of different target fluid effect models corresponding to different clipping values according to an example embodiment of the present disclosure.
[0043] Figure 17 The schematic diagram illustrates a method flowchart for rendering a target fluid effect model to obtain a target fluid effect according to an example embodiment of the present disclosure.
[0044] Figure 18 The illustration schematically shows a fluid bead effect generated on the surface of a target fluid effect model according to an example embodiment of the present disclosure.
[0045] Figure 19 A block diagram schematically illustrates a fluid effects generation apparatus according to an exemplary embodiment of the present disclosure.
[0046] Figure 20 An electronic device for implementing a fluid effects generation method according to an exemplary embodiment of the present invention is illustrated schematically. Detailed Implementation
[0047] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided to make the invention more comprehensive and complete, and to fully convey the concept of the exemplary embodiments to those skilled in the art. The described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a full understanding of embodiments of the invention. However, those skilled in the art will recognize that the technical solutions of the invention may be practiced with one or more of these specific details omitted, or other methods, components, apparatus, steps, etc., may be employed. In other instances, well-known technical solutions are not shown or described in detail to avoid obscuring various aspects of the invention.
[0048] Furthermore, the accompanying drawings are merely illustrative of the invention and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted. Some block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.
[0049] This example embodiment first provides a method for generating fluid effects, referencing... Figure 1 As shown, the following steps may be included:
[0050] Step S110. Obtain a line group in three-dimensional space, wherein the line group includes multiple lines arranged along a specified direction;
[0051] Step S120. Rotate and twist the lines in the line group along the specified direction to obtain the target lines;
[0052] Step S130. Generate a columnar line with width based on the target line, and obtain an initial fluid effect model through the columnar line with width;
[0053] Step S140. Render the initial fluid effect model to obtain the target fluid effect.
[0054] The aforementioned fluid effect generation method involves: acquiring a group of lines in three-dimensional space, the group comprising multiple lines arranged along a specified direction; rotating and twisting the lines in the group along the specified direction to obtain target lines; generating columnar lines with width based on the target lines, and obtaining an initial fluid effect model using these columnar lines; and rendering the initial fluid effect model to obtain the target fluid effect. On one hand, acquiring a group of lines in three-dimensional space, rotating and twisting the group to obtain target lines, generating columnar lines based on the target lines, and obtaining the initial fluid effect model from the columnar lines simplifies the fluid effect model generation process and improves the efficiency of fluid effect model generation. On the other hand, after generating the initial fluid effect model, obtaining the target fluid effect based on the initial fluid effect model further improves the efficiency of fluid effect generation.
[0055] The following provides a detailed explanation and description of each step involved in the fluid effects generation method of the exemplary embodiments of this disclosure.
[0056] First, the application scenarios and purposes of the exemplary embodiments of this disclosure will be explained and described. Specifically, the exemplary embodiments of this disclosure can be used to simulate fluid effects. The main focus is on how to improve the efficiency of fluid effect generation.
[0057] In this disclosure, based on the obtained line group, after obtaining the line group in three-dimensional space, the line group is rotated, twisted and deformed along a specified direction to obtain the target line. Based on the target line, a columnar line with width is generated. An initial fluid effect model is obtained through the columnar line with width. Finally, the initial fluid effect model is rendered to obtain the target fluid effect.
[0058] Next, steps S110-S140 will be further explained and described.
[0059] In step S110, a line group in three-dimensional space is obtained, the line group comprising multiple lines arranged along a specified direction.
[0060] In this example embodiment, the specified direction can be a vertical direction or a horizontal direction in three-dimensional space. In this example embodiment, the specified direction is not specifically limited. The line group in three-dimensional space is perpendicular to the cross-section of the specified direction. In this example embodiment, the line density per unit area in three-dimensional space is not specifically limited.
[0061] In this example embodiment, before acquiring the line group in three-dimensional space, the fluid effect generation method further includes:
[0062] Random points are generated in the three-dimensional space;
[0063] Multiple preset lines are obtained, and a relationship is established between each preset line and any point in the random points. Based on the multiple preset lines, the random points, and the relationship, the line group is obtained.
[0064] Specifically, firstly, several random points are generated in three-dimensional space; then, multiple preset lines are acquired, and a relationship is established between each preset line and any random point, i.e., each preset line corresponds one-to-one with each random point; finally, a line group is obtained based on the multiple preset lines, random points, and the relationship between the preset lines and random points. The number of generated random points is greater than or equal to the number of preset lines. In this example embodiment, the number of random points and preset lines is not specifically limited. The preset lines can be pre-generated lines, and their length can be 20 or 15. In this example embodiment, the length of the preset lines is not specifically limited.
[0065] Further reference Figure 2 As shown, generating random points in three-dimensional space can include:
[0066] Step S210. Generate a circular model, and generate a first random point in the circular model;
[0067] Step S220. Randomly jitter the first random point along the specified direction to obtain a random point in the three-dimensional space.
[0068] The following will further explain and illustrate steps S210 and S220. Specifically, firstly, a circular model is generated in three-dimensional space. The thickness of this circular model is negligible. Within this circular model, several first random points can be generated. These first random points can be evenly distributed within the circular model or unevenly distributed. After generating the several first random points, these points are randomly jittered along a specified direction in three-dimensional space. That is, the several first random points are randomly jittered and displaced in a specified direction to obtain random points in three-dimensional space.
[0069] For example, the generated circular model can be referenced. Figure 3 As shown, in Figure 3 When the first random point generated in the circular model is uniformly distributed, refer to Figure 4 As shown, after the first random point undergoes random jitter displacement along a specified direction, the generated random point in three-dimensional space can be referenced. Figure 5 As shown.
[0070] In this example embodiment, after obtaining a random point located in three-dimensional space, referencing Figure 6 As shown, multiple preset lines are obtained, and a relationship is established between each preset line and any point among the random points. Based on the multiple preset lines, the random points, and the relationship, the line group is obtained, which may include:
[0071] Step S610. Obtain the scaling attribute of the random point;
[0072] Step S620. Copy the preset lines to the random points respectively, and use the random points as the starting points of the preset lines to obtain the association relationship;
[0073] Step S630. Based on the scaling attribute of the random point, scale the preset lines that are related to the random point to obtain the line group.
[0074] The following will further explain and illustrate steps S610-S630. Specifically, after obtaining random points in three-dimensional space, preset lines can be acquired. The number of preset lines can be the same as or less than the number of random points. In this example embodiment, the number of preset lines and the number of random points are not specifically limited. Then, the scaling attribute pscale of the random points is acquired. The preset lines are copied to the random points, and the random points are used as the starting points of the preset lines to obtain the association between the preset lines and the random points. The preset lines associated with the random points are scaled according to the scaling attribute of the random points to obtain a line group. The scaling attribute value of each random point can be a random value between 0.5 and 1, or a random value between 0 and 0.5. In this example embodiment, the scaling attribute value is not specifically limited.
[0075] In step S120, the lines in the line group are rotated, twisted, and deformed along the specified direction to obtain the target lines.
[0076] In this example embodiment, after obtaining the line group, the lines included in the line group can be deformed by rotating and twisting the lines in the line group along the specified direction to obtain the target line. This can include:
[0077] Based on the specified direction, each line in the line group is rotated, twisted, and deformed to obtain the first deformed line group;
[0078] The target line is obtained by linearly deforming each line in the first deformed line group.
[0079] Specifically, after obtaining the line group, each line in the line group is rotated, twisted, and deformed based on the specified direction of each line in the line group to obtain the first deformed line group; after obtaining the first deformed line group, each line in the first deformed line group is linearly deformed to obtain the target line.
[0080] Further reference Figure 7 As shown, based on the specified direction, each line in the line group is rotated, twisted, and deformed to obtain a first deformed line group, which may include:
[0081] Step S710. Based on the specified direction, rotate and twist each line in the line group to obtain a twisted line group;
[0082] Step S720. Obtain the bounding mesh of the twisted line group, drag the vertices of the bounding mesh to control the deformation of the bounding mesh;
[0083] Step S730. By deforming the surrounding grid, the twisted line group is driven to deform, thus obtaining the first deformed line group.
[0084] The following will further explain and illustrate steps S710-S730. Specifically, when deforming the line group, firstly, the specified direction of each line in the line group is obtained. Based on the specified direction of each line, each line is twisted. After twisting all lines in the line group, a twisted line group is obtained. Then, the bounding mesh of the twisted line group and the vertices included in the bounding mesh are obtained. The vertices of the bounding mesh of the twisted line group are dragged to control the deformation of the bounding mesh. When the bounding mesh of the deformed line group is deformed, the twisted line group is driven to deform, resulting in the first deformed line group. When dragging the vertices of the bounding mesh of the twisted line group, the bottom vertices of the bounding mesh can be dragged to enlarge the bottom of the bounding mesh, or the top vertices of the bounding mesh can be dragged to enlarge the bounding mesh. This example embodiment does not specifically limit this.
[0085] For example, copying preset lines to random points will create a set of lines that can be used as a reference. Figure 8 As shown in (a), each line in the line group is rotated and twisted to obtain a twisted line group, which can be referenced. Figure 8 As shown in (b), after obtaining the twisted line group, drag the vertices of the surrounding mesh of the twisted line group to control the deformation of the surrounding mesh, thus causing the twisted line group to deform. When dragging the bottom vertex of the surrounding mesh to cause the twisted line group to deform, the resulting first deformed line group can be referenced. Figure 8 As shown in (c) in the figure.
[0086] Once the first set of deformed lines is obtained, linear deformation can be applied to this first set of deformed lines to obtain the target lines. (Refer to...) Figure 9 As shown, linear deformation is applied to each line in the first deformed line group to obtain the target line, which may include:
[0087] Step S910. Obtain the vertex of each line in the first deformed line group and the width attribute of each vertex;
[0088] Step S920. Obtain a custom deformation value. Based on the custom deformation value, perform linear deformation on each line by pulling a curve to obtain a deformed line.
[0089] Step S930. Map each line to the deformed line to obtain the target line.
[0090] The following will further explain and illustrate steps S910-S930. Specifically, when performing linear deformation on each line in the first deformable line group, firstly, each line included in the first deformable line group is obtained. Each line is composed of vertices, therefore, the vertices included in each line and the width attribute of each vertex can also be obtained. For each line, the number of vertices included in the line can be defined during generation. The longer the line, the more vertices it includes. In this example embodiment, the number of vertices included in the line is not specifically limited. The vertices in each line are arranged sequentially. The width attribute of each vertex can be mapped between 0 and 1 according to the vertex number. During mapping, the width attribute of each vertex can be obtained based on the vertex number / (total number of vertices - 1). After mapping the width attribute of the vertices, a custom deformation value can be obtained. Based on the custom deformation value, each line is linearly deformed by pulling curves to obtain deformed lines. After obtaining the deformed lines, each line can be mapped to its corresponding deformed line to obtain the target line and the target width attribute of each vertex in the target line. In this example embodiment, after mapping the lines to their corresponding deformed lines, the custom deformation value of each vertex in the deformed line is the value of the target width attribute of each vertex in the target line.
[0091] In step S130, a columnar line with width is generated based on the target line, and an initial fluid effect model is obtained through the columnar line with width.
[0092] In this example embodiment, after obtaining the target line, its width can be widened to generate a columnar line with width. The width of the widened target line is not specifically limited. After generating the columnar line with width, the width at different positions of the columnar line can be the same or different. In this example embodiment, the width at different positions of the columnar line is not specifically limited. (Reference) Figure 10 As shown, generating a columnar line with a width based on the target line may include:
[0093] Step S1010. Obtain the target width attribute of each vertex included in the target line;
[0094] Step S1020. Set the target width according to the target width attribute, and based on the target width, widen the target line into a columnar line with width.
[0095] The following will further explain and illustrate steps S1010 and S1020. Specifically, first, the value of the target width attribute of each vertex in the target line is obtained. Then, the target width is set for each vertex according to the value of the target width attribute. Based on the target width set for each vertex, the target line is expanded to widen it into a columnar line with width.
[0096] In this example embodiment, reference Figure 11 As shown, after widening the target line into a columnar line with width, the fluid effect generation method can also include:
[0097] Step S1110. Obtain the first sphere model and copy the first sphere model to the end of the target line;
[0098] Step S1120. Merge the target line, the first sphere model, and the columnar line with width corresponding to the target line to obtain the columnar model corresponding to the target line.
[0099] The following will further explain and illustrate steps S1110 and S1120. Specifically, after linearly deforming the lines in the first deformable line group to obtain the target line, a first sphere model can be obtained and copied to the end of the target line. Then, the target line, the first sphere model, and the corresponding columnar lines with width are merged to obtain a columnar model corresponding to the target line. The first sphere model can be a sphere or an ellipsoid; in this example embodiment, the first sphere model is not specifically limited.
[0100] After obtaining the columnar model, an initial fluid effect model can be derived from it, as shown in the reference. Figure 12 As shown, the initial fluid effect model obtained through the columnar lines with width can include:
[0101] Step S1210. Obtain the vertices included in the columnar model, add noise to the vertices included in the columnar model, and obtain the first fluid effect model;
[0102] Step S1220. Randomly distribute vertices on the surface of the first fluid effect model, obtain and copy the second sphere model to the randomly distributed vertices on the surface of the first fluid effect model;
[0103] Step S1230. Perform Boolean calculations on the second sphere model and the first fluid effect model to obtain the initial fluid effect model.
[0104] The following will further explain and illustrate steps S1210-S1230. Specifically, firstly, the vertices included in the columnar model are obtained. The surface of the columnar model is composed of multiple object primitives, which can be geometric surfaces. Vertices in the model are points where two or more edges intersect. Therefore, the vertices in the columnar model can be referenced... Figure 13 As shown; noise is added to the vertices included in the columnar model, that is, a certain displacement is generated in space to produce the columnar model, resulting in the first fluid effect model. The generated first fluid effect model is referenced. Figure 14 As shown. After obtaining the first fluid effect model, some vertices can be randomly distributed on the surface of the first fluid effect model. Then, a second sphere model is obtained, copied to the randomly distributed vertices on the surface of the first fluid effect model, and Boolean calculations are performed on the second sphere model and the first fluid effect model. That is, the overlapping part of the second sphere model is removed from the first fluid effect model to obtain the initial fluid effect model. The second sphere model can be a sphere or an ellipsoid; in this example embodiment, the second sphere model is not specifically limited.
[0105] In step S140, the initial fluid effect model is rendered to obtain the target fluid effect.
[0106] In this example embodiment, rendering the initial fluid effect model to obtain the target fluid effect may include:
[0107] Obtain the initial model mesh data corresponding to the initial fluid effect model, and perform data transformation on the initial model mesh data to obtain the target model mesh data;
[0108] The target fluid effect model is obtained by using the target model mesh data, and the target fluid effect model is rendered to obtain the target fluid effect.
[0109] Specifically, after obtaining the initial fluid effect model, since the initial model mesh data corresponding to the initial fluid effect model is disordered model data, the initial model mesh data can be transformed to obtain the target model mesh data; after obtaining the target model mesh data, the target fluid effect model can be obtained from the target model mesh data, and the target fluid effect model can be rendered to obtain the final German and Austrian target fluid effect.
[0110] Further reference Figure 15 As shown, data transformation of the initial model mesh data to obtain the target model mesh data can include:
[0111] Step S1510. Convert the initial model mesh data into volumetric data;
[0112] Step S1520. Smooth the volume data, convert the smoothed volume data into grid data, and obtain the target model grid data through the grid data.
[0113] The following will further explain and illustrate steps S1510 and S1520. Specifically, firstly, the initial model mesh data corresponding to the initial fluid effect model is obtained. This initial model mesh data is then converted into volumetric data. Volumetric data describes smoke, fire, gas, fluid, and other data in 3D software that is difficult to express using a model mesh. If a photograph is composed of individual pixels, then the volumetric data is composed of individual voxels. Ordinary model mesh data is hollow, containing only surface vertices and faces, with mesh data typically carried on the vertices. Volumetric data, however, is solid, with data carried on each voxel. Currently, the most commonly used volumetric data format is .vdb. After converting the initial model mesh data into volumetric data, the volumetric data is smoothed, and then converted back into mesh data, thereby eliminating surface imperfections and making the mesh smooth without internal overlap. The target model mesh data is obtained through the mesh data. In this example embodiment, the computational load for generating fluid effects is reduced through 3D model transformation, improving the efficiency of fluid effect generation.
[0114] In this example embodiment, obtaining the target fluid effect model using the target model mesh data may include:
[0115] Obtain the clipping value of the target line;
[0116] The clipping value is controlled to change over time, and the target fluid effect model is obtained based on the changing clipping value and the target model mesh data; wherein, the clipping value is used to control the length change of the target lines.
[0117] Specifically, after obtaining the target model mesh data, the clipping value of the target lines can be acquired. This clipping value controls the length of the target lines and the associated columnar models, and it can change continuously over time. Based on the changes in the clipping value and the target model mesh data, a target fluid effect model is obtained. This model presents a fluid flow effect that changes over time. For example, refer to... Figure 16 As shown, when the clipping value carve takes different values, the corresponding target fluid effect model is also different.
[0118] Further, refer to Figure 17 As shown, after obtaining the target fluid effect model, the target fluid effect model is rendered to obtain the target fluid effect, which may include:
[0119] Step S1710. Random vertices are distributed on the surface of the target fluid effect model, the normal direction of the random vertices distributed on the surface of the target fluid effect model is obtained, and the random vertices are controlled to randomly offset along the normal direction;
[0120] Step S1720. Obtain the third sphere model, copy the third sphere model to the offset random vertex, and generate the fluid bead effect on the surface of the target fluid effect model;
[0121] Step S1730. Obtain and assign a first material corresponding to the target fluid effect model, obtain and assign a second material corresponding to the fluid bead effect, render the first material and the second material to obtain the target fluid effect.
[0122] The following will further explain and illustrate steps S1710-S1730. Specifically, after obtaining the target fluid effect model, random vertices can be distributed on the surface of the target fluid effect model, and the normal direction of the random vertices distributed on the surface of the target fluid effect model can be obtained. The random vertices are controlled to randomly offset along the normal direction. In this example embodiment, the offset distance is not specifically limited. After offsetting the random vertices, a third sphere model is obtained and copied to the offset random vertices to generate the fluid bead effect on the surface of the target fluid effect model. The third sphere model can be a sphere model or an ellipsoid model. In this example embodiment, the third sphere model is not specifically limited; the fluid beads can be water droplets. In this example embodiment, the fluid beads are not specifically limited; the fluid bead effect generated on the surface of the target fluid effect model can refer to... Figure 18 As shown. After generating the fluid bead effect on the surface of the target fluid effect model, a first material corresponding to the target fluid effect model and a second material corresponding to the fluid bead effect can be obtained. The first material is assigned to the target fluid effect model, and the second material is assigned to the fluid bead effect. Finally, the first material and the second material are rendered to obtain the target fluid effect.
[0123] The fluid effect generation method provided in the exemplary embodiments of this disclosure has at least the following advantages: On the one hand, it obtains a group of lines in three-dimensional space, rotates and twists the group of lines to obtain target lines, generates columnar lines based on the target lines, and obtains an initial fluid effect model based on the columnar lines. The generation of the initial fluid effect model from the group of lines simplifies the process of generating fluid effect models and improves the efficiency of generating fluid effect models. On the other hand, after generating the initial fluid effect model, the target fluid effect is obtained based on the initial fluid effect model, which improves the efficiency of generating fluid effect models.
[0124] This disclosure also provides an example embodiment of a fluid effects generation device, referencing... Figure 19 As shown, it may include: a line group acquisition module 1910, a line deformation module 1920, a fluid effect model generation module 1930, and a fluid effect generation module 1940. Among them:
[0125] The line group acquisition module 1910 is used to acquire line groups in three-dimensional space, wherein the line group includes multiple lines arranged along a specified direction.
[0126] The line deformation module 1920 is used to rotate and twist the lines in the line group along the specified direction to obtain the target line.
[0127] The fluid effect model generation module 1930 is used to generate a columnar line with width based on the target line, and to obtain an initial fluid effect model through the columnar line with width.
[0128] The fluid effects generation module 1940 is used to render the initial fluid effects model to obtain the target fluid effects.
[0129] The specific details of each module in the aforementioned fluid effects generation device have been described in detail in the corresponding fluid effects generation method, so they will not be repeated here.
[0130] In one exemplary embodiment of this disclosure, before acquiring a group of lines in three-dimensional space, the method includes:
[0131] Random points are generated in the three-dimensional space;
[0132] Obtain multiple preset lines, establish the association relationship between each preset line and any point in the random points, and obtain the line group based on the multiple preset lines, the random points, and the association relationship.
[0133] In one exemplary embodiment of this disclosure, generating random points in the three-dimensional space includes:
[0134] Generate a circular model, and generate a first random point in the circular model;
[0135] The first random point is randomly jittered along the specified direction to obtain a random point in the three-dimensional space.
[0136] In one exemplary embodiment of this disclosure, multiple preset lines are obtained, an association relationship is established between each preset line and any point among the random points, and the line group is obtained based on the multiple preset lines, the random points, and the association relationship, including:
[0137] Obtain the scaling attribute of the random point;
[0138] The preset lines are copied to the random points respectively, and the random points are used as the starting points of the preset lines to obtain the association relationship;
[0139] Based on the scaling attribute of the random point, the preset lines associated with the random point are scaled to obtain the line group.
[0140] In one exemplary embodiment of this disclosure, rotating and twisting the lines in the line group along the specified direction to obtain the target line includes:
[0141] Based on the specified direction, each line in the line group is rotated, twisted, and deformed to obtain the first deformed line group;
[0142] The target line is obtained by linearly deforming each line in the first deformed line group.
[0143] In one exemplary embodiment of this disclosure, each line in the line group is rotated and twisted based on the specified direction to obtain a first deformed line group, including:
[0144] Based on the specified direction, each line in the line group is rotated and twisted to obtain a twisted line group;
[0145] Obtain the bounding mesh of the twisted line group, drag the vertices of the bounding mesh to control the deformation of the bounding mesh;
[0146] The deformation of the surrounding grid causes the twisted line group to deform, resulting in the first deformed line group.
[0147] In one exemplary embodiment of this disclosure, linear deformation is performed on each line in the first deformable line group to obtain the target line, including:
[0148] Obtain the vertex of each line in the first deformed line group and the width attribute of each vertex;
[0149] Obtain a custom deformation value, and based on the custom deformation value, perform linear deformation on each line by pulling a curve to obtain a deformed line;
[0150] Each line is mapped onto the deformed line to obtain the target line.
[0151] In one exemplary embodiment of this disclosure, generating a columnar line with a width based on the target line includes:
[0152] Obtain the target width attribute of each vertex included in the target line;
[0153] Set the target width according to the target width attribute, and based on the target width, widen the target line into a columnar line with width.
[0154] In one exemplary embodiment of this disclosure, after widening the target line into a columnar line with width, the fluid effect generation method further includes:
[0155] Obtain the first sphere model and copy the first sphere model to the end of the target line;
[0156] The target line, the first sphere model, and the columnar line with width corresponding to the target line are merged to obtain the columnar model corresponding to the target line.
[0157] In one exemplary embodiment of this disclosure, obtaining an initial fluid effect model through the columnar lines with width includes:
[0158] Obtain the vertices included in the columnar model, add noise to the vertices included in the columnar model, and obtain the first fluid effect model;
[0159] Randomly distribute vertices on the surface of the first fluid effect model, and obtain and copy the second sphere model onto the randomly distributed vertices on the surface of the first fluid effect model;
[0160] Boolean calculations are performed on the second sphere model and the first fluid effect model to obtain the initial fluid effect model.
[0161] In one exemplary embodiment of this disclosure, rendering the initial fluid effect model to obtain the target fluid effect includes:
[0162] Obtain the initial model mesh data corresponding to the initial fluid effect model, and perform data transformation on the initial model mesh data to obtain the target model mesh data;
[0163] The target fluid effect model is obtained by using the target model mesh data, and the target fluid effect model is rendered to obtain the target fluid effect.
[0164] In one exemplary embodiment of this disclosure, data transformation is performed on the initial model mesh data to obtain target model mesh data, including:
[0165] Convert the initial model mesh data into volumetric data;
[0166] The volume data is smoothed, and the smoothed volume data is converted into grid data. The target model grid data is obtained through the grid data.
[0167] In one exemplary embodiment of this disclosure, a target fluid effect model is obtained using the target model mesh data, including:
[0168] Obtain the clipping value of the target line;
[0169] The clipping value is controlled to change over time, and the target fluid effect model is obtained based on the changing clipping value and the target model mesh data; wherein, the clipping value is used to control the length change of the target lines.
[0170] In one exemplary embodiment of this disclosure, rendering the target fluid effect model to obtain the target fluid effect includes:
[0171] Random vertices are distributed on the surface of the target fluid effect model. The normal direction of the random vertices distributed on the surface of the target fluid effect model is obtained, and the random vertices are controlled to randomly offset along the normal direction.
[0172] Obtain the third sphere model, copy the third sphere model to the offset random vertex, and generate the fluid bead effect on the surface of the target fluid effect model;
[0173] Obtain and assign a first material corresponding to the target fluid effect model, obtain and assign a second material corresponding to the fluid bead effect, and render the first material and the second material to obtain the target fluid effect.
[0174] It should be noted that although several modules or units of the device for performing actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of the present invention, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0175] Furthermore, although the steps of the method in this invention are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in that specific order, or that all the steps shown must be performed to achieve the desired result. Additional or alternative steps may be omitted, multiple steps may be combined into one step, and / or a step may be broken down into multiple steps.
[0176] In an exemplary embodiment of the present invention, an electronic device capable of implementing the above-described method is also provided.
[0177] Those skilled in the art will understand that various aspects of the present invention can be implemented as systems, methods, or program products. Therefore, various aspects of the present invention can be specifically implemented in the following forms: entirely in hardware, entirely in software (including firmware, microcode, etc.), or in a combination of hardware and software, collectively referred to herein as “circuit,” “module,” or “system.”
[0178] The following reference Figure 20 To describe an electronic device 2000 according to this embodiment of the present invention. Figure 20 The electronic device 2000 shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.
[0179] like Figure 20 As shown, the electronic device 2000 is manifested in the form of a general-purpose computing device. The components of the electronic device 2000 may include, but are not limited to: at least one processing unit 2010, at least one storage unit 2020, a bus 2030 connecting different system components (including storage unit 2020 and processing unit 2010), and a display unit 2040.
[0180] The storage unit stores program code that can be executed by the processing unit 2010, causing the processing unit 2010 to perform the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of the present invention. For example, the processing unit 2010 can perform, as follows: Figure 1 The steps shown are as follows: S110: Obtain a line group in three-dimensional space, the line group including multiple lines arranged along a specified direction; S120: Rotate and twist the lines in the line group along the specified direction to obtain the target line; S130: Generate a columnar line with width based on the target line, and obtain an initial fluid effect model through the columnar line with width; S140: Render the initial fluid effect model to obtain the target fluid effect.
[0181] Storage unit 2020 may include readable media in the form of volatile storage units, such as random access memory (RAM) 20201 and / or cache memory 20202, and may further include read-only memory (ROM) 20203.
[0182] The storage unit 2020 may also include a program / utility 20204 having a set (at least one) program module 20205, such program module 20205 including but not limited to: an operating system, one or more applications, other program modules, and program data, each or some combination of these examples may include an implementation of a network environment.
[0183] Bus 2030 can represent one or more of several types of bus structures, including memory cell bus or memory cell controller, peripheral bus, graphics acceleration port, processing unit, or local bus using any of the multiple bus structures.
[0184] Electronic device 2000 can also communicate with one or more external devices 2100 (e.g., keyboard, pointing device, Bluetooth device, etc.), and with one or more devices that enable a user to interact with electronic device 2000, and / or with any device that enables electronic device 2000 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 2050. Furthermore, electronic device 2000 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 2060. As shown, network adapter 2060 communicates with other modules of electronic device 2000 via bus 2030. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 2000, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID (Redundant Arrays of Independent Disks) systems, tape drives, and data backup storage systems.
[0185] Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, portable hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the method according to the embodiments of the present invention.
[0186] In exemplary embodiments of the present invention, a computer-readable storage medium is also provided, on which a program product capable of implementing the methods described above is stored. In some possible embodiments, various aspects of the present invention may also be implemented as a program product comprising program code that, when the program product is run on a terminal device, causes the terminal device to perform the steps of the various exemplary embodiments of the present invention described in the "Exemplary Methods" section above.
[0187] According to embodiments of the present invention, a program product for implementing the above-described method may employ a portable compact disc read-only memory (CD-ROM) and include program code, and may run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, a readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.
[0188] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0189] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting programs for use by or in conjunction with an instruction execution system, apparatus, or device.
[0190] The program code contained on the readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF (Radio Frequency), etc., or any suitable combination thereof.
[0191] Program code for performing the operations of this invention can be written in any combination of one or more programming languages, including object-oriented programming languages such as Java and C++, and conventional procedural programming languages such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0192] Furthermore, the above figures are merely illustrative of the processes included in the method according to exemplary embodiments of the present invention, and are not intended to be limiting. It is readily understood that the processes shown in the above figures do not indicate or limit the temporal order of these processes. Additionally, it is readily understood that these processes may be executed synchronously or asynchronously, for example, in multiple modules.
[0193] Other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention described herein. This application is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not invented herein. The specification and embodiments are to be considered exemplary only, and the true scope and spirit of the invention are indicated by the claims.
Claims
1. A method of fluid special effect generation, characterized by, The method comprises the following steps: generating random points in a three-dimensional space; obtaining a plurality of preset lines, establishing an association relationship between each of the plurality of preset lines and any of the random points, and obtaining a line group based on the plurality of preset lines, the random points and the association relationship; obtaining the line group, which comprises a plurality of lines arranged in a specified direction; based on the specified direction, each line in the line group is subjected to rotational distortion deformation to obtain a first deformed line group; each line in the first deformed line group is subjected to linear deformation to obtain a target line; a target width attribute of each vertex included in the target line; setting a target width according to the target width attribute, and widening the target line into a columnar line with a width based on the target width; obtaining a first sphere model, copying the first sphere model to the end of the target line, and merging the target line, the first sphere model and the columnar line with a width corresponding to the target line to obtain a columnar model corresponding to the target line; obtaining the vertex included in the columnar model, adding noise to the vertex included in the columnar model to obtain a first fluid special effect model; randomly distributing vertices on the surface of the first fluid special effect model, obtaining and copying a second sphere model to the randomly distributed vertices on the surface of the first fluid special effect model; performing Boolean calculation on the second sphere model and the first fluid special effect model to obtain an initial fluid special effect model; obtaining initial model mesh data corresponding to the initial fluid special effect model, performing data conversion on the initial model mesh data to obtain target model mesh data; obtaining a target fluid special effect model through the target model mesh data, and rendering the target fluid special effect model to obtain the target fluid special effect.
2. The fluid special effect generation method of claim 1, wherein, The method comprises the following steps: generating random points in a three-dimensional space, comprising: generating a circular model and generating a first random point in the circular model; 3. The fluid special effect generation method of claim 1, wherein, randomly shaking the first random point in the specified direction to obtain random points in the three-dimensional space. obtaining a plurality of preset lines, establishing an association relationship between each of the plurality of preset lines and any of the random points, and obtaining the line group based on the plurality of preset lines, the random points and the association relationship, comprising: obtaining the scaling attribute of the random point; copying the preset lines to the random points respectively, taking the random points as the starting points of the preset lines to obtain the association relationship; 4. The fluid special effect generation method of claim 1, wherein, scaling the preset lines associated with the random points according to the scaling attribute of the random point to obtain the line group. based on the specified direction, each line in the line group is subjected to rotational distortion deformation to obtain a first deformed line group, comprising: based on the specified direction, each line in the line group is subjected to rotational distortion to obtain a twisted line group; obtaining the bounding box of the twisted line group, dragging the vertices of the bounding box to control the deformation of the bounding box; The first deformed line group is obtained by deforming the surrounding grid and driving the twist line group to deform.
5. The fluid special effect generation method of claim 4, wherein, Each line in the first deformed line group is linearly deformed to obtain the target line, including: Obtaining the vertex of each line in the first deformed line group and the width attribute of each vertex; Obtaining a custom deformation value, and linearly deforming each line by a pull curve according to the custom deformation value to obtain a deformed line; Mapping each line to the deformed line to obtain the target line.
6. The fluid special effect generation method of claim 1, wherein, The target model grid data is obtained by data conversion of the initial model grid data, including: Converting the initial model grid data into volume data; Smoothing the volume data and converting the smoothed volume data into grid data to obtain the target model grid data through the grid data.
7. The fluid special effect generation method of claim 6, wherein, The target fluid special effect model is obtained through the target model grid data, including: Obtaining a clipping value of the target line; Controlling the clipping value to change over time, and obtaining the target fluid special effect model based on the changed clipping value and the target model grid data; wherein the clipping value is used to control the length change of the target line.
8. The fluid special effect generation method of claim 7, wherein, The target fluid special effect is obtained by rendering the target fluid special effect model, including: Distributing random vertices on the surface of the target fluid special effect model, obtaining the normal direction of the random vertices distributed on the surface of the target fluid special effect model, and controlling the random vertices to randomly offset along the normal direction; Obtaining a third sphere model, copying the third sphere model to the offset random vertices to generate a fluid bead special effect on the surface of the target fluid special effect model; Obtaining and assigning a first material corresponding to the target fluid special effect model, obtaining and assigning a second material corresponding to the fluid bead special effect, and rendering the first material and the second material to obtain the target fluid special effect.
9. A fluid special effect generating device, characterized in that Including: A line group acquisition module is configured to generate random points in a three-dimensional space; A plurality of preset lines are obtained, an association between each preset line in the plurality of preset lines and any point in the random points is established, and a line group is obtained based on the plurality of preset lines, the random points, and the association; the line group includes a plurality of lines arranged in a specified direction; A line deformation module is configured to rotate and twist deform each line in the line group based on the specified direction to obtain a first deformed line group, and linearly deform each line in the first deformed line group to obtain a target line; A fluid special effect model generation module is configured to set a target width based on a target width attribute of each vertex included in the target line, and widen the target line into a columnar line with a width based on the target width; A first sphere model is obtained, and the first sphere model is copied to the end of the target line; the target line, the first sphere model, and the columnar line with a width corresponding to the target line are merged to obtain a columnar model corresponding to the target line. acquire vertices included in the columnar model, add noise to the vertices included in the columnar model to obtain a first fluid special effect model; randomly distribute vertices on a surface of the first fluid special effect model, acquire and copy a second sphere model to the randomly distributed vertices on the surface of the first fluid special effect model; perform a Boolean calculation on the second sphere model and the first fluid special effect model to obtain an initial fluid special effect model; a fluid special effect generation module, configured to acquire initial model mesh data corresponding to the initial fluid special effect model, perform data conversion on the initial model mesh data to obtain target model mesh data, obtain a target fluid special effect model through the target model mesh data, and render the target fluid special effect model to obtain the target fluid special effect.
10. A computer storage medium having stored thereon a computer program, characterized in that The computer program, when executed by a processing unit, implements the fluid special effect generation method of any one of claims 1-8.
11. An electronic device, comprising: comprise: a processing unit; and a storage unit configured to store executable instructions of the processing unit; wherein the processing unit is configured to implement the fluid special effect generation method of any one of claims 1-8 by executing the executable instructions.
Citation Information
Patent Citations
Particle special effect rendering method, device and equipment and storage medium
CN112652044A
Model generation method and device and electronic equipment
CN114663555A