Vertex animation processing method, device and electronic equipment

By obtaining vertex animation textures and drawing render target textures to generate mask maps, the problem of difficult vertex animation interaction is solved, and dynamic interaction and flexible control of partial areas in large-area models are achieved.

CN114627214BActive Publication Date: 2025-09-16NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210189612.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-28
Publication Date
2025-09-16
Estimated Expiration
2042-02-28

AI Technical Summary

Technical Problem

In the existing technology, the interactive method of vertex animation is difficult to achieve real-time control and dynamic interaction in large-area models, and the pre-defined animation effects are fixed, making it impossible to flexibly control the vertex animation of a specific area.

Method used

By obtaining the vertex animation texture of the target model, determining the interaction area, drawing a preset pattern to obtain the rendering target texture, and generating a mask map based on the rendering target texture, the mask map is used to offset the vertices of the target model to achieve dynamic interaction in some areas of the target model.

Benefits of technology

It realizes the dynamic interaction of vertex animation in some areas of the target model, calculates the interaction dynamics in real time, solves the problem of difficult vertex animation interaction, and enhances the interactive flexibility and dynamic effect of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114627214B_ABST
    Figure CN114627214B_ABST
Patent Text Reader

Abstract

The present invention provides a vertex animation processing method, device, and electronic device, which obtain the vertex animation texture of a target model; in response to an interactive operation between a controlled interactive model and a target model, determine a first interactive area on the target model, draw a preset pattern on a rendering area corresponding to the first interactive area in a preset rendering target, and obtain a rendering target texture; based on the rendering target texture, determine a first mask map of the target model; and offset the vertices of the target model according to the first mask map and the vertex animation texture to obtain a second animation frame of the first interactive area in the target model. In this method, by determining the first interactive area, the interactive dynamics of the target model can be calculated in real time, the dynamic interactive area of ​​the target model is recorded by the preset rendering target, and the first interactive area of ​​the target model is made optional and controllable by the first mask map, thereby realizing dynamic interaction of vertex animation in a partial area of ​​the target model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer three-dimensional technology, and in particular to a vertex animation processing method, device and electronic equipment. Background Art

[0002] Vertex animation is to stretch the vertices of the model vertex by vertex using coordinate transformation, and obtain the deformation animation of the model's mesh through the vertex changes between each frame. In game production and actual game operation, it is usually necessary to interact with the established vertex animation in real time. In the related art, the different deformation states of the model are recorded by different frame numbers, and then the frame number of the vertex animation is manipulated in real time to achieve the purpose of simple manipulation of vertex animation and simple interaction. Alternatively, according to the animation information of the vertices of the pre-set vertex animation effect, a vertex animation texture is produced in the three-dimensional software, and the vertex change information recorded in the vertex animation texture is used to achieve a frame-by-frame animation effect. However, the animation effects obtained in the above method are almost fixed, and it is impossible to control the vertex animation of the real-time interactive area in a large-area model. Summary of the Invention

[0003] In view of this, an object of the present invention is to provide a vertex animation processing method, device and electronic device, which can control the vertex animation of a partial area in a target model in real time.

[0004] In a first aspect, an embodiment of the present invention provides a method for processing vertex animation, the method comprising: obtaining a vertex animation texture of a target model; wherein the vertex animation texture stores position information and / or rotation information of vertices in the target model in the first animation frame; determining a first interaction area on the target model in response to an interaction operation between a controlled interaction model and the target model; obtaining a rendering area corresponding to the first interaction area from a preset rendering target, drawing a preset pattern in the rendering area, and obtaining a rendering target texture; determining a first mask map of the target model based on the rendering target texture; performing vertex offset processing on the vertices of the first interaction area in the target model in the first animation frame according to the first mask map and the vertex animation texture, and obtaining a second animation frame of the first interaction area in the target model.

[0005] Furthermore, a rendering area corresponding to the first interactive area is obtained from a preset rendering target, and a preset pattern is drawn in the rendering area to obtain a rendering target texture, including: obtaining the rendering area from the preset rendering target based on a position correspondence between a position point on the surface of the target model and a position point of the preset rendering target; determining UV coordinates of mapping the preset pattern to the rendering area based on the position coordinates of the rendering area, the position coordinates of the first interactive area, and preset texture scaling parameters; and drawing the preset pattern to the rendering area based on the UV coordinates to obtain a rendering target texture.

[0006] Furthermore, the pixels of the area of ​​the preset pattern in the rendering target texture are first pixel values, and the pixels of the area other than the area of ​​the preset pattern are second pixel values; based on the rendering target texture, the step of determining the first mask map of the target model includes: obtaining the first mask map of the target model according to the first pixel value corresponding to the first interactive area in the rendering target texture, and the second pixel value corresponding to the area other than the first interactive area.

[0007] Furthermore, the step of obtaining a first mask image of the target model according to the first pixel value corresponding to the first interactive area in the rendering target texture and the second pixel value corresponding to the area other than the first interactive area includes: Among them, RTColOrigin represents the first mask image, including the first pixel value and the second pixel value; RTTex represents the rendering target texture; Wpos.xy represents the world coordinate position information of the target model; RTScale represents the size of the preset rendering target; SampleBias represents the UV offset parameter; Sample() is the sampling function.

[0008] Furthermore, the first pixel value includes at least a first numerical value and a second numerical value; in the preset rendering target, the pixels in the central area of ​​the preset pattern are the first numerical value, and the pixels in the edge area of ​​the central area of ​​the preset pattern are the second numerical value; wherein the first numerical value is greater than the second numerical value, and the second numerical value is greater than the second pixel value.

[0009] Furthermore, after the step of determining the first mask map of the target model based on the rendering target texture, the method also includes: offsetting the preset pattern in the rendering target texture according to preset offset parameters to obtain the mask map of the offset rendering target texture; obtaining the second mask map of the rendering target texture based on the mask map of the offset rendering target texture and the first mask map; wherein the second mask map includes the area of ​​the preset pattern and the offset area after the preset pattern is offset; and determining the third mask map of the target model based on the second mask map and the first mask map.

[0010] Furthermore, according to a preset offset parameter, the preset pattern in the rendering target texture is offset to obtain a mask map of the offset rendering target texture, including: according to the offset direction and offset distance indicated by the offset parameter, the preset pattern in the rendering target texture is offset in the offset direction by the above-mentioned offset distance to obtain the offset rendering target texture; wherein the offset direction includes at least: the positive direction of the UV X-axis, the positive direction of the UV Y-axis, the negative direction of the UV X-axis, and the negative direction of the UV Y-axis; according to the pixel values ​​corresponding to the second interactive area in the offset rendering target texture, and the pixel values ​​corresponding to the area other than the second interactive area in the rendering target texture, the mask map of the offset rendering target texture is obtained; wherein the second interactive area includes the first interactive area and the edge area of ​​the first interactive area, and the edge area is the area corresponding to the offset area after the preset pattern is offset.

[0011] Furthermore, the offset mask map of the rendering target texture includes multiple mask maps; the step of obtaining the second mask map of the rendering target texture based on the offset mask map of the rendering target texture and the first mask map includes: adding the pixel values ​​of corresponding positions in the multiple offset mask maps of the rendering target texture, and subtracting the pixel values ​​of corresponding positions in the first mask map of the rendering target texture to obtain the second mask map of the rendering target texture.

[0012] Furthermore, the step of determining a third mask map of the target model based on the second mask map and the first mask map includes: Among them, RTColMulti represents the third mask image, including the pixel values ​​corresponding to the second interactive area and the pixel values ​​of the area other than the second interactive area; the second interactive area includes the first interactive area and the edge area of ​​the first interactive area, and the edge area is the area corresponding to the offset area after the preset pattern is offset; RTColOrigin represents the first mask image; RTCol(Offset n ) represents the second mask image, Offset n Indicates the nth area range corresponding to the edge area of ​​the first interactive area in the second interactive area, Offset n >Offset n-1 ;ω is the first coefficient that controls the pixel value corresponding to the first interactive area;φ i is the second coefficient corresponding to the mask image of the edge area of ​​the first interactive area corresponding to the i-th area range.

