Model rendering method and device and electronic equipment

By determining the melting degree parameters and vertex shift parameters of the target model, efficient rendering of the role melting effect is achieved, solving the problem of high equipment performance consumption in the prior art, and improving the generation efficiency of the model melting effect.

CN120285562APending Publication Date: 2025-07-11NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510167835.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-14
Publication Date
2025-07-11

AI Technical Summary

Technical Problem

When the prior art realizes the role melting effect, multiple maps need to be sampled, resulting in large equipment performance consumption and low efficiency.

Method used

By determining the melting degree parameters of the target model, the melted and unmelted parts are determined based on the melting degree parameters and the preset plane, and the corresponding vertex offset parameters are calculated to render the model to avoid sampling multiple maps.

Benefits of technology

It reduces equipment performance consumption and improves the generation efficiency of model melting effects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120285562A_ABST
    Figure CN120285562A_ABST
Patent Text Reader

Abstract

The invention provides a model rendering method and device and electronic equipment. The method comprises the following steps: determining a melting degree parameter of a target model; the target model comprises a plurality of vertexes; based on the melting degree parameter of the target model and a preset first plane, determining a melting part and a non-melting part of the target model; determining a first vertex offset parameter corresponding to the melting part, and determining a second vertex offset parameter corresponding to the non-melting part; rendering the target model based on the first vertex offset parameter and the second vertex offset parameter; the distance between the display position of the fused part after the vertex is shifted and the first plane is smaller than or equal to a preset distance threshold value, and the distance between the display position of the non-fused part after the vertex is shifted and the first plane is larger than the distance between the display position of the non-fused part before the vertex is shifted and the first plane. The mode does not need to sample a plurality of chartlets, so that the equipment performance consumption is reduced, and the generation efficiency of the model melting effect is improved.
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 more particularly, to a model rendering method, apparatus, and electronic device. Background Art

[0002] In a game, when a character is attacked, an attack effect will be displayed. In actual implementation, an effect that the character melts into a pool of liquid on the ground can be displayed. Usually, the VAT (Vertex Animation Texture) animation texture scheme is used to implement this effect. However, when using the VAT scheme, multiple textures need to be sampled, resulting in high consumption of device performance and low efficiency. Summary of the Invention

[0003] In view of this, an object of the present disclosure is to provide a model rendering method, apparatus, and electronic device to reduce the consumption of device performance and improve the generation efficiency of the model melting effect.

[0004] In a first aspect, an embodiment of the present disclosure provides a model rendering method, which includes: determining a melting degree parameter of a target model; the target model includes multiple vertices; based on the melting degree parameter of the target model and a preset first plane, determining a melted part and an unmelted part of the target model; determining a first vertex offset parameter corresponding to the melted part, and determining a second vertex offset parameter corresponding to the unmelted part; rendering the target model based on the first vertex offset parameter and the second vertex offset parameter; the distance between the display position of the vertex-offset melted part and the first plane is less than or equal to a preset distance threshold, and the distance between the display position of the vertex-offset unmelted part and the first plane is greater than the distance between the display position of the unmelted part before vertex offset and the first plane.

[0005] In a second aspect, an embodiment of the present disclosure provides a model rendering apparatus, which includes: a melting degree parameter determination module for determining a melting degree parameter of a target model; the target model includes multiple vertices; a melted part determination module for determining a melted part and an unmelted part of the target model based on the melting degree parameter of the target model and a preset first plane; a vertex offset parameter determination module for determining a first vertex offset parameter corresponding to the melted part, and determining a second vertex offset parameter corresponding to the unmelted part; a rendering module for rendering the target model based on the first vertex offset parameter and the second vertex offset parameter; the distance between the display position of the vertex-offset melted part and the first plane is less than or equal to a preset distance threshold, and the distance between the display position of the vertex-offset unmelted part and the first plane is greater than the distance between the display position of the unmelted part before vertex offset and the first plane.

[0006] In a third aspect, an embodiment of the present invention provides an electronic device, including a processor and a memory. 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 model rendering method.

[0007] In a fourth aspect, an embodiment of the present invention provides a machine-readable storage medium. The machine-readable storage medium stores machine-executable instructions, and when the machine-executable instructions are called and executed by a processor, the machine-executable instructions cause the processor to implement the above-mentioned model rendering method.

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

[0009] For the above-mentioned model rendering method, device and electronic device, a melting degree parameter of a target model is determined; the target model includes a plurality of vertices; based on the melting degree parameter of the target model and a preset first plane, the melted part and the non-melted part of the target model are determined; a first vertex offset parameter corresponding to the melted part is determined, and a second vertex offset parameter corresponding to the non-melted part is determined; based on the first vertex offset parameter and the second vertex offset parameter, the target model is rendered; the distance between the display position of the melted part after vertex offset and the first plane is less than or equal to a preset distance threshold, and the distance between the display position of the non-melted part after vertex offset and the first plane is greater than the distance between the display position of the non-melted part before vertex offset and the first plane. This method does not require sampling multiple texture maps, reduces the device performance consumption, and improves the generation efficiency of the model melting effect.

[0010] Other features and advantages of the present disclosure will be described in the following description, and in part, will be obvious from the description, or will be understood by implementing the present disclosure. The objectives and other advantages of the present disclosure are achieved and obtained by the structures specifically pointed out in the description, claims and drawings.

[0011] To make the above objectives, features and advantages of the present disclosure more obvious and understandable, the following specific preferred embodiments are given, and in conjunction with the accompanying drawings, the detailed description is as follows. Description of the Drawings

[0012] To more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the prior art, the following will briefly introduce the drawings required for the description of the specific embodiments or the prior art. Obviously, the following drawings are some embodiments of the present disclosure. For those skilled in the art, without creative efforts, other drawings can be obtained based on these drawings.

[0013] Figure 1 It is a flowchart of a model rendering method provided by an embodiment of the present disclosure;

[0014] Figure 2 Schematic diagram of the relative position between the first plane provided by the embodiments of the present disclosure and the target model;

[0015] Figure 3 Schematic diagram of the target height of the target model provided by the embodiments of the present disclosure;

[0016] Figure 4 Schematic diagram of the display effect before and after the melting of the target model provided by the embodiments of the present disclosure;

[0017] Figure 5 Schematic diagram of the noise map provided by the embodiments of the present disclosure;

[0018] Figure 6 Schematic diagram of the light and shadow noise map provided by the embodiments of the present disclosure;

[0019] Figure 7 Schematic diagram of the reflection map provided by the embodiments of the present disclosure;

[0020] Figure 8 Schematic diagram of the ink transparency map provided by the embodiments of the present disclosure;

[0021] Figure 9 Schematic diagram of the effect during the melting process of the character provided by the embodiments of the present disclosure;

[0022] Figure 10 Schematic diagram of the structure of a model rendering device provided by the embodiments of the present disclosure;

[0023] Figure 11 Schematic diagram of the structure of an electronic device provided by the embodiments of the present disclosure. Detailed implementation manners

[0024] To make the objectives, technical solutions, and advantages of the embodiments of the present disclosure clearer, the technical solutions of the present disclosure will be clearly and completely described below with reference to the accompanying drawings. Apparently, the described embodiments are some but not all of the embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present disclosure.

[0025] In related technologies, when making some relatively complex vertex animations, the VAT animation map scheme is generally used in the industry. However, the VAT scheme consumes a large amount and requires multiple samplings of multiple maps. Moreover, for models with fewer vertex faces, even if the VAT scheme is used, good effects cannot be achieved.

