Method and device for rendering broken animation of virtual objects
By dividing the grid collection of virtual objects into multiple mesh subsets and performing position transformation, the problem of low rendering efficiency of virtual objects crushing animation is solved, and efficient rendering and more realistic crushing effects are achieved on low-end platforms.
Patent Information
- Application Number
- CN202210096660.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-26
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2042-01-26
AI Technical Summary
In the prior art, the rendering efficiency of the broken animation of virtual objects is low, and it is impossible to effectively control the size and number of fragments. It is difficult to support rendering on low-end mobile game platforms, and backend personnel need to repeatedly debug the broken position to achieve a more realistic one. Broken effect, low efficiency.
By predividing the mesh collection of the target virtual objects into multiple mesh subsets, each mesh subset includes adjacent mesh, perform position transformation in response to the breaking instruction, and render the broken animation according to the broken position, so that each mesh subset can be made by rendering each mesh subset. The fragments of the set move from the initial position to the broken position, enabling efficient rendering of the fragments.
It improves the efficiency of the broken animation rendering of virtual objects, controls the number and size of fragments, reduces the number of storage space calls, is suitable for low-end mobile gaming platforms, and improves the practicality of the broken effect.
Smart Images

Figure CN114470762B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computers, and in particular to a method and device for rendering a fragmented animation of a virtual object. Background Art
[0002] In the related field, the shattering of virtual objects is common in virtual game scenes. The shattering animation of virtual objects makes the virtual game scene more realistic. Virtual objects can be buildings, objects, trees, etc. in the virtual game scene. Taking shooting games as an example, in the virtual game scene, the virtual character controlled by the player performs an attack operation on the enemy building. After being attacked, the enemy building presents a shattering animation effect in the virtual game scene.
[0003] At present, the Geometry Collection pre-cutting algorithm is usually used to cut game objects. However, this algorithm cannot control the size and number of fragments generated after cutting. In addition, the fragment data generated by this algorithm are recorded in different storage spaces. When rendering fragments, it is necessary to call the corresponding fragment data in multiple different storage spaces. Such multiple calls affect the terminal performance. For lower-end mobile game platforms, it is difficult to support the rendering of fragments. In addition, when rendering each fragment, the background staff needs to repeatedly debug to determine the fragmentation position of each fragment to make the fragmentation effect more realistic, which is inefficient.
[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0005] The embodiments of the present invention provide a method and device for rendering a fragmented animation of a virtual object, so as to at least solve the technical problem of low efficiency in rendering a fragmented animation of a virtual object.
[0006] According to one aspect of an embodiment of the present invention, a method for rendering a broken animation of a virtual object is provided, comprising: displaying a target virtual object, wherein a target grid set corresponding to the target virtual object is pre-divided into multiple grid subsets, each grid subset is used to form corresponding virtual object fragments after the target virtual object is broken, and each grid subset includes a group of adjacent grids; in response to a breaking instruction for the target virtual object, performing a position transformation on each grid subset to obtain a broken position where each grid subset is located after the target virtual object is broken; and rendering a broken animation of the target virtual object according to the broken position where each grid subset is located, wherein in the broken animation, the virtual object fragments formed by each grid subset move from their respective current positions to the broken position where each grid subset is located.
[0007] Optionally, the method further includes: in accordance with the acquired segmentation instruction, segmenting the target virtual object into multiple parts along some meshes in the surface mesh set, wherein each part becomes a virtual object fragment after the target virtual object is broken, and the surface mesh set is used to form the surface of the target virtual object; setting a new surface mesh set on each face added to each part relative to the surface of the target virtual object, wherein each new surface mesh set is used to form the added face, the target mesh set includes the surface mesh set and the new surface mesh set set on each face, the relationship between two meshes on different parts of the multiple parts is a non-adjacent relationship, and when two meshes on the same part of the multiple parts have at least two identical vertices, the relationship between the two meshes on the same part is an adjacent relationship; according to the adjacent relationship between the meshes in the target mesh set, the target mesh set is divided into the multiple mesh subsets.
[0008] Optionally, dividing the target mesh set into the multiple mesh subsets according to the adjacent relationship between meshes in the target mesh set comprises: performing the following operations on the meshes in the target mesh set until each mesh in the target mesh set is traversed: selecting a current mesh in the target mesh set, wherein the current mesh has not yet been determined as a mesh in the multiple mesh subsets; determining a mesh in the target mesh set that has the adjacent relationship with the current mesh to obtain a current adjacent mesh subset, wherein the current mesh has at least two identical vertices with the meshes in the current adjacent mesh subset; determining a mesh in the target mesh set that has an adjacent relationship with the current mesh to obtain a current adjacent mesh subset, wherein the current mesh is connected to meshes in the current adjacent mesh subset by at least one mesh; determining the current mesh subset to include the current mesh, the current adjacent mesh subset and the current adjacent mesh subset, wherein the current mesh, the meshes in the current adjacent mesh subset and the meshes in the current adjacent mesh subset are a group of adjacent meshes in the current mesh subset, and the multiple mesh subsets include the current mesh subset.
[0009] Optionally, in response to a crushing instruction for the target virtual object, position transformation is performed on each grid subset, including: in response to the crushing instruction for the target virtual object, reading the identifier of each grid subset in the multiple grid subsets in the same storage space through a target call instruction, wherein the identifier of each grid subset in the multiple grid subsets is stored in the same storage space; and according to the identifier of each grid subset, position transformation is performed on each grid subset.
[0010] Optionally, the position transformation of each grid subset according to the identifier of each grid subset includes: performing the following steps for the identifier of each grid subset, wherein when performing the following steps, the identifier of each grid subset is the identifier of the current grid subset: searching for the identifier of each grid included in the current grid subset according to the identifier of the current grid subset, and obtaining the initial position of each grid included in the current grid subset according to the identifier of each grid included in the current grid subset; performing the position transformation on each grid in the current grid subset according to the identifier of the current grid subset and the initial position of each grid included in the current grid subset to obtain the broken position of each grid in the current grid subset.
[0011] Optionally, the position transformation is performed on each grid in the current grid subset according to the identifier of the current grid subset and the initial position of each grid included in the current grid subset to obtain the broken position of each grid in the current grid subset, including: obtaining a preset transformation mode corresponding to the identifier of the current grid subset, wherein the transformation mode includes: translation and / or rotation; and according to the transformation mode corresponding to the identifier of the current grid subset, the position transformation is performed on the initial position of each grid in the current grid subset to obtain the broken position of each grid in the current grid subset.
[0012] Optionally, the position transformation is performed on the initial position of each grid in the current grid subset according to the conversion method corresponding to the identifier of the current grid subset to obtain the broken position of each grid in the current grid subset, including: determining the moving trajectory of the current grid subset according to the conversion method corresponding to the identifier of the current grid subset; performing the following operations on each grid in the current grid subset, when the following operations are performed, each grid in the current grid subset is called the current grid: determining the moving trajectory of the current grid according to the position of the current grid in the current grid subset and the moving trajectory of the current grid subset; moving the current grid from the initial position of the current grid according to the moving trajectory of the current grid, and determining the position of the current grid at the end of the movement as the broken position of the current grid.
[0013] Optionally, the rendering of the fragmentation animation of the target virtual object according to the fragmentation position of each grid subset includes: moving the virtual object fragments formed by each grid subset in the multiple grid subsets from the initial position of each grid subset according to the moving trajectory of each grid subset, wherein each grid in each grid subset moves from the initial position of each grid according to the moving trajectory of each grid to the fragmentation position of each grid.
[0014] Optionally, before reading the identifier of each grid subset in the multiple grid subsets in the same storage space through the target calling instruction, the method also includes: obtaining the identifier of each grid subset in the multiple grid subsets and the identifier of each grid included in each grid subset; storing the identifier of each grid subset and the identifier of each grid included in each grid subset having a mapping relationship in the same storage space.
[0015] According to another aspect of an embodiment of the present invention, a device for rendering a broken animation of a virtual object is also provided, comprising: a display module, used to display a target virtual object, wherein a target grid set corresponding to the target virtual object is pre-divided into multiple grid subsets, each grid subset is used to form corresponding virtual object fragments after the target virtual object is broken, and each grid subset includes a group of adjacent grids; a transformation module, used to respond to a breaking instruction for the target virtual object, transform the position of each grid subset to obtain a broken position of each grid subset after the target virtual object is broken; a rendering module, used to render a broken animation of the target virtual object according to the broken position of each grid subset, wherein in the broken animation, the virtual object fragments formed by each grid subset move from their respective current positions to the broken position of each grid subset.
[0016] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned virtual object fragmentation animation rendering method when running.
[0017] According to another aspect of the embodiment of the present application, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the above virtual object fragmentation animation rendering method.
[0018] According to another aspect of an embodiment of the present invention, there is further provided an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the above-mentioned method for rendering a fragmented animation of a virtual object through the computer program.
[0019] In the embodiment of the present invention, the target virtual object is divided into multiple grids in a grid manner. The target grid set corresponding to the target virtual object is pre-divided into multiple grid subsets, and each grid subset is a broken virtual object fragment. In this way, the target virtual object is divided into multiple fragments in a grid manner, and the number and size of the fragments can be controlled.
[0020] In another embodiment of the invention, when rendering the corresponding virtual object fragments formed after breaking, the position transformation is performed based on the mesh subset corresponding to the virtual object fragments, that is, all meshes in the mesh subset are transformed as a whole according to the identification of the mesh subset, and the positions of all meshes in the mesh subset can be transformed as a whole at the same time, without the need to transform the position of each mesh one by one, thereby improving the efficiency of mesh position transformation, and further improving the rendering efficiency of virtual object fragments. In this way, the technical problem of low efficiency in rendering the broken animation of virtual objects is solved.
[0021] In another embodiment of the invention, the identifiers of multiple grid subsets and the identifiers of the grids included in each grid are recorded in the same storage space, and when rendering the fragmentation animation of the target virtual object, the storage space only needs to be called once to complete the rendering. In this way, the rendering of fragments can also be supported on lower-end mobile games. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0023] Figure 1 is a schematic diagram of an application environment of an optional method for rendering a fragmentation animation of a virtual object according to an embodiment of the present invention;
[0024] Figure 2 A flowchart of an optional method for rendering a fragmented animation of a virtual object according to an embodiment of the present invention;
[0025] Figure 3 A schematic diagram of a virtual object in an optional virtual game scene according to an embodiment of the present invention;
[0026] Figure 4 An optional grid schematic diagram according to an embodiment of the present invention;
[0027] Figure 5 An optional schematic diagram of an original grid according to an embodiment of the present invention;
[0028] Figure 6 A schematic diagram of an optional grid fragment according to an embodiment of the present invention;
[0029] Figure 7 Another optional schematic diagram of grid fragments according to an embodiment of the present invention;
[0030] Figure 8 A schematic diagram of an optional virtual object fragment according to an embodiment of the present invention;
[0031] Fig. 9 An optional adjacent grid schematic diagram according to an embodiment of the present invention;
[0032] Fig.10 An optional flowchart of an embodiment of the present invention;
[0033] Fig.11 An optional texture coordinate of an embodiment of the present invention;
[0034] Fig.12 is another optional flow chart of an embodiment of the invention;
[0035] Fig.13 is another optional flow chart of an embodiment of the invention;
[0036] Fig.14 is another optional moving trajectory schematic diagram of an embodiment of the invention;
[0037] Fig.15 is an optional schematic diagram of a fragmentation animation rendering effect of an embodiment of the invention;
[0038] Fig.16 is another optional schematic diagram of a fragmentation animation rendering effect according to an embodiment of the invention;
[0039] Fig.17 is a structural schematic diagram of an optional virtual object fragmentation animation rendering device according to an embodiment of the present invention;
[0040] Fig.18 is a schematic structural diagram of an optional electronic device according to an embodiment of the present invention;
[0041] Fig.19 It is a block diagram of a computer system structure of an optional electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0042] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0043] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0044] According to one aspect of an embodiment of the present invention, a method for rendering a broken animation of a virtual object is provided. Optionally, as an optional implementation, the method for rendering a broken animation of a virtual object may be applied to, but is not limited to, Figure 1 The application environment shown in the figure includes a user device 102 , a network 110 and a server 112 .
[0045] Optionally, the user device 102 may be a terminal device configured with a target client, which may include but is not limited to at least one of the following: a mobile phone (such as an Android phone, an iOS phone, etc.), a laptop, a tablet computer, a PDA, a MID (Mobile Internet Devices), a PAD, a desktop computer, a smart TV, etc. The target client may be a game client, a video client, an instant messaging client, a browser client, etc. The user device includes: a memory 104, a processor 106 and a display 108, wherein the memory is used to store data, including but not limited to a target grid set corresponding to a target virtual object. The processor is used to process the data, including but not limited to position transformation of each grid subset, rendering of a broken animation of the target virtual object according to the broken position of each grid subset, etc. The display is used to display the screen in the target client, including but not limited to displaying the target virtual object, and displaying a broken animation, etc.
[0046] The above-mentioned network 110 may include but is not limited to: a wired network and a wireless network, wherein the wired network includes: a local area network, a metropolitan area network and a wide area network, and the wireless network includes: Bluetooth, WIFI and other networks that realize wireless communication.
[0047] The server 112 includes a database 114 and a processing engine 116. The database is used to store data, including but not limited to: a target grid set corresponding to a target virtual object. The processing engine can be used to process the following steps:
[0048] Step S11, in response to a breaking instruction for the target virtual object, performing position transformation on each of the grid subsets to obtain a breaking position of each of the grid subsets after the target virtual object is broken;
[0049] Step S12: Rendering a fragmentation animation of the target virtual object according to the fragmentation position of each grid subset.
[0050] The above service can be a single server, a server cluster consisting of multiple servers, or a cloud server.
[0051] The above is only an example and is not limited in this embodiment.
[0052] Optionally, as an optional implementation, as Figure 2 As shown, the above-mentioned broken animation rendering method of the virtual object includes:
[0053] Step S202, displaying the target virtual object, wherein the target grid set corresponding to the target virtual object is pre-divided into a plurality of grid subsets, each grid subset is used to form corresponding virtual object fragments after the target virtual object is broken, and each grid subset includes a group of adjacent grids;
[0054] The target virtual object may be an object in a virtual game scene, such as a virtual building, a virtual object, a virtual character, a virtual tree, etc. Figure 3 In the virtual game scene shown, 300, 301, 302, 303 and 304 shown in the figure are all virtual objects of the virtual game scene.
[0055] The above-mentioned target mesh subset includes multiple meshes, and a mesh is a data structure containing a vertex array and a face array. The vertex array is a data structure, which can be a three-dimensional space vector, and the three-dimensional space vector contains the position of the vertex in the three-dimensional space [x, y, z]. The face array can be a data structure containing three index integers, and the index is used to identify the vertices on the face. Each face can contain multiple edges (for example, 3, 4, 5, etc.), and the specific number of edges can be determined according to the actual situation. In this embodiment, 3 edges are taken as an example. The edge array is an array containing two indexes, and the index is used to identify the vertices on the edge. Figure 4 In the mesh schematic diagram shown in the figure, the face array of the triangular mesh shown in the figure is Face = [0,1,2], where 0,1,2 are vertex indices. The triangular mesh includes an edge array Edge1 = [0,1], which is used to indicate that the vertices contained in the edge Edge1 are 0,1. Vertex Vertex = [x,y,z], where [x,y,z] is used to indicate the position of the vertex in three-dimensional space. For example, the three vertices 0,1,2 contained in the figure, the three-dimensional space position of vertex 1 can be expressed as Vertex1 = [x1,y1,z1], the three-dimensional space position of vertex 2 can be expressed as Vertex2 = [x2,y2,z2], and the three-dimensional space position of vertex 3 can be expressed as Vertex3 = [x3,y3,z3].
[0056] The original mesh refers to the mesh on the outer surface of the target virtual object before it is broken. Figure 5 The mesh in the original mesh shown in the original mesh schematic is a structure containing vertices and faces. Mesh fragments refer to partial meshes obtained from the original mesh, such as Figure 6 The mesh fragments shown are from Figure 5 The fragmentation algorithm is an algorithm that obtains smaller mesh fragments from the original mesh, such as Figure 7 Shown is the Figure 5 The original grid shown is broken into grid fragments using the breaking algorithm.
[0057] by Figure 8 Taking the target virtual object shown in as an example, it is assumed that the target virtual object is broken into virtual object fragment 1 and virtual object fragment 2 as shown in the figure. Figure 8 The outer surface of each virtual object fragment shown in FIG. 1 includes a plurality of meshes, the meshes included in virtual object fragment 1 constitute mesh subset 1, and the meshes included in virtual object fragment 2 constitute another mesh subset 2. The target mesh set is pre-divided into the above-mentioned mesh subset 1 and mesh subset 2.
[0058] Step S204, in response to a breaking instruction for the target virtual object, performing position transformation on each of the grid subsets to obtain a breaking position of each of the grid subsets after the target virtual object is broken;
[0059] The above-mentioned breaking instruction may be an instruction to break the target virtual object after the virtual props used by the player perform an attack operation on the target virtual object. For example, the player uses a bomb to attack the enemy's virtual building, and the above-mentioned breaking instruction is obtained when the bomb hits the virtual building. The above-mentioned breaking position may be the position of the virtual object fragments after the target virtual object is broken.
[0060] Step S206, rendering a fragmentation animation of the target virtual object according to the fragmentation position of each grid subset, wherein in the fragmentation animation, the virtual object fragments formed by each grid subset move from their respective current positions to the fragmentation position of each grid subset.
[0061] Through the above, the target virtual object is divided into multiple grids by using a grid method. The target grid set corresponding to the target virtual object is pre-divided into multiple grid subsets, and each grid subset is a virtual object fragment after being broken. In this way, the target virtual object is divided into multiple fragments by a grid method, and the number and size of the fragments can be controlled. When rendering the corresponding virtual object fragments formed after breaking, the position is transformed based on the grid subset corresponding to the virtual object fragment, which can improve the rendering efficiency of the virtual object fragment. In this way, the technical problem of low efficiency in rendering the broken animation of the virtual object is solved.
[0062] Optionally, the method further includes: in accordance with the acquired segmentation instruction, segmenting the target virtual object into multiple parts along some meshes in the surface mesh set, wherein each part becomes a virtual object fragment after the target virtual object is broken, and the surface mesh set is used to form the surface of the target virtual object; setting a new surface mesh set on each face added to each part relative to the surface of the target virtual object, wherein each new surface mesh set is used to form the added face, the target mesh set includes the surface mesh set and the new surface mesh set set on each face, the relationship between two meshes on different parts of the multiple parts is a non-adjacent relationship, and when two meshes on the same part of the multiple parts have at least two identical vertices, the relationship between the two meshes on the same part is an adjacent relationship; according to the adjacent relationship between the meshes in the target mesh set, the target mesh set is divided into the multiple mesh subsets.
[0063] As an optional implementation, Figure 8Taking the target virtual object shown in the figure as an example, the outer surface of the target virtual object is composed of grids, and the grids included on the outer surface of the target virtual object constitute the above-mentioned surface grid set. The above-mentioned target virtual object is broken along the common edge of grid A and grid B, and the above-mentioned partial grids are grid A and grid B shown in the figure. After the breaking, grid A becomes A', and grid B becomes B'. The above-mentioned target virtual object is broken along the common edge of grid A and grid B to form two parts (virtual object fragment 1 and virtual object fragment 2).
[0064] Each broken part will add new surface, such as Figure 8 The surface on the right side of the virtual object fragment 1 shown in the figure is the newly added surface, and the surface on the left side of the virtual object fragment 2 is the newly added surface. A mesh is set on each newly added surface to obtain a mesh set of each newly added surface. Figure 8 Taking the new surface added on the right side of the virtual object fragment 1 shown in the figure as an example, the meshes C, D, and E shown in the figure constitute the newly added surface mesh set of the virtual object fragment 1.
[0065] The target virtual object is broken along the common edge of mesh A and mesh B. After the breaking, mesh A becomes A' and mesh B becomes B'. Mesh A and mesh B are in an adjacent relationship, while mesh A' and mesh B' are in a non-adjacent relationship. The above adjacent relationship means that there are at least two identical vertices between meshes. Figure 8 In the example, mesh A and mesh B have two common vertices, and mesh A and mesh B are in an adjacent relationship, or Fig. 9 There are common edges and two common vertices in the two meshes shown. Fig. 9 The two meshes shown in are adjacent to each other. However, there are no common vertices between A' and B' after the splitting, and A' and B' are not adjacent to each other. A' and B' also belong to the surface meshes of the target virtual object.
[0066] The surface mesh set in the above target mesh set and the newly added surface mesh set on each surface. Figure 8 Taking the example shown, the grids on the outer surface of the target virtual object in the target grid set also include grids (grids C, D, and E) on the new surface added to virtual object fragment 1 (the right side of virtual object fragment 1), and grids on the new surface added to virtual object fragment 2 (the left side of virtual object fragment 1, not shown in the figure).
[0067] In the above embodiment, the target virtual object is represented by a grid, and when the target virtual object is broken, the common edges of two adjacent grids are split, so that the size and number of the fragments can be controlled.
[0068] Optionally, dividing the target mesh set into the multiple mesh subsets according to the adjacent relationship between meshes in the target mesh set comprises: performing the following operations on the meshes in the target mesh set until each mesh in the target mesh set is traversed: selecting a current mesh in the target mesh set, wherein the current mesh has not yet been determined as a mesh in the multiple mesh subsets; determining a mesh in the target mesh set that has the adjacent relationship with the current mesh to obtain a current adjacent mesh subset, wherein the current mesh has at least two identical vertices with the meshes in the current adjacent mesh subset; determining a mesh in the target mesh set that has an adjacent relationship with the current mesh to obtain a current adjacent mesh subset, wherein the current mesh is connected to meshes in the current adjacent mesh subset by at least one mesh; determining the current mesh subset to include the current mesh, the current adjacent mesh subset and the current adjacent mesh subset, wherein the current mesh, the meshes in the current adjacent mesh subset and the meshes in the current adjacent mesh subset are a group of adjacent meshes in the current mesh subset, and the multiple mesh subsets include the current mesh subset.
[0069] As an optional implementation, Figure 8 For example, assuming that the current grid is grid A', the grid F shown in the figure has two common vertices with grid A', then grid F and grid A' are in an adjacent relationship, similarly, grid G and grid A' have two common vertices, then grid G and grid A' are in an adjacent relationship, and so on, by judging whether there are at least two common vertices between the two grids, it is determined whether the grids have an adjacent relationship. The grids that have an adjacent relationship with the current grid form the current adjacent grid subset.
[0070] As an optional implementation, two grids connected by at least one grid are in an adjacent relationship. Figure 8 For example, grid A' and grid H are connected through grid G, that is, grid A' is adjacent to grid G, and grid G is adjacent to grid H, so grid A' and grid H are in an adjacent relationship. Similarly, the grids that have an adjacent relationship with grid A' constitute the current adjacent grid subset.
[0071] The grids having adjacent relationships with the grid A and the grids having adjacent relationships with the grid A are collectively referred to as grids adjacent to the grid A. The grid A' and the grids having adjacent relationships with the grid A' and the grids having adjacent relationships with the grid A' are determined as a grid subset (grid subset 1).
[0072] Since the grid B' in the target grid set is not in one of the grid sets determined above, that is, the grid B' has not been determined as a grid in the multiple grid subsets. Referring to the above embodiment, the grids adjacent to the grid B' and the grids adjacent to the grid B' are determined in the target grid set. The grid B' and the grids adjacent to the grid B and the grids adjacent to the grid B' are determined as another grid subset (grid subset 2). In this way, Figure 8 The target grid set in is divided into two grid subsets, and the two grid subsets are used to form corresponding virtual object fragments (virtual object fragment 1 and virtual object fragment 2 shown in the figure) after the target virtual object is broken.
[0073] As an optional implementation, Fig.10 As shown in the flowchart, the meshes in the target mesh set can be grouped to obtain multiple mesh subsets by the following steps:
[0074] Step S1001, setting the values of all grids in the target grid subset to -1, where -1 is a preset value only for illustrating the present embodiment and is not limited thereto, and can also be set to 0, 1, 2, etc.
[0075] Step S1002, obtain the i-th grid in the target grid set, and determine whether the value of the i-th grid is -1. In this embodiment, i can start from 0. If the value of the i-th grid is -1, execute step S1003. If the value of the i-th grid is not -1, execute step S1005.
[0076] Step S1003, record the i-th grid in the current grid subset in the target cache. Specifically, the i-th grid can be recorded in a hash table, which is stored in the above-mentioned target cache. The hash table records the correspondence between the identifier of the grid subset and the identifier of the grid included in the grid subset in a Key-Value manner. In this embodiment, the identifier of the current grid subset is Key, and the i-th grid is Value.
[0077] Step S1004, the value of the i-th grid in the target grid set is increased by 1. For the grid in the target grid set that has not been determined to be in the multiple grid subsets, its value is initially -1, and for the grid in the multiple grid subsets that have been determined (for example, the i-th grid), in the next round of grouping, since its value has changed (increased by 1), it is no longer necessary to group it, which can improve the efficiency of dividing the target grid set into multiple grid subsets.
[0078] Step S1005, searching for a mesh adjacent to the ith mesh in the target mesh set, where the adjacent order includes adjacent and adjoining. Adjacent means that there are at least two common vertices between two meshes, and adjoining means that two meshes are connected by at least one mesh.
[0079] Step S1006, determine whether the value of the adjacent grid is -1. If yes, execute step S1007, if not, execute step S1009.
[0080] Step S1007, recording the adjacent grids into the current grid subset in the target cache. Specifically, the grids adjacent to the ith grid may be recorded in the above hash table. In the hash table, the adjacent grids have the same Key as the ith grid.
[0081] Step S1008, adding one to the value of the grid adjacent to the i-th grid in the target grid set.
[0082] Step S1009, determine whether the target grid set has been traversed, if so, execute step S1010.
[0083] Step S1010, increase the value of i by one, and continue to execute step S1002.
[0084] Through the above steps, the meshes in the target mesh set can be grouped into multiple mesh subsets, each mesh subset is used to render the corresponding virtual object fragments, so as to achieve the effect of improving the rendering efficiency of the fragments.
[0085] Optionally, in response to a crushing instruction for the target virtual object, position transformation is performed on each grid subset, including: in response to the crushing instruction for the target virtual object, reading the identifier of each grid subset in the multiple grid subsets in the same storage space through a target call instruction, wherein the identifier of each grid subset in the multiple grid subsets is stored in the same storage space; and according to the identifier of each grid subset, position transformation is performed on each grid subset.
[0086] As an optional implementation, the target call instruction may be Drawcall, which is a call command from the central processing unit (CPU) to the underlying graphics drawing interface, and the graphics processing unit (GPU) performs the rendering operation. The rendering process is implemented in a pipeline, and the CPU and GPU work in parallel. The CPU and GPU are connected through a command buffer, to which the CPU sends rendering commands, and the GPU receives and executes the corresponding rendering commands.
[0087] As an optional implementation, the above-mentioned storage space may store the above-mentioned hash table, which records the identifier of each grid subset in a plurality of grid subsets, wherein the identifier of each grid subset serves as the key in the hash table. The identifier of the grid included in each grid subset serves as the value in the hash table. The hash table records the identifier of each grid subset and the identifier of the grid included in each grid subset in a Key-Value manner. In this embodiment, since the identifiers of the plurality of grid subsets and the identifiers of the grids included in each grid subset are recorded in the same storage space. Therefore, when rendering fragment animation, only one draw call (Drawcall) is required, which is suitable for lower-end mobile game platforms.
[0088] Optionally, the position transformation of each grid subset according to the identifier of each grid subset includes: performing the following steps for the identifier of each grid subset, wherein when performing the following steps, the identifier of each grid subset is the identifier of the current grid subset: searching for the identifier of each grid included in the current grid subset according to the identifier of the current grid subset, and obtaining the initial position of each grid included in the current grid subset according to the identifier of each grid included in the current grid subset; performing the position transformation on each grid in the current grid subset according to the identifier of the current grid subset and the initial position of each grid included in the current grid subset to obtain the broken position of each grid in the current grid subset.
[0089] As an optional implementation, the above-mentioned identification of the mesh subset and the identification of the meshes included in each mesh subset are stored in a hash table, the identification of the mesh subset is the key, and the identification of the mesh is the value. The identification of the mesh can be found in the hash table through the identification of the mesh subset, and the initial position of the mesh is obtained according to the identification of the mesh. The initial position refers to the position of the mesh before the target virtual object is broken. The position of the mesh can be the vertex position of the mesh. Figure 8 For example, the initial position of mesh A is the position (x, y, z) of the three vertices of mesh A in three-dimensional space.
[0090] As an optional implementation, the identifier of the mesh subset is groupID, and the above-mentioned multiple mesh subsets are respectively embedded in the mesh group data format on the texture coordinate channels 1-7, and the identifier of each mesh subset is stored in the texture coordinates. Each mesh has three vertices, and the texture coordinates of the vertices of each mesh are [groupID, 0]. Fig.11 As shown, the texture coordinates uv=[0,0] of the three vertices of the mesh with groupID=0, and the texture coordinates uv=[1,0] of the three vertices of the mesh with groupID=1.
[0091] like Fig.12 The flowchart shown is for setting texture coordinates for each mesh, which includes the following steps:
[0092] Step S1201, searching for the vertex of the current grid that is 0;
[0093] Step S1202, setting the texture coordinates of the vertex to uv = [groupID, 0], where groupID is the identifier of the mesh subset to which the current mesh belongs;
[0094] Step S1203, determine whether the vertex value is less than 3, if so, end, if not, execute step S1204;
[0095] Step S1204, increase the value of vertex vertexde by 1, and continue to execute step S1202.
[0096] The positions of the meshes in the mesh subset are transformed according to the identifier of the mesh subset. Then M = transforms[groupID], where transforms include but are not limited to: translation, rotation and other transformations. The broken positions of the meshes in the mesh set are (x', y', z') = M*(x, y, z), where (x, y, z) is the initial position of the mesh, and (x', y', z') is the broken position of the mesh. Because the identifier of each mesh subset in multiple mesh subsets is different, the M obtained after the transformation is different. Each mesh subset can be separated from the target mesh subset in a single Drawcall, and the virtual object fragments corresponding to each mesh subset can be rendered.
[0097] In the above embodiment, the positions of the grids in each grid subset are transformed according to the identifier of each grid subset to obtain the broken positions of each virtual object fragment, which can improve the rendering efficiency of the broken animation.
[0098] Optionally, the position transformation is performed on each grid in the current grid subset according to the identifier of the current grid subset and the initial position of each grid included in the current grid subset to obtain the broken position of each grid in the current grid subset, including: obtaining a preset transformation mode corresponding to the identifier of the current grid subset, wherein the transformation mode includes: translation and / or rotation; and according to the transformation mode corresponding to the identifier of the current grid subset, the position transformation is performed on the initial position of each grid in the current grid subset to obtain the broken position of each grid in the current grid subset.
[0099] As an optional implementation, the above-mentioned transformation modes transforms include translation and rotation, and the transforms corresponding to each grid subset can be calculated according to the physical simulation system.
[0100] As an optional implementation, the position of the grid in each grid subset of the multiple grid subsets is transformed to obtain the broken position of the grid. For example, the grid is a triangle (including three vertices), such as Fig.13 The flowchart shown includes the following steps:
[0101] Step S1301, setting the transformation mode of each grid subset in a plurality of grid subsets into a corresponding array, the transformation mode including but not limited to translation, rotation and transformation, the corresponding array may be transform[], translation[], rotation[];
[0102] Step S1302, set i=1;
[0103] Step S1303, taking the i-th grid in the target grid set as the current grid, and obtaining the identifier of the current grid;
[0104] Step S1304, searching the hash table for the identifier of the grid subset corresponding to the identifier of the current grid according to the identifier of the current grid;
[0105] Step S1305, determining a conversion method and a corresponding array corresponding to the identifier of the grid subset in the preset conversion methods;
[0106] Step S1306, using the array of the transformation mode to transform the position of each vertex on the grid, specifically, j=1 may be set;
[0107] Step S1307, obtaining the jth vertex;
[0108] Step S1308, using the conversion method to transform the position of the j-th vertex of the mesh;
[0109] Step S1309, determine whether j is less than 3 (the number of vertices of the mesh), if yes, go to step S1310, if no, go to step S1312;
[0110] Step S1310, determine whether all grids in the target grid set have been traversed, if yes, execute step S1311 if no;
[0111] Step S1311, set i=i+1, and continue to execute step S1303.
[0112] Optionally, the position transformation is performed on the initial position of each grid in the current grid subset according to the conversion method corresponding to the identifier of the current grid subset to obtain the broken position of each grid in the current grid subset, including: determining the moving trajectory of the current grid subset according to the conversion method corresponding to the identifier of the current grid subset; performing the following operations on each grid in the current grid subset, when the following operations are performed, each grid in the current grid subset is called the current grid: determining the moving trajectory of the current grid according to the position of the current grid in the current grid subset and the moving trajectory of the current grid subset; moving the current grid from the initial position of the current grid according to the moving trajectory of the current grid, and determining the position of the current grid at the end of the movement as the broken position of the current grid.
[0113] As an optional implementation, the above-mentioned moving trajectory includes but is not limited to the trajectory of each virtual object fragment moving from the current position to the broken position during the breaking process after the target virtual object is broken. It can be the trajectory of the center of the virtual object fragment moving from the current position to the broken position, or it can be the trajectory of any point on the virtual object fragment moving from the current position to the broken position.
[0114] As an optional implementation, the moving trajectory of the current grid subset is the trajectory of the center of the corresponding virtual object fragment moving to the corresponding broken position as the moving trajectory, such as Fig.14 As shown, track 1 in the figure is that the center point of virtual object fragment 1 moves from the initial position O1 on the target virtual object to the fragment position O2. Track 2 is that the center point of virtual object fragment 2 moves from the initial position O3 on the target virtual object to the fragment position O4.
[0115] As an optional implementation, Fig.14 Taking the grid A in the figure as the current grid as an example, the above-mentioned moving trajectory 1 is the moving trajectory of the virtual object fragment where the grid A is located. The moving trajectory of the grid A refers to the moving trajectory of the virtual object fragment. As shown in the figure, the grid A includes three vertices. Each vertex moves with reference to the trajectory 1 to obtain the corresponding trajectory. The moving trajectory is the moving trajectory of the grid. As shown in Figure 14, the trajectory 3 is the moving trajectory of the grid A. The trajectory 1 and the trajectory 3 are two parallel trajectories in space, so as to obtain the broken position of the grid A.
[0116] Optionally, the rendering of the fragmentation animation of the target virtual object according to the fragmentation position of each grid subset includes: moving the virtual object fragments formed by each grid subset in the multiple grid subsets from the initial position of each grid subset according to the moving trajectory of each grid subset, wherein each grid in each grid subset moves from the initial position of each grid according to the moving trajectory of each grid to the fragmentation position of each grid.
[0117] Optionally, before reading the identifier of each grid subset in the multiple grid subsets in the same storage space through the target calling instruction, the method also includes: obtaining the identifier of each grid subset in the multiple grid subsets and the identifier of each grid included in each grid subset; storing the identifier of each grid subset and the identifier of each grid included in each grid subset having a mapping relationship in the same storage space.
[0118] As an optional implementation, Fig.15 and 16 The schematic diagram of the broken animation rendering effect shown in the figure shows that the virtual object in the virtual game is broken into multiple virtual object fragments. The broken animation rendering method of the present application does not require pre-cutting of the grid, so it does not need to generate more vertices and faces, has lower GPU requirements, and can be widely used in relatively low-end game platforms.
[0119] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described action sequence, because according to the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
[0120] According to another aspect of an embodiment of the present invention, a virtual object fragmentation animation rendering device for implementing the above virtual object fragmentation animation rendering method is also provided. Fig.17As shown, the device includes: a display module 1702, used to display a target virtual object, wherein a target grid set corresponding to the target virtual object is pre-divided into a plurality of grid subsets, each grid subset is used to form corresponding virtual object fragments after the target virtual object is broken, and each grid subset includes a group of adjacent grids; a transformation module 1704, used to respond to a breaking instruction for the target virtual object, transform the position of each grid subset to obtain a broken position of each grid subset after the target virtual object is broken; a rendering module 1706, used to render a broken animation of the target virtual object according to the broken position of each grid subset, wherein in the broken animation, the virtual object fragments formed by each grid subset move from their respective current positions to the broken position of each grid subset.
[0121] Optionally, the above-mentioned device is used to divide the target virtual object into multiple parts along some grids in the surface grid set according to the acquired segmentation instruction, wherein each part becomes a virtual object fragment after the target virtual object is broken, and the surface grid set is used to form the surface of the target virtual object; a new surface grid set is set on each face added to each part relative to the surface of the target virtual object, wherein each new surface grid set is used to form the added face, the target grid set includes the surface grid set and the new surface grid set set on each face, the relationship between two grids on different parts of the multiple parts is a non-adjacent relationship, and when two grids on the same part of the multiple parts have at least two identical vertices, the relationship between the two grids on the same part is an adjacent relationship; according to the adjacent relationship between the grids in the target grid set, the target grid set is divided into the multiple grid subsets.
[0122] Optionally, the above-mentioned device is used to perform the following operations on the grids in the target grid set until each grid in the target grid set is traversed: selecting a current grid in the target grid set, wherein the current grid has not yet been determined as a grid in the multiple grid subsets; determining a grid in the target grid set that has the adjacent relationship with the current grid to obtain a current adjacent grid subset, wherein the current grid and the grids in the current adjacent grid subset have at least two identical vertices; determining a grid in the target grid set that has an adjacent relationship with the current grid to obtain a current adjacent grid subset, wherein the current grid and the grids in the current adjacent grid subset are connected by at least one grid; determining the current grid subset to include the current grid, the current adjacent grid subset and the current adjacent grid subset, wherein the current grid and the grids in the current adjacent grid subset and the grids in the current adjacent grid subset are a group of adjacent grids in the current grid subset, and the multiple grid subsets include the current grid subset.
[0123] Optionally, the above-mentioned device is used to respond to a crushing instruction for the target virtual object, read the identifier of each grid subset in the multiple grid subsets in the same storage space through a target call instruction, wherein the identifier of each grid subset in the multiple grid subsets is stored in the same storage space; and perform position transformation on each grid subset according to the identifier of each grid subset.
[0124] Optionally, the above-mentioned device is used to perform the following steps for the identifier of each grid subset, wherein, when performing the following steps, the identifier of each grid subset is the identifier of the current grid subset: according to the identifier of the current grid subset, searching for the identifier of each grid included in the current grid subset, and according to the identifier of each grid included in the current grid subset, obtaining the initial position of each grid included in the current grid subset; according to the identifier of the current grid subset and the initial position of each grid included in the current grid subset, performing the position transformation on each grid in the current grid subset to obtain the broken position of each grid in the current grid subset.
[0125] Optionally, the above-mentioned device is used to obtain a pre-set transformation method corresponding to the identifier of the current grid subset, wherein the transformation method includes: translation and / or rotation; according to the transformation method corresponding to the identifier of the current grid subset, the initial position of each grid in the current grid subset is transformed to obtain the broken position of each grid in the current grid subset.
[0126] Optionally, the above-mentioned device is used to determine the moving trajectory of the current grid subset according to the conversion method corresponding to the identifier of the current grid subset; perform the following operations on each grid in the current grid subset, and when the following operations are performed, each grid in the current grid subset is called the current grid: determine the moving trajectory of the current grid according to the position of the current grid in the current grid subset and the moving trajectory of the current grid subset; move the current grid from the initial position of the current grid according to the moving trajectory of the current grid, and determine the position of the current grid at the end of the movement as the broken position of the current grid.
[0127] Optionally, the above-mentioned device is used to move the virtual object fragments formed by each grid subset in the multiple grid subsets from the initial position of each grid subset according to the moving trajectory of each grid subset, wherein each grid in each grid subset is moved from the initial position of each grid according to the moving trajectory of each grid to the fragmented position where each grid is located.
[0128] Optionally, the above-mentioned device is used to obtain the identification of each grid subset in the multiple grid subsets and the identification of each grid included in each grid subset before reading the identification of each grid subset in the multiple grid subsets in the same storage space through the target calling instruction; and store the identification of each grid subset and the identification of each grid included in each grid subset having a mapping relationship in the same storage space.
[0129] According to another aspect of the embodiments of the present invention, an electronic device for implementing the above-mentioned virtual object fragmentation animation rendering method is also provided. The electronic device may be Figure 1 The terminal device or server shown in the figure. This embodiment is described by taking the electronic device as a server as an example. Fig.18 As shown, the electronic device includes a memory 1802 and a processor 1804. The memory 1802 stores a computer program, and the processor 1804 is configured to execute the steps in any of the above method embodiments through the computer program.
[0130] Optionally, in this embodiment, the electronic device may be located in at least one network device among a plurality of network devices of a computer network.
[0131] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0132] S1, displaying a target virtual object, wherein a target grid set corresponding to the target virtual object is pre-divided into a plurality of grid subsets, each grid subset is used to form corresponding virtual object fragments after the target virtual object is broken, and each grid subset includes a group of adjacent grids;
[0133] S2, in response to a breaking instruction for the target virtual object, performing position transformation on each of the grid subsets to obtain a breaking position of each of the grid subsets after the target virtual object is broken;
[0134] S3, rendering a fragmentation animation of the target virtual object according to the fragmentation position of each grid subset, wherein in the fragmentation animation, virtual object fragments formed by each grid subset move from their respective current positions to the fragmentation position of each grid subset.
[0135] Alternatively, a person skilled in the art may understand that: Fig.18 The structure shown is for illustration only, and the electronic device may also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (MID), a PAD, and other terminal devices. Fig.18 The electronic device and the electronic equipment described above are not limited in structure. Fig.18 More or fewer components (such as network interfaces, etc.) as shown in, or with Fig.18 Different configurations are shown.
[0136] Among them, the memory 1802 can be used to store software programs and modules, such as the program instructions / modules corresponding to the method and device for rendering the broken animation of virtual objects in the embodiments of the present invention. The processor 1804 executes various functional applications and data processing by running the software programs and modules stored in the memory 1802, that is, to implement the above-mentioned method for rendering the broken animation of virtual objects. The memory 1802 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 1802 may further include a memory remotely arranged relative to the processor 1804, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. Among them, the memory 1802 may specifically be, but is not limited to, used to store information such as sample characteristics of items and target virtual resource accounts. As an example, if Fig.18As shown, the memory 1802 may include, but is not limited to, the display module 1702, the transformation module 1704, and the rendering module 1706 in the broken animation rendering device of the virtual object. In addition, it may also include, but is not limited to, other module units in the broken animation rendering device of the virtual object, which will not be repeated in this example.
[0137] Optionally, the transmission device 1806 is used to receive or send data via a network. Specific examples of the above-mentioned network may include a wired network and a wireless network. In one example, the transmission device 1806 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices and routers via a network cable so as to communicate with the Internet or a local area network. In one example, the transmission device 1806 is a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0138] In addition, the electronic device further includes: a display 1808 for displaying the target virtual object and the breaking animation; and a connection bus 1810 for connecting various module components in the electronic device.
[0139] In other embodiments, the terminal device or server may be a node in a distributed system, wherein the distributed system may be a blockchain system, and the blockchain system may be a distributed system formed by connecting the multiple nodes through network communication. Among them, the nodes may form a peer-to-peer (P2P, Peer To Peer) network, and any form of computing device, such as a server, terminal and other electronic devices, may become a node in the blockchain system by joining the peer-to-peer network.
[0140] According to one aspect of the present application, a computer program product is provided, the computer program product comprising a computer program / instruction, the computer program / instruction comprising a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication part 1909, and / or installed from a removable medium 1911. When the computer program is executed by the central processor 1901, various functions provided in the embodiments of the present application are executed.
[0141] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0142] Fig.19 The structure block diagram of a computer system for implementing an electronic device according to an embodiment of the present application is schematically shown.
[0143] It should be noted that Fig.19The computer system 1900 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0144] like Fig.19 As shown, the computer system 1900 includes a central processing unit 1901 (CPU), which can perform various appropriate actions and processes according to the program stored in the read-only memory 1902 (ROM) or the program loaded from the storage part 1908 to the random access memory 1903 (RAM). Various programs and data required for system operation are also stored in the random access memory 1903. The central processing unit 1901, the read-only memory 1902 and the random access memory 1903 are connected to each other through a bus 1904. The input / output interface 1905 (Input / Output interface, i.e., I / O interface) is also connected to the bus 1904.
[0145] The following components are connected to the input / output interface 1905: an input section 1906 including a keyboard, a mouse, etc.; an output section 1907 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1908 including a hard disk, etc.; and a communication section 1909 including a network interface card such as a LAN card, a modem, etc. The communication section 1909 performs communication processing via a network such as the Internet. A drive 1910 is also connected to the input / output interface 1905 as needed. A removable medium 1911, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1910 as needed so that a computer program read therefrom is installed into the storage section 1908 as needed.
[0146] In particular, according to an embodiment of the present application, the processes described in the various method flow charts can be implemented as computer software programs. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication part 1909, and / or installed from a removable medium 1911. When the computer program is executed by the central processor 1901, various functions defined in the system of the present application are executed.
[0147] According to one aspect of the present application, a computer-readable storage medium is provided, and a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in the above-mentioned various optional implementations.
[0148] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:
[0149] S1, displaying a target virtual object, wherein a target grid set corresponding to the target virtual object is pre-divided into a plurality of grid subsets, each grid subset is used to form corresponding virtual object fragments after the target virtual object is broken, and each grid subset includes a group of adjacent grids;
[0150] S2, in response to a breaking instruction for the target virtual object, performing position transformation on each of the grid subsets to obtain a breaking position of each of the grid subsets after the target virtual object is broken;
[0151] S3, rendering a fragmentation animation of the target virtual object according to the fragmentation position of each grid subset, wherein in the fragmentation animation, virtual object fragments formed by each grid subset move from their respective current positions to the fragmentation position of each grid subset.
[0152] Optionally, in this embodiment, a person of ordinary skill in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing hardware related to the terminal device through a program, and the program may be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.
[0153] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling one or more computer devices (which can be personal computers, servers or network devices, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention.
[0154] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0155] In the several embodiments provided in the present application, it should be understood that the disclosed client can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0156] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0157] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0158] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for rendering a fragmented animation of a virtual object, characterized in that: include: Displaying a target virtual object, wherein a target grid set corresponding to the target virtual object is pre-divided into a plurality of grid subsets, each grid subset is used to form corresponding virtual object fragments after the target virtual object is broken, and each grid subset includes a group of adjacent grids; In response to a fragmentation instruction for the target virtual object, the identifier of each grid subset in the multiple grid subsets is read in the same storage space through a target call instruction, wherein the identifier of each grid subset in the multiple grid subsets is stored in the same storage space; the following steps are performed for the identifier of each grid subset, wherein when performing the following steps, the identifier of each grid subset is the identifier of the current grid subset: according to the identifier of the current grid subset, the identifier of each grid included in the current grid subset is searched, and according to the identifier of each grid included in the current grid subset, the initial position of each grid included in the current grid subset is obtained; a conversion method corresponding to the identifier of the current grid subset is obtained, wherein the conversion method includes: translation and / or rotation; according to the conversion method corresponding to the identifier of the current grid subset, the initial position of each grid in the current grid subset is transformed to obtain the fragmentation position of each grid in the current grid subset; According to the fragmentation position of each grid subset, a fragmentation animation of the target virtual object is rendered, wherein in the fragmentation animation, virtual object fragments formed by each grid subset move from their respective current positions to the fragmentation position of each grid subset.
2. The method according to claim 1, characterized in that The method further comprises: According to the acquired segmentation instruction, the target virtual object is segmented into a plurality of parts along a part of the grids in the surface grid set, wherein each part becomes a virtual object fragment after the target virtual object is broken, and the surface grid set is used to form a surface of the target virtual object; A newly added face mesh set is set on each face added to each part relative to the surface of the target virtual object, wherein each newly added face mesh set is used to form an added face, the target mesh set includes the surface mesh set and the newly added face mesh set set on each face, the relationship between two meshes on different parts of the multiple parts is a non-adjacent relationship, and when two meshes on the same part of the multiple parts have at least two identical vertices, the relationship between the two meshes on the same part is an adjacent relationship; The target grid set is divided into the plurality of grid subsets according to the adjacent relationships between grids in the target grid set.
3. The method according to claim 2, characterized in that The step of dividing the target grid set into the plurality of grid subsets according to the adjacent relationship between grids in the target grid set comprises: The following operations are performed on the meshes in the target mesh set until each mesh in the target mesh set is traversed: Selecting a current grid in the target grid set, wherein the current grid has not been determined as a grid in the plurality of grid subsets; Determine a grid having the adjacent relationship with the current grid in the target grid set to obtain a current adjacent grid subset, wherein the current grid and the grids in the current adjacent grid subset have at least two common vertices; Determine a grid in the target grid set that has an adjacency relationship with the current grid, and obtain a current adjacent grid subset, wherein the current grid is connected to grids in the current adjacent grid subset through at least one grid; The current grid subset is determined to include the current grid, the current adjacent grid subset and the current adjacent grid subset, wherein the current grid and the grids in the current adjacent grid subset and the grids in the current adjacent grid subset are a group of adjacent grids in the current grid subset, and the multiple grid subsets include the current grid subset.
4. The method according to claim 1, characterized in that: The step of performing the position transformation on the initial position of each grid in the current grid subset according to the conversion mode corresponding to the identifier of the current grid subset to obtain the fragmentation position of each grid in the current grid subset includes: Determining a moving trajectory of the current grid subset according to the conversion mode corresponding to the identifier of the current grid subset; Perform the following operations on each grid in the current grid subset, wherein each grid in the current grid subset is referred to as a current grid when performing the following operations: Determine a moving trajectory of the current grid according to a position of the current grid in the current grid subset and a moving trajectory of the current grid subset; The current grid is moved from an initial position of the current grid according to a moving track of the current grid, and a position of the current grid at the end of the movement is determined as a broken position of the current grid.
5. The method according to claim 4, characterized in that The rendering of the fragmentation animation of the target virtual object according to the fragmentation position of each grid subset includes: The virtual object fragments formed by each grid subset in the multiple grid subsets are moved from the initial position of each grid subset according to the moving trajectory of each grid subset, wherein each grid in each grid subset is moved from the initial position of each grid according to the moving trajectory of each grid to the broken position where each grid is located.
6. The method according to claim 1, characterized in that Before reading the identifier of each of the plurality of grid subsets in the same storage space through the target calling instruction, the method further includes: Obtaining an identifier of each of the plurality of grid subsets and an identifier of each grid included in each grid subset; The identifier of each grid subset having a mapping relationship and the identifier of each grid included in each grid subset are stored in the same storage space.
7. A device for rendering a broken animation of a virtual object, characterized in that: include: A display module, used for displaying a target virtual object, wherein a target grid set corresponding to the target virtual object is pre-divided into a plurality of grid subsets, each grid subset is used to form corresponding virtual object fragments after the target virtual object is broken, and each grid subset includes a group of adjacent grids; A transformation module, for responding to a fragmentation instruction for the target virtual object, reading the identifier of each grid subset in the multiple grid subsets in the same storage space through a target call instruction, wherein the identifier of each grid subset in the multiple grid subsets is stored in the same storage space; performing the following steps for the identifier of each grid subset, wherein when performing the following steps, the identifier of each grid subset is the identifier of the current grid subset: searching for the identifier of each grid included in the current grid subset according to the identifier of the current grid subset, and obtaining the initial position of each grid included in the current grid subset according to the identifier of each grid included in the current grid subset; obtaining a preset conversion mode corresponding to the identifier of the current grid subset, wherein the conversion mode includes: translation and / or rotation; performing a position transformation on the initial position of each grid in the current grid subset according to the conversion mode corresponding to the identifier of the current grid subset, and obtaining the fragmentation position of each grid in the current grid subset; A rendering module is used to render a fragmentation animation of the target virtual object according to the fragmentation position of each grid subset, wherein in the fragmentation animation, the virtual object fragments formed by each grid subset move from their respective current positions to the fragmentation position of each grid subset.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the program executes the method described in any one of claims 1 to 6 when executed.
9. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 6 through the computer program.