[0013] Furthermore, according to the first mask image and the vertex animation texture, vertex offset processing is performed on the vertices of the first interactive area in the target model in the first animation frame to obtain the second animation frame of the first interactive area in the target model, including: obtaining the position information and / or rotation information of the first animation frame in the vertex animation texture; according to the first mask image and the preset coordinate scaling vector, offsetting the position information and / or rotation information of the vertices of the first interactive area in the target model in the first animation frame by the pixel values ​​of the first interactive area in the first mask image through a preset vertex offset function to obtain the second animation frame of the first interactive area in the target model.

[0014] Furthermore, after the step of determining the third mask map of the target model based on the second mask map and the first mask map, the method also includes: updating the pixel values ​​corresponding to the edge area of ​​the second interaction area in the third mask map by updating the second coefficient to obtain an updated third mask map; performing vertex offset processing on the vertices of the second interaction area in the target model according to the updated third mask map and the vertex animation texture to obtain a third animation frame of the second interaction area in the target model.

[0015] Furthermore, the vertex animation texture also stores position information and / or rotation information of vertices in the target model in multiple animation frames; after determining the first mask map of the target model based on the rendering target texture, the method also includes: determining the key frame of the first mask map according to the first pixel value corresponding to the first interactive area in the first mask map; determining the pixel value corresponding to the first interactive area in the key frame as the first pixel value, and determining the pixel value corresponding to the area other than the first interactive area in the key frame as the second pixel value; wherein, the first interactive area of ​​the target model is an operable area, and the area other than the first interactive area is a non-operating area; according to the key frame, the frame number of the key frame corresponding to the target model is updated to determine the vertex animation of the first interactive area in the target model.

[0016] In a second aspect, an embodiment of the present invention provides a vertex animation processing device, the device comprising: an acquisition module for acquiring a vertex animation texture of a target model; wherein the vertex animation texture stores position information and / or rotation information of vertices in the target model in the first animation frame; a drawing module for determining a first interaction area on the target model in response to an interaction operation between a controlled interaction model and the target model; obtaining a rendering area corresponding to the first interaction area from a preset rendering target, drawing a preset pattern in the rendering area, and obtaining a rendering target texture; a determination module for determining a first mask map of the target model based on the rendering target texture; a processing module for performing update processing according to the first mask map and the vertex animation texture, performing vertex offset processing on the vertices of the first interaction area in the target model in the first animation frame, and obtaining a second animation frame of the first interaction area in the target model.

[0017] In a third aspect, an embodiment of the present invention provides an electronic device comprising a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the vertex animation processing method of any one of the first aspects.

[0018] In a fourth aspect, an embodiment of the present invention provides a machine-readable storage medium, which stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the vertex animation processing method of any one of the first aspects.

[0019] The embodiments of the present invention bring the following beneficial effects:

[0020] The present invention provides a vertex animation processing method, device, and electronic device, which obtain the vertex animation texture of a target model; in response to an interactive operation between a controlled interactive model and a target model, determine a first interactive area on the target model, draw a preset pattern on a rendering area corresponding to the first interactive area in a preset rendering target, and obtain a rendering target texture; based on the rendering target texture, determine a first mask map of the target model; and offset the vertices of the target model according to the first mask map and the vertex animation texture to obtain a second animation frame of the first interactive area in the target model. In this method, by determining the first interactive area, the interactive dynamics of the target model can be calculated in real time, the dynamic interactive area of ​​the target model is recorded by the preset rendering target, and the first interactive area of ​​the target model is made optional and controllable by the first mask map, thereby realizing dynamic interaction of vertex animation in a partial area of ​​the target model.

[0021] Other features and advantages of the present invention will be described in the following description, and in part will become apparent from the description, or understood by practicing the present invention. The purposes and other advantages of the present invention are realized and obtained by the structures particularly pointed out in the description, claims and drawings.

[0022] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the specific embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.

[0024] Figure 1A flowchart of a vertex animation processing method provided by an embodiment of the present invention;

[0025] Figure 2 A schematic diagram of a preset pattern provided by an embodiment of the present invention;

[0026] Figure 3 A schematic diagram of drawing a rendering target texture provided by an embodiment of the present invention;

[0027] Figure 4 A schematic diagram of another rendering target texture provided by an embodiment of the present invention;

[0028] Figure 5 A schematic diagram of different range areas in an edge area provided by an embodiment of the present invention;

[0029] Figure 6 A schematic diagram of vertex offsets in different ranges of an edge region provided by an embodiment of the present invention;

[0030] Figure 7 A third mask diagram and trajectory schematic diagram provided by an embodiment of the present invention;

[0031] Figure 8 A schematic structural diagram of a vertex animation processing device provided by an embodiment of the present invention;

[0032] Figure 9 A schematic structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0033] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work shall fall within the scope of protection of the present invention.

[0034] Vertex animation involves stretching vertices vertex by vertex using coordinate transformations, creating a deformation animation of the target mesh through the vertex changes between frames. Currently, most common vertex animations are performed in the vertex shader on the GPU (Graphics Processing Unit), where vertices are stretched and transformed using a predefined method. Alternatively, a Vertex Animation Texture (VAT) can be used. Vertex animation textures encode vertex animation information within the texture. During use, the texture can be decoded to obtain the frame-by-frame position and rotation information of each vertex of the model, thereby achieving a predefined model vertex animation effect. However, this predefined vertex animation effect can simulate the dynamic changes of the model using a fixed animation sequence, reducing the physical calculation overhead in real-time rendering and saving computational costs. However, because vertex animation is predefined, this method limits the deformation effect of the model for each frame, making it difficult to achieve dynamic model deformation effects while simultaneously interacting with the real-time rendering.

[0035] Furthermore, if you want to interact with a given vertex animation in real time, related techniques typically record the different deformation states of the model at different frame rates during vertex animation production. By manipulating the frame rate of the vertex animation in real time, you can achieve simple manipulation of the vertex animation and thus simple interaction. Alternatively, when using vertex animation textures, you can deform the model to offset the model's vertices during the animation, thereby changing the given animation trajectory.

[0036] However, importing large-area model animations into the engine consumes a lot of resources, and the engine also has an upper limit on the number of triangles that can be imported. The animations obtained by vertex animation technology are almost all fixed dynamics and very restrictive. If the dynamics of model deformation are controlled by manipulating the frame number of the vertex animation texture, the limitations of vertex animation are not fundamentally changed, and it can only switch between established forms. If the vertex animation is manipulated by deformation, it is almost a matter of displacing, rotating, and scaling the model as a whole, or performing deformation operations such as bending and twisting according to certain rules. This method is limited to the interaction of partial areas of the model according to specific rules such as the UV or local coordinates of the model to obtain local interaction areas. If you want to select and manipulate specific areas according to user needs, it is difficult to achieve. Based on this, an embodiment of the present invention provides a method, device, and electronic device for processing vertex animation. This technology can be applied to devices with vertex animation production functions, especially graphics processors.

[0037] To facilitate understanding of this embodiment, a method for processing vertex animation disclosed in an embodiment of the present invention is first introduced in detail. Figure 1As shown, the method includes the following steps:

[0038] Step S102, obtaining a vertex animation texture of the target model; wherein the vertex animation texture stores position information and / or rotation information of vertices in the target model in the first animation frame;

[0039] The target model mentioned above typically refers to a virtual model used during game development or actual game execution. This virtual model is typically any mesh model associated with vertex animation, such as a virtual snow model, a virtual ice model, or virtual leaves. The vertex animation texture is used to store the target model's animation as texture information. This is typically read and modified in the vertex shader to achieve complex dynamic effects such as soft bodies, shattering, and liquids with minimal rendering overhead.

