Rendering methods, devices, and electronic equipment for virtual assets
By generating virtual assets through partial cropping of particle animation and sampling vertex coordinate data in the animation curve texture map, the problem of limited performance in virtual asset rendering is solved, and the rendering effect of high-precision long-duration animation resources is achieved.
Patent Information
- Application Number
- CN202411942866.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-11-14
- Estimated Expiration
- 2044-12-25
AI Technical Summary
With limitations in the performance of virtual asset deployment, existing technologies often result in low precision and poor deployment of long-duration animation resources, particularly on terminal devices.
Virtual assets, including mesh models and vertex animation texture maps, are generated by performing partial cropping operations on particle animation. Vertex coordinate data is sampled from the curve texture map corresponding to the animation curve, so that the dynamic model moves cyclically along the animation curve to form the animation to be rendered.
Without reducing the precision of virtual assets, the package size of virtual assets was optimized, the performance consumption during rendering was reduced, and high-precision rendering effects for long-duration animation resources were achieved.
Smart Images

Figure CN119868931B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and more particularly to a method, apparatus, electronic device, and computer-readable storage medium for rendering virtual assets. Background Technology
[0002] Virtual assets can enhance the visual appeal of virtual applications such as games, and high-precision virtual assets can provide users with an immersive experience.
[0003] Currently, VAT (Vertex Animation Textures) technology is an efficient way to create virtual assets with complex physical dynamics, such as liquids. VAT technology stores the position information of each vertex of the model in the form of texture maps, reducing the size of the virtual resource package and the performance overhead of rendering. However, for some animation resources with a long overall duration, there is often a trade-off between the rendering performance and the accuracy of the virtual asset. Usually, in order to optimize the rendering performance, the accuracy of the virtual asset can only be reduced, but this will undoubtedly affect the final rendering effect and bring a poor user experience.
[0004] Therefore, existing technologies suffer from limitations in the landing performance of virtual assets, resulting in low precision of virtual resources corresponding to long-duration animation resources and poor landing effects. Summary of the Invention
[0005] This application provides a rendering method, apparatus, electronic device, and computer-readable storage medium for virtual assets, in order to solve the technical problems existing in the prior art where the rendering performance of virtual assets is limited, resulting in low precision of virtual resources corresponding to long-duration animation resources and poor rendering effects.
[0006] In a first aspect, embodiments of this application provide a rendering method for virtual assets. The method includes: acquiring a virtual asset and a curve texture map corresponding to an animation curve; wherein the virtual asset is generated based on a local cropping operation of particle animation, including a mesh model and a vertex animation texture map, the animation curve is pre-constructed based on the animation to be rendered, and the curve texture map stores curve information corresponding to each point on the animation curve, the curve information including at least the coordinate data of each point on the animation curve; rendering a dynamic model corresponding to the virtual asset based on the mesh model and vertex animation texture map included in the virtual asset, and controlling the dynamic model to deform along the animation curve; determining the corresponding point of each vertex of the dynamic model on the animation curve at each time point, and collecting the coordinate data of the corresponding point in the curve texture map; at each time point, changing the position of each vertex of the dynamic model based on the coordinate data corresponding to each vertex of the dynamic model at the time point, forming an animation to be rendered in which the dynamic model moves cyclically along the animation curve.
[0007] Secondly, embodiments of this application provide a rendering apparatus for virtual assets, the apparatus comprising: an acquisition unit, a deformation unit, a collection unit, and a rendering unit; the acquisition unit is used to acquire virtual assets and curve texture maps corresponding to animation curves; wherein, the virtual assets are generated based on local cropping operations of particle animation, including a mesh model and vertex animation texture maps, the animation curve is pre-constructed based on the animation to be rendered, and the curve texture map stores curve information corresponding to each point on the animation curve, the curve information including at least the coordinate data of each point on the animation curve; the deformation unit is used to render a dynamic model corresponding to the virtual asset based on the mesh model and vertex animation texture maps included in the virtual asset, and control the dynamic model to deform along the animation curve; the collection unit is used to determine the corresponding points of each vertex of the dynamic model on the animation curve at each time point, and collect the coordinate data of the corresponding points in the curve texture map; the rendering unit is used to change the position of each vertex of the dynamic model at each time point based on the coordinate data corresponding to each vertex of the dynamic model at the time point, forming an animation to be rendered in which the dynamic model moves cyclically along the animation curve.
[0008] Thirdly, embodiments of this application provide an electronic device, including: a memory and a processor; the memory is used to store one or more computer instructions; the processor is used to execute the one or more computer instructions to implement the above method.
[0009] Fourthly, embodiments of this application provide a computer-readable storage medium storing one or more computer instructions that, when executed by a processor, perform the above-described method.
[0010] Compared with existing technologies, the virtual asset rendering method provided in this application includes: acquiring virtual assets and curve texture maps corresponding to animation curves; wherein, the virtual assets are generated based on local cropping operations of particle animation, including mesh models and vertex animation texture maps, the animation curves are pre-constructed based on the animation to be rendered, and the curve texture maps store curve information corresponding to each point on the animation curve, the curve information including at least the coordinate data of each point on the animation curve; rendering the dynamic model corresponding to the virtual assets based on the mesh model and vertex animation texture maps included in the virtual assets, and controlling the deformation of the dynamic model along the animation curve; determining the corresponding points of each vertex of the dynamic model on the animation curve at each time point, and collecting the coordinate data of the corresponding points in the curve texture maps; at each time point, changing the position of each vertex of the dynamic model based on the coordinate data corresponding to each vertex of the dynamic model at the time point, forming the animation to be rendered where the dynamic model moves cyclically along the animation curve. First, this method generates virtual assets by performing local cropping operations on particle animation. That is, this method reduces the size of the virtual asset package and optimizes the landing performance of virtual assets by cropping local areas, while maintaining the high precision of the virtual assets. This method does not require reducing the precision of virtual assets by lowering mesh model accuracy, face count, or vertex texture map resolution to optimize rendering performance. In other words, the precision of virtual assets generated by this method remains intact, avoiding poor rendering results. Second, this method obtains an animation curve pre-constructed based on the animation to be rendered and samples the coordinate data of each vertex of the dynamic model (obtained from virtual asset rendering) at each time point in the curve texture map corresponding to the animation curve. This allows the dynamic model to move cyclically along the animation curve, forming the animation to be rendered. That is, this method uses animation curves to create long-duration animation resources based on small-package virtual assets. Therefore, the virtual asset rendering method provided in this application solves the technical problem in existing technologies where, under limited rendering performance of virtual assets, the virtual resources corresponding to long-duration animation resources have low precision, resulting in poor rendering effects. Attached Figure Description
[0011] Figure 1 This is an application system diagram of the virtual asset generation method provided in the embodiments of this application;
[0012] Figure 2 This is an application system diagram of the virtual asset rendering method provided in the embodiments of this application;
[0013] Figure 3 This is a flowchart of the method for generating virtual assets provided in the first embodiment of this application;
[0014] Figure 4(a) is a first schematic diagram of the first embodiment of this application, which shows the interception of a local region of a particle stream and the splicing of it into a sub-particle stream.
[0015] Figure 4(b) is a second schematic diagram of the first embodiment of this application, which shows the interception of a local region of a particle stream and the splicing of it into a sub-particle stream;
[0016] Figure 4(c) is a third schematic diagram of the first embodiment of this application, which shows the interception of a local region of a particle stream and the splicing of it into a sub-particle stream.
[0017] Figure 4(d) is a fourth schematic diagram of the first embodiment of this application, which shows the interception of a local region of a particle stream and the splicing of it into a sub-particle stream.
[0018] Figure 4(e) is a fifth schematic diagram of the first embodiment of this application, which shows the interception of a local region of a particle stream and the splicing of it into a sub-particle stream.
[0019] Figure 4(f) is a sixth schematic diagram of the first embodiment of this application, which shows the interception of a local region of a particle stream and the splicing of it into a sub-particle stream.
[0020] Figure 5 This is a flowchart of the virtual asset rendering method provided in the second embodiment of this application;
[0021] Figure 6 This is a schematic diagram illustrating the rendering of virtual assets with different animation effects provided in the second embodiment of this application;
[0022] Figure 7 This is a schematic diagram of the structure of the virtual asset generation device provided in the third embodiment of this application;
[0023] Figure 8 This is a schematic diagram of the structure of the virtual asset rendering apparatus provided in the fourth embodiment of this application;
[0024] Figure 9 This is a schematic diagram of the structure of the electronic device provided in the fifth embodiment of this application. Detailed Implementation
[0025] Many specific details are set forth in the following description to provide a full understanding of this application. However, this application can be implemented in many other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of this application; therefore, this application is not limited to the specific embodiments disclosed below.
[0026] With the rapid advancement of computer technology, virtual applications such as games have entered an unprecedented stage of development. While enhancing functionality, developers are increasingly focusing on user experience. The integration of virtual assets into virtual applications can enhance their visual appeal. High-precision virtual assets, in particular, can provide users with excellent psychological feedback and an immersive experience.
[0027] Currently, VAT (Vertex Animation Textures) technology is an efficient way to create virtual assets with complex physical dynamics, such as liquid fluids. VAT technology stores the position information of each vertex of the model in the form of texture maps, reducing the size of the virtual resource package and the performance consumption during rendering. When virtual assets prepared using VAT technology are rendered in virtual application projects, the shader of the rendering engine can sample from the vertex animation texture maps to obtain the position information of each vertex of the model at a specific point in time, thereby rendering the corresponding animation effects of the virtual resource in the virtual application project, such as fluid animation effects. However, for some animation resources with a long overall duration, there is often a contradiction between the rendering performance and accuracy of virtual assets. Usually, in order to optimize the rendering performance, the accuracy of virtual assets can only be reduced (e.g., reducing the accuracy of the model, reducing the number of faces of the model, reducing the resolution of the vertex animation texture maps, etc.), but this will undoubtedly affect the final rendering effect and bring a poor user experience. In addition, since the accuracy of virtual assets is related to the overall duration of the animation resource, for animation resources of different lengths, it is often necessary to customize corresponding virtual assets, resulting in poor reusability. When virtual assets fail to perform well during deployment, repeated modifications are required, necessitating a return to the virtual asset creation process. This undoubtedly reduces the development efficiency of virtual application projects. This is especially true for virtual application projects deployed on terminal devices with limited storage and processing capabilities, such as mobile phones, where deploying high-precision virtual resources becomes even more challenging.
[0028] Therefore, there is an urgent need for a virtual asset creation and deployment method that can reduce the package size of virtual assets without compromising their precision, thereby reducing the performance consumption of virtual asset deployment. This would solve the technical problem that existing technologies suffer from low precision and poor deployment effects for long-duration animation resources when the performance of virtual asset deployment is limited.
[0029] In view of this, this application provides a rendering method for virtual assets. First, this method generates virtual assets by performing local cropping operations on particle animation. That is, by cropping a portion of the virtual asset, this method reduces the size of the virtual asset package, optimizes the rendering performance, and maintains the high precision of the virtual asset. This method does not require reducing the precision of the virtual asset by lowering the mesh model precision, face count, or vertex texture map resolution to optimize its rendering performance. In other words, the precision of the virtual asset generated by this method is not compromised, and it does not cause poor rendering results. Second, this method obtains an animation curve pre-constructed based on the animation to be rendered, and samples the coordinate data of each vertex of the dynamic model (obtained based on virtual asset rendering) at each time point in the curve texture map corresponding to the animation curve. This allows the dynamic model to move cyclically along the animation curve, forming the animation to be rendered. In other words, this method uses animation curves to enable the formation of long-duration animation resources from small-package virtual assets.
[0030] The rendering method, apparatus, electronic device, and computer-readable storage medium for virtual assets described in this application will be further described in detail below with reference to specific embodiments and accompanying drawings. The following embodiments will respectively illustrate the generation (i.e., creation) and rendering (i.e., deployment) of virtual assets.
[0031] Figure 1 This is an application system diagram of the virtual asset generation method provided in the embodiments of this application. For example... Figure 1 As shown, the system includes a first user terminal 101 and a first server terminal 102. The first user terminal 101 can be any device such as a smartphone, tablet, laptop, desktop computer, or personal digital assistant (PDA). The first server terminal 102 can be a processing module located inside the first user terminal 101, a processing device electrically connected to the first user terminal 101, or a server communicatively connected to multiple first user terminals 101. A virtual asset generation method is deployed on the first server terminal 102, and in response to receiving a virtual asset generation request sent by the first user terminal 101, it generates high-precision, low-packet-size virtual assets based on the virtual asset generation method.
[0032] Figure 2 This is an application system diagram of the virtual asset rendering method provided in the embodiments of this application. For example... Figure 2As shown, the system includes a second user terminal 201, a second server terminal 202, and a third server terminal 203. The second user terminal 201 can be any device such as a smartphone, tablet, laptop, desktop computer, or personal digital assistant (PDA). The second server terminal 202 can be a processing module located inside the second user terminal 201, a processing device electrically connected to the second user terminal 201, or a server communicatively connected to multiple second user terminals 201. The second server terminal 202 deploys virtual application projects (e.g., game applications) and virtual asset rendering methods. In response to receiving a virtual asset rendering instruction sent by the second user terminal 201, it uses virtual assets imported from the third server terminal 203 (which deploys a virtual asset generation method) to render corresponding animation effects in the virtual application project.
[0033] The first embodiment of this application provides a method for generating virtual assets.
[0034] This method is deployed in Figure 1 Within the first server 102 shown, in response to receiving a virtual asset generation instruction, the first server 102 generates a high-precision, low-package-size virtual asset based on the method provided in this embodiment, so as to ensure that the virtual asset consumes less performance and achieves better results when it is deployed in a virtual application project. In an optional implementation, the virtual asset generation method is executed by 3D animation production software (such as Houdini, SD, etc.).
[0035] Figure 3 This is a flowchart of the virtual asset generation method provided in this embodiment. The following is in conjunction with... Figure 3 The method for generating virtual assets provided in this embodiment will be described in detail. The embodiments described below are used to explain the technical solutions of this application and are not intended to limit actual use.
[0036] like Figure 3 As shown, the method for generating virtual assets provided in this embodiment includes the following steps S310 to S340:
[0037] Step S310: Create a particle animation. In the particle animation, multiple particles move along a preset particle motion path to form a particle flow.
[0038] The particle animation can be understood as a motion animation formed by the movement of multiple particles. In this embodiment, multiple particles will move along a preset particle motion path, and the particle group formed by multiple particles moving along the preset particle motion path is defined as a particle flow.
[0039] In an alternative implementation, creating particle animation may specifically include the following steps S311 to S314:
[0040] Step S311: Obtain the pre-constructed particle motion path and generate the velocity field along the particle motion path, which is associated with the type of virtual asset.
[0041] Step S312: Control the particle emitter to emit multiple particles and apply a velocity field to the multiple particles so that the multiple particles move along the particle motion path to form a particle stream.
[0042] Step S313: Based on preset disturbance parameters, apply forces corresponding to the disturbance parameters to multiple particles to adjust the shape of the particle flow to match the type of virtual asset.
[0043] Step S314: Generate particle animation.
[0044] The particle motion path can be carried and transmitted to the first server 102 by the virtual asset generation instruction to guide the particle's movement. This path can be a curve or a geometric shape of any shape. Specifically, it needs to be pre-constructed according to the type of the pre-generated virtual asset. For example, if the type of the pre-generated virtual asset is fluid, then the particle motion path can be constructed as a linear path (e.g., a straight line, a curve, etc.). If the type of the pre-generated virtual asset is rigid body, then the particle motion path can be constructed as a closed geometric shape (e.g., a square, a triangle, etc.).
[0045] Once the particle motion path is obtained, a particle emitter can be established to emit particles. By setting the direction of the velocity field to be consistent with the particle motion path, the particles can move along the particle motion path to form a particle stream.
[0046] Optionally, to make the particle flow shape more consistent with the type of virtual asset, additional forces can be applied to the particles by adding perturbation parameters to adjust the particle flow to a shape consistent with the virtual asset type. For example, if the pre-generated virtual asset is of the fluid type, parameters that help the particle flow simulate fluid behavior (such as viscosity, surface tension, etc.) can be added to adjust the particle flow to a liquid form.
[0047] Step S320: Extract a sub-particle stream of a preset length and obtain the sub-particle animation corresponding to the sub-particle stream from the particle animation. The sub-particle stream is a local region in the particle stream.
[0048] In the method provided in this embodiment, a local region is extracted from the particle stream, and the extracted local region and its corresponding local particle animation are used as the original resources for generating virtual assets. In this embodiment, the local region extracted from the particle stream is defined as a sub-particle stream, and the local particle animation corresponding to the local region is defined as a sub-particle animation.
[0049] In one optional implementation, the sub-particle stream of a preset length can be extracted as follows: according to a preset extraction rule, a local region of a preset length that conforms to the extraction rule is extracted from the particle stream and used as the sub-particle stream.
[0050] The extraction rule can be understood as defining which local region to extract from the particle flow. This extraction rule can be redefined according to specific virtual asset generation requirements. For example, the extraction rule can be to extract a region of a preset length from the middle of the particle flow, or it can be to extract the key region with the most complex shape changes based on the shape of the particle flow.
[0051] In one optional implementation, to ensure that the virtual assets generated by the sub-particle stream and sub-particle animation do not show any stitching marks during the landing loop, the sub-particle stream of the preset length is not directly truncated. Instead, a local area shorter than the preset length is truncated and then stitched together to form a sub-particle stream of the preset length. Based on this, truncating the sub-particle stream of the preset length may specifically include the following steps S321 to S324:
[0052] Step S321: Extract a first sub-particle stream of a first length. The first length is less than a preset length. The first sub-particle stream includes a first end and a second end.
[0053] Step S322: Perform a copying operation on the first sub-particle stream to form a first copied sub-particle stream corresponding to the first sub-particle stream. The first copied sub-particle stream includes a third end and a fourth end. The third end is the same as the first end, and the fourth end is the same as the second end.
[0054] Step S323: Perform a mid-section cutting operation on the first replicating particle stream to split the first replicating particle stream into a first part and a second part. The first part includes a third end and a cutting part, and the second part includes a fourth end and a cutting part.
[0055] Step S324: The third end of the first part is spliced with the second end of the first sub-particle stream, and the fourth end of the second part is spliced with the first end of the first sub-particle stream to form a sub-particle stream of a preset length. The sub-particle stream includes a fifth end and a sixth end, both of which are cut-off portions.
[0056] For example, to extract a sub-particle stream of 3 unit lengths from a particle stream, firstly, a first sub-particle stream of 2 unit lengths is extracted from the particle stream. This first sub-particle stream includes a first end (head) and a second end (tail). Next, the first sub-particle stream is replicated to form a first replicated sub-particle stream, which includes a third end (head) and a fourth end (tail). Then, the first replicated sub-particle stream is cut in the middle, splitting it into a first part of 1 unit length and a second part of 1 unit length. The first part includes the third end (head). The first part consists of a cut-off section and a fourth end (tail). Finally, the third end (head) of the first part is spliced with the second end (tail) of the first sub-particle stream, with an overlap of 0.5 units. The fourth end (tail) of the second part is then spliced with the first end (head) of the first sub-particle stream, also with an overlap of 0.5 units. This results in a sub-particle stream composed of the second part, the first sub-particle stream, and the first part. This sub-particle stream includes a fifth end (head) and a sixth end (tail), both of which are actually cut-off sections. When the virtual asset is logged into the system and a head-to-tail splicing loop is performed, no splicing marks will appear because the head and tail are identical.
[0057] It should be noted that the mid-section cutting operation of the first replicator particle stream does not need to be strictly cut from the middle of the first replicator particle stream to form two parts of equal length. It can also be cut from other positions according to the actual situation. It can also be cut obliquely or curvedly according to the shape of the first replicator particle stream. There are no specific restrictions.
[0058] Step S330: Perform mesh transformation on the sub-particle flow to generate a mesh model corresponding to the sub-particle flow, and determine the displacement information of each vertex of the mesh model according to the sub-particle animation. Bake the displacement information of each vertex of the mesh model to the texture map to generate a vertex animation texture map.
[0059] This step includes two aspects: first, generating a model based on the sub-particle flow; and second, generating vertex animation texture maps based on the sub-particle animation.
[0060] For the sub-particle flow generation model, this implementation uses a mesh transformation method, which is relatively mature and will not be described in detail here. In an optional implementation, the form of the sub-particle flow at each time point in the sub-particle animation is different. Therefore, the sub-particle flow at each time point in the sub-particle animation is first mesh transformed to form a candidate mesh model for each time point; then, the candidate mesh model with the most facets is selected as the final mesh model. Selecting the candidate mesh model with the most facets as the mesh model included in the final virtual asset ensures that the mesh model can simulate the form at any time point.
[0061] In this embodiment, VAT technology is used to generate vertex animation texture maps based on sub-particle animations. Specifically, since the mesh model is formed by meshing the sub-particle flow, each vertex of the mesh model can find a corresponding particle in the sub-particle flow. Therefore, the displacement information of each vertex of the mesh model is determined based on the motion trajectory of the corresponding particle in the sub-particle animation. The displacement information of each vertex of the mesh model is then baked into the texture map to generate the vertex animation texture map. Each pixel in the vertex animation texture map stores the position information of a vertex of the mesh model at a given time point.
[0062] Step S340: Combine the mesh model with the vertex animation texture map into a virtual asset.
[0063] In this embodiment, the virtual asset consists of a mesh model and a vertex animation texture map. The mesh model and the vertex animation texture map are generated in the above steps, and the two are combined to form the virtual asset.
[0064] The following example uses fluid assets (virtual assets) as an example, with Houdini as the execution subject of the method provided in this embodiment, to illustrate how to generate high-precision, low-package-size fluid assets based on the virtual asset generation method provided in this embodiment.
[0065] Generating fluid assets based on the virtual asset generation method provided in this embodiment may include the following steps S401 to S405:
[0066] Step S401: Establish the particle emitter and particle motion path.
[0067] The particle emitter can be in the form of a point, line, surface, or volume, depending on the fluid phenomenon to be simulated. The particle emitter is used to emit multiple particles.
[0068] A particle motion path can be understood as a guiding path that directs the particle's movement; it can be a curve or a geometric shape of any form. Since the asset model corresponding to a fluid asset is a fluid model, the particle motion path can also be a curve to simulate the flow pattern of a fluid.
[0069] Specifically, you can use the Curve tool or Spline node in Houdini to create fluid curves, and ensure that the fluid curves have sufficient resolution and smoothness to accurately represent the guide path.
[0070] Step S402: Emit particles based on the particle emitter and set the direction of the velocity field to be consistent with the particle motion path.
[0071] Multiple particles are emitted from a particle emitter, and their motion direction is controlled by a velocity field. The direction of the velocity field is consistent with the particle's motion path to ensure that the particles move along the path, forming a particle stream with a specific shape. In this example, the particle motion path is a curve, and the direction of the velocity field is set to be consistent with the curve, causing the particles to move along the curve and forming a particle stream with a fluid shape.
[0072] Specifically, you can use the Pop Source node in Houdini to define the initial properties of the particles, such as position and velocity, use the Trail or Stream node to generate the velocity field along the particle's motion path, use the Popobject node to associate the particles with the particle's motion path, and use the Pop Force node to apply the velocity field to the particles.
[0073] In step S403, by combining the perturbation parameters and the popfluid node, the particles are adjusted to a liquid form to create a fluid particle animation.
[0074] Adding perturbations makes the particle flow appear more fluid. In this step, random disturbances can be introduced into the particle flow by adjusting the particle's velocity, acceleration, or other physical properties. The Pop Fluid node helps the particle flow simulate fluid behavior, such as viscosity and surface tension. By adjusting these parameters, the particle flow can be made closer to the real-world behavior of a fluid.
[0075] Specifically, you can use the Pop Drag and Pop Wind nodes in Houdini to add random forces to particles to simulate environmental effects, and use the Pop Fluid Solver node to simulate the physical properties of fluids, such as viscosity, density, and surface tension. Adjusting parameters such as Viscosity and Surface Tension can make the motion behavior of particle flow more realistic.
[0076] Step S404: Extract a local region from the particle flow to form a sub-particle flow, and obtain the sub-fluid particle animation corresponding to the sub-particle flow in the fluid particle animation.
[0077] For example, a sub-particle flow of 3 units in length is extracted from a particle flow of 10 units in length, and the corresponding sub-fluid particle animation is obtained from the fluid particle animation. Optionally, the extracted sub-particle flow can be the middle region of the particle flow, or a key region of the particle flow (e.g., a region with vortices, a region with splashing water, etc.). The specific extraction area can be determined according to the landing requirements of the fluid asset and is not limited here.
[0078] In one optional implementation, to ensure that there are no splicing marks due to cyclic sampling when the fluid assets are deployed, the beginning and end of the fluid model must be connected. In this example, after truncating a local region, a two-way continuous welding technique can be used to splice the truncated local region. Specifically, the local region is copied, and the copied local region is cut off from the middle. The beginning of the left part is connected to the end of the local region, and the end of the right part is connected to the beginning of the local region, forming a sub-particle flow composed of the left part, the local region, and the right part. The beginning and end of this sub-particle flow are both cut off, and therefore identical. When cyclic sampling is performed later, because the beginning and end are identical, they can be tightly connected without any splicing marks. It should be noted that because the sub-particle flow is composed of two local regions, the truncated local region needs to be smaller than the length of the final sub-particle flow. For example, a local region of 1.5 units is truncated from a particle flow of 10 units in length, and after two-way continuous welding, a sub-particle flow of 3 units in length is formed. In practical applications, since there will be some overlap during splicing, the length of the extracted local region can be appropriately increased. For example, a local region of 2 units can be extracted from a particle stream of 10 units in length and then continuously welded to form a sub-particle stream of 3 units in length. The specific extraction length needs to be determined according to the splicing requirements.
[0079] Specifically, you can use the Copy Stamp or Attribute Transfer node in Houdini to copy and stitch together local regions of the particle flow.
[0080] Figure 4 is a schematic diagram of the local region of the particle stream being intercepted and spliced into a sub-particle stream according to this embodiment.
[0081] As shown in Figure 4(a), a fluid particle animation is formed based on the particle emitter and the preset particle motion path. The fluid particle animation includes a particle flow 401 with a length of 10 units.
[0082] As shown in Figure 4(b), a local region 402 of two unit lengths is cut out from the middle region of the particle flow 401. The beginning of the local region 402 is a, and the end is b.
[0083] As shown in Figure 4(c), the local region 402 is copied to form a copied local region 403. The beginning of the copied local region 403 is a, and the end is b.
[0084] As shown in Figure 4(d), the copied local region 403 is cut in the middle to form a left part 4031 and a right part 4032. The beginning of the left part 4031 is a and the end is c. The beginning of the right part 4032 is c and the end is b.
[0085] As shown in Figure 4(e), the tail b of the right part 4032 is spliced with the head a of the local region 402, with an overlap of 0.5 units at the splicing point. The head a of the left part 4031 is spliced with the tail b of the local region 402, with an overlap of 0.5 units at the splicing point.
[0086] As shown in Figure 4(f), a sub-particle flow 404 is formed, with c at the beginning and c at the end, achieving the same beginning and end.
[0087] Step S405: Perform mesh transformation on the sub-particle flow at a certain time point in the sub-fluid particle animation to generate a fluid model, and use VAT technology to generate vertex animation texture maps corresponding to the sub-fluid particle animation. The fluid model and vertex animation texture maps are combined to form a fluid asset.
[0088] For each time point in the sub-fluid particle animation, a surface is created and the mesh structure is refined to form a polygonal mesh. The polygonal mesh with the most faces is output as the fluid model. Further, the displacement information of each vertex of this fluid model at each time point is baked into a texture map, outputting a vertex animation texture map. The fluid model and the vertex animation texture map are then combined to form the fluid asset.
[0089] Specifically, the SOP Particle To Mesh node in Houdini can be used to convert the sub-particle flow into a mesh. A dedicated VAT baking tool or script can then be used to bake the displacement information of each vertex of the fluid model into a texture map so that it can be sampled by the shader during rendering.
[0090] Through the above steps, a fluid asset including a fluid model and vertex animation texture maps is generated, which enables degraded simulation of fluid pathing. Without reducing the accuracy of the fluid model or the resolution of the vertex animation texture maps, the size of the fluid asset package is reduced by decreasing the length of the fluid model and the total number of frames (i.e., time points) recorded in the vertex animation texture maps, thus reducing the performance consumption of the fluid asset when deployed in virtual application projects.
[0091] The first embodiment described above provides an optional method for generating virtual assets. First, this method extracts a sub-particle stream of a preset length from the particle stream and generates virtual assets based on this sub-particle stream and its corresponding sub-particle animation. That is, this method reduces the size of the virtual asset package and optimizes its rendering performance while maintaining high precision by extracting a local portion. Second, this method does not require reducing the precision of the virtual asset by lowering the mesh model precision, face count, or vertex texture resolution to optimize its rendering performance. In other words, the precision of the virtual assets generated by this method is not compromised, and it does not cause poor rendering results.
[0092] It should be noted that the examples in the first embodiment are only for explaining the methods described in this application and are not intended to limit actual use. The methods for generating virtual assets provided in this application include, but are not limited to, the methods described in the first embodiment.
[0093] The second embodiment of this application provides a method for rendering virtual assets.
[0094] This method is deployed in Figure 2 The second server 202 shown is used to render animation effects corresponding to virtual resources in a virtual application project. In an optional implementation, the rendering method of the virtual asset is executed by the shader of the rendering engine.
[0095] Figure 5 This is a flowchart of the virtual asset rendering method provided in this embodiment. The following is in conjunction with... Figure 5 The rendering method for virtual assets provided in this embodiment will be described in detail. The embodiments described below are used to explain the technical solutions of this application and are not intended to limit actual use.
[0096] like Figure 5 As shown, the virtual asset rendering method provided in this embodiment includes the following steps S510 to S540:
[0097] Step S510: Obtain the virtual assets and the curve texture map corresponding to the animation curve; wherein, the virtual assets are generated based on the local cropping operation of the particle animation, including the mesh model and vertex animation texture map, the animation curve is pre-constructed according to the animation to be rendered, and the curve texture map stores the curve information corresponding to each point on the animation curve, and the curve information includes at least the coordinate data of each point on the animation curve.
[0098] The virtual asset includes vertex animation texture maps and mesh models, and the virtual asset is generated by the virtual asset generation method provided in the first embodiment of this application.
[0099] The animation curve is pre-created in 3D software based on the animation path in the animation to be rendered. For example, if the fluid in the animation flows from point A to point B in a straight line, and the length between points A and B is 50 units, then the animation curve is a straight line of 50 units. Alternatively, if the fluid in the animation flows from point A to point B in a spiral pattern, and the length between points A and B is 50 units, then the animation curve is a spiral curve of 50 units.
[0100] The curve texture map is a texture map that records curve information. Optionally, the animation curve created in the 3D software is imported into software that supports processing curve data and can output texture maps, such as Houdini or SD. The length of the animation curve, as well as the width, coordinates, normal, tangent, and subnormal of each point on the animation curve, are calculated, and this curve information is written into the texture map to form the curve texture map.
[0101] Step S520: Render the dynamic model corresponding to the virtual asset based on the mesh model and vertex animation texture map included in the virtual asset, and control the dynamic model to deform along the animation curve.
[0102] In the rendering engine, shaders can sample from vertex animation texture maps and obtain the displacement information of each vertex of the mesh model based on the sampling. This allows for the rendering of mesh models of different shapes at different time points. These mesh models from multiple time points combine to form a mesh model with dynamic effects. In this embodiment, the mesh model with dynamic effects is defined as a dynamic model. After rendering the dynamic model corresponding to the virtual asset, it is necessary to control the deformation of the dynamic model along the animation curve in order to render the animation effects in the animation to be rendered.
[0103] In an optional implementation, based on the mesh model and vertex animation texture maps included in the virtual asset, the dynamic model corresponding to the virtual asset is rendered, and the deformation of the dynamic model along the animation curve is controlled. Specifically, this may include the following steps S521 to S522:
[0104] Step S521: Render each vertex of the mesh model according to the displacement information of each vertex of the mesh model recorded in the vertex animation texture map to form a dynamic model.
[0105] Step S522: Map the coordinate axes of each vertex of the dynamic model to the tangent, normal, and secondary tangent directions of the animation curve, so that the dynamic model deforms along the animation curve.
[0106] The normal, tangent, and bitangent directions are the three fundamental directions of a curve. The tangent (T) is the direction along the curve; at any point on the curve, the tangent vector points in the instantaneous direction of the curve's movement at that point. The normal (N) is perpendicular to the tangent and usually points outward from the curve; the normal vector at any point on the curve determines the curve's curvature at that point. The bitangent (B) is perpendicular to both the tangent and normal directions.
[0107] Mapping the coordinate axes of each vertex of the dynamic model to the three directions of the animation curve essentially redefines a new coordinate system for each vertex of the dynamic model, relative to the animation curve. Specifically, mapping the X-axis of each vertex to the tangent of the animation curve allows the dynamic model to stretch, compress, or remain unchanged along the direction of the animation curve, ensuring correct alignment along the path of the animation curve. Mapping the Y-axis of each vertex to the normal of the animation curve controls how the dynamic model expands outward relative to the curve, and can be used to adjust the width or other vertical dimensions of the dynamic model. Mapping the Z-axis of each vertex to the secondary tangent of the animation curve helps maintain the correct orientation of the dynamic model in space. Through mapping the coordinate axes of the dynamic model to the three basic directions of the animation curve, synchronization between the dynamic model and the animation curve is essentially achieved.
[0108] Step S530: Determine the corresponding points of each vertex of the dynamic model on the animation curve at each time point, and collect the coordinate data of the corresponding points in the curve texture map.
[0109] The above steps achieve synchronization between the dynamic model and the animation curve. To enable the dynamic model to move along the animation curve and create an animation effect, the concept of time needs to be introduced. Each vertex of the dynamic model corresponds to a different point on the animation curve at each time point, thus rendering the animation of the dynamic model moving along the animation curve over time. In this embodiment, the point on the animation curve corresponding to each vertex of the dynamic model at each time point is defined as the corresponding point.
[0110] In an optional implementation, the corresponding points of each vertex of the dynamic model on the animation curve at each time point are determined, and the coordinate data of the corresponding points are collected in the curve texture map. Specifically, this may include the following steps S531 to S533:
[0111] Step S531: Based on the length of the dynamic model, normalize the coordinates of each vertex of the dynamic model along the tangent of the animation curve to form normalized coordinates of each vertex of the dynamic model along the tangent of the animation curve.
[0112] Step S532: The fractional part of the sum of the normalized coordinates and the time value corresponding to each time point, and the storage location of the coordinate data in the curve texture map are used as the sampling coordinates of each vertex of the dynamic model at each time point. The points on the curve corresponding to the sampling coordinates are the corresponding points of each vertex of the dynamic model on the animation curve.
[0113] Step S533: Based on the sampled coordinates of each vertex of the dynamic model at each time point, collect the coordinate data corresponding to each vertex of the dynamic model in the curve texture map.
[0114] To make the vertices of the dynamic model move along the animation curve, the coordinate data of the corresponding points on the animation curve needs to be assigned to each vertex of the dynamic model. Since the coordinate data of the points on the animation curve is recorded in the curve texture map, the coordinates of each vertex of the dynamic model along the tangent of the animation curve need to be normalized to between 0 and 1. This is necessary to establish a correspondence between each vertex of the dynamic model and the points recorded in the curve texture map. In this embodiment, the coordinates obtained by normalizing the coordinates of each vertex of the dynamic model along the tangent of the animation curve are defined as normalized coordinates.
[0115] Adding time values to the normalized coordinates of each vertex of the dynamic model along the tangent of the animation curve allows each vertex to correspond to a different point on the animation curve at different time points, enabling the vertices of the dynamic model to move along the animation curve over time. Taking the decimal part of the time value added to the normalized coordinates of each vertex along the tangent of the animation curve allows the vertices of the dynamic model to move from the beginning to the end of the animation curve and then return to the beginning to continue moving, achieving cyclical movement of the dynamic model along the animation curve and increasing the animation duration. Therefore, in this embodiment, the decimal part of the sum of the normalized coordinates and the time value corresponding to each time point is used as the U value of the sampling coordinates.
[0116] The curve texture map stores curve information of the animation curve. Typically, different curve information is stored in separate partitions. For example, the curve texture map might be divided into four regions vertically, with the curve's attribute information stored in the first region and the curve's coordinate data stored in the second region. Therefore, in this embodiment, the storage location of the coordinate data in the curve texture map is used as the V value of the sampling coordinates.
[0117] After obtaining the sampled coordinates (U, V) of each vertex of the dynamic model at each time point, sampling can be performed on the curve texture map to obtain the corresponding coordinate data of each vertex of the dynamic model at each time point.
[0118] Step S540: At each time point, the position of each vertex of the dynamic model is changed based on the coordinate data corresponding to each vertex of the dynamic model at that time point, forming an animation to be rendered in which the dynamic model moves cyclically along the animation curve.
[0119] After obtaining the coordinate data of each vertex of the dynamic model at each time point, the position of each vertex of the dynamic model at each time point is updated based on the coordinate data, thus forming the animation to be rendered, in which the dynamic model moves cyclically along the animation curve. It should be noted that the animation to be rendered in this embodiment not only realizes the movement of the model along the curve, but also maintains the dynamics of the model itself, making the dynamic effects of the animation to be rendered richer and more natural.
[0120] In one optional implementation of this embodiment, before obtaining the virtual asset and the curve texture map corresponding to the animation curve, the method provided in this embodiment may further include: generating the virtual asset by performing a local cropping operation on the particle animation. Specifically, generating the virtual asset by performing a local cropping operation on the particle animation may include the following steps: creating a particle animation, in which multiple particles move along a preset particle motion path to form a particle flow; cropping a sub-particle flow of a preset length, and obtaining the sub-particle animation corresponding to the sub-particle flow from the particle animation, wherein the sub-particle flow is a local region in the particle flow; performing mesh transformation on the sub-particle flow to generate a mesh model corresponding to the sub-particle flow, and determining the displacement information of each vertex of the mesh model according to the sub-particle animation, baking the displacement information of each vertex of the mesh model to a texture map to generate a vertex animation texture map; and combining the mesh model and the vertex animation texture map into a virtual asset. The specific method for generating the virtual asset can be referred to the detailed description in the first embodiment of this application, and will not be repeated here.
[0121] This embodiment also provides several optional implementation methods for optimizing the rendering effect of virtual assets, which will be described one by one below.
[0122] In one optional implementation, the curve information also includes transparency data for each point on the animation curve. Based on this, determining the corresponding points of each vertex of the dynamic model on the animation curve at each time point and collecting the coordinate data of the corresponding points in the curve texture map can further include: determining the corresponding points of each vertex of the dynamic model on the animation curve at each time point and collecting the coordinate data and transparency data of the corresponding points in the curve texture map. By collecting the transparency data corresponding to each vertex of the dynamic model, an animation with transparency changing over time can be generated during the rendering of the animation to be rendered, thereby enhancing the landing effect of the virtual asset.
[0123] Based on this, at each time point, the position of each vertex of the dynamic model is changed based on the coordinate data corresponding to each vertex of the dynamic model at that time point, forming an animation to be rendered in which the dynamic model moves cyclically along the animation curve. Specifically, this can include: at each time point, changing the position of each vertex of the dynamic model based on the coordinate data corresponding to each vertex of the dynamic model at that time point, and changing the transparency of each vertex of the dynamic model based on the transparency data, forming an animation to be rendered in which the dynamic model moves cyclically along the animation curve.
[0124] In another optional implementation, the curve information also includes width data for each point on the animation curve. Based on this, determining the corresponding points of each vertex of the dynamic model on the animation curve at each time point and collecting the coordinate data of the corresponding points in the curve texture map can also include: determining the corresponding points of each vertex of the dynamic model on the animation curve at each time point and collecting the coordinate and width data of the corresponding points in the curve texture map. By collecting the width data corresponding to each vertex of the dynamic model, the dynamic model can be scaled along the animation curve based on the width data when rendering the animation to be rendered, realizing the secondary deformation of the dynamic model and forming the animation to be rendered where the width of the dynamic model changes over time, thereby enhancing the landing effect of the virtual asset.
[0125] After the dynamic model undergoes a secondary deformation, the coordinate data of each vertex of the dynamic model will shift with the width scaling. Therefore, by calculating the offset of each vertex of the dynamic model due to the width scaling and adding this offset to the coordinate data, the coordinate data of each vertex of the dynamic model after width scaling can be formed. Based on this, at each time point, the position of each vertex of the dynamic model is changed based on the coordinate data corresponding to each vertex of the dynamic model at that time point, forming the animation to be rendered where the dynamic model moves cyclically along the animation curve. Specifically, this can include the following steps S541-1 to S541-4:
[0126] Step S541-1: Use the coordinates of each vertex of the dynamic model along the normal and secondary tangential directions of the animation curve as the basic offset of each vertex of the dynamic model on the radial plane of the animation curve.
[0127] Step S541-2: Based on the width data of each vertex of the dynamic model at each time point and the basic offset, calculate the first offset of each vertex of the dynamic model on the radial plane of the animation curve after scaling along the animation curve at each time point.
[0128] Step S541-3: The sum of the coordinate data corresponding to each vertex of the dynamic model at each time point and the first offset is used as the first coordinate data corresponding to each vertex of the dynamic model at each time point.
[0129] Step S541-4: At each time point, the position of each vertex of the dynamic model is changed based on the first coordinate data corresponding to each vertex of the dynamic model at that time point, forming an animation to be rendered in which the dynamic model moves cyclically along the animation curve.
[0130] In this embodiment, after scaling each vertex of the dynamic model along the animation curve, the offset of each vertex of the dynamic model on the radial plane of the animation curve is defined as the first offset. The first offset is the product of the width data corresponding to each vertex of the dynamic model at each time point and the basic offset. After obtaining the first offset, the first offset is added to the coordinate data corresponding to each vertex of the dynamic model at each time point to form the coordinate data of each vertex of the dynamic model after scaling along the animation curve. In this embodiment, the coordinate data of each vertex of the dynamic model after scaling along the animation curve is defined as the first coordinate data. After obtaining the first coordinate data corresponding to each vertex of the dynamic model at each time point, the position of each vertex of the dynamic model can be changed based on the corresponding first coordinate data at each time point to form the animation to be rendered, in which the dynamic model moves cyclically after scaling along the animation curve.
[0131] In another optional implementation, the curve information also includes the rotation angle data of the animation curve. Based on this, determining the corresponding points of each vertex of the dynamic model on the animation curve at each time point and collecting the coordinate data of the corresponding points in the curve texture map can also include: determining the corresponding points of each vertex of the dynamic model on the animation curve at each time point and collecting the coordinate data of the corresponding points in the curve texture map, as well as the rotation angle data of the animation curve. By collecting the rotation angle data, the dynamic model can be rotated along the animation curve based on the rotation angle data when rendering the animation to be rendered, realizing the secondary deformation of the dynamic model and forming the animation to be rendered where the dynamic model rotates over time, thereby enhancing the landing effect of the virtual asset.
[0132] After the dynamic model undergoes a secondary deformation, the coordinate data of each vertex of the dynamic model will shift with rotation. Therefore, by calculating the offset of each vertex of the dynamic model due to rotation and adding this offset to the coordinate data, the coordinate data of each vertex of the dynamic model after rotation can be formed. Based on this, at each time point, the position of each vertex of the dynamic model is changed based on the coordinate data corresponding to each vertex of the dynamic model at that time point, forming the animation to be rendered in which the dynamic model moves cyclically along the animation curve. Specifically, this can include the following steps S542-1 to S542-5:
[0133] Step S542-1: Use the coordinates of each vertex of the dynamic model along the normal and secondary tangential directions of the animation curve as the basic offset of each vertex of the dynamic model on the radial plane of the animation curve.
[0134] Step S542-2: Based on the rotation angle data of the animation curve, calculate the radial plane basis vector of the animation curve. The radial plane basis vector includes the secondary tangential basis vector and the normal basis vector.
[0135] Step S542-3: Based on the basic offset, the secondary tangential basis vector, and the normal basis vector, calculate the second offset of each vertex of the dynamic model on the radial plane of the animation curve after each vertex of the dynamic model rotates along the animation curve.
[0136] Step S542-4: The sum of the coordinate data corresponding to each vertex of the dynamic model at each time point and the second offset is used as the second coordinate data corresponding to each vertex of the dynamic model at each time point.
[0137] Step S542-5: At each time point, the position of each vertex of the dynamic model is changed based on the second coordinate data corresponding to each vertex of the dynamic model at that time point, forming an animation to be rendered in which the dynamic model moves cyclically along the animation curve.
[0138] In this embodiment, the offset of each vertex of the dynamic model on the radial plane of the animation curve after rotation along the animation curve is defined as the second offset. The second offset is the product of the radial plane basis vector calculated based on the rotation angle data and the basic offset. Specifically, it includes the secondary tangential offset obtained by multiplying the secondary tangential basis vector by the basic offset, and the normal offset obtained by multiplying the normal basis vector by the basic offset. After obtaining the second offset, it is added to the coordinate data corresponding to each vertex of the dynamic model at each time point to form the coordinate data of each vertex of the dynamic model after rotation along the animation curve. In this embodiment, the coordinate data of each vertex of the dynamic model after rotation along the animation curve is defined as the second coordinate data. After obtaining the second coordinate data corresponding to each vertex of the dynamic model at each time point, the position of each vertex of the dynamic model can be changed based on the corresponding second coordinate data at each time point to form the animation to be rendered, in which the dynamic model rotates and moves cyclically along the animation curve.
[0139] As can be seen above, changes in the animation curve lead to changes in the curve information, ultimately resulting in different virtual asset rendering effects. Therefore, the method provided in this embodiment can not only maintain the high precision of virtual assets while reducing rendering performance, but also enable the reuse of virtual assets, allowing the same virtual asset to be rendered with different animation effects. Specifically, as follows... Figure 6 As shown, Figure 6 (a) is a schematic diagram of the dynamic model corresponding to the virtual asset. Figure 6 (b) is a schematic diagram of an animation effect obtained by rendering the virtual asset. Figure 6 (c) is a schematic diagram of another animation effect obtained by rendering the virtual asset. Figure 6 (d) is a schematic diagram illustrating another animation effect obtained by rendering this virtual asset. Figure 6 It can be seen that the same virtual assets and the same dynamic models can render different animation effects.
[0140] The following example illustrates how to render fluid animations corresponding to fluid assets in a game engine, using the game engine's shader as the execution subject of the method provided in this embodiment.
[0141] Rendering fluid assets based on the virtual asset rendering method provided in this embodiment may include the following steps S601 to S607:
[0142] Step S601: Obtain fluid assets and generate a fluid dynamic model.
[0143] The fluid assets are generated through steps S401 to S405 in the first embodiment of this application. These assets include a fluid model and a vertex animation texture map, where the vertex animation texture map records the displacement information of each vertex of the fluid model at each time point. After the game engine obtains the fluid assets, the shader can render a fluid model with dynamic effects based on the vertex animation texture map. In this embodiment, the fluid model with dynamic effects is defined as a fluid dynamic model. Specifically, the shader reads the displacement information of each vertex of the fluid model at each time point from the vertex animation texture map, thereby rendering a fluid model of a specific shape at each time point. The fluid models of specific shapes at each time point constitute a fluid dynamic model with dynamic effects.
[0144] Step S602: Obtain the curve texture map corresponding to the animation curve.
[0145] The animation curve can be understood as a pre-constructed fluid movement path based on the expected animation path. For example, if the expected animation path is a straight line of 10 units, then the pre-constructed animation curve is a straight line of 10 units. As another example, if the expected animation path is a polyline of 20 units, then the pre-constructed animation curve is a polyline of 20 units, with the inflection point coinciding with the inflection point of the polyline path. Yet another example, if the expected animation path is a loop of 5 units, then the pre-constructed animation curve is a closed circle of 5 units. Optionally, this animation curve is created using 3D software.
[0146] The curve texture map corresponding to the animation curve can be understood as a texture map that records curve information. Optionally, the animation curve created in 3D software is imported into software that supports processing curve data and can output textures. The length, width, coordinates, normal, tangent, and subnormal of the animation curve are calculated, and the curve is written into the texture map to form a curve texture map. In this example, the curve texture map is exported from software such as Houdini and imported into the rendering engine.
[0147] Step S603: Map the coordinate axes of each vertex of the fluid dynamic model to the tangential, normal, and secondary tangential directions of the animation curve, so that the fluid dynamic model deforms along the curve.
[0148] The purpose of this step is to move the coordinate space of the fluid dynamic model along the curve, so that the fluid dynamic model can deform according to the direction and shape of the curve.
[0149] In one specific implementation, mapping the coordinate axes of each vertex of the fluid dynamic model to the tangential, normal, and secondary tangential directions of the curve may include the following steps S603-1 to S603-3:
[0150] Step S603-1: Place the fluid dynamic model along the negative X-axis direction of the model coordinate space.
[0151] Specifically, the head of the fluid dynamic model is located at the origin (0,0,0) in the model coordinate space, and the tail of the fluid dynamic model is located in the negative X-axis direction (-ModleLength,0,0) in the model coordinate space, where ModleLength represents the length of the fluid dynamic model. The model coordinate space can be either world coordinate space or local coordinate space, without any restrictions.
[0152] Step S603-2: Read the coordinates of each vertex of the fluid dynamic model on the YZ plane, and use them as the offset vectors of each vertex of the fluid dynamic model on the radial plane of the curve.
[0153] Specifically, this can be achieved through the following expression 3.1:
[0154] offset rPlant =float3(0,LocalPos.yz) Expression 3.1
[0155] Among them, Offset rPlant This represents the offset vector of each vertex of the fluid dynamics model in the radial plane of the curve. LocalPos.yz represents the Y and Z coordinates of each vertex of the fluid dynamics model in the model coordinate space. float3() represents a vector containing three floating-point numbers.
[0156] Step S603-3: Read the coordinates of each vertex of the fluid dynamic model on the X-axis and divide them by the length of the fluid dynamic model to obtain the normalized coordinates of each vertex of the fluid dynamic model on the tangent of the animation curve.
[0157] Since the sampling range of the curve texture map corresponding to the animation curve is 0 to 1, the coordinates of each vertex of the fluid dynamic model on the tangent of the animation curve are normalized to normalized coordinates in this step, so as to facilitate sampling in the curve texture map in subsequent steps.
[0158] Specifically, this can be achieved through the following expression 3.2:
[0159] offset tPlant =remap(-LocalPos.x,(0,ModleLength),(0,1)) (Expression 3.2)
[0160] Among them, offset tPlant LocalPos.x represents the normalized coordinates of each vertex of the fluid dynamic model along the tangent of the animation curve, LocalPos.x represents the X coordinate of each vertex of the fluid dynamic model in the model coordinate space, ModleLength represents the length of the fluid dynamic model, and remap() is a mapping function that maps the value of -LocalPos.x from one range (0, ModleLength) to another range (0, 1).
[0161] Step S604: Move the fluid dynamic model along the animation curve as the system time increases, and calculate the sampling coordinates of the sampling curve data of each vertex of the fluid dynamic model at each system time.
[0162] The system time is a value that automatically increments during game execution. Using the system time as the sampling interval eliminates the need for additional timer or time interval management, simplifying the implementation process and reducing runtime performance consumption. Furthermore, the consistency of the system time makes it easier to render fluid animations at a specific game time.
[0163] Specifically, this can be achieved through expressions 4.1 to 4.4 as follows:
[0164] TexCoord mix =float2(frac(offset) tPlant +Time),0.125) Expression 4.1
[0165] TexCoord pos =float2(frac(Offset) tPlant +Time),0.375) Expression 4.2
[0166] TexCoord normal =float2(frac(Offset) tPlant +Time), 0.625) Expression 4.3
[0167] TexCoord tangent =float2(frac(Offset) tPlant +Time), 0.875) Expression 4.4
[0168] Among them, TexCoord mix TexCoord represents the sampling coordinates of the mix data (i.e., the length, width, and opacity of the curve) of the sampled curve in the curve texture map. pos TexCoord represents the sampling coordinates of points on the sampling curve in a curve texture map. normal TexCoord represents the sampling coordinates of the normal data of a point on the sampling curve in a curve texture map. tangent Offset represents the sampling coordinates of the tangential data of a point on the sampling curve in the curve texture map. tPlant This represents the normalized coordinates of each vertex of the fluid model along the tangent of the animation curve (obtained through expression 3.2). Time represents the system time. frac() is a function used to extract the decimal part of a numerical value. frac(X+Time) implements the movement of each vertex of the fluid dynamic model along the animation curve as the system time increases. When each vertex of the fluid dynamic model passes the tail of the animation curve, it returns from the head of the animation curve and continues to loop this process. 0.125, 0.375, 0.625, and 0.875 represent 1 / 8, 3 / 8, 5 / 8, and 7 / 8 respectively. The curve texture map is divided into four equal parts in the vertical direction (0 / 8 to 2 / 8 is the first part, 2 / 8 to 4 / 8 is the second part, 4 / 8 to 6 / 8 is the third part, and 6 / 8 to 6 / 8 is the fourth part). These parts store the curve's mix data, the coordinate data of points on the curve, the normal data of points on the curve, and the tangential data of points on the curve. To avoid data contamination between adjacent pixels, the corresponding curve data is stored at the pixels at the vertical center of each part (i.e., 1 / 8, 3 / 8, 5 / 8, and 7 / 8). Therefore, the V value of the sampling coordinates is the coordinate of the vertical center of each part.
[0169] Step S605: Based on the sampling coordinates of the sampling curve data of each vertex of the fluid dynamic model at each system time, sample curve data in the curve texture map.
[0170] Specifically, this can be achieved through expressions 5.1 to 5.7 as follows:
[0171] Data mix =Sample(DataTexture,TexCoord mix Expression 5.1
[0172] Data Pos =Sample(DataTexture,TexCoord pos Expression ).xyz 5.2
[0173] Data normal =Sample(DataTexture,TexCoordnormal ).xyz expression 5.3
[0174] Data tangent =Sample(DataTexture,TexCoord tangent ).xyz expression 5.4
[0175] Data binormal =cross(Data normal Data tangent Expression 5.5
[0176] Data thickness =Data mix .x expressions 5.6
[0177] Data alpha =Data mix .y expression 5.7
[0178] Among them, Data mix This represents the mix data of the curve (i.e., the curve's length, width, and opacity). Pos Data represents the coordinate data of points on the curve. normal Data represents the normal data of points on the curve. tangent Data represents the tangential data of points on the curve. binormal This represents the secondary tangential data of points on the curve, which is obtained through Data. normal With Data tangent Data is obtained through the cross product operation. thickness This represents the width data of points on the curve, which is Data. mix The x-component of the data, Data alpha This represents the transparency data of points on the curve, which is Data. mix The y-component of the data, DataTexture represents a curve texture map, TexCoord mix TexCoord represents the sampling coordinates of the mix data of the sampled curve in the curve texture map (obtained via expression 4.1). pos TexCoord represents the sampled coordinates of a point on the sampled curve in the curve texture map (obtained via expression 4.2). normal TexCoord represents the sampled coordinates of the normal data of a point on the sampled curve in the curve texture map (obtained via expression 4.3). tangentThis represents the sampling coordinates (obtained via expression 4.4) of the tangential data of a point on the sampling curve in the curve texture map. `Sample()` is a sampling function. `Sample(DataTexture, TexCoord)` mix ) indicates based on TexCoord mix Sample Data from DataTexture mix Data, Sample(DataTexture, TexCoord) pos ).xyz indicates based on TexCoord pos Sample Data from DataTexture Pos The components of the data in the x, y, and z directions, Sample(DataTexture, TexCoord) normal ).xyz indicates based on TexCoord normal Sample Data from DataTexture normal The components of the data in the x, y, and z directions, Sample(DataTexture, TexCoord) tangent ).xyz indicates based on TexCoord tangent Sample Data from DataTexture tangent The components of the data in the x, y, and z directions.
[0179] Step S606: Based on the curve data corresponding to each vertex of the fluid dynamic model at each system time, determine the rendering information of each vertex of the fluid dynamic model at each system time.
[0180] The rendering information can be understood as the information required to render the fluid dynamic model into a fluid animation. In this embodiment, the rendering information includes at least the vertex coordinates of each vertex of the fluid dynamic model. Vertex coordinates can be understood as the coordinate data of the points on the curve corresponding to each vertex of the fluid dynamic model, which has been obtained through the above expression 5.2. Therefore, based on this rendering information, a fluid animation of the fluid dynamic model moving along the curve can be rendered.
[0181] In one optional implementation, the rendering information includes at least the vertex transparency of each vertex of the fluid dynamic model. Vertex transparency can be understood as the transparency data of the points on the curve corresponding to each vertex of the fluid dynamic model, which has been obtained through expressions 5.1 and 5.7 above. Therefore, based on this rendering information, a more realistic fluid animation can be rendered, showing the fluid dynamic model moving along the curve and its transparency changing.
[0182] In another optional implementation, the curve data also includes the width data of the animation curve and the rotation angle data of the curve. In this case, the vertex coordinates of each vertex of the fluid dynamic model cannot directly correspond to the coordinate data obtained by expression 5.2. Instead, the final vertex coordinates of each vertex of the fluid dynamic model need to be obtained by adding the offset due to the width scaling and rotation changes of each vertex along the animation curve. Specifically, this can include the following steps S606-1 to S606-4:
[0183] Step S606-1: Calculate the basis vector of the radial plane of the rotated curve based on the rotation angle data of the animation curve.
[0184] Specifically, this can be achieved through expressions 6.1 to 6.2 as follows:
[0185] BaseVector binormal =float3(0,sin(RotateAngle),cos(RotateAngle)) Expression 6.1
[0186] BaseVector normal =float3(0,sin(RotateAngle+90°),cos(RotateAngle+90°)) Expression 6.2
[0187] Among them, BaseVector binormal BaseVector represents the basis vector of the bitangential direction of the curve after rotation. normal Represents the basis vector of the curve's normal after rotation, and RotateAngle represents the curve's rotation angle data.
[0188] Step S606-2: Based on the width data of the animation curve, calculate the offset vector of each vertex of the fluid dynamic model in the radial plane of the curve after the width of each vertex of the fluid dynamic model is scaled along the animation curve.
[0189] Specifically, this can be achieved through the following expression 6.3:
[0190] Offset rPlant ′=Offset rPlant *Data thickness Expression 6.3
[0191] Among them, Offset rPlant ′ represents the offset vector of each vertex of the fluid dynamic model in the radial plane of the curve after the width of each vertex is scaled along the animation curve. rPlantThe offset vectors of each vertex of the fluid dynamic model in the radial plane of the curve are shown (obtained through expression 3.1). thickness This represents the width data of the curve (obtained via expression 5.6).
[0192] Step S606-3: Based on the offset vectors of each vertex of the scaled fluid dynamic model on the radial plane of the curve and the basis vectors of the radial plane of the curve after rotation, calculate the offset vectors of each vertex of the fluid dynamic model on the radial plane of the curve after rotation along the animation curve.
[0193] Specifically, this can be achieved through the following expression 6.4:
[0194] Offset rPlant " = Offset rPlant ′.x*BaseVector normal +Offset rPlant ′.y*0+Offset rPlant ′.z*BaseVector binormal Expression 6.4
[0195] Among them, Offset rPlant "" represents the offset vector of each vertex of the fluid dynamic model on the radial plane of the curve after rotational transformation. rPlant '.x' represents the x-component of the offset vector of each vertex of the fluid dynamic model on the radial plane of the curve after scaling the fluid dynamic model along the curve width (obtained through expression 6.3). rPlant '.y represents the y-component of the offset vector of each vertex of the fluid dynamic model on the radial plane of the curve after scaling the fluid dynamic model along the curve width (obtained through expression 6.3), Offset rPlant ′.z represents the z-component of the offset vector of each vertex of the fluid dynamic model in the radial plane of the curve after scaling the fluid dynamic model along the curve width (obtained through expression 6.3), BaseVector normal BaseVector represents the basis vector of the curve normal after rotation (obtained through expression 6.2). binormal The basis vector represents the secondary tangent of the curve after rotation (obtained through expression 6.1).
[0196] Step S606-4: Calculate the vertex coordinates of each vertex of the fluid dynamic model based on the coordinate data of the points on the curve corresponding to each vertex of the fluid dynamic model and the offset vector of each vertex of the fluid dynamic model on the radial plane of the curve after the rotation transformation of the fluid dynamic model.
[0197] Specifically, this can be achieved through the following expression 6.5:
[0198] Position=Data Pos +Offset rPlant Expression 6.5
[0199] Where Position represents the vertex coordinates of each vertex in the fluid dynamics model, and Data Pos The Offset represents the coordinate data of the points on the curve corresponding to each vertex of the fluid dynamic model (obtained through expression 5.2). rPlant "" represents the offset vector of each vertex of the fluid dynamic model on the radial plane of the curve after the fluid dynamic model is rotated (obtained through expression 6.4).
[0200] Step S607: Render fluid animation in the game application based on the rendering information of each vertex of the fluid dynamic model at each system time.
[0201] Specifically, based on the vertex coordinates of each vertex in the fluid dynamic model at each system time, the vertices of the fluid dynamic model are moved to the positions indicated by the vertex coordinates. Furthermore, based on the vertex transparency of each vertex in the fluid dynamic model at each system time, the visual appearance of each vertex is changed. This results in a highly realistic fluid animation where the fluid dynamic model moves along an animation curve and loops repeatedly.
[0202] It should be noted that when rendering fluid assets, different shading materials can be applied to create different forms of fluid animation, such as water-based fluid animation, lava-based fluid animation, etc.
[0203] The second embodiment described above provides an optional method for rendering virtual assets. This method allows the same virtual asset to display different effects depending on changes in the animation curve, thus achieving the reuse of virtual assets. It should be noted that the examples in the second embodiment are merely for illustrative purposes and are not intended to limit actual use. The virtual asset rendering method provided in this application includes, but is not limited to, the method described in the second embodiment.
[0204] The third embodiment of this application provides a device for generating virtual assets. Figure 7 This is a schematic diagram of the structure of the virtual asset generation device provided in this embodiment.
[0205] like Figure 7 As shown, the virtual asset generation device provided in this embodiment includes: a creation unit 701, an extraction unit 702, a generation unit 703, and a combination unit 704.
[0206] The creation unit 701 is used to create particle animation, in which multiple particles move along a preset particle motion path to form a particle flow.
[0207] Optionally, the creation of particle animation includes:
[0208] Obtain a pre-constructed particle motion path and generate a velocity field along the particle motion path, the particle motion path being associated with the type of the virtual asset;
[0209] The particle emitter is controlled to emit multiple particles, and the velocity field is applied to the multiple particles to make the multiple particles move along the particle motion path to form a particle stream.
[0210] Based on preset disturbance parameters, a force corresponding to the disturbance parameters is applied to the plurality of particles to adjust the shape of the particle flow to match the type of the virtual asset;
[0211] Generate particle animation.
[0212] The interception unit 702 is used to intercept a sub-particle stream of a preset length and obtain the sub-particle animation corresponding to the sub-particle stream from the particle animation, wherein the sub-particle stream is a local region in the particle stream.
[0213] Optionally, the process of intercepting a sub-particle stream of a preset length includes:
[0214] According to the preset interception rules, a local region of a preset length that conforms to the interception rules in the particle stream is intercepted and used as the sub-particle stream.
[0215] Optionally, the process of intercepting a sub-particle stream of a preset length includes:
[0216] A first sub-particle stream of a first length is extracted, the first length being less than the preset length, and the first sub-particle stream includes a first end and a second end;
[0217] The first sub-particle stream is copied to form a first copied sub-particle stream corresponding to the first sub-particle stream. The first copied sub-particle stream includes a third end and a fourth end. The third end is the same as the first end, and the fourth end is the same as the second end.
[0218] The first replica sub-particle stream is subjected to a mid-section severing operation, splitting the first replica sub-particle stream into a first part and a second part. The first part includes the third end and the severing part, and the second part includes the fourth end and the severing part.
[0219] The third end of the first part is spliced with the second end of the first sub-particle stream, and the fourth end of the second part is spliced with the first end of the first sub-particle stream to form the sub-particle stream of the preset length. The sub-particle stream includes a fifth end and a sixth end, both of which are cut-off portions.
[0220] The generation unit 703 is used to perform mesh transformation on the sub-particle flow, generate a mesh model corresponding to the sub-particle flow, determine the displacement information of each vertex of the mesh model according to the sub-particle animation, bake the displacement information of each vertex of the mesh model to a texture map, and generate a vertex animation texture map.
[0221] Optionally, the shape of the sub-particle flow at each time point in the sub-particle animation is different; the step of meshing the sub-particle flow to form a mesh model corresponding to the sub-particle flow includes:
[0222] The sub-particle flow corresponding to each time point in the sub-particle animation is transformed into a mesh to form a candidate mesh model corresponding to the sub-particle flow at each time point.
[0223] The candidate mesh model with the most mesh faces among the candidate mesh models is selected as the mesh model.
[0224] The combination unit 704 is used to combine the mesh model and the vertex animation texture map into the virtual asset.
[0225] The fourth embodiment of this application provides a rendering apparatus for virtual assets. Figure 8 This is a schematic diagram of the structure of the virtual asset rendering device provided in this embodiment.
[0226] like Figure 8 As shown, the virtual asset rendering device provided in this embodiment includes: an acquisition unit 801, a deformation unit 802, a collection unit 803, and a rendering unit 804.
[0227] The acquisition unit 801 is used to acquire virtual assets and curve texture maps corresponding to animation curves; wherein, the virtual assets are generated based on local cropping operations of particle animation, including mesh models and vertex animation texture maps, the animation curves are pre-constructed based on the animation to be rendered, and the curve texture maps store curve information corresponding to each point on the animation curve, the curve information including at least the coordinate data of each point on the animation curve.
[0228] The deformation unit 802 is used to render the dynamic model corresponding to the virtual asset based on the mesh model and vertex animation texture map included in the virtual asset, and control the dynamic model to deform along the animation curve.
[0229] Optionally, the step of rendering the dynamic model corresponding to the virtual asset based on the mesh model and vertex animation texture map included in the virtual asset, and controlling the deformation of the dynamic model along the animation curve, includes:
[0230] Based on the displacement information of each vertex of the mesh model recorded in the vertex animation texture map, each vertex of the mesh model is rendered to form the dynamic model;
[0231] The coordinate axes of each vertex of the dynamic model are mapped to the tangent, normal, and secondary tangent directions of the animation curve, so that the dynamic model deforms along the animation curve.
[0232] The acquisition unit 803 is used to determine the corresponding points of each vertex of the dynamic model on the animation curve at each time point, and to acquire the coordinate data of the corresponding points in the curve texture map.
[0233] Optionally, determining the corresponding points of each vertex of the dynamic model on the animation curve at each time point, and collecting the coordinate data of the corresponding points in the curve texture map, includes:
[0234] Based on the length of the dynamic model, the coordinates of each vertex of the dynamic model along the tangent of the animation curve are normalized to form the normalized coordinates of each vertex of the dynamic model along the tangent of the animation curve.
[0235] The fractional part of the sum of the normalized coordinates and the time value corresponding to each time point, and the storage location of the coordinate data in the curve texture map are used as the sampled coordinates of each vertex of the dynamic model at each time point, and the points on the curve corresponding to the sampled coordinates are the corresponding points of each vertex of the dynamic model on the animation curve.
[0236] Based on the sampled coordinates of each vertex of the dynamic model at each time point, the coordinate data corresponding to each vertex of the dynamic model is collected in the curve texture map.
[0237] The rendering unit 804 is used to change the position of each vertex of the dynamic model at each time point based on the coordinate data corresponding to each vertex of the dynamic model at the time point, so as to form an animation to be rendered in which the dynamic model moves cyclically along the animation curve.
[0238] Optionally, the curve information may also include transparency data at each point on the animation curve;
[0239] The step of determining the corresponding points of each vertex of the dynamic model on the animation curve at each time point, and collecting the coordinate data of the corresponding points in the curve texture map, includes:
[0240] Determine the corresponding points of each vertex of the dynamic model on the animation curve at each time point, and collect the coordinate data and transparency data of the corresponding points in the curve texture map;
[0241] The step of changing the position of each vertex of the dynamic model based on the coordinate data corresponding to each vertex of the dynamic model at each time point to form a rendering animation in which the dynamic model moves cyclically along the animation curve includes:
[0242] At each point in time, the position of each vertex of the dynamic model is changed based on the coordinate data corresponding to each vertex of the dynamic model at that point in time, and the transparency of each vertex of the dynamic model is changed based on the transparency data, so as to form an animation to be rendered in which the dynamic model moves cyclically along the animation curve.
[0243] Optionally, the curve information may also include width data of each point on the animation curve;
[0244] The step of determining the corresponding points of each vertex of the dynamic model on the animation curve at each time point, and collecting the coordinate data of the corresponding points in the curve texture map, includes:
[0245] Determine the corresponding points of each vertex of the dynamic model on the animation curve at each time point, and collect the coordinate data and width data of the corresponding points in the curve texture map;
[0246] The step of changing the position of each vertex of the dynamic model based on the coordinate data corresponding to each vertex of the dynamic model at each time point to form a rendering animation in which the dynamic model moves cyclically along the animation curve includes:
[0247] The coordinates of each vertex of the dynamic model along the normal and secondary tangential directions of the animation curve are used as the basic offsets of each vertex of the dynamic model on the radial plane of the animation curve.
[0248] Based on the width data corresponding to each vertex of the dynamic model at each time point, and the basic offset, calculate the first offset of each vertex of the dynamic model on the radial plane of the animation curve after scaling along the animation curve at each time point;
[0249] The sum of the coordinate data corresponding to each vertex of the dynamic model at each time point and the first offset is used as the first coordinate data corresponding to each vertex of the dynamic model at each time point;
[0250] At each point in time, the position of each vertex of the dynamic model is changed based on the first coordinate data corresponding to each vertex of the dynamic model at that point in time, forming an animation to be rendered in which the dynamic model moves cyclically along the animation curve.
[0251] Optionally, the curve information may also include the rotation angle data of the animation curve;
[0252] The step of determining the corresponding points of each vertex of the dynamic model on the animation curve at each time point, and collecting the coordinate data of the corresponding points in the curve texture map, includes:
[0253] Determine the corresponding points of each vertex of the dynamic model on the animation curve at each time point, and collect the coordinate data of the corresponding points and the rotation angle data of the animation curve in the curve texture map;
[0254] The step of changing the position of each vertex of the dynamic model based on the coordinate data corresponding to each vertex of the dynamic model at each time point to form a rendering animation in which the dynamic model moves cyclically along the animation curve includes:
[0255] The coordinates of each vertex of the dynamic model along the normal and secondary tangential directions of the animation curve are used as the basic offsets of each vertex of the dynamic model on the radial plane of the animation curve.
[0256] Based on the rotation angle data of the animation curve, the radial plane basis vector of the animation curve is calculated, and the radial plane basis vector includes the secondary tangential basis vector and the normal basis vector;
[0257] Based on the basic offset, the secondary tangential basis vector, and the normal basis vector, calculate the second offset of each vertex of the dynamic model on the radial plane of the animation curve after the dynamic model is rotated along the animation curve;
[0258] The sum of the coordinate data corresponding to each vertex of the dynamic model at each time point and the second offset is used as the second coordinate data corresponding to each vertex of the dynamic model at each time point;
[0259] At each point in time, the position of each vertex of the dynamic model is changed based on the second coordinate data corresponding to each vertex of the dynamic model at that point in time, forming an animation to be rendered in which the dynamic model moves cyclically along the animation curve.
[0260] Optionally, the apparatus further includes: a generation unit;
[0261] The generation unit is used to perform partial cropping operations on particle animation to generate the virtual asset.
[0262] The fifth embodiment of this application provides an electronic device. Figure 9 This is a schematic diagram of the structure of the electronic device provided in this embodiment.
[0263] like Figure 9 As shown, the electronic device provided in this embodiment includes: a memory 901 and a processor 902;
[0264] The memory 901 is used to store computer instructions for executing rendering methods of virtual assets.
[0265] The processor 902 is configured to execute computer instructions stored in the memory 901 to perform the following operations:
[0266] Obtain virtual assets and curve texture maps corresponding to animation curves; wherein, the virtual assets are generated based on local cropping operations of particle animation, including mesh models and vertex animation texture maps, the animation curves are pre-constructed based on the animation to be rendered, and the curve texture maps store curve information corresponding to each point on the animation curve, the curve information including at least the coordinate data of each point on the animation curve;
[0267] Based on the mesh model and vertex animation texture map included in the virtual asset, render the dynamic model corresponding to the virtual asset, and control the dynamic model to deform along the animation curve;
[0268] Determine the corresponding points of each vertex of the dynamic model on the animation curve at each time point, and collect the coordinate data of the corresponding points in the curve texture map;
[0269] At each point in time, the position of each vertex of the dynamic model is changed based on the coordinate data corresponding to each vertex of the dynamic model at that point in time, forming an animation to be rendered in which the dynamic model moves cyclically along the animation curve.
[0270] Optionally, before the step of obtaining the virtual asset and the curve texture map corresponding to the animation curve, the following is also performed: performing a partial cropping operation on the particle animation to generate the virtual asset;
[0271] The process of generating the virtual asset by performing a partial cropping operation on the particle animation includes:
[0272] Create a particle animation in which multiple particles move along a preset particle motion path to form a particle flow;
[0273] A sub-particle stream of a preset length is extracted, and the sub-particle animation corresponding to the sub-particle stream is obtained from the particle animation. The sub-particle stream is a local region in the particle stream.
[0274] The sub-particle flow is meshed to generate a mesh model corresponding to the sub-particle flow. Based on the sub-particle animation, the displacement information of each vertex of the mesh model is determined. The displacement information of each vertex of the mesh model is baked into a texture map to generate a vertex animation texture map.
[0275] The mesh model and the vertex animation texture map are combined to form the virtual asset.
[0276] Optionally, the creation of particle animation includes:
[0277] Obtain a pre-constructed particle motion path and generate a velocity field along the particle motion path, the particle motion path being associated with the type of the virtual asset;
[0278] The particle emitter is controlled to emit multiple particles, and the velocity field is applied to the multiple particles to make the multiple particles move along the particle motion path to form a particle stream.
[0279] Based on preset disturbance parameters, a force corresponding to the disturbance parameters is applied to the plurality of particles to adjust the shape of the particle flow to match the type of the virtual asset;
[0280] Generate particle animation.
[0281] Optionally, the process of intercepting a sub-particle stream of a preset length includes:
[0282] According to the preset interception rules, a local region of a preset length that conforms to the interception rules in the particle stream is intercepted and used as the sub-particle stream.
[0283] Optionally, the process of intercepting a sub-particle stream of a preset length includes:
[0284] A first sub-particle stream of a first length is extracted, the first length being less than the preset length, and the first sub-particle stream includes a first end and a second end;
[0285] The first sub-particle stream is copied to form a first copied sub-particle stream corresponding to the first sub-particle stream. The first copied sub-particle stream includes a third end and a fourth end. The third end is the same as the first end, and the fourth end is the same as the second end.
[0286] The first replica sub-particle stream is subjected to a mid-section severing operation, splitting the first replica sub-particle stream into a first part and a second part. The first part includes the third end and the severing part, and the second part includes the fourth end and the severing part.
[0287] The third end of the first part is spliced with the second end of the first sub-particle stream, and the fourth end of the second part is spliced with the first end of the first sub-particle stream to form the sub-particle stream of the preset length. The sub-particle stream includes a fifth end and a sixth end, both of which are cut-off portions.
[0288] Optionally, the shape of the sub-particle flow at each time point in the sub-particle animation is different; the step of meshing the sub-particle flow to form a mesh model corresponding to the sub-particle flow includes:
[0289] The sub-particle flow corresponding to each time point in the sub-particle animation is transformed into a mesh to form a candidate mesh model corresponding to the sub-particle flow at each time point.
[0290] The candidate mesh model with the most mesh faces among the candidate mesh models is selected as the mesh model.
[0291] Optionally, the step of rendering the dynamic model corresponding to the virtual asset based on the mesh model and vertex animation texture map included in the virtual asset, and controlling the deformation of the dynamic model along the animation curve, includes:
[0292] Based on the displacement information of each vertex of the mesh model recorded in the vertex animation texture map, each vertex of the mesh model is rendered to form the dynamic model;
[0293] The coordinate axes of each vertex of the dynamic model are mapped to the tangent, normal, and secondary tangent directions of the animation curve, so that the dynamic model deforms along the animation curve.
[0294] Optionally, determining the corresponding points of each vertex of the dynamic model on the animation curve at each time point, and collecting the coordinate data of the corresponding points in the curve texture map, includes:
[0295] Based on the length of the dynamic model, the coordinates of each vertex of the dynamic model along the tangent of the animation curve are normalized to form the normalized coordinates of each vertex of the dynamic model along the tangent of the animation curve.
[0296] The fractional part of the sum of the normalized coordinates and the time value corresponding to each time point, and the storage location of the coordinate data in the curve texture map are used as the sampled coordinates of each vertex of the dynamic model at each time point, and the points on the curve corresponding to the sampled coordinates are the corresponding points of each vertex of the dynamic model on the animation curve.
[0297] Based on the sampled coordinates of each vertex of the dynamic model at each time point, the coordinate data corresponding to each vertex of the dynamic model is collected in the curve texture map.
[0298] Optionally, the curve information may also include transparency data at each point on the animation curve;
[0299] The step of determining the corresponding points of each vertex of the dynamic model on the animation curve at each time point, and collecting the coordinate data of the corresponding points in the curve texture map, includes:
[0300] Determine the corresponding points of each vertex of the dynamic model on the animation curve at each time point, and collect the coordinate data and transparency data of the corresponding points in the curve texture map;
[0301] The step of changing the position of each vertex of the dynamic model based on the coordinate data corresponding to each vertex of the dynamic model at each time point to form a rendering animation in which the dynamic model moves cyclically along the animation curve includes:
[0302] At each point in time, the position of each vertex of the dynamic model is changed based on the coordinate data corresponding to each vertex of the dynamic model at that point in time, and the transparency of each vertex of the dynamic model is changed based on the transparency data, so as to form an animation to be rendered in which the dynamic model moves cyclically along the animation curve.
[0303] Optionally, the curve information may also include width data of each point on the animation curve;
[0304] The step of determining the corresponding points of each vertex of the dynamic model on the animation curve at each time point, and collecting the coordinate data of the corresponding points in the curve texture map, includes:
[0305] Determine the corresponding points of each vertex of the dynamic model on the animation curve at each time point, and collect the coordinate data and width data of the corresponding points in the curve texture map;
[0306] The step of changing the position of each vertex of the dynamic model based on the coordinate data corresponding to each vertex of the dynamic model at each time point to form a rendering animation in which the dynamic model moves cyclically along the animation curve includes:
[0307] The coordinates of each vertex of the dynamic model along the normal and secondary tangential directions of the animation curve are used as the basic offsets of each vertex of the dynamic model on the radial plane of the animation curve.
[0308] Based on the width data corresponding to each vertex of the dynamic model at each time point, and the basic offset, calculate the first offset of each vertex of the dynamic model on the radial plane of the animation curve after scaling along the animation curve at each time point;
[0309] The sum of the coordinate data corresponding to each vertex of the dynamic model at each time point and the first offset is used as the first coordinate data corresponding to each vertex of the dynamic model at each time point;
[0310] At each point in time, the position of each vertex of the dynamic model is changed based on the first coordinate data corresponding to each vertex of the dynamic model at that point in time, forming an animation to be rendered in which the dynamic model moves cyclically along the animation curve.
[0311] Optionally, the curve information may also include the rotation angle data of the animation curve;
[0312] The step of determining the corresponding points of each vertex of the dynamic model on the animation curve at each time point, and collecting the coordinate data of the corresponding points in the curve texture map, includes:
[0313] Determine the corresponding points of each vertex of the dynamic model on the animation curve at each time point, and collect the coordinate data of the corresponding points and the rotation angle data of the animation curve in the curve texture map;
[0314] The step of changing the position of each vertex of the dynamic model based on the coordinate data corresponding to each vertex of the dynamic model at each time point to form a rendering animation in which the dynamic model moves cyclically along the animation curve includes:
[0315] The coordinates of each vertex of the dynamic model along the normal and secondary tangential directions of the animation curve are used as the basic offsets of each vertex of the dynamic model on the radial plane of the animation curve.
[0316] Based on the rotation angle data of the animation curve, the radial plane basis vector of the animation curve is calculated, and the radial plane basis vector includes the secondary tangential basis vector and the normal basis vector;
[0317] Based on the basic offset, the secondary tangential basis vector, and the normal basis vector, calculate the second offset of each vertex of the dynamic model on the radial plane of the animation curve after the dynamic model is rotated along the animation curve;
[0318] The sum of the coordinate data corresponding to each vertex of the dynamic model at each time point and the second offset is used as the second coordinate data corresponding to each vertex of the dynamic model at each time point;
[0319] At each point in time, the position of each vertex of the dynamic model is changed based on the second coordinate data corresponding to each vertex of the dynamic model at that point in time, forming an animation to be rendered in which the dynamic model moves cyclically along the animation curve.
[0320] The sixth embodiment of this application provides a computer-readable storage medium, which includes computer instructions that, when executed by a processor, are used to implement the methods described in the embodiments of this application.
[0321] It should be noted that the relational terms such as "first" and "second" used in this document are only used to distinguish one entity or operation from another, and do not require or imply any actual relationship or order between these entities or operations. Furthermore, "including," "having," "containing," and other similar terms are synonymous, and the conclusion of any one or more items following any of the foregoing words is open-ended; none of the foregoing terms indicates that the one or more items have been exhaustively listed, or are limited to only one or more of the listed items.
[0322] When used herein, unless otherwise expressly stated, the term "or" includes all possible combinations except those that are impractical. For example, if expressed as a database may include A or B, then unless otherwise specified or impractical, it may include database A, or B, or A and B. As a second example, if expressed as a database may include A, B, or C, then unless otherwise specified or impractical, the database may include database A, or B, or C, or A and B, or A and C, or B and C, or A and B and C.
[0323] It is worth noting that the above embodiments can be implemented by hardware or software (program code), or a combination of hardware and software. If implemented by software, it can be stored in the above-described computer-readable medium. When executed by a processor, the software can perform the methods disclosed above. The computing units and other functional units described in this disclosure can be implemented by hardware or software, or a combination of hardware and software. Those skilled in the art will also understand that the above-described multiple modules / units can be combined into one module / unit, and each of the above-described modules / units can be further divided into multiple sub-modules / sub-units.
[0324] In the foregoing detailed description, embodiments have been described with reference to numerous specific details, which may vary depending on the implementation. Certain adaptations and modifications can be made to the embodiments. Other implementations will be readily apparent to those skilled in the art from the specific embodiments disclosed herein. This specification and examples are for illustrative purposes only, and the true scope and essence of this application are defined by the claims. The sequence of steps shown in the figures is also for illustrative purposes only and is not intended to limit to any particular step or order. Therefore, those skilled in the art will recognize that these steps can be performed in different orders when implementing the same method.
[0325] Exemplary embodiments are disclosed in the figures and detailed description of this application. However, many variations and modifications can be made to these embodiments. Accordingly, although specific terms are used, they are only general and descriptive and not for limiting purposes.
Claims
1. A method for rendering virtual assets, characterized in that, The method includes: Obtain virtual assets and curve texture maps corresponding to animation curves; wherein, the virtual assets are generated based on local cropping operations of particle animation, including mesh models and vertex animation texture maps, the animation curves are pre-constructed based on the animation to be rendered, and the curve texture maps store curve information corresponding to each point on the animation curve, the curve information including at least the coordinate data of each point on the animation curve; Based on the mesh model and vertex animation texture map included in the virtual asset, render the dynamic model corresponding to the virtual asset, and control the dynamic model to deform along the animation curve; Determine the corresponding points of each vertex of the dynamic model on the animation curve at each time point, and collect the coordinate data of the corresponding points in the curve texture map; At each point in time, the position of each vertex of the dynamic model is changed based on the coordinate data corresponding to each vertex of the dynamic model at that point in time, forming an animation to be rendered in which the dynamic model moves cyclically along the animation curve.
2. The method according to claim 1, characterized in that, Before the step of obtaining the virtual asset and the curve texture map corresponding to the animation curve, the method further includes: performing a partial cropping operation on the particle animation to generate the virtual asset; The process of generating the virtual asset by performing a partial cropping operation on the particle animation includes: Create a particle animation in which multiple particles move along a preset particle motion path to form a particle flow; A sub-particle stream of a preset length is extracted, and the sub-particle animation corresponding to the sub-particle stream is obtained from the particle animation. The sub-particle stream is a local region in the particle stream. The sub-particle flow is meshed to generate a mesh model corresponding to the sub-particle flow. Based on the sub-particle animation, the displacement information of each vertex of the mesh model is determined. The displacement information of each vertex of the mesh model is baked into a texture map to generate a vertex animation texture map. The mesh model and the vertex animation texture map are combined to form the virtual asset.
3. The method according to claim 2, characterized in that, The creation of particle animation includes: Obtain a pre-constructed particle motion path and generate a velocity field along the particle motion path, the particle motion path being associated with the type of the virtual asset; The particle emitter is controlled to emit multiple particles, and the velocity field is applied to the multiple particles to make the multiple particles move along the particle motion path to form a particle stream. Based on preset disturbance parameters, a force corresponding to the disturbance parameters is applied to the plurality of particles to adjust the shape of the particle flow to match the type of the virtual asset; Generate particle animation.
4. The method according to claim 2, characterized in that, The process of intercepting a sub-particle stream of a preset length includes: According to the preset interception rules, a local region of a preset length that conforms to the interception rules in the particle stream is intercepted and used as the sub-particle stream.
5. The method according to claim 2, characterized in that, The process of intercepting a sub-particle stream of a preset length includes: A first sub-particle stream of a first length is extracted, the first length being less than the preset length, and the first sub-particle stream includes a first end and a second end; The first sub-particle stream is copied to form a first copied sub-particle stream corresponding to the first sub-particle stream. The first copied sub-particle stream includes a third end and a fourth end. The third end is the same as the first end, and the fourth end is the same as the second end. The first replica sub-particle stream is subjected to a mid-section severing operation, splitting the first replica sub-particle stream into a first part and a second part. The first part includes the third end and the severing part, and the second part includes the fourth end and the severing part. The third end of the first part is spliced with the second end of the first sub-particle stream, and the fourth end of the second part is spliced with the first end of the first sub-particle stream to form the sub-particle stream of the preset length. The sub-particle stream includes a fifth end and a sixth end, both of which are cut-off portions.
6. The method according to claim 2, characterized in that, The sub-particle flow has a different shape at each time point in the sub-particle animation; the step of meshing the sub-particle flow to form a mesh model corresponding to the sub-particle flow includes: The sub-particle flow corresponding to each time point in the sub-particle animation is transformed into a mesh to form a candidate mesh model corresponding to the sub-particle flow at each time point. The candidate mesh model with the most mesh faces among the candidate mesh models is selected as the mesh model.
7. The method according to claim 1, characterized in that, The step of rendering the dynamic model corresponding to the virtual asset based on the mesh model and vertex animation texture map included in the virtual asset, and controlling the deformation of the dynamic model along the animation curve, includes: Based on the displacement information of each vertex of the mesh model recorded in the vertex animation texture map, each vertex of the mesh model is rendered to form the dynamic model; The coordinate axes of each vertex of the dynamic model are mapped to the tangent, normal, and secondary tangent directions of the animation curve, so that the dynamic model deforms along the animation curve.
8. The method according to claim 1, characterized in that, The step of determining the corresponding points of each vertex of the dynamic model on the animation curve at each time point, and collecting the coordinate data of the corresponding points in the curve texture map, includes: Based on the length of the dynamic model, the coordinates of each vertex of the dynamic model along the tangent of the animation curve are normalized to form the normalized coordinates of each vertex of the dynamic model along the tangent of the animation curve. The fractional part of the sum of the normalized coordinates and the time value corresponding to each time point, and the storage location of the coordinate data in the curve texture map are used as the sampled coordinates of each vertex of the dynamic model at each time point, and the points on the curve corresponding to the sampled coordinates are the corresponding points of each vertex of the dynamic model on the animation curve. Based on the sampled coordinates of each vertex of the dynamic model at each time point, the coordinate data corresponding to each vertex of the dynamic model is collected in the curve texture map.
9. The method according to claim 1, characterized in that, The curve information also includes transparency data for each point on the animation curve; The step of determining the corresponding points of each vertex of the dynamic model on the animation curve at each time point, and collecting the coordinate data of the corresponding points in the curve texture map, includes: Determine the corresponding points of each vertex of the dynamic model on the animation curve at each time point, and collect the coordinate data and transparency data of the corresponding points in the curve texture map; The step of changing the position of each vertex of the dynamic model based on the coordinate data corresponding to each vertex of the dynamic model at each time point to form a rendering animation in which the dynamic model moves cyclically along the animation curve includes: At each point in time, the position of each vertex of the dynamic model is changed based on the coordinate data corresponding to each vertex of the dynamic model at that point in time, and the transparency of each vertex of the dynamic model is changed based on the transparency data, so as to form an animation to be rendered in which the dynamic model moves cyclically along the animation curve.
10. The method according to claim 1, characterized in that, The curve information also includes the width data of each point on the animation curve; The step of determining the corresponding points of each vertex of the dynamic model on the animation curve at each time point, and collecting the coordinate data of the corresponding points in the curve texture map, includes: Determine the corresponding points of each vertex of the dynamic model on the animation curve at each time point, and collect the coordinate data and width data of the corresponding points in the curve texture map; The step of changing the position of each vertex of the dynamic model based on the coordinate data corresponding to each vertex of the dynamic model at each time point to form a rendering animation in which the dynamic model moves cyclically along the animation curve includes: The coordinates of each vertex of the dynamic model along the normal and secondary tangential directions of the animation curve are used as the basic offsets of each vertex of the dynamic model on the radial plane of the animation curve. Based on the width data corresponding to each vertex of the dynamic model at each time point, and the basic offset, calculate the first offset of each vertex of the dynamic model on the radial plane of the animation curve after scaling along the animation curve at each time point; The sum of the coordinate data corresponding to each vertex of the dynamic model at each time point and the first offset is used as the first coordinate data corresponding to each vertex of the dynamic model at each time point; At each point in time, the position of each vertex of the dynamic model is changed based on the first coordinate data corresponding to each vertex of the dynamic model at that point in time, forming an animation to be rendered in which the dynamic model moves cyclically along the animation curve.
11. The method according to claim 1, characterized in that, The curve information also includes the rotation angle data of the animation curve; The step of determining the corresponding points of each vertex of the dynamic model on the animation curve at each time point, and collecting the coordinate data of the corresponding points in the curve texture map, includes: Determine the corresponding points of each vertex of the dynamic model on the animation curve at each time point, and collect the coordinate data of the corresponding points and the rotation angle data of the animation curve in the curve texture map; The step of changing the position of each vertex of the dynamic model based on the coordinate data corresponding to each vertex of the dynamic model at each time point to form a rendering animation in which the dynamic model moves cyclically along the animation curve includes: The coordinates of each vertex of the dynamic model along the normal and secondary tangential directions of the animation curve are used as the basic offsets of each vertex of the dynamic model on the radial plane of the animation curve. Based on the rotation angle data of the animation curve, the radial plane basis vector of the animation curve is calculated, and the radial plane basis vector includes the secondary tangential basis vector and the normal basis vector; Based on the basic offset, the secondary tangential basis vector, and the normal basis vector, calculate the second offset of each vertex of the dynamic model on the radial plane of the animation curve after the dynamic model is rotated along the animation curve; The sum of the coordinate data corresponding to each vertex of the dynamic model at each time point and the second offset is used as the second coordinate data corresponding to each vertex of the dynamic model at each time point; At each point in time, the position of each vertex of the dynamic model is changed based on the second coordinate data corresponding to each vertex of the dynamic model at that point in time, forming an animation to be rendered in which the dynamic model moves cyclically along the animation curve.
12. A rendering apparatus for virtual assets, characterized in that, The device includes: an acquisition unit, a deformation unit, a collection unit, and a rendering unit; The acquisition unit is used to acquire virtual assets and curve texture maps corresponding to animation curves; wherein, the virtual assets are generated based on local cropping operations of particle animation, including mesh models and vertex animation texture maps, the animation curves are pre-constructed based on the animation to be rendered, and the curve texture maps store curve information corresponding to each point on the animation curve, the curve information including at least the coordinate data of each point on the animation curve; The deformation unit is used to render the dynamic model corresponding to the virtual asset based on the mesh model and vertex animation texture map included in the virtual asset, and control the dynamic model to deform along the animation curve; The acquisition unit is used to determine the corresponding points of each vertex of the dynamic model on the animation curve at each time point, and to acquire the coordinate data of the corresponding points in the curve texture map; The rendering unit is used to change the position of each vertex of the dynamic model at each time point based on the coordinate data corresponding to each vertex of the dynamic model at the time point, so as to form an animation to be rendered in which the dynamic model moves cyclically along the animation curve.
13. An electronic device, characterized in that, include: Memory, processor; The memory is used to store one or more computer instructions; The processor is configured to execute one or more computer instructions to implement the method as described in any one of claims 1-11.
14. A computer-readable storage medium storing one or more computer instructions thereon, characterized in that, When this instruction is executed by the processor, it performs the method as described in any one of claims 1-11.
Citation Information
Patent Citations
Special-effect deformation vertex animation generation method and device, equipment and storage medium
CN117173296A
Image rendering method and apparatus
US20230073574A1