[0026] In some games, it is necessary to implement a character ink melting effect, where after the character dies, the model melts into a pool of ink. If the VAT solution is used, vertex animations need to be made in the Houdini software, and then the vertex animations are converted into data and baked onto the texture map. In the Neox2 engine, complex death melting animations are achieved by sampling texture map information or position and rotation information. In this method, the texture map needs to be sampled multiple times, which places a huge performance pressure in the combat scene and it is difficult to implement the above-mentioned character ink melting effect.

[0027] Based on this, an embodiment of the present disclosure provides a model rendering method, apparatus and electronic device, and this technology can be applied to scenarios that require generating model melting.

[0028] See Figure 1 , first, a model rendering method provided by an embodiment of the present invention is introduced. The method includes the following steps:

[0029] Step S102, determine the melting degree parameter of the target model; the target model includes multiple vertices.

[0030] The above-mentioned target model is usually a three-dimensional model. The surface of the target model is formed by connecting multiple vertices. The target model can be a virtual building, a virtual character, a virtual plant, a virtual monster, etc., and is not limited here.

[0031] The target model may be in a melting state due to various reasons. Here, melting means that an object changes from a solid to a liquid. For example, the target model can be a snowman that melts as the temperature set in the game scene rises; the target model can be a virtual building in a fantasy environment that melts when the fantasy environment is broken; the target model can also be a virtual character that melts when the virtual character is attacked by a certain attack.

[0032] The target model can gradually change from a complete state to a completely melted state. The target model can also gradually change from a complete state to a semi-melted state corresponding to a certain melting degree without being completely melted. The target model can also instantaneously change from a complete state to a semi-melted state corresponding to a certain melting degree. Specifically, it can be set according to requirements.

[0033] The melting degree can correspond to the height or volume of the target model. When corresponding to the height, the melting degree is 50%, which means that 50% of the model part of the target model's height has melted. When corresponding to the volume, the melting degree is 50%, which means that 50% of the volume part of the target model has melted.

[0034] To describe the melting degree of the target model, a melting degree parameter is usually set. As the melting degree increases, the parameter value of the melting degree parameter usually increases. For example, the melting degree can range from not melted to completely melted, and the corresponding melting degree parameter can range from 0 to 1, or from 0 to 100, etc.

[0035] When it is necessary to make the target model display the melting state of a certain melting degree, it can be achieved by setting the melting degree parameter. To display the melting process of the target model, the melting rate of the target model can also be set, so that the melting degree parameter at the current moment can be determined based on the melting rate and time. Specifically, it can be set according to requirements and will not be restricted here.

[0036] Step S104, based on the melting degree parameter of the target model and a preset first plane, determine the melted part and the non-melted part of the target model.

[0037] The above-mentioned first plane usually refers to the plane where the melted target model is located. Generally speaking, when simulating a real-world scenario, the target model will melt to the plane supporting the target model, such as the ground, under the action of gravity. In a game, a gravity-reversed scenario can also be set, such as the head of the target model pressing against a certain plane and needing to melt to that plane. A vertical plane with "magic" can also be set, and the target model will be attracted to this plane and melt to this plane. It can also be set that the target model melts through an invisible plane passing through the target model, etc. Specifically, it can be set according to requirements and will not be restricted here. As Figure 2 shown, the straight line L represents the first plane from a side view angle, and the humanoid logo represents the target model from a test angle.

[0038] The above-mentioned melting degree parameter can indicate what percentage of the height or volume of the target model has melted. Generally speaking, the part of the target model closer to the first plane melts first. When the melting degree parameter corresponds to the height of the target model, if the height of the target model is 10 and the melting degree parameter indicates that 50% of the target model has melted, it is necessary to determine the melted part and the non-melted part in the target model based on the relative position of the target model and the first plane.

[0039] If the first plane is on one side of the target model, then the model part with a distance less than 5 from the first plane in the target model is the melted part, and the rest is the non-melted part. When the first plane passes through the target model, both parts of the target model on both sides of the first plane can melt, or it can be set that only the part on one side can melt. If it is the latter, it is the same as the case where the first plane is on one side of the target model. If it is the former, it is also necessary to distribute the melted height to the two parts on both sides of the first plane so that the sum of the heights of the melted model parts in each part is equal to 5.

[0040] When the melting degree parameter corresponds to the volume of the target model, it is also necessary to determine, based on the shape of the part of the target model adjacent to the first plane, the model part in the target model that is adjacent to the first plane and whose volume matches the percentage indicated by the melting degree parameter as the melted part, and the remaining part as the non-melted part. The specific implementation process is similar to when the melting degree parameter corresponds to the height, except that there is an additional process of converting volume to height.

[0041] Step S106: Determine the first vertex offset parameter corresponding to the melted part and the second vertex offset parameter corresponding to the non-melted part.

[0042] After determining the melted part and the non-melted part, in order to make the realistic effects of the two conform to the required melting effect, it is necessary to determine the vertex offset parameters of the two respectively. For the convenience of writing, the vertex offset parameter corresponding to the melted part is called the "first vertex offset parameter", and the vertex offset parameter corresponding to the non-melted part is called the "second vertex offset parameter".

[0043] Generally speaking, the distance between the melted part and the first plane is less than or equal to a preset distance threshold. When the distance threshold is 0, the melted part is displayed on the first plane; when the distance threshold is a value greater than 0, the value of the distance between the melted part and the first plane can be between 0 and the distance threshold. At this time, the melted part can be displayed as uneven, and the display effect is more natural.

[0044] When the melted part is usually displayed on the first plane, that is, the distance between it and the first plane is 0, the first vertex offset parameter needs to offset the distance between the melted part and the first plane. In specific implementation, the distance between the vertices of the melted part and the first plane can be calculated, and then the position parameter value changed by moving this distance in the normal direction of the first plane or the opposite direction of the normal direction can be determined, and this position parameter value is determined as the first vertex offset parameter. It is also possible to project the vertices of the melted part onto the first plane, and determine the difference between the position parameter of the projected position and the position parameter of the vertex before projection as the first vertex offset parameter.

[0045] In order to make the display effect of the melted part uneven, noise can be added to the distance between the vertices of the melted part and the first plane, and then the first vertex offset parameter is calculated.

[0046] Since the melted part is usually displayed as irregular and spreading out when it is displayed on the first plane, noise can also be added to the first vertex offset parameter. The first vertex offset parameter after adding noise usually also needs to control the vertices after offset to be on the first plane. In some cases, the vertices after offset can also be slightly higher than the first plane, which can be achieved by adding noise perpendicular to the first plane, and specific settings can be made according to requirements, which are not restricted here.

[0047] Since the melted part needs to be displayed on the first plane, for the sake of the coherence of the model display, the unmelted part also needs to "collapse" towards the first plane. The height of the collapse of the unmelted part is usually the maximum height of the melted part. After determining the maximum height, the position parameter value changed by moving this distance in the normal direction of the first plane or the opposite direction of the normal direction can be determined, and then this position parameter value is determined as the second vertex offset parameter. In order to display the irregular state of the unmelted part during the melting process, noise can be added to each vertex of the unmelted part based on the maximum height to determine the height value corresponding to each vertex, so as to determine the second vertex offset parameter corresponding to each vertex. Specifically, it can be set according to requirements and is not limited here.

[0048] Step S108, render the target model based on the first vertex offset parameter and the second vertex offset parameter; the distance between the display position of the melted part after vertex offset and the first plane is less than or equal to a preset distance threshold, and the distance between the display position of the unmelted part after vertex offset and the first plane is greater than the distance between the display position of the unmelted part before vertex offset and the first plane.