[0040] It is understandable that the vertex animation texture stores the position information of the vertices in the target model in the first animation frame, or the vertex animation texture stores the rotation information of the vertices in the target model in the first animation frame, or the vertex animation texture stores the position information and rotation information of the vertices in the target model in the first animation frame. In this embodiment, the vertex animation texture stores the position information and rotation information of the vertices in the target model in the first animation frame, wherein the first animation frame can be a random frame of animation in a certain animation of the target model, or it can be the initial animation frame. The first animation frame can be used as the basic form, and the target model maintains the form of the current frame, which is convenient for observing the dynamic interaction effect. Of course, the above-mentioned vertex animation texture can also store the position information and rotation information of the vertices in the target model in other animation frames. Generally, after using the vertex animation texture, different vertices can have different forms in different animation frames. Specifically, the vertex animation of the target model is usually encoded in the vertex animation texture in advance.

[0041] It should be noted that the difference between storing the position and rotation information of one frame and storing the position and rotation information of multiple frames in the vertex animation texture is that the multi-frame animation can switch the target model between the animation effects of different frames by calling, while a single frame will always keep the model in a specific animation state.

[0042] Step S104, in response to the controlled interaction model interacting with the target model, determining a first interaction area on the target model; obtaining a rendering area corresponding to the first interaction area from a preset rendering target, drawing a preset pattern in the rendering area, and obtaining a rendering target texture;

[0043] The aforementioned controlled interaction model typically refers to an object controlled by a user or player, such as a mouse-controlled brush, a keyboard-controlled character or vehicle, etc. A controlled interaction model is used instead of a physical medium (mouse, keyboard) to perform specific interactive operations. The aforementioned interactive operations typically refer to real-time interaction with vertex animations, often manifested in game production or actual game play. These include, but are not limited to, using a mouse or keyboard to control the entire or partial target model. For example, using a mouse instead of a brush to draw a portion of a target model to produce effects such as growth and expansion that differ from the original vertex animation, or using a keyboard to control certain characters or vehicles to collide with the target model to produce effects such as destruction that differ from the current animation.

[0044] The aforementioned first interaction area is typically determined based on the actual scenario. Different scenarios may produce different first interaction areas. This can be the contact area between the controlled interaction model and the target model, or the interaction area corresponding to the interaction dynamics generated after the controlled interaction area and the target model interact. For example, when a virtual vehicle passes by the ground at high speed, the leaves on the ground will move due to the vehicle's movement. In this case, the interaction area is not the contact area between the vehicle and the leaves (because the leaves and the vehicle are not in direct contact), but the entire surface of the leaves. For another example, if a bullet hole is drilled in the wall, the interaction area is the bullet impact point; if footprints are to be generated on a muddy road based on the movement trajectory, the walking trajectory is the interaction area; if drawing on a canvas, the brush drawing area is the interaction area, etc.

[0045] The above-mentioned preset rendering target refers to RT: the full name is Render target. In the field of computer graphics, the rendering target allows the 3D scene to be rendered into an intermediate storage buffer or a rendering target texture, and then the rendering target can be used by the pixel shader to merge with our final effect. Rendering targets are often used in games to record motion trajectories, draw weight patterns, and other cases. In this embodiment, the size of the preset rendering target is usually consistent with the size of the expanded view of the target model. After determining the first interactive area on the target model, the rendering area corresponding to the first interactive area can be determined on the preset rendering target based on the one-to-one correspondence between the target model and the preset rendering target.

[0046] The above preset patterns are usually GPU customized patterns, such as circles, rectangles, etc., or they can be customized patterns, such as chariots or warships, etc. Figure 2 The preset pattern shown, Figure 2 (a) is a circular pattern. Figure 2(b) in the figure is a chariot-shaped pattern. This customized pattern can also be the basic outline of the hand-controlled interaction model, which will make the dynamic interaction effect more realistic. In actual implementation, when the controlled interaction model interacts with the target model, first, the first interaction area of ​​the interaction operation is determined on the target model, and then the rendering area corresponding to the first interaction area is determined in the preset rendering target, which can be determined specifically according to the correspondence between the position coordinates. Then, the preset pattern can be drawn in the rendering area of ​​the preset rendering target by sampling, which can be drawn specifically by coordinate mapping. Finally, the rendering target texture is obtained, which records the first interaction area corresponding to the interaction operation.

[0047] In fact, when drawing a preset pattern in the rendering area, the edge color transition can be performed through programmatic processing or edge feathering image processing methods. The purpose is to use an overlay drawing method when drawing the preset pattern. The weight of the interactive area can be used. When the number of interactions increases, the pixel value corresponding to the interactive area will be larger, and the real-time changing pixel value of the rendering target texture will also increase the real-time dynamic interaction effect of the model, so that interactive animation can be automatically generated without the help of vertex animation texture.

[0048] Step S106, determining a first mask image of the target model based on the rendering target texture;

[0049] In practice, the pixel values ​​of the pixels corresponding to the first interactive area in the rendering target texture are different from the pixel values ​​of the pixels corresponding to the non-interactive area in the rendering target texture. Typically, the pixel values ​​corresponding to the non-interactive area in the rendering target texture are 0, while the pixel values ​​corresponding to the first interactive area are greater than 0 and less than or equal to 1. Specifically, a first mask map of the target model can be determined based on the pixel values ​​at each position in the rendering target texture. In the first mask map, regions with pixel values ​​greater than 0 correspond to the first interactive area, and regions with pixel values ​​equal to 0 correspond to the non-interactive area.

[0050] Step S108 , performing vertex offset processing on the vertices of the first interactive area in the target model in the first animation frame according to the first mask image and the vertex animation texture, to obtain a second animation frame of the first interactive area in the target model.

[0051] Specifically, the vertices of the first interactive area in the target model in the first animation frame can be updated based on the pixel value of each pixel point in the first mask image and the position information and rotation information of the vertices of the first interactive area stored in the vertex animation texture in the first animation frame. Specifically, the position information and rotation information of the first animation frame in the target model can be offset based on the pixel value in the first mask image to obtain the second animation frame of the target model. Among them, compared with the first animation frame, only the vertices of the first interactive area have changed in the second animation frame. In actual applications, the coordinates of the target model are finally updated frame by frame during the real-time rendering call process, thereby achieving the effect of dynamic interaction of the vertex animation of the first interactive area in the target model.

[0052] An embodiment of the present invention provides a method for processing vertex animation, which obtains a vertex animation texture of a target model; in response to an interactive operation between a controlled interactive model and a target model, determines a first interactive area on the target model, draws a preset pattern on a rendering area corresponding to the first interactive area in a preset rendering target, and obtains a rendering target texture; based on the rendering target texture, determines a first mask map of the target model; and offsets the vertices of the target model according to the first mask map and the vertex animation texture to obtain a second animation frame of the first interactive area in the target model. In this method, by determining the first interactive area, the interactive dynamics of the target model can be calculated in real time, the dynamic interactive area of ​​the target model is recorded by the preset rendering target, and the first interactive area of ​​the target model is made optional and controllable by the first mask map, thereby realizing dynamic interaction of vertex animation in a partial area of ​​the target model.

[0053] The following describes a possible implementation of the steps of obtaining a rendering area corresponding to the first interactive area from a preset rendering target, drawing a preset pattern in the rendering area, and obtaining a rendering target texture:

[0054] (1) obtaining a rendering area from the preset rendering target based on a position correspondence between a position point on the target model surface and a position point on the preset rendering target;

[0055] (2) determining UV coordinates of the preset pattern mapped to the rendering area according to the position coordinates of the rendering area, the position coordinates of the first interactive area, and a preset texture scaling parameter;

[0056] (3) According to the UV coordinates, the preset pattern is drawn into the rendering area to obtain the rendering target texture.

