Damaged effect generation method and device of virtual model and electronic equipment

By determining the damaged parameters of the virtual model and generating rendering parameters based on these parameters, using preset texture arrays and texture maps, efficient rendering and rich display of the damaged effects of the virtual model are achieved, solving the problems of complex operation, high cost and poor visual effects in the prior art.

CN120014143APending Publication Date: 2025-05-16NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411853997.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-16
Publication Date
2025-05-16

AI Technical Summary

Technical Problem

When the prior art realizes the damage effect of virtual items, the operation is complex and costly, and the damage effect generated by the multi-map texture tiling method is simple, the repetition is high, and the visual effect is poor.

Method used

By determining the damaged parameters of the virtual model, the rendering parameters of the virtual model are determined based on these parameters, preset texture arrays and texture coordinate parameters of the virtual model. Texture arrays are generated based on multiple texture maps, and texture maps have corresponding damaged types, thus achieving more efficient and rich rendering of damaged effects.

Benefits of technology

It improves the rendering efficiency of the damaged effects of the virtual model, enriches the display effect of various damaged conditions of the virtual model, and reduces operational complexity and cost.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120014143A_ABST
    Figure CN120014143A_ABST
Patent Text Reader

Abstract

The invention provides a virtual model damage effect generation method and apparatus, and an electronic device. The method comprises the steps of determining damage parameters of a virtual model; based on the damaged parameter, a preset texture array and a texture coordinate parameter of the virtual model, determining a rendering parameter of the virtual model; the texture array is generated based on a plurality of texture maps; the texture map has a corresponding damage type; and rendering the virtual model based on the rendering parameter, so that the rendered virtual model presents a damaged effect matched with the damaged parameter. In the mode, the texture array is generated based on the plurality of texture maps in advance, and when the virtual model is rendered, the texture data corresponding to the damaged type of the model is read from the texture array, so that the rendering parameters of the virtual model are determined, the model is rendered, the rendering efficiency of the damaged effect of the virtual model is improved, and the rendering efficiency of the damaged effect of the virtual model is improved. And the display effect of various damaged conditions of the virtual model is enriched.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of rendering technology, and in particular to a method, device and electronic device for generating a damage effect of a virtual model. Background Art

[0002] In the game, there may be scenes where virtual objects such as warships and vehicles are attacked. In order to create a visual experience of the attack scene, decals or multi-map textures are usually tiled on the surface of the object to show the effects of surface damage after the virtual object is attacked. However, to realize the surface damage model of virtual objects through decals, the production staff needs to modify the overall shading system, modify the engine, and consider compatibility. Players often need to re-download the game, which is complicated and costly. The damage effect produced by the multi-map texture tiling method is simple, highly repetitive, and has poor visual effects. Summary of the invention

[0003] In view of this, the purpose of the present disclosure is to provide a method, device and electronic device for generating damage effects of a virtual model, so as to improve the rendering efficiency of the damage effects of the virtual model and enrich the display effects of various damage conditions of the virtual model.

[0004] In a first aspect, an embodiment of the present disclosure provides a method for generating a damaged effect of a virtual model, the method comprising: determining damage parameters of the virtual model; the damaged parameters are used to indicate the corresponding degree of damage and / or target damage type of the virtual model; determining rendering parameters of the virtual model based on the damaged parameters, a preset texture array and texture coordinate parameters of the virtual model; the texture array is generated based on multiple texture maps; the texture map has a corresponding damage type; and rendering the virtual model based on the rendering parameters so that the rendered virtual model presents a damaged effect that matches the damaged parameters.

[0005] In a second aspect, an embodiment of the present disclosure provides a device for generating a damaged effect of a virtual model, the device comprising: a damaged parameter determination module, used to determine the damaged parameters of the virtual model; the damaged parameters are used to indicate the corresponding degree of damage and / or target damage type of the virtual model; a rendering parameter determination module, used to determine the rendering parameters of the virtual model based on the damaged parameters, a preset texture array and the texture coordinate parameters of the virtual model; the texture array is generated based on multiple texture maps; the texture map has a corresponding damage type; a rendering module, used to render the virtual model based on the rendering parameters, so that the rendered virtual model presents a damaged effect matching the damaged parameters.

[0006] In a third aspect, an embodiment of the present invention provides an electronic device, including a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the above-mentioned method for generating damage effects of a virtual model.

[0007] 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 above-mentioned method for generating damage effects of a virtual model.

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

[0009] The above-mentioned method, device and electronic device for generating the damaged effect of a virtual model determine the damaged parameters of the virtual model; determine the rendering parameters of the virtual model based on the damaged parameters, the preset texture array and the texture coordinate parameters of the virtual model; the texture array is generated based on multiple texture maps; the texture map has a corresponding damaged type; and the virtual model is rendered based on the rendering parameters so that the rendered virtual model presents a damaged effect that matches the damaged parameters. In this method, a texture array is generated based on multiple texture maps in advance, and when rendering the virtual model, texture data corresponding to the damaged type of the model is read from the texture array, and then the rendering parameters of the virtual model are determined, and the model is rendered, thereby improving the rendering efficiency of the damaged effect of the virtual model and enriching the display effects of various damaged conditions of the virtual model.

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

[0011] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0013] Figure 1 A flowchart of a method for generating a damage effect of a virtual model provided by an embodiment of the present disclosure;