[0049] After determining the first vertex offset parameter and the second vertex offset parameter, in order to make the melted part and the unmelted part be displayed at the display positions required during the melting process, when rendering the target model, it is necessary to perform offset and rendering based on the vertex offset parameters corresponding to each vertex through a shader.

[0050] In practical applications, the display effect of the melted part can be made different from that of the unmelted part. For example, the melted part can be made to display a soil effect, a puddle effect, etc., so as to set corresponding rendering parameters for the melted part. The display effect of the unmelted part is the same as the display effect of this part of the target model before melting, that is, the same rendering parameters are used, or other preset rendering parameters when the target model is in the melting process can also be used, which is not limited here. It is also possible to make both the melted part and the unmelted part use the rendering parameters used by the target model before the melting process, which is not limited here.

[0051] The above model rendering method determines the melting degree parameter of the target model; the target model includes multiple vertices; based on the melting degree parameter of the target model and a preset first plane, the melted part and the non-melted part of the target model are determined; the first vertex offset parameter corresponding to the melted part is determined, and the second vertex offset parameter corresponding to the non-melted part is determined; based on the first vertex offset parameter and the second vertex offset parameter, the target model is rendered; the distance between the display position of the melted part after vertex offset and the first plane is less than or equal to a preset distance threshold, and the distance between the display position of the non-melted part after vertex offset and the first plane is greater than the distance between the display position of the non-melted part before vertex offset and the first plane. This method does not require sampling multiple texture maps, reduces the consumption of device performance, and improves the generation efficiency of the model melting effect.

[0052] The following embodiments provide a specific method for determining the melting degree parameter of the target model.

[0053] In practical applications, it is possible to only render and generate an image of the target model at a certain melting degree, or to render and generate an animation of the target model gradually melting or gradually returning to its original state from the melted state. Usually, it is preset that the melting degree parameter of the target model changes from a first parameter value to a second parameter value within a preset time period. The first parameter value is usually different from the second parameter value, or they can be the same. For example, the target model can first gradually melt from the original state and then gradually return to the original state. The rule of the first parameter value changing to the second parameter value over time is usually known.

[0054] The preset time period usually corresponds to multiple animation frames arranged in a preset order. The time interval between adjacent animation frames is usually consistent. For each of the multiple animation frames, it is usually necessary to determine the melting degree parameter corresponding to the animation frame based on the sequence position of the animation frame in the preset order, the first parameter value, and the second parameter value. In specific implementation, the time corresponding to the animation frame can be calculated first, and then based on the rule of the first parameter value changing to the second parameter value over time and this time, the melting degree parameter corresponding to the animation frame can be calculated. Then, each animation frame can be rendered and generated in sequence, and continuously playing the animation frames forms the melting process animation of the target model.

[0055] The following embodiments provide a specific method for determining the melted part and the non-melted part of the target model based on the melting degree parameter of the target model and a preset first plane.

[0056] In specific implementation, it is necessary to determine the target height of the target model in the normal direction of the first plane. As Figure 3As shown, when the target model is a humanoid character lying on the first plane, its target height is l1, and when the target model is a humanoid character standing on the first plane, its target height is l2. Generally, the maximum distance between the surface of the target model and the first plane can be determined as the target height in the normal direction of the first plane of the target model. Then, based on the melting degree parameter and the target height of the target model, a height threshold is determined. If the melting degree parameter corresponds to height, the percentage of the height of the melted part in the target height can be directly determined based on the melting degree parameter, and then the height threshold can be calculated. If the melting degree parameter corresponds to volume, it is necessary to determine the percentage of the volume of the melted part in the volume of the target model based on the melting degree parameter, and then determine the height threshold based on the relative position relationship between the target model and the first plane in combination with the shape of the target model.

[0057] Furthermore, the part of the target model with a height greater than the height threshold in the normal direction can be determined as the non-melted part, and the part of the target model with a height less than or equal to the height threshold in the normal direction can be determined as the melted part.

[0058] The following embodiments provide a specific method for determining the first vertex offset parameter corresponding to the melted part.

[0059] In specific implementation, for each vertex of the melted part, the first position parameter of the projection point of the vertex on the first plane can be determined; then, based on the first position parameter and the current position parameter of the vertex, the first vertex offset parameter corresponding to the vertex is determined. Specifically, the first position parameter can be subtracted from the current position parameter correspondingly, and the subtraction result can be determined as the first vertex offset parameter.

[0060] To increase the display details, the first noise map can also be sampled based on the first position parameter to obtain the first sampling result. In specific implementation, generally, the first position parameter needs to be converted into the coordinate parameter in the object space system corresponding to the target model to ensure that the position of the target model in the virtual space does not affect the sampling result. Then, the first position parameter is updated based on the first sampling result; the position corresponding to the updated first position parameter is located on the first plane. The distance between the position corresponding to the updated first position parameter and the projection position of the center of the target model on the first plane is usually greater than the corresponding distance before updating. Then, based on the updated first position parameter and the current position parameter of the vertex, the first vertex offset parameter corresponding to the vertex is determined. Usually, the updated first position parameter is also subtracted from the current position parameter correspondingly, and then the subtraction result is determined as the first vertex offset parameter.

[0061] The following embodiments provide a specific method for determining the second vertex offset parameter corresponding to the non-melted part.

[0062] As described above, the distance between the unmelted part and the first plane is greater than the height threshold. The height threshold is determined based on the target height of the target model in the normal direction of the first plane and the melting degree parameter of the target model. Generally, it is necessary to determine the second vertex offset parameter of the unmelted part based on the normal direction of the first plane and the height threshold. In specific implementation, the change value of the position parameter when moving the height threshold along the normal direction or the opposite direction of the normal can be calculated, and then the calculation result is determined as the second vertex offset parameter.

[0063] In practical applications, the melting degree parameter can be related to a preset timing parameter. For example, when timing starts, the target model starts to melt at a preset rate, then the melting degree parameter is proportional to the timing parameter. To make the unmelted part show a flowing effect, for each vertex of the unmelted part, after determining the first distance between the vertex and the first plane, the first sampling parameter can be determined based on the first distance and the timing parameter, specifically, it can be the sum of the first distance and the timing parameter. Then, based on the first sampling parameter, the preset second noise map is sampled to obtain the second sampling result; and based on the second sampling result and the height threshold, the offset height corresponding to the vertex is determined. In specific implementation, it can be the sum of the height threshold and the second sampling result to obtain the offset height corresponding to the vertex, or it can also be the subtraction of the two, which is not limited here. Then, based on the offset height and the normal direction of the first plane, the second vertex offset parameter corresponding to the vertex is determined.

[0064] The following embodiments provide a specific method for rendering a target model based on the first vertex offset parameter and the second vertex offset parameter.

[0065] In practical applications, different display effects can be set for the melted part and the unmelted part. During rendering, it is necessary to render the melted part based on the first vertex offset parameter and the preset melting effect parameter; and render the unmelted part based on the second vertex offset parameter and the preset model effect parameter.

[0066] The greater the melting degree of the target model, the larger the area occupied by the display effect of the melted part on the first plane. To control this expansion process, a first mask texture can be determined based on the melting degree parameter. In the first mask texture, the size of the area where the black pixels are located is positively correlated with the melting degree parameter. The area where the black pixels are located usually represents the area where the rendering effect can be displayed. The area where the black pixels are located can be a circular area, and the radius of the circular area increases as the melting degree parameter increases. Furthermore, based on the first mask texture, the transparency parameter of the melted part is determined, that is, the transparency parameters of each vertex of the melted part are determined. Further, based on the first vertex offset parameter, the preset melting effect parameter, and the transparency parameter, the melted part is rendered.