[0057] Since the position coordinates of the expanded image of the target model correspond one-to-one with the position coordinates of the preset rendering target, the rendering area on the preset rendering target can be obtained according to the position correspondence. In this embodiment, the preset pattern can be drawn by world mapping. Specifically, the center of the world mapping can be defined as the world coordinate origin. The preset pattern mapping method adopts the texture magnification and reduction principle in the UV operation, reduces the preset pattern, and calculates the position drawn to the rendering area according to the predefined size of the preset rendering target, that is, the above-mentioned UV coordinates. The UV coordinates represent the UV values ​​after the preset pattern is mapped to the rendering area. Finally, according to the UV coordinates, the preset pattern is drawn to the rendering area through the drawing function to obtain the rendering target texture.

[0058] In this embodiment, the UV coordinates are determined in the DirectX environment. The specific calculation formula is as follows:

[0059]

[0060] Among them, BasicTexUV represents the above UV coordinates, that is, the UV value after the preset pattern is mapped to the rendering area, which is actually a two-dimensional vector; is a two-dimensional rotation matrix, where θ is the rotation angle of the preset pattern, which is the same as the rotation angle of the controlled interaction model. The rotation of the preset pattern during the rendering process is controlled in real time to ensure that the orientation of the preset pattern in the render target texture is the same as that of the controlled interaction model. Loc represents the position coordinates of the first interaction area determined in real time, taking its x and y components; RTScale represents the overall size of the preset render target; Scale represents the preset texture scaling parameter mentioned above, where (Texcoord.xy*Scale-(Scale*0.5-0.5)) represents scaling the preset render target to the Scale size around its center.

[0061] After obtaining the UV coordinates, the render target texture is obtained as follows:

[0062] RTTex=Draw(BasicTex,BasicTexUV);

[0063] RTTex represents the render target texture, BasicTex represents the preset pattern, and BasicTexUV represents the UV coordinates, i.e., the UV values ​​of the preset pattern after transformation. Draw() represents the drawing function. Specifically, the Draw function maps the preset pattern to the rendering area of ​​the preset render target, resulting in the render target texture. Graphics applications provide corresponding interfaces for this operation.

[0064] The rendering target texture diagram generated by drawing is as follows Figure 3 As shown, Figure 3 (a) in the figure shows an interactive trajectory effect similar to bullet shooting. Each light spot is drawn as a circle with a preset pattern, and the target texture is rendered. Figure 3 (b) in the figure represents an interactive effect similar to a moving trajectory, which can be produced by drawing any specific pattern or basic geometric pattern. The pattern combination recorded in each frame can generate this rendering target texture.

[0065] In addition, the above-mentioned preset patterns can be added with different mapping requirements as needed, such as rotation, scaling, displacement, etc., so as to match the dynamic interaction effects of different controlled interactive subjects.

[0066] In the above method, the preset pattern is mapped to the UV coordinates of the rendering area, and the preset pattern is drawn through world mapping, which avoids local mapping and reduces the number of passes of the preset rendering target. At the same time, drawing is only performed through the preset rendering target, which reduces the loss of performance cache.

[0067] The pixels in the area of ​​the preset pattern in the above-mentioned rendering target texture are the first pixel value, and the pixels in the area other than the area of ​​the preset pattern are the second pixel value; the above-mentioned first pixel value can be a value from 0 to 1, indicating a color between white and black, and the second pixel value can be 0, indicating black; Figure 2 As shown, the preset pattern area is white and gray, and the other areas are black. It can be seen that the color of the preset pattern area is gradient. It should be noted that the first pixel value of the above-mentioned preset pattern area can be predetermined or updated in real time based on the actual interaction operation. For example, the more interactions there are, the larger the pixel value of the preset pattern area, that is, the color value, that is, the brighter the color.

[0068] The following describes a possible implementation of the step of determining the first mask map of the target model based on the rendering target texture: the first mask map of the target model is obtained according to the first pixel value corresponding to the first interaction area in the rendering target texture and the second pixel value corresponding to the area other than the first interaction area.

[0069] Specifically, the area corresponding to the first interactive area in the rendering target texture can be determined as the controllable area of ​​the first mask map, and the pixel value of the controllable area can be the first pixel value. At the same time, the area corresponding to the area other than the first interactive area in the rendering target texture can be determined as the uncontrollable area of ​​the first mask map, and the pixel value of the uncontrollable area can be the second pixel value. The first mask map is also the same size as the target model, including the controllable area corresponding to the first interactive area and the uncontrollable areas corresponding to other areas.

[0070] In the above method, the first interactive area of ​​the vertex animation is recorded by rendering the target texture, and the first mask map of the target model is determined according to the corresponding pixel value, so that the single deformation mode of the vertex animation is changed into the deformation mode of the optional area, and the dynamic interaction of the vertex animation of some areas in the target model is realized, and the problem of the difficulty of vertex animation interaction is solved.

[0071] Specifically, the first mask image of the target model is determined by the following formula: RTColOrigin= Among them, RTColOrigin represents the first mask image, including the first pixel value and the second pixel value; RTTex represents the rendering target texture; Wpos.xy represents the world coordinate position information of the target model; RTScale represents the size of the preset rendering target; SampleBias represents the UV offset parameter; Sample() is the sampling function.

[0072] In fact, the Sample function is a sampling function that obtains the pixel value (i.e., color value) at the texture coordinates of the rendering target texture. In addition, SampleBias is determined based on the actual relationship between the world coordinates and the UV origin. (Wpos.xy) / RTScale+SampleBias means that the world coordinate origin is used as the center of the rendering target texture. In this embodiment, SampleBias can be set to (0.5, 0.5), which means that after the world coordinates are mapped to UV, a UV offset of (0.5, 0.5) is required to obtain the correct first interaction area of ​​the target model. For example, Figure 4 The diagram shows a mapping diagram of a rendering target texture with a size of 4, with the world coordinate origin (0, 0) as the center point of the corresponding UV coordinate control, see Figure 4 To obtain the UV coordinates of the dot at (1,1) (the circle in the image), we can use the world coordinates (1,1) / 4 + (0.5, 0.5) to obtain the UV coordinates (0.75, 0.75). Sample is then taken based on these UV coordinates. SampleBias can vary depending on the UV calculation method used by different graphics interfaces; the above (0.5, 0.5) is only an example.

[0073] In the above method, the first mask map is determined according to the pixel values ​​of the rendering target texture by sampling, and the UV offset parameter is set at the same time, thereby further improving the accuracy of the first mask map.

[0074] In addition, the above-mentioned first pixel value includes at least a first numerical value and a second numerical value; in the preset rendering target, the pixels in the central area of ​​the preset pattern are the first numerical value, and the pixels in the edge area of ​​the central area of ​​the preset pattern are the second numerical value; wherein the first numerical value is greater than the second numerical value, and the second numerical value is greater than the second pixel value.

[0075] Continue to see Figure 2 The schematic diagram of the preset pattern shown in the figure shows that the preset pattern drawn in the preset rendering target has a color transition between the middle area and the edge area of ​​the preset pattern. In fact, the above-mentioned first pixel value can include many values. The pixel in the central area of ​​the preset pattern can be 1, the pixel in the first edge area of ​​the central area of ​​the preset pattern can be 0.9, the pixel in the second edge area of ​​the central area of ​​the preset pattern can be 0.8, and so on, until the pixel in the outermost area of ​​the preset pattern is 0, which is the same as the second pixel value. The rendering target texture drawn with this preset pattern obtains a first mask map, and the first interactive area controlled can have a richer dynamic effect.

[0076] The following describes the steps of performing vertex offset processing on the vertices of the first interactive area in the target model in the first animation frame according to the first mask image and the vertex animation texture to obtain the second animation frame of the first interactive area in the target model. A possible implementation method is as follows: obtaining the position information and / or rotation information of the first animation frame in the vertex animation texture; according to the first mask image and the preset coordinate scaling vector, offsetting the position information and / or rotation information of the vertices of the first interactive area in the target model in the first animation frame by the pixel values ​​of the first interactive area in the first mask image through a preset vertex offset function to obtain the second animation frame of the first interactive area in the target model.