[0014] Figure 2 A schematic diagram of a texture map provided by an embodiment of the present disclosure;

[0015] Figure 3 A schematic diagram of a parallax texture map provided by an embodiment of the present disclosure;

[0016] Figure 4 A schematic diagram of a parallax determination process of an armored area provided in an embodiment of the present disclosure;

[0017] Figure 5 A schematic diagram of the structure of a device for generating a damage effect of a virtual model provided by an embodiment of the present disclosure;

[0018] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0019] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.

[0020] For game projects, combat content is usually involved, and the attack part is usually expressed by actions and special effects. However, with the development of technology and the improvement of practitioners' pursuit of artistic effects, other auxiliary effect expression methods are needed to increase details.

[0021] In the related art, decals can be used to express, or multi-map texture tiling can be used to express the damaged effect of items in the game. In game art, decals are a special kind of map, which are usually applied to the surface of the game environment to add details or changes, such as graffiti on the wall, oil stains on the ground, cracks, etc. Decals add details to the scene by superimposing a map on an existing surface without modifying the original geometric shape. However, this method requires modifying the overall shading system, modifying the engine, and considering compatibility issues. That is, for game projects, modifying the engine means that all players need to re-download the game, which is a more cumbersome operation. The damaged effect produced by multi-map texture tiling is relatively simple, with more maps, high repetition of the effect, and poor visual experience for players.

[0022] The above methods all have the problems of low performance, poor overall control, poor versatility, and being unfavorable for subsequent maintenance and expansion development.

[0023] Based on this, the embodiments of the present disclosure provide a method, device and electronic device for generating a damaged effect of a virtual model. The technology can be applied to scenarios where the damaged effect of a virtual model needs to be displayed.

[0024] See also Figure 1 First, a method for generating a damage effect of a virtual model provided by an embodiment of the present invention is introduced. The method comprises the following steps:

[0025] Step S102, determining damage parameters of the virtual model; the damage parameters are used to indicate the damage degree and / or target damage type corresponding to the virtual model.

[0026] The virtual model can be of various types, and can be a model simulating a non-biological object, such as a battleship model, a vehicle model, a building model, or a model simulating a biological object, such as an animal model, a character model, etc. The specific configuration can be based on the needs and is not limited here.

[0027] A virtual model will usually be damaged when it is attacked. The damage parameter is used to indicate the degree of damage to the virtual model. Generally speaking, the larger the damage parameter is, the higher the degree of damage to the virtual model is. The degree of damage is usually related to the type of damage. For example, when the degree of damage is low, the virtual model will usually appear to have scratches, blackened, covered in mud, etc. When the degree of damage is high, the virtual model may further appear to be damaged, or even expose its internal structure, etc. The damage parameter can also directly indicate the target damage type of the virtual model.

[0028] The above damage parameters can be preset, or can be determined according to the number and type of attacks suffered by the virtual model in the virtual scene, that is, changed in real time. It can be set according to the needs, and is not limited here.

[0029] Step S104, determining rendering parameters of the virtual model based on the damage parameter, the preset texture array and the texture coordinate parameters of the virtual model; the texture array is generated based on a plurality of texture maps; the texture maps have corresponding damage types.

[0030] A texture array is a collection of 2D textures of the same size, format, and tag that appear as a single object to the GPU and can be sampled in shaders using texel indices.

[0031] The above texture array is generated based on multiple texture maps. Each texture map has a corresponding damage type. Usually, multiple texture maps corresponding to the damage types are pre-set. The texture map can be a color map, a mask map, a normal map, etc. In order to achieve the display effect corresponding to each damage type, one or more maps of the color map, mask map, and normal map corresponding to a damage type can be set. The specific settings can be based on the needs and are not limited here.

[0032] The target damage type corresponding to the virtual model can usually be determined based on the damage parameters of the virtual model. The damage parameters can directly indicate the target damage type. When the damage parameters represent the damage degree of the virtual model, the target damage type corresponding to the virtual model can be determined based on the corresponding relationship between the damage degree and the damage type. When the damage degree of the virtual model is large, the corresponding damage effect may be multiple, so the above-mentioned target damage type may be multiple.

[0033] The texture data of the texture map corresponding to the target damage type has been stored in the texture array. The texture data corresponding to the target damage type needs to be read from the texture array. When the texture data of the texture map is stored in the texture array, the index of the texture data in the texture array is usually recorded to facilitate reading the corresponding texture data in the texture array. Furthermore, the read texture data can be sampled based on the texture coordinate parameters of the virtual model to determine the rendering parameters of the virtual model.

[0034] Step S106: Rendering the virtual model based on the rendering parameters, so that the rendered virtual model presents a damaged effect matching the damaged parameters.

[0035] After the rendering parameters of the model are determined, the virtual model can be rendered based on the rendering parameters. The display effect of the rendered virtual model is the damage effect that matches the damage parameters. When the damage parameters of the virtual model change, it is necessary to re-determine the target damage type of the virtual model, and then update the rendering parameters of the virtual model so that the virtual model can display the damage effect that matches the damage parameters in real time.