[0067] Due to the write depth of the melted part, there will be a flickering effect because the patches with depth information are on the same horizontal plane. Therefore, it is necessary to control that the melted part and the model part close to the melted part are not written with depth. Specifically, for each vertex of multiple vertices, the position parameter of the vertex after offset needs to be determined; based on the position parameter after offset, the distance between the vertex and the first plane is determined; if the distance is less than the preset distance threshold, the depth of the vertex is cancelled from being written. The above preset distance threshold is usually taken as 0.3. Other distance thresholds can also be set according to empirical values, which are not limited here.

[0068] The embodiment of the present invention also provides another method for determining the target element, which is implemented on the basis of the method shown in Figure 1 This method takes into account the problem of performance consumption. First, the VAT scheme is excluded, and then the traditional vertex offset in the shader is used to achieve the melting effect. This method uses the XZ plane in the world coordinates as the first plane, and the melting effect is set to the ink-wash effect. At the same time, due to the animation playback mechanism of the game engine, and the character's death and resurrection will switch back and forth between the normal state and the ink-wash form, special effects are used to add a richer death melting effect.

[0069] The production principle of this method is: use the shader to calculate the flattened character model, and use the ink-wash texture map to control the transparency of the finally flattened model, simulating the effect of ink-wash melting.

[0070] In this method, it is necessary to first analyze the death ink-wash melting effect, which is essentially a process of a three-dimensional model being flattened into a plane. After being flattened into a plane, the ink-wash is simulated by controlling rendering textures, etc. Before the model dies, it is still a three-dimensional model and the depth must be written. Otherwise, the lack of depth information will cause the rendering order to be disordered. After the model dies, the model has been flattened from three-dimensional to a plane, and at this time, the depth cannot be written, otherwise there will be a flickering effect because the patches with depth information are on the same horizontal plane.

[0071] In practical applications, in order to be able to handle the depth information before and after the model's death, the ink-wash melting shader of the model cannot complete the rendering with only one pass. In addition, since the original rendering shader of the model already has a pass for normal-outline expansion, there is also a need for a pass for outlining in the ink-wash melting shader.

[0072] Therefore, the ink-wash melting shader consists of 3 passes

[0073] 1. Depth pass, responsible for writing depth information. The melted part of the character's death is not written with depth, and the part that has not melted is reserved for writing depth.

[0074] 2. Ink effect pass, responsible for rendering the original effect before the character's death and the ink effect after the character's death.

[0075] 3. Outline pass, responsible for rendering the original outline effect before the character's death.

[0076] When specifically implemented, 4 surf shaders can be newly created and named respectively: toon_melt_depth (depth pass); toon_melt (ink effect pass); toon_melt_outline (outline pass); toon_melt_multipass. Among them, toon_melt_multipass is the shader actually used for character rendering, and the previous three surf shaders will be put into this surf shader as passes for rendering to achieve the effect of multi-pass rendering.

[0077] This method is implemented in the following way:

[0078] 1. Create a new material function named MF_CharMelt, and the ink melting calculation will be encapsulated in the material function. The reason for making a material function is that there are many identical calculations in the 3 passes. It is more convenient to encapsulate the ink melting effect into the material function and then put the material function MF_CharMelt into the 3 passes respectively.

[0079] 2. Calculate the vertex offset of death melting in the material function. The process of death is a process of being flattened and expanded, as Figure 4 shown. Figure 4 In it, the left side shows the normal display effect of the model before death, and the right side shows the effect of the model being flattened and expanded after death.

[0080] First, calculate the expanded vertices,