[0077] Perform vertex offset processing on the target model. The vertex offset method uses the vertex offset function in the vertex animation texture. It bakes the model's own pivot onto the UV, extracts the coordinate and rotation information from the vertex animation texture, and performs vertex transformation on the model. Pivot is the pivot point. The pivot point refers to the coordinates of the model's center of mass. In 3D scenes, the model's pivot point is generally used to represent the world position of the entire model. In 3D software, the pivot point is often defined at the center or lowest point of the model, but can also be changed according to special needs.

[0078] The above-mentioned preset coordinate scaling vector is mainly used to enlarge or reduce the overall or local coordinates of the target model, and can be set according to the actual needs of the effect. The above-mentioned vertex offset function can be expressed as WPO(S, O), where S represents the coordinate scaling vector, and O represents the vertex offset vector of the local coordinates of the target model. In this embodiment, the pixel value corresponding to the first interactive area in the first mask image is used as the above-mentioned vertex offset. First, the position information and rotation information of the first animation frame in the vertex animation texture are obtained by decoding. Then, the position information and rotation information of the vertices corresponding to the first interactive area in the first animation frame are offset through WPO(S, O) to obtain the second animation frame of the first interactive area in the target model. Finally, during the calling process, the vertices can produce real-time dynamic effects, that is, the processed three-dimensional vertex animation model with dynamic interactive effects is rendered. The vertex animation playback state can be maintained in the non-interactive part, and the number of frames of the vertex animation can be changed in the interactive part, and the vertex offset method and position can be changed.

[0079] In the above method, the area corresponding to the first interactive area in the first mask image can be used as the mask area for vertex offset, and the pixel value of this area can also be used as the offset of vertex offset, realizing real-time control of vertex animation in part of the target model.

[0080] In fact, in some interactive scenarios, not only will the contact area between the controlled interactive model and the target module (i.e., the first interactive area) experience interactive animation, but corresponding interactive animations may also occur in the edge area of ​​the contact area. For example, when a stone hits the snow, the snow in the area where the stone is located will have a sinking effect, while the snow around the stone will have a parabolic change shape that first bulges and then flattens. Therefore, after determining the first mask map of the target model based on the rendering target texture, the above method also includes the step of obtaining the edge area of ​​the first interactive area, which specifically includes:

[0081] (1) performing an offset process on a preset pattern in a rendering target texture according to a preset offset parameter to obtain a mask image of the rendering target texture after the offset;

[0082] (2) obtaining a second mask map of the rendering target texture according to the mask map of the offset rendering target texture and the first mask map; wherein the second mask map includes an offset region after the preset pattern is offset;

[0083] (3) Based on the second mask map and the first mask map, a third mask map of the target model is determined.

[0084] The above-mentioned preset offset parameters can be set according to the actual interactive scenario, and the above-mentioned offset parameters may include multiple parameters, including parameters for offsetting in different directions. The offset amount can be set according to actual needs, so that multiple mask maps of the rendering target texture after different offsets can be obtained. Since the mask map of the offset rendering target will change the position of the preset pattern in the preset rendering target, it is necessary to obtain the second mask map of the rendering target texture (also called the second mask map of the target model) based on the first mask map. Specifically, the mask map of each offset rendering target texture can be added to the first mask map, and then the area where the mask map of the offset rendering target texture overlaps with the preset pattern area in the first mask map can be subtracted to obtain the second mask map.

[0085] Finally, the first mask image is added to the second mask image to obtain a third mask image of the target model. Furthermore, since dynamic interactions at the edge of the first interactive area may result in different offsets, the edge of the first interactive area (also referred to as the interactive area) can be segmented as needed to produce different dynamic effects at different edge areas. Specifically, different edge ranges can be set for the second mask image, and different pixel values ​​can be set within these ranges to obtain a third mask image with a segmented vertex offset effect.

[0086] The above method takes into account the problem that in actual application scenarios, dynamic effects may also occur in the edge area of ​​the first interactive area. The edge area of ​​the first interactive area is further obtained. By offsetting the preset pattern, the edge area of ​​the first interactive area can be obtained. Finally, a third mask map including the edge area is obtained, which further enriches the actual application scenarios of vertex animation.

[0087] The following describes the above-mentioned step (1) of offsetting the preset pattern in the rendering target texture according to the preset offset parameter to obtain the mask map of the offset rendering target texture. A possible implementation method is as follows: according to the offset direction and offset distance indicated by the offset parameter, the preset pattern in the rendering target texture is offset in the offset direction by the offset distance to obtain the offset rendering target texture; wherein the offset direction includes at least: the positive X-axis direction of UV, the positive Y-axis direction of UV, the negative X-axis direction of UV, and the negative Y-axis direction of UV; and according to the pixel values ​​in the offset rendering target texture, the mask map of the offset rendering target texture is obtained.

[0088] Specifically, the mask map of the offset rendering target texture can be obtained by the following method:

[0089]

[0090]

[0091] Among them, OffsetSize is the above-mentioned preset offset parameter, RTColXPos is the offset rendering target texture obtained by offsetting the preset pattern to the positive direction of the UV's X-axis by OffsetSize. RTColXNeg is the offset rendering target texture obtained by offsetting the preset pattern to the negative direction of the UV's X-axis by OffsetSize. OffsetScale is an independent variable used to control the area range of the edge area. Similarly, RTColYPos and RTColYNeg can be obtained, wherein RTColYPos is the offset rendering target texture obtained by offsetting the preset pattern to the positive direction of the UV's Y-axis by OffsetSize, and RTColYNeg is the offset rendering target texture obtained by offsetting the preset pattern to the negative direction of the UV's Y-axis by OffsetSize. In this method, the edge area of ​​the first interactive area is obtained by offsetting, and the mask map of the offset rendering target texture is obtained, which further increases the controllable area in the target model and improves the dynamic interactive effect of the vertex animation.

[0092] In addition, the above-mentioned offset rendering target texture mask map includes multiple ones; the following describes the step (2) of obtaining the second mask map of the rendering target texture based on the offset rendering target texture mask map and the first mask map. A possible implementation method is: adding the pixel values ​​of corresponding positions in the multiple offset rendering target texture mask maps and subtracting the pixel values ​​of corresponding positions in the first mask map of the rendering target texture to obtain the second mask map of the rendering target texture.

[0093] Then, the second mask map of the rendering target texture is obtained according to the following method:

[0094] RTCol(OffsetScale)=

[0095] (RTColXPos(OffsetScale)+RTColYPos(OffsetScale)+RTColXNeg(OffsetScale)+RTColYNeg(OffsetScale)-RTColOrigin);

[0096] Among them, RTCol is the mask map of the offset rendering target texture, and OffsetScale is used as an independent variable to further obtain the multi-segment edge area. RTColOrigin is the first mask map mentioned above. In actual implementation, by changing the value of OffsetScale, you can obtain edge areas of different ranges. For example, Figure 5As shown, when OffsetScale is 1, the size of the edge area is the square area in the figure, when OffsetScale is 2, the size of the edge area is the shaded area in the figure, and when OffsetScale is 3, the size of the edge area is the gray area in the figure. It should be noted that the pixel value of the edge area after offset is also the first pixel value, so different operations can be performed on the edge area with the help of this first pixel value.

[0097] In the above manner, the second mask map of the rendering target texture can be rendered by adding the offset mask maps of the rendering target texture and subtracting the first mask map of the rendering target texture.

[0098] The following describes a possible implementation of the steps of determining the third mask map of the target model based on the second mask map and the first mask map:

[0099]

[0100] Among them, RTColMulti represents the third mask image, including the pixel values ​​corresponding to the second interactive area and the pixel values ​​of the area other than the second interactive area. The second interactive area includes the first interactive area and the edge area of ​​the first interactive area. The edge area is the area corresponding to the offset area after the preset pattern is offset. RTColOrigin represents the first mask image. RTCol(Offset n ) represents the second mask image, Offset n Indicates the nth area range corresponding to the edge area of ​​the first interactive area in the second interactive area, Offset n >Offset n-1 ;ω is the first coefficient that controls the pixel value corresponding to the first interactive area;φ i is the second coefficient corresponding to the mask image of the edge area of ​​the first interactive area corresponding to the i-th area range. Where n∈{2,3,4…}