[0036] The above-mentioned method for generating the damaged effect of a virtual model comprises the following steps: determining the damaged parameters of the virtual model; determining the rendering parameters of the virtual model based on the damaged parameters, a preset texture array and the texture coordinate parameters of the virtual model; the texture array is generated based on a plurality of texture maps; the texture map has a corresponding damaged type; and rendering the virtual model based on the rendering parameters so that the rendered virtual model presents a damaged effect that matches the damaged parameters. In this method, a texture array is generated based on a plurality of texture maps in advance, and when rendering the virtual model, texture data corresponding to the damaged type of the model is read from the texture array, and then the rendering parameters of the virtual model are determined, and the model is rendered, thereby improving the rendering efficiency of the damaged effect of the virtual model and enriching the display effects of various damaged conditions of the virtual model.

[0037] The following embodiment provides a specific method for determining the rendering parameters of the virtual model based on the damage parameter, the preset texture array and the texture coordinate parameters of the virtual model.

[0038] In practical applications, the damage parameter can be a damage degree parameter, such as 10%, 50%, 80%, etc. Generally speaking, the larger the parameter value, the more serious the damage to the virtual model. Each texture map has a corresponding damage type, and the above-mentioned multiple texture maps usually correspond to multiple damage types; the damage effect corresponding to a damage type may require multiple texture maps to achieve; each damage type has a corresponding damage degree range. For example, assuming that the damage degree can be taken in the value range of [0,1], and the larger the value, the greater the damage degree; the damage degree range corresponding to the damage type used to express a less damaged effect can be [0.2,1], and the damage degree range corresponding to the damage type used to express a more damaged effect can be [0.8,1]; that is, when the damage degree is 0.5, a less damaged effect is presented, and when the damage degree is 0.9, the current damage effect is displayed by superimposing the less damaged effect and the more damaged effect.

[0039] In generating a texture array based on multiple texture maps, the texture data of each texture map usually has a corresponding index in the texture array. After determining the degree of damage, it is necessary to determine the target damage type corresponding to the virtual model from the multiple damage types based on the damage degree parameter and the damage degree range corresponding to the multiple damage types. As mentioned above, the target damage type may be one or more. Then, it is necessary to determine the target index of the texture data of the texture map corresponding to the target damage type in the texture array. Since the texture data of each texture map has a corresponding index in the texture array, the damage type corresponding to each texture map is also determined, so the index of the texture data of the texture map corresponding to the target damage type can be determined as the target index. Since there may be multiple target damage types, and each target damage type may also correspond to one or more texture maps, the target index may also be one or more. Further, the rendering parameters of the virtual model can be determined based on the texture array, the target index and the texture coordinate parameters of the virtual model.

[0040] When multiple texture maps include color maps and mask maps, and the target index includes the first index of the texture data of the color map corresponding to the target damage type in the texture array, and the second index of the texture data of the mask map corresponding to the target damage type in the texture array, the following operations need to be performed for each vertex of the virtual model. The first operation is: based on the texture coordinate parameter of the vertex and the first index, the texture data in the texture array is sampled to determine the first damaged color parameter corresponding to the vertex; the sampling of the texture array requires inputting the index and the texture coordinate parameter, so that the corresponding texture data in the texture array can be read, usually the pixel value, which can be used as the first damaged color parameter corresponding to the vertex, and the color parameter usually needs to be mixed with the color parameter of the vertex in the normal state as the color parameter during rendering. The second operation is: based on the texture coordinate parameter of the vertex and the second index, the texture data in the texture array is sampled to determine the first transparency parameter corresponding to the vertex. Since the second index is the index of the texture data of the mask map, the pixel value read through the second index is related to the transparency parameter of the vertex. Further, the rendering parameter corresponding to the vertex needs to be determined based on the first damaged color parameter and the first transparency parameter. The order of determining the first color parameter and the first transparency parameter is not limited, and they can be performed one after the other or simultaneously.

[0041] When the mask map corresponding to the target damage type is a black and white image, the black area usually indicates a transparent area, and the white area usually indicates an opaque area. When the pixel value read is 255, it means that the vertex is in the white area and is opaque. When the pixel value read is 0, it means that the vertex is in the black area and is transparent.

[0042] When the mask map corresponding to the target damage type is a grayscale map, it is necessary to determine the mask pixel threshold based on the damage degree parameter and the damage degree range of the target damage type; through the mask pixel threshold, the display range of the damage effect corresponding to the target damage type can be controlled. Specifically, the result of subtracting the lower limit of the damage degree range from the damage degree parameter can be calculated, and then the result can be divided by the size of the damage degree range, and the product of the calculation result and 256 is determined as the mask pixel threshold. For example, if the damage degree parameter is 0.75 and the damage degree range is [0.5,1], the calculation result obtained based on the above method is 128, that is, the mask pixel threshold can be 128.

[0043] After sampling the texture data in the texture array based on the texture coordinate parameter of the vertex and the second index to obtain the first sampling result, the first transparency parameter corresponding to the vertex can be determined based on the first sampling result and the mask pixel threshold. Specifically, the first sampling result can be compared with the mask pixel threshold; if the first sampling result is greater than the mask pixel threshold, the first transparency parameter of the vertex is determined to be the first transparency; the first transparency is greater than 0, that is, it has a certain degree of transparency, or is completely opaque; if the first sampling result is less than or equal to the mask pixel threshold, the first transparency parameter of the vertex is determined to be 0, that is, it is completely transparent. When the first transparency parameter of a vertex is completely transparent, the vertex will not show a damage effect, that is, the first color parameter will not affect the rendering of the vertex.

[0044] In a specific implementation, in order to present a more natural transition effect, the transparency parameter of the vertex whose corresponding first sampling result is close to the mask pixel threshold may be set to a transparency between the first transparency and 0.