[0081] A. First, sample a noise texture map (equivalent to the above first noise texture map). To ensure that the character can have the same effect performance regardless of its position, the texture coordinates (UV) of the noise texture map are the XZ information obtained by subtracting the world space position information from the model center position (equivalent to the position parameter of the vertex's projection on the first plane above).

[0082] Float3(0,0,0) => TransPosition => Get the model center position

[0083] (Model center position - World space position (worldposition)).xz = Noise texture map UV

[0084] B. Use the UV sampling of the noise texture map to obtain the data Meltepandnoise. The noise texture map is as shown in Figure 5 shown.

[0085] UV sampling of the noise texture map => Meltepandnoise

[0086] C. Multiply Meltepandnoise by the XZ components of the vertex normal vertexnormal to obtain the effect of expansion in the XZ direction.

[0087] Since the model melts from bottom to top, the expansion of the vertices in the XZ direction gradually increases as the model melts. It is also necessary to calculate the mask of the model melting, and only the part of the model within the mask where melting occurs is subject to vertex expansion.

[0088] Normalize the height of the character model by dividing the Y information of the world space position by the Y information of the bounding box information of the character model, and then subtract the parameter meltinten (equivalent to the above "melting degree parameter"). In this way, the mask of the model melting is obtained. The parameter meltinten is a value within the range of 0 - 1, where 0 means no melting and 1 means melting. By dynamically changing this parameter, the mask of the model melting from bottom to top can be obtained.

[0089] Y information of the world space position / Y information of the bounding box information of the character model = Normalized height of the character model

[0090] Saturate(normalized height of the character model - parameter meltinten) = Mask of the model melting from bottom to top

[0091] Meltepandnoise × vertex normal vertexnormal.xz = Vertex expansion offset

[0092] Lerp(vertex expansion offset, 0, mask of the model melting from bottom to top) = Final vertex expansion offset of the model

[0093] The calculated final vertex expansion offset of the model is used as the output of the material function and is finally output to the worldoffset output ports of the depth pass and the ink wash effect pass.

[0094] 3. After calculating the expansion in the XZ direction (XZ direction information) of the model flattening, calculate the Y direction information when the model melts to simulate the liquid fluctuation effect during melting.

[0095] A. Similarly, sample the noise texture, but the UV information is different from that in the second step. Here, the UV information is the sum of the world space position XZ information and the time (equivalent to the "timing parameter" mentioned above), which will result in a continuously moving noise texture. Multiply it by the parameter meltinten to obtain the MeltNoise data controlled by the melting degree parameter.

[0096] worldposition.xz + FrameTime (time) => noise texture UV

[0097] Float3(0, noise texture UV samples the noise texture * parameter meltinten, 0) => Meltnoise

[0098] 4. Calculate the final vertex offset information MeltOutputWorldOffset.

[0099] This data will be input into the shader vertex offset output interfaces of 3 passes respectively as the output result of the material function. Thus, the vertex animation calculation of the ink melting effect is completed. By controlling the parameter meltinten, the death melting degree parameter of the character model can be controlled. The change of the parameter meltinten from 0 to 1 is the vertex change of the model's death melting from bottom to top.

[0100] Meltepandnoise - Meltnoise = MeltOutputWorldOffset

[0101] 5. Process the depth calculation of the depth pass. This calculation is outside the material function.

[0102] A. Use the step function to judge. If it is lower than the world space position height of 0.3, it is judged as 0, otherwise it is 1. The purpose is to stop writing the depth for the part of the model below the world height of 0.3, and write the depth normally for the part above 0.3.

[0103] The calculation result is finally output to the opacitymask interface of the depth pass shader.

[0104] Step(0.3, world position Worldposition.y) = opacitymask information of the depth pass

[0105] B. The depth pass is calculated as a pass in toon_melt_multipass. Adjust the pass to write depth (TestWriteLEqual), cull none for both sides (None), and the blend mode is Add. Thus, the calculation and processing of the depth pass are completed.

[0106] 6. Next, process the ink effect pass, which is calculated as a pass in toon_melt_multipass. Depth is not written (TestNoWriteLEqual), cull none for both sides (None), and the blend mode is Blend (semi-transparent).

[0107] In the ink effect pass, first complete the calculation of the original effect before the character's death:

[0108] A. Calculate the dot product of the light direction and the model vertex normal to obtain the light and shadow information. Multiply the light and shadow information by the model's diffuse color map (the color map of each model is different) to obtain the calculation of the original effect before the character's death.

[0109] Dot(light direction, model vertex normal) = light and shadow information

[0110] Light and shadow information * diffuse color map = original effect before the character's death

[0111] The original effect before the character's death is input as an input port of the material function and participates in the calculation in the material function.

[0112] B. Then calculate the effect after the character's death begins in the material function. The original effect before the character's death is input as an input port of the material function for calculation

[0113] Obtain the Y-axis information of the world space position. Use the smoothstep function to judge. Those lower than 0.2 of the world space height are all judged as 0, and those higher than 0.25 are judged as 1. Here, this calculated value is named the colormask parameter. Among them, 0.2 and 0.25 are empirical values.

[0114] Smoothstep(0.2, 0.25, world space position Worldposition.y) = colormask

[0115] The colormask is input to the alpha interface of the lerp function. The A interface of the lerp function will input the calculation effect of the character completely melted into ink, and the B interface of the lerp function will input the effect of the character gradually turning black and white as the meltinten parameter increases.

[0116] Desaturation (Original effect before character death) = Desaturated character death effect

[0117] The calculation of the computational effect where the character completely melts into ink and wash is shown in the calculation steps in point 7 below.

[0118] Lerp (Computational effect where the character completely melts into ink and wash, Desaturated character death effect, colormask) = Ink and wash basecolor effect

[0119] The colormask is passed into the lerp function for effect blending. As the meltinten parameter gradually increases, the vertices of the character model are slowly flattened. The part of the character model below the world space position height of 0.2 is judged as the completely melted part, presenting the ink and wash effect. The part of the character that has not melted will be desaturated, becoming black and white, and the original color will not be retained.

[0120] Because the computational effect after the ink and wash is completely melted and the original effect of the character are distributed according to the colormask, as the model is flattened, the world space height information of the character is also changing, so the effect also changes accordingly.

[0121] Finally, the ink and wash basecolor effect is output in the material function and then output to the basecolor interface of the ink and wash effect pass shader.

[0122] Thus, the calculation of the ink and wash effect pass shader is completed.

[0123] 7. Here are the calculation steps for the ink and wash effect when the character completely melts into ink and wash

[0124] A. Since the vertex normal information of the model itself does not change as the model is flattened and melted, it is impossible to directly calculate the light and shadow using the vertex normal information. Therefore, a fake normal information needs to be created.

[0125] First, use the XZ information of the world space position added to the time to sample and obtain the information of a flowing light and shadow noise map, and then add it to the float3 value (0, 1, 0) to obtain a fake worldnormal information. The light and shadow noise map is as Figure 6 shown. This noise map will flow more like ink and wash.

[0126] World space position (worldposition).xz + FrameTime (time) => Refraction noise map UV

[0127] Refraction noise map UV samples the light and shadow noise map => Flowing light and shadow noise

[0128] Float3(0, 1, 0) + flowing light and shadow noise = fake world normal

[0129] B. The dot product of this fake world normal information and the fake scene lighting direction is calculated to obtain the ink and wash light and shadow information. The dot product with the camera direction is calculated to obtain the highlight information of the ink and wash

[0130] Fake scene lighting direction = float3(-0.3, 0.7, -0.5)

[0131] Dot(fake world normal, fake scene lighting direction) = ink and wash light and shadow information

[0132] Since the camera in the scene is fixed, using a fixed fake scene lighting direction can achieve better results in ink and wash rendering calculations

[0133] C. Then calculate the highlight information of the ink and wash

[0134] Dot(camera direction cameravector, fake world normal) = ink and wash highlight information

[0135] D. Calculate the ink and wash reflection effect. To ensure that the reflection effect of each pool of ink and wash is relatively fixed, subtract the XZ information of the world space position information from the model center position, add the XZ information to the reflection noise map to sample the reflection image, and obtain the fixed reflection information. The reflection map is as Figure 7 shown

[0136] Float3(0, 0, 0) => TransPosition => obtain the model center position

[0137] (Model center position - world space position (worldposition)).xz + flowing light and shadow noise = reflection UV

[0138] Reflection UV samples the reflection map => ink and wash reflection effect

[0139] E. Integrate the previously calculated information to obtain the final calculation effect of the character completely melting into ink and wash

[0140] (Ink and wash reflection effect + ink and wash highlight information) * ink and wash light and shadow information = calculation effect of the character completely melting into ink and wash

[0141] 8. Calculate the transparency information of the ink and wash effect pass to ensure that the shape of the character after melting is a pool of ink and wash. This step is calculated in the material function

[0142] First, prepare the ink and wash transparency map, as Figure 8 shown

[0143] Similarly, to ensure that each ink effect remains fixed, the XZ information of the world space position is subtracted from the center position of the model to sample the ink transparency map. As the meltinten parameter changes and the model is flattened, the transparency will finally change from the original model transparency map to the ink transparency map.

[0144] (Center position of the model - World space position (worldposition)).xz = UV of the ink transparency map

[0145] Sampling the ink transparency map with UV of the ink transparency map => inkmask

[0146] To make the ink melting process more realistic, there is a spreading process after the character is flattened. A dissolve noise map is used to create the transparency change of the cut. The dissolve noise map can use Figure 4 the noise map shown, or other noise maps, which are not restricted here.

[0147] (Center position of the model - World space position (worldposition)).xz = UV of the dissolve noise map

[0148] Sampling the dissolve noise map with UV of the dissolve noise map => dissolve noise

[0149] Calculate a circular mask, and use lerp to mix in the dissolve noise within the circular mask. As the circular mask expands, specifically controlled by the parameter meltopacitycenterarea, and added with the parameter, as the value of the parameter meltopacitycenterarea increases, the circular mask expands to achieve the spreading effect

[0150] Distance (Center position of the model, World space position) = Base circular mask

[0151] Base circular mask + Parameter meltopacitycenterarea = Circular mask

[0152] Lerp(0, dissolve noise, circular mask) * inkmask = Final ink transparency

[0153] Output the final ink transparency in the material function and finally output it to the opacity interface of the ink effect pass shader. Thus, the calculation of the ink transparency is completed.

[0154] 9. Calculation of the ink stroke pass, completely copy the original stroke calculation before the character's death, perform a normal expansion calculation, but as meltinten increases, the transparency will decrease

[0155] A. First, it is the setting of the ink stroke pass. The depth is not written (TestNoWriteLEqual), the front side is culled (Front), and the blend mode is Blend (semi-transparent).

[0156] B. Then, it is the original stroke calculation before the character's death. Just multiply the vertex normal of the model by 0.05 (0.05 here is an empirical value).

[0157] Use the previously calculated colormask for lerp blending. For the part where the world space height position is below 0.2, the stroke color is 0, and for the rest, it is the color provided by the diffuse color map.

[0158] Vertexnormal * 0.05 = model stroke

[0159] Lerp(0, diffuse color map, colormask) = model stroke color

[0160] Output the model stroke to the worldoffset interface of the stroke pass shader.

[0161] Output the model stroke color to the basecolor interface of the stroke pass shader.

[0162] C. Finally, it is the processing of the stroke pass during the character's death. This step is calculated in the material function. Use the previously calculated colormask for lerp blending. For the part where the world space height position is below 0.2, the opacity is 0, that is, the stroke is not rendered.

[0163] Lerp(0, 1, colormask) = final stroke opacity information

[0164] Output the final stroke opacity information as the output of the material function to the opacity interface of the stroke pass shader.

[0165] Thus, the calculation of the stroke pass is completed.

[0166] 9. Finally, the complete effect is composed of 3 passes. Assign the mtyl material using the toon_melt_multipass shader to the character model to achieve the effect that the character melts and dies into a pool of ink, as Figure 9 shown.

[0167] 10. Make material changes in accordance with the timeline in the animation file of the engine, keyframe the material parameters for the death animation of the character model, and obtain the effect of melting into ink when dead.

[0168] The keyframe parameters are the parameter meltopacitycenterarea and the parameter meltinten.

[0169] This method realizes the death melting effect by combining animation in the rendering engine with keyframing of materials. It is completely material-dependent and has little performance consumption. After the models at different positions die, a fixed and unified ink melting effect can be obtained. The ink melting in the multi-pass scheme ensures that there is no abnormality in the depth throughout the process before and after the character's death.

[0170] For the above method embodiments, refer to Figure 10 A model rendering device as shown, which includes:

[0171] A melting degree parameter determination module 1002, configured to determine the melting degree parameter of the target model; the target model includes multiple vertices;

[0172] A melting part determination module 1004, configured to determine the melting part and the non-melting part of the target model based on the melting degree parameter of the target model and a preset first plane;

[0173] A vertex offset parameter determination module 1006, configured to determine a first vertex offset parameter corresponding to the melting part, and to determine a second vertex offset parameter corresponding to the non-melting part;

[0174] A rendering module 1008, configured to render the target model based on the first vertex offset parameter and the second vertex offset parameter; the display position of the melting part after vertex offset is less than or equal to a preset distance threshold from the first plane, and the distance between the display position of the non-melting part after vertex offset and the first plane is greater than the distance between the display position of the non-melting part before vertex offset and the first plane.

[0175] The above-mentioned model rendering device determines the melting degree parameter of the target model; the target model includes multiple vertices; based on the melting degree parameter of the target model and a preset first plane, it determines the melted part and the non-melted part of the target model; determines the first vertex offset parameter corresponding to the melted part, and determines the second vertex offset parameter corresponding to the non-melted part; based on the first vertex offset parameter and the second vertex offset parameter, renders the target model; the distance between the display position of the melted part after vertex offset and the first plane is less than or equal to a preset distance threshold, and the distance between the display position of the non-melted part after vertex offset and the first plane is greater than the distance between the display position of the non-melted part before vertex offset and the first plane. This method does not require sampling multiple texture maps, reduces the device performance consumption, and improves the generation efficiency of the model melting effect.

[0176] The above-mentioned melted part determination module is further used for: determining the target height of the target model in the normal direction of the first plane; based on the melting degree parameter of the target model and the target height, determining the height threshold; determining the part of the target model with a height greater than the height threshold in the normal direction as the non-melted part; determining the part of the target model with a height less than or equal to the height threshold in the normal direction as the melted part.

[0177] The above-mentioned vertex offset parameter determination module is further used for: for each vertex of the melted part, determining the first position parameter of the projection point of the vertex on the first plane; based on the first position parameter and the current position parameter of the vertex, determining the first vertex offset parameter corresponding to the vertex.

[0178] The above-mentioned vertex offset parameter determination module is further used for: sampling the preset first noise texture map based on the first position parameter to obtain a first sampling result; updating the first position parameter based on the first sampling result; the position corresponding to the updated first position parameter is located on the first plane; based on the updated first position parameter and the current position parameter of the vertex, determining the first vertex offset parameter corresponding to the vertex.

[0179] The distance between the above-mentioned non-melted part and the first plane is greater than the height threshold; the height threshold is determined based on the target height of the target model in the normal direction of the first plane and the melting degree parameter of the target model; the above-mentioned vertex offset parameter determination module is further used for: based on the normal direction of the first plane and the height threshold, determining the second vertex offset parameter of the non-melted part.

[0180] The above melting degree parameter is related to a preset timing parameter; the above vertex offset parameter determination module is further configured to: for each vertex of the unfused part, determine a first distance between the vertex and the first plane; based on the first distance and the timing parameter, determine a first sampling parameter; based on the first sampling parameter, sample a preset second noise map to obtain a second sampling result; based on the second sampling result and a height threshold, determine an offset height corresponding to the vertex; based on the offset height and the normal direction of the first plane, determine a second vertex offset parameter corresponding to the vertex.

[0181] The above rendering module is further configured to: render the melted part based on the first vertex offset parameter and a preset melting effect parameter; render the unfused part based on the second vertex offset parameter and a preset model effect parameter.

[0182] The above rendering module is further configured to: determine a first mask texture based on the melting degree parameter; in the first mask texture, the size of the area where the black pixels are located is positively correlated with the melting degree parameter; determine a transparency parameter for the melted part based on the first mask texture; render the melted part based on the first vertex offset parameter, a preset melting effect parameter, and the transparency parameter.

[0183] The above device further includes: a position parameter determination module configured to determine an offset position parameter of each vertex for a plurality of vertices; a distance determination module configured to determine a distance between the vertex and the first plane based on the offset position parameter; a depth write cancellation module configured to cancel writing the depth of the vertex if the distance is less than a preset distance threshold.

[0184] The melting degree parameter of the above target model changes from a first parameter value to a second parameter value within a preset duration; the preset duration corresponds to a plurality of animation frames arranged in a preset order; the melting degree parameter determination module is further configured to: for each of the plurality of animation frames, determine a melting degree parameter corresponding to the animation frame based on the order position of the animation frame in the preset order, the first parameter value, and the second parameter value.

[0185] This embodiment further provides an electronic device, including a processor and a memory, the memory storing machine-executable instructions that can be executed by the processor, and the processor executing the machine-executable instructions to implement the above model rendering method, for example:

[0186] Determine the melting degree parameter of the target model; the target model includes multiple vertices; based on the melting degree parameter of the target model and a preset first plane, determine the melted part and the non-melted part of the target model; determine the first vertex offset parameter corresponding to the melted part, and determine the second vertex offset parameter corresponding to the non-melted part; based on the first vertex offset parameter and the second vertex offset parameter, render the target model; the distance between the display position of the melted part after vertex offset and the first plane is less than or equal to a preset distance threshold, and the distance between the display position of the non-melted part after vertex offset and the first plane is greater than the distance between the display position of the non-melted part before vertex offset and the first plane.

[0187] The above method does not require sampling multiple texture maps, reduces the consumption of device performance, and improves the generation efficiency of the model melting effect.

[0188] Optionally, the step of determining the melted part and the non-melted part of the target model based on the melting degree parameter of the target model and a preset first plane includes: determining the target height of the target model in the normal direction of the first plane; based on the melting degree parameter of the target model and the target height, determine the height threshold; determine the part of the target model with a height greater than the height threshold in the normal direction as the non-melted part; determine the part of the target model with a height less than or equal to the height threshold in the normal direction as the melted part.

[0189] Optionally, the step of determining the first vertex offset parameter corresponding to the melted part includes: for each vertex of the melted part, determine the first position parameter of the projection point of the vertex on the first plane; based on the first position parameter and the current position parameter of the vertex, determine the first vertex offset parameter corresponding to the vertex.

[0190] Optionally, the step of determining the first vertex offset parameter corresponding to the vertex based on the first position parameter and the current position parameter of the vertex includes: sampling a preset first noise texture map based on the first position parameter to obtain a first sampling result; updating the first position parameter based on the first sampling result; the position corresponding to the updated first position parameter is located on the first plane; based on the updated first position parameter and the current position parameter of the vertex, determine the first vertex offset parameter corresponding to the vertex.

[0191] Optionally, the distance between the non-melted part and the first plane is greater than the height threshold; the height threshold is determined based on the target height of the target model in the normal direction of the first plane and the melting degree parameter of the target model; the step of determining the second vertex offset parameter corresponding to the non-melted part includes: determining the second vertex offset parameter of the non-melted part based on the normal direction of the first plane and the height threshold.

[0192] Optionally, the above melting degree parameter is related to a preset timing parameter; the step of determining the second vertex offset parameter of the unmelted part based on the normal direction of the first plane and the height threshold includes: for each vertex of the unmelted part, determining the first distance between the vertex and the first plane; based on the first distance and the timing parameter, determining the first sampling parameter; based on the first sampling parameter, sampling a preset second noise map to obtain a second sampling result; based on the second sampling result and the height threshold, determining the offset height corresponding to the vertex; based on the offset height and the normal direction of the first plane, determining the second vertex offset parameter corresponding to the vertex.

[0193] Optionally, the above step of rendering the target model based on the first vertex offset parameter and the second vertex offset parameter includes: rendering the melted part based on the first vertex offset parameter and a preset melting effect parameter; rendering the unmelted part based on the second vertex offset parameter and a preset model effect parameter.

[0194] Optionally, the above step of rendering the melted part based on the first vertex offset parameter and a preset melting effect parameter includes: determining a first mask texture based on the melting degree parameter; in the first mask texture, the size of the area where the black pixels are located is positively correlated with the melting degree parameter; determining the transparency parameter of the melted part based on the first mask texture; rendering the melted part based on the first vertex offset parameter, the preset melting effect parameter, and the transparency parameter.

[0195] Optionally, the above method further includes: for each of multiple vertices, determining the offset position parameter of the vertex; based on the offset position parameter, determining the distance between the vertex and the first plane; if the distance is less than a preset distance threshold, cancel writing the depth of the vertex.

[0196] Optionally, the melting degree parameter of the above target model changes from a first parameter value to a second parameter value within a preset time period; the preset time period corresponds to multiple animation frames arranged in a preset order; the step of determining the melting degree parameter of the target model includes: for each of the multiple animation frames, based on the ordinal position of the animation frame in the preset order, the first parameter value, and the second parameter value, determining the melting degree parameter corresponding to the animation frame.

[0197] See Figure 11 As shown, the electronic device includes a processor 100 and a memory 101. 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 model rendering method.

[0198] Furthermore, Figure 11The electronic device shown also includes a bus 102 and a communication interface 103. The processor 100, the communication interface 103, and the memory 101 are connected through the bus 102.

[0199] Among them, 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 memory. Through at least one communication interface 103 (which can be wired or wireless), a communication connection is realized between this system network element and at least one other network element. The Internet, wide area network, local area network, metropolitan area network, etc. can be used. The bus 102 can be an ISA bus, a PCI bus, an EISA bus, etc. The said bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of convenience of representation, Figure 11 only a bidirectional arrow is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0200] 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 integrated logic circuit in the hardware of the processor 100 or by instructions in software form. The above-mentioned processor 100 can be a general-purpose processor, including a central processing unit (CPU for short), a network processor (NP for short), etc.; it can also be a digital signal processor (DSP for short), an application specific integrated circuit (ASIC for short), a field programmable gate array (FPGA for short), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present disclosure. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The method disclosed in combination with the embodiments of the present disclosure can be directly embodied as being executed and completed by a hardware decoding processor, or by a combination of hardware and software modules in the decoding processor. The software module can be located in a mature storage medium 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. This storage medium is located in the memory 101, and the processor 100 reads the information in the memory 101 and combines its hardware to complete the method of the foregoing embodiments.