[0101] First, it should be noted that the third mask image includes the interaction area between the target model and the controlled interaction model, namely the first interaction area, and also includes the offset area after the preset pattern is offset, namely the edge area. The first interaction area and the edge area can be determined as the second interaction area.

[0102] In addition, the dynamic effects of edge regions with different ranges may be different, e.g. Figure 6 As shown in the figure, the effect of vertex offset corresponding to the grid area may be convex, and the effect of vertex offset corresponding to the shadow area may be concave. Therefore, RTCol(Offset n )-RTCol(Offset n-1) to obtain different edge regions, namely Figure 6 The grid area or shaded area in , and φ i Used to control the pixel values ​​corresponding to different edge regions. The specific settings can be set according to the actual scene, mainly to add more variations to the vertex animation. In addition, ω can also control the pixel values ​​corresponding to the first interactive region.

[0103] For details, please refer to Figure 7 The schematic diagram of the third mask diagram is shown, where Figure (a) is a schematic diagram of the UV offset of the rendering target texture track edge, and Figure (b) is a schematic diagram of the track and multi-segment edge vertex offset, with examples of different convex and concave effects of multi-segment areas described by curves.

[0104] In the above method, different Offset n ,Adopting a multi-segment UV offset method, different edge areas of the ,first interactive area corresponding to the interactive operation are obtained, ,and vertex offset of the divisible areas is realized, enriching the application ,scenario of vertex animation.

[0105] After the steps of determining a third mask map of the target model based on the second mask map and the first mask map described below, the method further includes: updating the pixel values ​​corresponding to the edge area of ​​the second interactive area in the third mask map by updating the second coefficient to obtain an updated third mask map; performing vertex offset processing on the vertices of the second interactive area in the target model according to the updated third mask map and the vertex animation texture to obtain a third animation frame of the second interactive area in the target model.

[0106] A possible implementation method is to obtain the position information and / or rotation information of the first animation frame in the vertex animation texture; based on the third mask image and the preset coordinate scaling vector, through a preset vertex offset function, the position information and / or rotation information of the vertices of the second interaction area in the target model in the first animation frame is offset by the pixel values ​​of the second interaction area in the third mask image to obtain the third animation frame of the second interaction area in the target model.

[0107] Specifically, the position information and rotation information of the first animation frame of the vertices in the second interactive area in the target model can be offset through WPO(S,RTColMulti). Specifically, the position information and rotation information of the first animation frame of the vertices in the second interactive area in the target model are offset according to the pixel values ​​of different areas in the third mask image. In fact, it is necessary to set the value of φ in RTColMulti to obtain different vertex offset effects.

[0108] In the above method, for the scenario where the edge area of ​​the first interactive area also has vertex animation, the first interactive area of ​​the target model can be controlled by using a third mask image including the first interactive area and the edge area, and different edge areas can also be controlled at the same time, thereby achieving richer vertex animation and further enriching the application scenarios of vertex animation.

[0109] In fact, in some scenes, for example, fallen leaves on the ground originally have a vertex animation effect of gently undulating in the wind. After a person runs, the fallen leaves can be made to fly and dance according to the interactive area. This is the effect of encoding multiple frames of vertex animation and switching vertex animation according to the interactive area. For this vertex animation scene, the above-mentioned vertex animation texture also stores the position information and rotation information of the vertices in the target model in multiple animation frames. Based on this, after the step of determining the first mask map of the target model based on the rendering target texture, the above-mentioned method also includes:

[0110] According to the first pixel value corresponding to the first interactive area in the first mask image, the key frame of the first mask image is determined; the pixel value corresponding to the first interactive area in the key frame is determined as the first pixel value, and the pixel value corresponding to the area other than the first interactive area in the key frame is determined as the second pixel value; wherein, the first interactive area of ​​the target model is an operable area, and the area other than the first interactive area is a non-operating area; according to the key frame, the frame number of the key frame corresponding to the target model is updated to determine the vertex animation of the first interactive area in the target model.

[0111] The first interactive area can not only be used to perform vertex offset operations on the model, but can also be used to control the key frames of vertex animation. As a key frame mask, the frame number of vertex animation is changed only in this area.

[0112] Of course, the above steps can also be: determine the key frame of the third mask image based on the pixel value corresponding to the second interaction area in the third mask image; determine the pixel value corresponding to the second interaction area in the key frame as the first pixel value, and determine the pixel value corresponding to the area other than the second interaction area in the key frame as the second pixel value; wherein, the second interaction area of ​​the target model is the operable area, and the area other than the second interaction area is the non-operation area; according to the key frame, update the frame number of the key frame corresponding to the target model to determine the vertex animation of the second interaction area in the target model.

[0113] Specifically, the key frame of the third mask image can be determined in the following manner:

[0114] Frame=Ceil(RTColMulti*α);

[0115] The Ceil() function rounds up to an integer. This function only returns the smallest integer greater than or equal to the specified expression, typically 0 or greater. This means that the region with a value of 0 represents the keyframe unchanged, while the region with a value greater than 0 represents the keyframe operable region. α represents the keyframe variation coefficient. The Frame result, obtained from the third mask map, serves as an optional operation for dynamically interacting with the target vertex animation model. This operation can transform the keyframe animation state of the interactive region, particularly when the vertex animation texture encodes multiple keyframes.

[0116] For example, the pixel value of the first interactive area in the third mask image is 1, and the pixel values ​​of the edge areas A and B calculated according to the UV offset effect are 0.5 and 0.2. Using this value as a coefficient can change the vertex animation key frames of the first interactive area and the edge area. For example, the pixel values ​​of the third mask image are uniformly multiplied by 10 (i.e. α = 10), and then the Frame is calculated using the above formula. This result can be provided to the program as the number of frames to set the key frames of different areas. The key frame value of the first interactive area is 10, and the key frames of the edge areas A and B are 5 and 2 respectively. The non-interactive area does not change.

[0117] In the above method, the first interactive area can not only be used as a mask area for vertex offset, but also as a mask area for vertex animation key frame changes. The key frame change effect of vertex animation can be achieved within the mask area, which provides more flexible usage for some special local animation requirements.

[0118] Corresponding to the above method embodiment, the embodiment of the present invention provides a vertex animation processing device, such as Figure 8 As shown, the device includes:

[0119] An acquisition module 81 is configured to acquire a vertex animation texture of a target model, wherein the vertex animation texture stores position information and / or rotation information of a vertex in the target model in a first animation frame;

[0120] The drawing module 82 is configured to determine a first interaction area on the target model in response to the controlled interaction model interacting with the target model; obtain a rendering area corresponding to the first interaction area from a preset rendering target, draw a preset pattern in the rendering area, and obtain a rendering target texture;

[0121] A determination module 83 is configured to determine a first mask image of a target model based on the rendering target texture;

[0122] The processing module 84 is used to perform update processing according to the first mask image and the vertex animation texture, and perform vertex offset processing on the vertices of the first interactive area in the target model in the first animation frame to obtain a second animation frame of the first interactive area in the target model.

[0123] The present invention provides a vertex animation processing device that obtains a vertex animation texture of a target model; in response to an interactive operation between a controlled interactive model and a target model, determines a first interactive area on the target model, draws a preset pattern on a rendering area corresponding to the first interactive area in a preset rendering target, and obtains a rendering target texture; based on the rendering target texture, determines a first mask map of the target model; and offsets the vertices of the target model according to the first mask map and the vertex animation texture to obtain a second animation frame of the first interactive area in the target model. In this method, by determining the first interactive area, the interactive dynamics of the target model can be calculated in real time, the dynamic interactive area of ​​the target model is recorded by the preset rendering target, and the first interactive area of ​​the target model is made optional and controllable by the first mask map, thereby realizing dynamic interaction of vertex animation in a partial area of ​​the target model.