[0045] When the multiple texture maps include a mask map and a parallax texture map, and the target index includes the third index of the texture data of the mask map corresponding to the target damage type in the texture array, and the fourth index of the parallax texture data in the texture array, the following operations need to be performed for each vertex of the virtual model. The first operation is: for each vertex of the virtual model, based on the texture coordinate parameter of the vertex and the third index, the texture data in the texture array is sampled to determine the second transparency parameter corresponding to the vertex. This process is similar to the process of determining the first transparency parameter, and is not repeated here. The second operation is: based on the texture coordinate parameter of the vertex and the fourth index, the texture data in the texture array is sampled to determine the texture offset parameter corresponding to the vertex; then based on the texture offset parameter and the base map of the virtual model, the second damaged color parameter corresponding to the vertex is determined. Through the texture offset parameter and the texture coordinate parameter of the vertex, it can be determined that the texture displayed by the vertex is offset. The above-mentioned base map can be a map of the virtual model in an undamaged state, or a map corresponding to the internal structure of the virtual model, so as to display the damage effect of the virtual model being damaged and causing the internal structure to be exposed. Then, based on the second damaged color parameter and the second transparency parameter, the rendering parameter corresponding to the vertex is determined.

[0046] When it is necessary to specifically display the damage effect of a certain position on the virtual model after being attacked, it is necessary to first determine the attacked position on the surface of the virtual model, and then generate a spherical mask based on the attacked position; the attacked position is located inside the spherical mask, and generally speaking, the spherical mask is generated with the attacked position as the center of the sphere. Furthermore, the rendering parameters of the virtual model can be determined based on the spherical mask, damage parameters, a preset texture array, and texture coordinate parameters of the virtual model. Similar to the above method of determining the rendering parameters, only a spherical mask is added to limit the display area of ​​the damage effect.

[0047] The present disclosure also provides another method for generating a damage effect of a virtual model. Figure 1 The method is implemented on the basis of the method shown in the figure. The method reduces the number of maps used in the process of generating the damaged effect of the virtual model, realizes the hierarchical control of the effect, and reduces the difficulty of production technology. It has the characteristics of high versatility and low post-maintenance.

[0048] This method classifies the damage effects of the entire ship (equivalent to the above-mentioned "damage type"), which are blackened-burned-cracked (also called "cracked"). Specifically, it can be done through 3 layers of effect textures (equivalent to the above-mentioned "color map") and 2 layers of masks (equivalent to the above-mentioned "mask map"), and through the merging method of array (Array) maps (equivalent to the above-mentioned "texture array"), 5 effect channels are merged into one Array map, which greatly reduces consumption. In order to be universal for all ships, the bounding box size and UV randomness are set, and different thresholds are configured for the appearance and disappearance of each layer of effects, and controlled by a total damage progress parameter, so that planners and programmers can easily control the performance process. This method also supports the expression of single-point damage by passing in the coordinate position of the hit point.

[0049] In actual application, the effects can be divided into three levels according to the degree of damage, namely blackening, burning and breakage.

[0050] First, two maps can be used, namely the damage information map and the damage parallax map. Among them, the damage information map is a map that merges the atlas texture by converting 6 maps into a map through the two-dimensional texture array technology, such as Figure 2 Shown from left to right are the smoked texture, fire mask, damage mask, smoked mask, combined fire and damage mask, and the fire texture.

[0051] Considering that the frequency of the actual mask image is low, but the frequency of the texture is high, it is necessary to try to retain most of the data accuracy of the texture when merging textures. Specifically, the compression method of Texture2DArray can be used to pack all textures into a texture sampling pool. The texture is pre-processed by FFT (Fast Fourier Transform), that is, the texture is frequency compressed.

[0052] Broken parallax maps such as Figure 3 shown.

[0053] The calculation method for the above maps corresponding to different damage effects is as follows:

[0054] Smoked effect = smoked texture x smoked mask

[0055] Fire effect = Fire texture x Fire mask x Fire and damage total mask

[0056] Damage effect = Damage mask xf (parallax texture)

[0057] Armor area = damage mask xf (parallax texture)

[0058] Here, f(image) refers to the calculation of the texture equation. Finally, the above three effects are accumulated in sequence according to the degree of damage, so that the damage effects of the warship at different stages can be clearly shown.

[0059] like Figure 4 As shown in the figure, when the perspective ray B enters the plane represented by the solid line, that is, the armor plane, through the armor height set by the artist, we can know that there is a camouflage armor surface, that is, the purple area (the height of this surface is determined by the artist). When ray B enters the plane, there is a normal that matches the current plane, as well as the tangent and the secondary tangent. Through these three vector information, the green ray can be converted to the UV space of the texture tile. In the UV space, it is offset according to the direction of the ray, that is, the A vector, and moves a small distance each time. When the vector is detected within the dotted line range, it proves that the ray will collide with the armor range. Then the armor effect is returned. The same is true for the damage effect, but the direction is opposite.

[0060] For the smoked effect, you can use the mask blending method; for the flame effect, you can perform secondary sampling of the flame texture and multiply the displacements in different directions to create a visual effect of moving flames; for the damaged effect, you can use the plane parallax method to achieve height expression under the plane, and at the same time increase the armor thickness layer to express the vertical range of the armor.