[0201] This embodiment also provides a machine-readable storage medium storing machine-executable instructions that, when called and executed by a processor, cause the processor to implement the above model rendering method.

[0202] A model rendering method, apparatus, and electronic device provided by an embodiment of the present disclosure include a computer-readable storage medium storing program code, and the instructions included in the program code can be used to execute the method described in the foregoing method embodiments. For example:

[0203] Determine the melting degree parameter of the target model; the target model includes a plurality of vertices; based on the melting degree parameter of the target model and a preset first plane, determine the melted part and the non-melted part of the target model; determine the first vertex offset parameter corresponding to the melted part, and determine the second vertex offset parameter corresponding to the non-melted part; based on the first vertex offset parameter and the second vertex offset parameter, render the target model; the distance between the display position of the melted part after vertex offset and the first plane is less than or equal to a preset distance threshold, and the distance between the display position of the non-melted part after vertex offset and the first plane is greater than the distance between the display position of the non-melted part before vertex offset and the first plane.

[0204] The above method does not require sampling multiple texture maps, reducing the device performance consumption and improving the generation efficiency of the model melting effect.

[0205] Optionally, the step of determining the melted part and the non-melted part of the target model based on the melting degree parameter of the target model and a preset first plane includes: determining the target height of the target model in the normal direction of the first plane; based on the melting degree parameter of the target model and the target height, determining a height threshold; determining the part of the target model with a height greater than the height threshold in the normal direction as the non-melted part; determining the part of the target model with a height less than or equal to the height threshold in the normal direction as the melted part.