[0124] Furthermore, the above-mentioned drawing module is also used to: obtain a rendering area from the preset rendering target based on the position correspondence between the position points on the surface of the target model and the position points of the preset rendering target; determine the UV coordinates of the preset pattern mapped to the rendering area based on the position coordinates of the rendering area, the position coordinates of the first interactive area, and the preset texture scaling parameters; and draw the preset pattern to the rendering area based on the UV coordinates to obtain the rendering target texture.

[0125] Furthermore, the pixels of the area of ​​the preset pattern in the above-mentioned rendering target texture are the first pixel values, and the pixels of the area other than the area of ​​the preset pattern are the second pixel values; the above-mentioned determination module is also used to: obtain the first mask map of the target model according to the first pixel value corresponding to the first interactive area in the rendering target texture, and the second pixel value corresponding to the area other than the first interactive area.

[0126] Furthermore, the above determination module is also used to: Among them, RTColOrigin represents the first mask image, including the first pixel value and the second pixel value; RTTex represents the rendering target texture; Wpos.xy represents the world coordinate position information of the target model; RTScale represents the size of the preset rendering target; SampleBias represents the UV offset parameter; Sample() is the sampling function.

[0127] Furthermore, the above-mentioned first pixel value includes at least a first numerical value and a second numerical value; in the above-mentioned preset rendering target, the pixels in the central area of ​​the preset pattern are the first numerical value, and the pixels in the edge area of ​​the central area of ​​the preset pattern are the second numerical value; wherein the first numerical value is greater than the second numerical value, and the second numerical value is greater than the second pixel value.

[0128] Furthermore, the above-mentioned device also includes an offset module, which is used to: offset the preset pattern in the rendering target texture according to preset offset parameters to obtain a mask map of the rendering target texture after offset; obtain a second mask map of the rendering target texture according to the mask map of the rendering target texture after offset and the first mask map; wherein the second mask map includes the offset area after the preset pattern is offset; based on the second mask map and the first mask map, determine the third mask map of the target model.

[0129] Furthermore, the above-mentioned offset module is also used to: offset the preset pattern in the rendering target texture in the offset direction by the offset distance according to the offset direction and offset distance indicated by the offset parameter, so as to obtain the offset rendering target texture; wherein the offset direction includes at least: the positive direction of the UV X-axis, the positive direction of the UV Y-axis, the negative direction of the UV X-axis, and the negative direction of the UV Y-axis; and obtain the mask map of the offset rendering target texture according to the pixel value in the offset rendering target texture.

[0130] Furthermore, the above-mentioned offset rendering target texture includes multiple mask maps; the above-mentioned offset module is also used to: add the pixel values ​​of corresponding positions in the multiple offset rendering target texture mask maps, and subtract the pixel values ​​of corresponding positions in the first mask map of the rendering target texture to obtain the second mask map of the rendering target texture.

[0131] Furthermore, the above-mentioned offset module is also used for: Among them, RTColMulti represents the third mask image, including the pixel values ​​corresponding to the second interactive area and the pixel values ​​of the area other than the second interactive area. The second interactive area includes the first interactive area and the edge area of ​​the first interactive area. The edge area is the area corresponding to the offset area after the preset pattern is offset. RTColOrigin represents the first mask image. RTCol(Offset n ) represents the second mask image, Offset n Indicates the nth area range corresponding to the edge area of ​​the first interactive area in the second interactive area, Offset n >Offset n-1 ;ω is the first coefficient that controls the pixel value corresponding to the first interactive area;φ i is the second coefficient corresponding to the mask image of the edge area of ​​the first interactive area corresponding to the i-th area range.

[0132] Furthermore, the above-mentioned processing module is also used to: obtain the position information and / or rotation information of the first animation frame in the vertex animation texture; according to the first mask image and the preset coordinate scaling vector, through the preset vertex offset function, offset the position information and / or rotation information of the vertices of the first interaction area in the target model in the first animation frame, and the pixel value of the first interaction area in the first mask image to obtain the second animation frame of the first interaction area in the target model.

[0133] Furthermore, the above-mentioned device also includes a second processing module, which is used to: update the pixel values ​​corresponding to the edge area of ​​the second interaction area in the third mask image by updating the second coefficient to obtain an updated third mask image; perform vertex offset processing on the vertices of the second interaction area in the target model according to the updated third mask image and the vertex animation texture to obtain a third animation frame of the second interaction area in the target model.

[0134] Furthermore, the above-mentioned vertex animation texture also stores position information and / or rotation information of vertices in the target model in multiple animation frames; the above-mentioned device also includes a third processing module, which is used to: determine the key frame of the first mask image based on the first pixel value corresponding to the first interactive area in the first mask image; determine the pixel value corresponding to the first interactive area in the key frame as the first pixel value, and determine the pixel value corresponding to the area other than the first interactive area in the key frame as the second pixel value; wherein, the first interactive area of ​​the target model is an operable area, and the area other than the first interactive area is a non-operating area; according to the key frame, the frame number of the key frame corresponding to the target model is updated to determine the vertex animation of the first interactive area in the target model.

[0135] The vertex animation processing device provided in the embodiment of the present invention has the same technical features as the vertex animation processing method provided in the above embodiment, and therefore can also solve the same technical problems and achieve the same technical effects.

[0136] This embodiment further provides an electronic device including a processor and a memory, wherein the memory stores computer-executable instructions executable by the processor, and the processor executes the computer-executable instructions to implement the above-mentioned vertex animation processing method. The electronic device can be a server or a terminal device.

[0137] See also Figure 9 As shown, the electronic device includes a processor 100 and a memory 101 . The memory 101 stores computer-executable instructions that can be executed by the processor 100 . The processor 100 executes the computer-executable instructions to implement the above-mentioned vertex animation processing method.

[0138] Furthermore, Figure 9The electronic device shown further includes a bus 102 and a communication interface 103 , and the processor 100 , the communication interface 103 and the memory 101 are connected via the bus 102 .

[0139] The memory 101 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the system network element and at least one other network element is achieved through at least one communication interface 103 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used. The bus 102 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 9 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or one type of bus.

[0140] The processor 100 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by hardware integrated logic circuits in the processor 100 or software instructions. The above processor 100 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present invention. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in conjunction with the embodiments of the present invention can be directly implemented and executed by a hardware decoding processor, or by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium well-known in the art, such as a random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or register. The storage medium is located in the memory 101. The processor 100 reads the information in the memory 101 and, in conjunction with its hardware, completes the steps of the method of the aforementioned embodiment.

[0141] This embodiment further provides a computer-readable storage medium storing computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the above-mentioned vertex animation processing method.

[0142] The computer program products of the vertex animation processing methods, devices, electronic devices, and systems provided in the embodiments of the present invention include computer-readable storage media storing program codes. The instructions included in the program codes can be used to execute the methods described in the previous method embodiments. For specific implementations, please refer to the method embodiments and will not be repeated here.

[0143] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described systems and devices can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0144] In addition, in the description of the embodiments of the present invention, unless otherwise expressly specified or limited, the terms "mounted," "connected," and "connected" should be understood in a broad sense. For example, they may refer to fixed connections, detachable connections, or integral connections; they may refer to mechanical connections or electrical connections; they may refer to direct connections or indirect connections through an intermediate medium; and they may refer to internal communication between two components. Those skilled in the art will understand the specific meanings of the above terms in the present invention based on the specific circumstances.

[0145] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0146] In the description of the present invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicating orientations or positional relationships, are based on the orientations or positional relationships shown in the accompanying drawings and are intended solely to facilitate and simplify the description of the present invention. They are not intended to indicate or imply that the devices or components referred to must have, be constructed, or operate in a specific orientation, and therefore should not be construed as limitations on the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.

[0147] Finally, it should be noted that the above embodiments are only specific implementation methods of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that any person skilled in the art can modify or easily conceive of changes to the technical solutions described in the above embodiments within the technical scope disclosed by the present invention, or replace some of the technical features therein with equivalents. Such modifications, changes or replacements do not deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.

Claims