[0061] Each of the above effects will be affected by their respective thresholds and the overall mapping range, so the timing of the complete appearance of each effect can be controlled by the intensity parameter 0-1 interval and segmented.

[0062] Here, the remapping function is used to represent the possible occurrence of various damage situations. That is, for the function domain [0,1], given different damage effect domains [0,1], and its target domain [A,B], the actual performance can be calculated by the following expression:

[0063]

[0064] For example, the smoked effect can be set in the range of 0 to 0.6. As the value increases, the effect gradually appears until it is complete.

[0065] The flame can be in the range of 0.6 to 0.85, and as the value gradually increases, the effect gradually appears until it is complete.

[0066] The damage effect can be in the range of 0.85 to 1. As the value gradually increases, the effect gradually appears until it is complete.

[0067] The above redirection method can ensure that the three intervals will not overlap and add up to exactly 1, which can make the battleship model more clearly distinguish between different degrees of damage.

[0068] Since the effect is used on different warships, the damage of different ships can be randomized by randomly offsetting each texture, and the damaged area box can be tiled to perform proportional scaling according to the bounding box size of warships of different sizes. This part of the setting can be completed through code without the need for art producers to control it. Therefore, in later maintenance, you only need to debug the textures and parameters of the basic art effects, without having to adjust each ship.

[0069] This method lowers the threshold for damage effects on mobile devices and can be used extensively on the same screen. Once the effect parameters are set, they can be applied to all warship models, so later maintenance is simple. You only need to adjust the set of parameters, and there is no need to adjust each ship separately. The programmer only needs to control one intensity parameter to control the progress of different levels of damage. It can provide a basic framework for expanding the performance of different impact damage in the future, such as surface damage caused by different weapons. Art developers only need to replace a map.

[0070] For the above method embodiments, see Figure 5 A device for generating damage effect of a virtual model as shown, the device comprising:

[0071] A damaged parameter determination module 502 is used to determine the damaged parameters of the virtual model; the damaged parameters are used to indicate the damage degree and / or target damage type corresponding to the virtual model;

[0072] A rendering parameter determination module 504 is used to determine the rendering parameters of the virtual model based on the damage parameter, a preset texture array and texture coordinate parameters of the virtual model; the texture array is generated based on a plurality of texture maps; the texture maps have corresponding damage types;

[0073] The rendering module 506 is used to render the virtual model based on the rendering parameters, so that the rendered virtual model presents a damage effect matching the damage parameters.

[0074] The above-mentioned device for generating the damaged effect of a virtual model determines the damaged parameters of the virtual model; determines the rendering parameters of the virtual model based on the damaged parameters, a preset texture array and the texture coordinate parameters of the virtual model; the texture array is generated based on a plurality of texture maps; the texture map has a corresponding damaged type; and the virtual model is rendered based on the rendering parameters so that the rendered virtual model presents a damaged effect that matches the damaged parameters. In this method, a texture array is generated based on a plurality of texture maps in advance, and when rendering the virtual model, texture data corresponding to the damaged type of the model is read from the texture array, and then the rendering parameters of the virtual model are determined, and the model is rendered, thereby improving the rendering efficiency of the damaged effect of the virtual model and enriching the display effects of various damaged conditions of the virtual model.

[0075] The above-mentioned damage parameters include damage degree parameters; multiple texture maps have corresponding multiple damage types; each damage type has a corresponding damage degree range; the texture data of each texture map has a corresponding index in the texture array; the rendering parameter determination module is also used to: based on the damage degree parameter and the damage degree range of multiple damage types, determine the target damage type corresponding to the virtual model from multiple damage types; determine the target index of the texture data of the texture map corresponding to the target damage type in the texture array; based on the texture array, the target index and the texture coordinate parameters of the virtual model, determine the rendering parameters of the virtual model.

[0076] The above-mentioned multiple texture maps include color maps and mask maps; the target index includes the first index of the texture data of the color map corresponding to the target damage type in the texture array, and the second index of the texture data of the mask map corresponding to the target damage type in the texture array; the rendering parameter determination module is also used to: for each vertex of the virtual model, based on the texture coordinate parameters and the first index of the vertex, sample the texture data in the texture array to determine the first damaged color parameter corresponding to the vertex; based on the texture coordinate parameters and the second index of the vertex, sample the texture data in the texture array to determine the first transparency parameter corresponding to the vertex; based on the first damaged color parameter and the first transparency parameter, determine the rendering parameter corresponding to the vertex.

[0077] The above-mentioned rendering parameter determination module is also used to: determine the mask pixel threshold based on the damage degree parameter and the damage degree range of the target damage type; sample the texture data in the texture array based on the texture coordinate parameter of the vertex and the second index to obtain a first sampling result; determine the first transparency parameter corresponding to the vertex based on the first sampling result and the mask pixel threshold.

[0078] The above-mentioned rendering parameter determination module is also used to: compare the first sampling result with the mask pixel threshold; if the first sampling result is greater than the mask pixel threshold, determine the first transparency parameter of the vertex as the first transparency; the first transparency is greater than 0; if the first sampling result is less than or equal to the mask pixel threshold, determine the first transparency parameter of the vertex as 0.