[0206] Optionally, the step of determining the first vertex offset parameter corresponding to the melted part includes: for each vertex of the melted part, determining the first position parameter of the projection point of the vertex on the first plane; based on the first position parameter and the current position parameter of the vertex, determining the first vertex offset parameter corresponding to the vertex.

[0207] Optionally, the step of determining the first vertex offset parameter corresponding to the vertex based on the first position parameter and the current position parameter of the vertex includes: sampling a preset first noise map based on the first position parameter to obtain a first sampling result; updating the first position parameter based on the first sampling result; the position corresponding to the updated first position parameter is located on the first plane; based on the updated first position parameter and the current position parameter of the vertex, determining the first vertex offset parameter corresponding to the vertex.

[0208] Optionally, the distance between the unfused part and the first plane is greater than a height threshold; the height threshold is determined based on the target height of the target model in the normal direction of the first plane and the melting degree parameter of the target model; the step of determining the second vertex offset parameter corresponding to the unfused part includes: determining the second vertex offset parameter of the unfused part based on the normal direction of the first plane and the height threshold.

[0209] Optionally, the melting degree parameter is related to a preset timing parameter; the step of determining the second vertex offset parameter of the unfused part based on the normal direction of the first plane and the height threshold includes: for each vertex of the unfused part, determining the first distance between the vertex and the first plane; determining a first sampling parameter based on the first distance and the timing parameter; sampling a preset second noise map based on the first sampling parameter to obtain a second sampling result; determining the offset height corresponding to the vertex based on the second sampling result and the height threshold; determining the second vertex offset parameter corresponding to the vertex based on the offset height and the normal direction of the first plane.

[0210] Optionally, the step of rendering the target model based on the first vertex offset parameter and the second vertex offset parameter includes: rendering the melted part based on the first vertex offset parameter and a preset melting effect parameter; rendering the unfused part based on the second vertex offset parameter and a preset model effect parameter.