1. A method for processing vertex animation, characterized in that: The method comprises: Acquire a vertex animation texture of a target model; wherein the vertex animation texture stores position information and / or rotation information of vertices in the target model in a first animation frame; In response to the controlled interaction model interacting with the target model, a first interaction area on the target model is determined; a rendering area corresponding to the first interaction area is acquired from a preset rendering target, and a preset pattern is drawn on the rendering area to obtain a rendering target texture; Determining a first mask map of the target model based on the rendering target texture; performing vertex offset processing on vertices of the first interactive area in the target model in a first animation frame according to the first mask image and the vertex animation texture to obtain a second animation frame of the first interactive area in the target model; The pixels in the region of the preset pattern in the rendering target texture are of a first pixel value, and the pixels in the region other than the region of the preset pattern are of a second pixel value; The step of determining a first mask map of the target model based on the rendering target texture includes: obtaining the first mask map of the target model according to a first pixel value corresponding to the first interaction area in the rendering target texture and a second pixel value corresponding to an area other than the first interaction area.

2. The method according to claim 1, characterized in that The step of obtaining a rendering area corresponding to the first interactive area from a preset rendering target, drawing a preset pattern in the rendering area, and obtaining a rendering target texture includes: Acquiring the rendering area from the preset rendering target according to a position correspondence between position points on the target model surface and position points on the preset rendering target; Determining UV coordinates of the preset pattern mapped to the rendering area according to the position coordinates of the rendering area, the position coordinates of the first interactive area, and preset texture scaling parameters; The preset pattern is drawn into the rendering area according to the UV coordinates to obtain the rendering target texture.

3. The method according to claim 1, characterized in that The step of obtaining a first mask image of the target model according to a first pixel value corresponding to the first interactive area in the rendering target texture and a second pixel value corresponding to an area other than the first interactive area includes: Among them, RTColOrigin represents the first mask map, including the first pixel value and the second pixel value; RTTex represents the rendering target texture; Wpos.xy represents the world coordinate position information of the target model; RTScale represents the size of the preset rendering target; SampleBias represents the UV offset parameter; Sample() is a sampling function.

4. The method according to claim 1, wherein The first pixel value includes at least a first numerical value and a second numerical value; in the preset rendering target, the pixels in the central area of ​​the preset pattern are the first numerical value, and the pixels in the edge area of ​​the central area of ​​the preset pattern are the second numerical value; wherein, the first numerical value is greater than the second numerical value, and the second numerical value is greater than the second pixel value.

5. The method according to claim 1, wherein After the step of determining a first mask map of the target model based on the rendering target texture, the method further includes: Performing an offset process on a preset pattern in the rendering target texture according to a preset offset parameter to obtain a mask map of the rendering target texture after the offset; Obtaining a second mask map of the rendering target texture according to the shifted mask map of the rendering target texture and the first mask map; wherein the second mask map includes the shifted area of ​​the preset pattern; A third mask map of the target model is determined based on the second mask map and the first mask map.

6. The method according to claim 5, characterized in that The step of performing an offset process on a preset pattern in the rendering target texture according to a preset offset parameter to obtain a mask map of the rendering target texture after the offset comprises: According to the offset direction and offset distance indicated by the offset parameter, the preset pattern in the rendering target texture is offset in the offset direction by the offset distance to obtain the offset rendering target texture; wherein the offset direction includes at least: a positive X-axis direction of UV, a positive Y-axis direction of UV, a negative X-axis direction of UV, and a negative Y-axis direction of UV; A mask map of the offset rendering target texture is obtained according to the pixel values ​​in the offset rendering target texture.

7. The method according to claim 5, characterized in that The offset mask map of the rendering target texture includes a plurality of mask maps; The step of obtaining a second mask map of the rendering target texture according to the shifted mask map of the rendering target texture and the first mask map comprises: The pixel values ​​at corresponding positions in the shifted mask maps of the rendering target texture are added together, and the pixel values ​​at corresponding positions in the first mask map of the rendering target texture are subtracted to obtain a second mask map of the rendering target texture.

8. The method according to claim 5, characterized in that The step of determining a third mask map of the target model based on the second mask map and the first mask map includes: Wherein, RTColMulti represents the third mask image, including the pixel values ​​corresponding to the second interactive area and the pixel values ​​of the area other than the second interactive area, the second interactive area includes the first interactive area and the edge area of ​​the first interactive area, and the edge area is the area corresponding to the offset area after the preset pattern is offset; RTColOrigin represents the first mask image; RTCol(Offset n ) represents the second mask image, Offset n Indicates the nth area range corresponding to the edge area of ​​the first interactive area in the second interactive area, Offset n >Offset n-1 ω is the first coefficient for controlling the pixel value corresponding to the first interactive area; φ i is the second coefficient corresponding to the mask image of the edge area of ​​the first interactive area corresponding to the i-th area range.

9. The method according to claim 1, characterized in that The step of performing vertex offset processing on vertices of the first interactive area in the target model in a first animation frame according to the first mask image and the vertex animation texture to obtain a second animation frame of the first interactive area in the target model includes: Obtaining position information and / or rotation information of the first animation frame in the vertex animation texture; According to the first mask image and the preset coordinate scaling vector, through a preset vertex offset function, the position information and / or rotation information of the vertices of the first interactive area in the target model in the first animation frame are offset by the pixel values ​​of the first interactive area in the first mask image to obtain a second animation frame of the first interactive area in the target model.

10. The method according to claim 8, characterized in that After the step of determining a third mask map of the target model based on the second mask map and the first mask map, the method further includes: By updating the second coefficient, the pixel values ​​corresponding to the edge area of ​​the second interaction area in the third mask image are updated to obtain the updated third mask image; Vertex offset processing is performed on the vertices of the second interactive area in the target model according to the updated third mask map and the vertex animation texture to obtain a third animation frame of the second interactive area in the target model.

11. The method according to claim 1, characterized in that The vertex animation texture further stores position information and / or rotation information of vertices in the target model in multiple animation frames; After the step of determining a first mask map of the target model based on the rendering target texture, the method further includes: determining a key frame of the first mask image according to a first pixel value corresponding to the first interaction area in the first mask image; Determining a pixel value corresponding to the first interactive area in the key frame as the first pixel value, and determining a pixel value corresponding to an area other than the first interactive area in the key frame as the second pixel value; wherein the first interactive area of ​​the target model is an operable area, and the area other than the first interactive area is a non-operable area; According to the key frames, the frame number of the key frames corresponding to the target model is updated to determine the vertex animation of the first interactive area in the target model.

12. A vertex animation processing device, characterized in that: The device comprises: An acquisition module, configured to acquire a vertex animation texture of a target model; wherein the vertex animation texture stores position information and / or rotation information of vertices in the target model in a first animation frame; a rendering module, configured to determine a first interaction area on the target model in response to an interaction operation between the controlled interaction model and the target model; obtain a rendering area corresponding to the first interaction area from a preset rendering target, and draw a preset pattern in the rendering area to obtain a rendering target texture; A determination module, configured to determine a first mask image of the target model based on the rendering target texture; a processing module, configured to perform vertex offset processing on vertices of the first interactive area in the target model in the first animation frame according to the first mask image and the vertex animation texture, to obtain a second animation frame of the first interactive area in the target model; The pixels in the region of the preset pattern in the rendering target texture are of a first pixel value, and the pixels in the region other than the region of the preset pattern are of a second pixel value; The determination module is further configured to obtain a first mask image of the target model according to a first pixel value corresponding to the first interactive area in the rendering target texture and a second pixel value corresponding to an area other than the first interactive area.

13. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the vertex animation processing method according to any one of claims 1 to 11.

14. A machine-readable storage medium, characterized in that The machine-readable storage medium stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the vertex animation processing method according to any one of claims 1 to 11.

Citation Information

Patent Citations

  • Model element deformation processing and picture rendering method and device, equipment and medium

    CN112132934A

  • Target virtual model rendering method and device and electronic equipment

    CN113077539A