[0079] The above-mentioned multiple texture maps include mask maps and parallax texture maps; the target index includes the third index of the texture data of the mask map corresponding to the target damage type in the texture array, and the fourth index of the parallax texture data in the texture array; the above-mentioned rendering parameter determination module is also used for: for each vertex of the virtual model, based on the texture coordinate parameters of the vertex and the third index, sampling the texture data in the texture array to determine the second transparency parameter corresponding to the vertex; based on the texture coordinate parameters of the vertex and the fourth index, sampling the texture data in the texture array to determine the texture offset parameter corresponding to the vertex; based on the texture offset parameter and the basic map of the virtual model, determining the second damaged color parameter corresponding to the vertex; based on the second damaged color parameter and the second transparency parameter, determining the rendering parameter corresponding to the vertex.

[0080] The above-mentioned rendering parameter determination module is also used to: determine the attacked position on the surface of the virtual model; generate a spherical mask based on the attacked position; the attacked position is located inside the spherical mask; determine the rendering parameters of the virtual model based on the spherical mask, damage parameters, a preset texture array and texture coordinate parameters of the virtual model.

[0081] This embodiment further provides an electronic device, including a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the above-mentioned method for generating a damaged effect of a virtual model, for example:

[0082] Determine the damage parameters of the virtual model; the damage parameters are used to indicate the corresponding damage degree and\or target damage type of the virtual model; determine the rendering parameters of the virtual model based on the damage parameters, a preset texture array and the texture coordinate parameters of the virtual model; the texture array is generated based on multiple texture maps; the texture map has a corresponding damage type; render the virtual model based on the rendering parameters, so that the rendered virtual model presents a damage effect that matches the damage parameters.

[0083] In the above method, a texture array is generated in advance based on multiple texture maps. When rendering the virtual model, texture data corresponding to the damage type of the model is read from the texture array, and then the rendering parameters of the virtual model are determined and the model is rendered, thereby improving the rendering efficiency of the damage effect of the virtual model and enriching the display effects of various damage conditions of the virtual model.

[0084] Optionally, the above-mentioned damage parameters include damage degree parameters; multiple texture maps have corresponding multiple damage types; each damage type has a corresponding damage degree range; the texture data of each texture map has a corresponding index in the texture array; based on the damage parameters, the preset texture array and the texture coordinate parameters of the virtual model, the step of determining the rendering parameters of the virtual model includes: based on the damage degree parameters and the damage degree ranges of the multiple damage types, determining the target damage type corresponding to the virtual model from the multiple damage types; determining the target index of the texture data of the texture map corresponding to the target damage type in the texture array; based on the texture array, the target index and the texture coordinate parameters of the virtual model, determining the rendering parameters of the virtual model.

[0085] Optionally, the above-mentioned multiple texture maps include a color map and a mask map; the target index includes the first index of the texture data of the color map corresponding to the target damage type in the texture array, and the second index of the texture data of the mask map corresponding to the target damage type in the texture array; based on the texture array, the target index and the texture coordinate parameters of the virtual model, the step of determining the rendering parameters of the virtual model includes: for each vertex of the virtual model, based on the texture coordinate parameters of the vertex and the first index, sampling the texture data in the texture array to determine the first damaged color parameter corresponding to the vertex; based on the texture coordinate parameters of the vertex and the second index, sampling the texture data in the texture array to determine the first transparency parameter corresponding to the vertex; based on the first damaged color parameter and the first transparency parameter, determining the rendering parameters corresponding to the vertex.

[0086] Optionally, the above-mentioned step of sampling the texture data in the texture array based on the texture coordinate parameters of the vertex and the second index to determine the first transparency parameter corresponding to the vertex includes: determining the mask pixel threshold based on the damage degree parameter and the damage degree range of the target damage type; sampling the texture data in the texture array based on the texture coordinate parameters of the vertex and the second index to obtain a first sampling result; and determining the first transparency parameter corresponding to the vertex based on the first sampling result and the mask pixel threshold.

[0087] Optionally, the above step of determining the first transparency parameter corresponding to the vertex based on the first sampling result and the mask pixel threshold includes: comparing the first sampling result with the mask pixel threshold; if the first sampling result is greater than the mask pixel threshold, determining the first transparency parameter of the vertex as the first transparency; the first transparency is greater than 0; if the first sampling result is less than or equal to the mask pixel threshold, determining the first transparency parameter of the vertex as 0.

[0088] Optionally, the above-mentioned multiple texture maps include a mask map and a parallax texture map; the target index includes the third index of the texture data of the mask map corresponding to the target damage type in the texture array, and the fourth index of the parallax texture data in the texture array; the step of determining the rendering parameters of the virtual model based on the texture array, the target index and the texture coordinate parameters of the virtual model includes: for each vertex of the virtual model, based on the texture coordinate parameters of the vertex and the third index, sampling the texture data in the texture array to determine the second transparency parameter corresponding to the vertex; based on the texture coordinate parameters of the vertex and the fourth index, sampling the texture data in the texture array to determine the texture offset parameter corresponding to the vertex; based on the texture offset parameters and the base map of the virtual model, determining the second damaged color parameter corresponding to the vertex; based on the second damaged color parameter and the second transparency parameter, determining the rendering parameter corresponding to the vertex.

[0089] Optionally, the step of determining the rendering parameters of the virtual model based on the damage parameters, the preset texture array and the texture coordinate parameters of the virtual model includes: determining the attacked position on the surface of the virtual model; generating a spherical mask based on the attacked position; the attacked position is located inside the spherical mask; determining the rendering parameters of the virtual model based on the spherical mask, the damage parameters, the preset texture array and the texture coordinate parameters of the virtual model.