[0211] Optionally, the step of rendering the melted part based on the first vertex offset parameter and a preset melting effect parameter includes: determining a first mask texture based on the melting degree parameter; in the first mask texture, the size of the area where the black pixels are located is positively correlated with the melting degree parameter; determining the transparency parameter of the melted part based on the first mask texture; rendering the melted part based on the first vertex offset parameter, the preset melting effect parameter, and the transparency parameter.

[0212] Optionally, the method further includes: for each of multiple vertices, determining the offset position parameter of the vertex; determining the distance between the vertex and the first plane based on the offset position parameter; if the distance is less than a preset distance threshold, cancel writing the depth of the vertex.

[0213] Optionally, the melting degree parameter of the target model changes from a first parameter value to a second parameter value within a preset duration; the preset duration corresponds to multiple animation frames arranged in a preset order; the step of determining the melting degree parameter of the target model includes: for each of the multiple animation frames, determining the melting degree parameter corresponding to the animation frame based on the sequence position of the animation frame in the preset order, the first parameter value, and the second parameter value.

[0214] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the systems and devices described above can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated herein.

[0215] In addition, in the description of the embodiments of the present disclosure, unless otherwise clearly specified and limited, the terms "installed", "connected", and "coupled" 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 directly connected or indirectly connected through an intermediate medium, and it can be the communication inside two elements. For those skilled in the art, the specific meanings of the above terms in the present disclosure can be understood according to specific situations.

[0216] If the above functions are implemented in the form of software function units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present disclosure, in essence, or the part that contributes to the prior art or a part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present disclosure. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs that can store program codes.

[0217] In the description of the present disclosure, it should be noted that the orientation or positional relationship indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc. is based on the orientation or positional relationship shown in the drawings, and is 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 should not be construed as a limitation to the present disclosure. In addition, the terms "first", "second", and "third" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance.

[0218] Finally, it should be noted that the above embodiments are only specific implementation manners of the present disclosure, used to illustrate the technical solutions of the present disclosure, rather than limiting it. The protection scope of the present disclosure is not limited thereto. Although the present disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art within the technical scope disclosed by the present disclosure can still modify the technical solutions recorded in the foregoing embodiments, or can easily think of changes, or perform equivalent replacements on some of the technical features; 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 all be covered within the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be subject to the protection scope of the claims.

Claims

1. A model rendering method, characterized in that, Including: Determine the melting degree parameter of the target model; The target model includes multiple vertices; Based on the melting degree parameter of the target model and a preset first plane, determine the melted part and the non-melted part of the target model; Determine the first vertex offset parameter corresponding to the melted part, and determine the second vertex offset parameter corresponding to the non-melted part; Render the target model based on the first vertex offset parameter and the second vertex offset parameter; the distance between the display position of the melted part after vertex offset and the first plane is less than or equal to a preset distance threshold, and the distance between the display position of the non-melted part after vertex offset and the first plane is greater than the distance between the display position of the non-melted part before vertex offset and the first plane.

2. The method according to claim 1, wherein The step of determining the melted part and the non-melted part of the target model based on the melting degree parameter of the target model and a preset first plane includes: Determine the target height of the target model in the normal direction of the first plane; Based on the melting degree parameter of the target model and the target height, determine a height threshold; Determine the part of the target model with a height greater than the height threshold in the normal direction as the non-melted part; Determine the part of the target model with a height less than or equal to the height threshold in the normal direction as the melted part.

3. The method according to claim 1, wherein The step of determining the first vertex offset parameter corresponding to the melted part includes: For each vertex of the melted part, determine the first position parameter of the projection point of the vertex on the first plane; Based on the first position parameter and the current position parameter of the vertex, determine the first vertex offset parameter corresponding to the vertex.

4. The method according to claim 3, characterized in that, The step of determining the first vertex offset parameter corresponding to the vertex based on the first position parameter and the current position parameter of the vertex includes; Sample a preset first noise map based on the first position parameter to obtain a first sampling result; Update the first position parameter based on the first sampling result; The position corresponding to the updated first position parameter is located on the first plane; Based on the updated first position parameter and the current position parameter of the vertex, determine the first vertex offset parameter corresponding to the vertex.

5. The method according to claim 1, wherein The distance between the non-melted part and the first plane is greater than the height threshold; the height threshold is determined based on the target height of the target model in the normal direction of the first plane and the melting degree parameter of the target model; The step of determining the second vertex offset parameter corresponding to the non-melted part includes: Based on the normal direction of the first plane and the height threshold, determine the second vertex offset parameter of the non-melted part.

6. The method according to claim 5, wherein The melting degree parameter is related to a preset timing parameter; The step of determining the second vertex offset parameter of the non-melted part based on the normal direction of the first plane and the height threshold includes: For each vertex of the non-melted part, determine the first distance between the vertex and the first plane; Based on the first distance and the timing parameter, determine a first sampling parameter; Sample a preset second noise map based on the first sampling parameter to obtain a second sampling result; Determine the offset height corresponding to the vertex based on the second sampling result and the height threshold; Determine the second vertex offset parameter corresponding to the vertex based on the offset height and the normal direction of the first plane.

7. The method according to claim 1, wherein The step of rendering the target model based on the first vertex offset parameter and the second vertex offset parameter includes: Render the melted part based on the first vertex offset parameter and a preset melting effect parameter; Render the non-melted part based on the second vertex offset parameter and a preset model effect parameter.

8. The method according to claim 7, characterized in that The step of rendering the melted part based on the first vertex offset parameter and a preset melting effect parameter includes: Determine a first mask texture based on the melting degree parameter; in the first mask texture, the size of the area where the black pixels are located is positively correlated with the melting degree parameter; Determine the transparency parameter of the melted part based on the first mask texture; Render the melted part based on the first vertex offset parameter, a preset melting effect parameter, and the transparency parameter.

9. The method according to claim 1, wherein The method further includes: For each of the multiple vertices, determine the offset position parameter of the vertex; Determine the distance between the vertex and the first plane based on the offset position parameter; If the distance is less than a preset distance threshold, cancel writing the depth of the vertex.

10. The method according to claim 1, wherein The melting degree parameter of the target model changes from a first parameter value to a second parameter value within a preset time period; the preset time period corresponds to a plurality of animation frames arranged in a preset order; The step of determining the melting degree parameter of the target model includes: For each of the multiple animation frames, determine the melting degree parameter corresponding to the animation frame based on the sequence position of the animation frame in the preset order, the first parameter value, and the second parameter value.

11. A model rendering device, characterized in that, Includes: A melting degree parameter determination module for determining the melting degree parameter of the target model; The target model includes multiple vertices; A melted part determination module for determining the melted part and the non-melted part of the target model based on the melting degree parameter of the target model and a preset first plane; A vertex offset parameter determination module for determining the first vertex offset parameter corresponding to the melted part and determining the second vertex offset parameter corresponding to the non-melted part; A rendering module for rendering the target model based on the first vertex offset parameter and the second vertex offset parameter; the display position of the melted part after vertex offset and the first plane is less than or equal to a preset distance threshold, and the display position of the non-melted part after vertex offset and the first plane is greater than the display position of the non-melted part before vertex offset and the first plane.

12. An electronic device, characterized in that, Includes a processor and a memory, the memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the model rendering method according to any one of claims 1-10.

13. A machine-readable storage medium, characterized in that, The machine-readable storage medium stores machine-executable instructions which, when called and executed by a processor, cause the processor to implement the model rendering method according to any one of claims 1-10.