[0090] See also Figure 6 As shown, the electronic device includes a processor 100 and a memory 101, wherein the memory 101 stores machine executable instructions that can be executed by the processor 100, and the processor 100 executes the machine executable instructions to implement the above-mentioned method for generating damage effects of a virtual model.

[0091] Further, Figure 6 The 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 .

[0092] 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 realized through at least one communication interface 103 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used. The bus 102 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

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

[0094] This embodiment also 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 above-mentioned method for generating the damage effect of the virtual model.

[0095] The embodiments of the present disclosure provide a method, device and electronic device for generating a damage effect of a virtual model, including a computer-readable storage medium storing program codes, wherein the program codes include instructions that can be used to execute the methods described in the above method embodiments, for example:

[0096] Determine the damage parameters of the virtual model; the damage parameters are used to indicate the corresponding damage degree and\or target damage type of the virtual model; determine the rendering parameters of the virtual model based on the damage parameters, a preset texture array and the texture coordinate parameters of the virtual model; the texture array is generated based on multiple texture maps; the texture map has a corresponding damage type; render the virtual model based on the rendering parameters, so that the rendered virtual model presents a damage effect that matches the damage parameters.

[0097] In the above method, a texture array is generated in advance based on multiple texture maps. When rendering the virtual model, texture data corresponding to the damage type of the model is read from the texture array, and then the rendering parameters of the virtual model are determined and the model is rendered, thereby improving the rendering efficiency of the damage effect of the virtual model and enriching the display effects of various damage conditions of the virtual model.

[0098] Optionally, the above-mentioned damage parameters include damage degree parameters; multiple texture maps have corresponding multiple damage types; each damage type has a corresponding damage degree range; the texture data of each texture map has a corresponding index in the texture array; based on the damage parameters, the preset texture array and the texture coordinate parameters of the virtual model, the step of determining the rendering parameters of the virtual model includes: based on the damage degree parameters and the damage degree ranges of the multiple damage types, determining the target damage type corresponding to the virtual model from the multiple damage types; determining the target index of the texture data of the texture map corresponding to the target damage type in the texture array; based on the texture array, the target index and the texture coordinate parameters of the virtual model, determining the rendering parameters of the virtual model.

[0099] Optionally, the above-mentioned multiple texture maps include a color map and a mask map; the target index includes the first index of the texture data of the color map corresponding to the target damage type in the texture array, and the second index of the texture data of the mask map corresponding to the target damage type in the texture array; based on the texture array, the target index and the texture coordinate parameters of the virtual model, the step of determining the rendering parameters of the virtual model includes: for each vertex of the virtual model, based on the texture coordinate parameters of the vertex and the first index, sampling the texture data in the texture array to determine the first damaged color parameter corresponding to the vertex; based on the texture coordinate parameters of the vertex and the second index, sampling the texture data in the texture array to determine the first transparency parameter corresponding to the vertex; based on the first damaged color parameter and the first transparency parameter, determining the rendering parameters corresponding to the vertex.

[0100] Optionally, the above-mentioned step of sampling the texture data in the texture array based on the texture coordinate parameters of the vertex and the second index to determine the first transparency parameter corresponding to the vertex includes: determining the mask pixel threshold based on the damage degree parameter and the damage degree range of the target damage type; sampling the texture data in the texture array based on the texture coordinate parameters of the vertex and the second index to obtain a first sampling result; and determining the first transparency parameter corresponding to the vertex based on the first sampling result and the mask pixel threshold.

[0101] Optionally, the above step of determining the first transparency parameter corresponding to the vertex based on the first sampling result and the mask pixel threshold includes: comparing the first sampling result with the mask pixel threshold; if the first sampling result is greater than the mask pixel threshold, determining the first transparency parameter of the vertex as the first transparency; the first transparency is greater than 0; if the first sampling result is less than or equal to the mask pixel threshold, determining the first transparency parameter of the vertex as 0.

[0102] Optionally, the above-mentioned multiple texture maps include a mask map and a parallax texture map; the target index includes the third index of the texture data of the mask map corresponding to the target damage type in the texture array, and the fourth index of the parallax texture data in the texture array; the step of determining the rendering parameters of the virtual model based on the texture array, the target index and the texture coordinate parameters of the virtual model includes: for each vertex of the virtual model, based on the texture coordinate parameters of the vertex and the third index, sampling the texture data in the texture array to determine the second transparency parameter corresponding to the vertex; based on the texture coordinate parameters of the vertex and the fourth index, sampling the texture data in the texture array to determine the texture offset parameter corresponding to the vertex; based on the texture offset parameters and the base map of the virtual model, determining the second damaged color parameter corresponding to the vertex; based on the second damaged color parameter and the second transparency parameter, determining the rendering parameter corresponding to the vertex.

[0103] Optionally, the step of determining the rendering parameters of the virtual model based on the damage parameters, the preset texture array and the texture coordinate parameters of the virtual model includes: determining the attacked position on the surface of the virtual model; generating a spherical mask based on the attacked position; the attacked position is located inside the spherical mask; determining the rendering parameters of the virtual model based on the spherical mask, the damage parameters, the preset texture array and the texture coordinate parameters of the virtual model.

[0104] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0105] In addition, in the description of the embodiments of the present disclosure, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For those skilled in the art, the specific meanings of the above terms in the present disclosure can be understood according to specific circumstances.

[0106] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code.

[0107] In the description of the present disclosure, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present disclosure and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation of the present disclosure. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.

[0108] Finally, it should be noted that the above embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure is described in detail with reference to the above embodiments, those skilled in the art should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above embodiments within the technical scope disclosed in the present disclosure, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.

Claims

1. A method for generating a damage effect of a virtual model, characterized in that: include: determining damaged parameters of the virtual model; The damage parameter is used to indicate the damage degree and / or target damage type corresponding to the virtual model; Determining rendering parameters of the virtual model based on the damage parameter, a preset texture array and texture coordinate parameters of the virtual model; the texture array is generated based on a plurality of texture maps; the texture maps have corresponding damage types; The virtual model is rendered based on the rendering parameters, so that the rendered virtual model presents a damage effect matching the damage parameters.

2. The method according to claim 1, characterized in that The damage parameter includes a damage degree parameter; the plurality of texture maps have corresponding plurality of damage types; each damage type has a corresponding damage degree range; the texture data of each of the texture maps has a corresponding index in the texture array; The step of determining the rendering parameters of the virtual model based on the damaged parameters, the preset texture array and the texture coordinate parameters of the virtual model comprises: Based on the damage degree parameter and the damage degree ranges of the multiple damage types, determining a target damage type corresponding to the virtual model from the multiple damage types; Determine a target index of texture data of a texture map corresponding to the target damage type in the texture array; Rendering parameters of the virtual model are determined based on the texture array, the target index and the texture coordinate parameters of the virtual model.

3. The method according to claim 2, characterized in that The multiple texture maps include a color map and a mask map; the target index includes a first index of texture data of the color map corresponding to the target damage type in the texture array, and a second index of texture data of the mask map corresponding to the target damage type in the texture array; The step of determining rendering parameters of the virtual model based on the texture array, the target index and the texture coordinate parameters of the virtual model comprises: For each vertex of the virtual model, based on the texture coordinate parameter of the vertex and the first index, sampling the texture data in the texture array to determine a first damaged color parameter corresponding to the vertex; Based on the texture coordinate parameter of the vertex and the second index, sampling the texture data in the texture array to determine a first transparency parameter corresponding to the vertex; Determine rendering parameters corresponding to the vertex based on the first damaged color parameter and the first transparency parameter.

4. The method according to claim 3, characterized in that The step of sampling texture data in the texture array based on the texture coordinate parameter of the vertex and the second index to determine a first transparency parameter corresponding to the vertex includes: Determining a mask pixel threshold based on the damage degree parameter and the damage degree range of the target damage type; Based on the texture coordinate parameter of the vertex and the second index, sampling the texture data in the texture array to obtain a first sampling result; Based on the first sampling result and the mask pixel threshold, a first transparency parameter corresponding to the vertex is determined.

5. The method according to claim 4, characterized in that The step of determining a first transparency parameter corresponding to the vertex based on the first sampling result and the mask pixel threshold comprises: Comparing the first sampling result with the mask pixel threshold; If the first sampling result is greater than the mask pixel threshold, determining the first transparency parameter of the vertex as a first transparency; the first transparency is greater than 0; If the first sampling result is less than or equal to the mask pixel threshold, the first transparency parameter of the vertex is determined to be 0.

6. The method according to claim 2, characterized in that The multiple texture maps include a mask map and a parallax texture map; the target index includes a third index of texture data of the mask map corresponding to the target damage type in the texture array, and a fourth index of the parallax texture data in the texture array; The step of determining rendering parameters of the virtual model based on the texture array, the target index and the texture coordinate parameters of the virtual model comprises: For each vertex of the virtual model, based on the texture coordinate parameter of the vertex and the third index, sampling the texture data in the texture array to determine a second transparency parameter corresponding to the vertex; Based on the texture coordinate parameter of the vertex and the fourth index, sampling the texture data in the texture array to determine the texture offset parameter corresponding to the vertex; Determining a second damaged color parameter corresponding to the vertex based on the texture offset parameter and the base map of the virtual model; Based on the second damaged color parameter and the second transparency parameter, a rendering parameter corresponding to the vertex is determined.

7. The method according to claim 1, characterized in that The step of determining the rendering parameters of the virtual model based on the damaged parameters, the preset texture array and the texture coordinate parameters of the virtual model comprises: determining an attacked position on the surface of the virtual model; Based on the attacked position, a spherical mask is generated; the attacked position is located inside the spherical mask; The rendering parameters of the virtual model are determined based on the spherical mask, the damage parameters, a preset texture array and the texture coordinate parameters of the virtual model.

8. A device for generating damage effects of a virtual model, characterized in that: include: A damaged parameter determination module, used for determining damaged parameters of the virtual model; The damage parameter is used to indicate the damage degree and / or target damage type corresponding to the virtual model; A rendering parameter determination module, configured to determine the rendering parameters of the virtual model based on the damage parameter, a preset texture array and a texture coordinate parameter of the virtual model; the texture array is generated based on a plurality of texture maps; the texture maps have corresponding damage types; A rendering module is used to render the virtual model based on the rendering parameters so that the rendered virtual model presents a damaged effect matching the damaged parameters.

9. An electronic device, characterized in that: The invention comprises a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the method for generating damage effects of a virtual model according to any one of claims 1 to 7.

10. 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 method for generating damage effects of a virtual model as described in any one of claims 1-7.