Model rendering method and device and electronic equipment
By generating crack effect texture parameters based on stress distribution parameters and crack elements in 3D game and film production, and then rendering the surface model, the problems of long production cycle and unrealistic effect in the existing technology are solved, achieving realistic crack effect and reducing labor costs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NETEASE (HANGZHOU) NETWORK CO LTD
- Filing Date
- 2025-12-29
- Publication Date
- 2026-05-05
AI Technical Summary
Existing technologies suffer from problems such as long production cycles, high labor costs, and a lack of natural logic and structural hierarchy in the creation of special effects scenes like ground fissures, magma, and energy cracks in 3D games and film production.
By determining the target region in the target model, generating crack effect texture parameters based on stress distribution parameters and crack elements, rendering the face model, controlling its display of crack effects on the surface of the target model, and generating realistic crack effects using the face model and crack effect texture parameters.
It reduces the need for manual modifications, improves the realism and visual experience of crack effects, reduces labor costs, and enhances the logic and layering of special effects scenes.
Smart Images

Figure CN121982186A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of rendering technology, and more specifically, to a model rendering method, apparatus, and electronic device. Background Technology
[0002] In 3D game and film production, the creation of special effects scenes such as ground fissures, lava flows, and energy cracks is a common requirement. Related technologies typically require staff to manually sculpt high-precision models and create textures to generate the corresponding display effects. This method is time-consuming, extremely inconvenient to modify or adjust, and has high labor costs.
[0003] Cracks can also be simulated in some graphics software by combining basic noise nodes with nodes used for pixel value adjustment. However, the crack shapes generated by this method often lack natural logic and structural hierarchy. Crack-related effects are usually simply achieved by masking and overlaying, lacking a deep internal connection, resulting in poor visual effects and affecting the user experience. Summary of the Invention
[0004] In view of this, the purpose of the present invention is to provide a model rendering method, apparatus and electronic device to reduce labor costs, improve crack effect and enhance user visual experience.
[0005] In a first aspect, embodiments of the present invention provide a model rendering method, the method comprising: determining a target region in a target model; the target model being located in a specified virtual space, the specified virtual space being provided with a patch model; determining position parameters of the patch model in the specified virtual space based on the target region; rendering the patch model based on the position parameters and pre-generated crack effect texture parameters to control the patch model to display a crack effect on the surface of the target model; the crack effect texture parameters being generated based on stress distribution parameters and crack elements.
[0006] Secondly, embodiments of the present invention provide a model rendering apparatus, the apparatus comprising: a target region determination module, used to determine a target region in a target model; the target model is located in a specified virtual space, and a patch model is set in the specified virtual space; a position parameter determination module, used to determine the position parameters of the patch model in the specified virtual space based on the target region; and a rendering module, used to render the patch model based on the position parameters and pre-generated crack effect texture parameters, so as to control the patch model to display a crack effect on the surface of the target model; the crack effect texture parameters are generated based on stress distribution parameters and crack elements.
[0007] Thirdly, embodiments of the present invention provide 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-described model rendering method. Fourthly, embodiments of the present invention provide a machine-readable storage medium storing machine-executable instructions. When the machine-executable instructions are invoked and executed by a processor, the machine-executable instructions cause the processor to implement the above-described model rendering method.
[0008] The embodiments of the present invention bring the following beneficial effects: The aforementioned model rendering method, apparatus, and electronic device determine a target region within a target model. The target model is located in a designated virtual space, which contains patch models. Based on the target region, the position parameters of the patch models within the designated virtual space are determined. Based on the position parameters and pre-generated crack effect texture parameters, the patch models are rendered to control the display of crack effects on the surface of the target model. The crack effect texture parameters are generated based on stress distribution parameters and crack elements. This method can generate crack effects in the target region of the target model using patch models and crack effect texture parameters. The location of the crack effect can be adjusted as needed without manual modification by relevant personnel, reducing labor costs. The crack texture parameters, generated based on stress distribution parameters and crack elements, possess logical consistency and a hierarchical structure, resulting in realistic crack effects and improving the user's visual experience.
[0009] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention are realized and obtained in accordance with the structures particularly pointed out in the description, claims and drawings.
[0010] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0011] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0012] Figure 1 A flowchart of a model rendering method provided in an embodiment of the present invention; Figure 2 This is a schematic diagram of the structure of a model rendering device provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0013] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0014] In 3D game and film production workflows, the creation of special effects scenes such as ground fissures, lava flows, and energy cracks is a common requirement. The following three methods are typically used to achieve the creation of special effects scenes: The first method involves constructing special effects scenes through manual sculpting and painting. Artists use digital sculpting software such as ZBrush to create high-precision models, then bake normal maps, AO maps, and other textures, and finally paint base colors and self-illuminating maps in Substance Painter or Photoshop. This method offers high artistic freedom, but the production cycle is long, modifications and adjustments are extremely inconvenient, and it is difficult to batch and reuse procedurally.
[0015] The second method involves generating special effects scenes procedurally: in node-based software like Substance Designer, basic noise nodes (such as Perlin Noise, Clouds, and Worley Noise) are combined and thresholded using the Levels node to simulate cracks. While this method is fast, the generated crack shapes often lack natural logic and structural hierarchy. The direction and distribution of the cracks are highly random, making it difficult to simulate the effect of real crustal tearing. Furthermore, energy effects and crack shapes are usually simply superimposed through masking, lacking a deep, intrinsic connection, resulting in a flat and lifeless visual effect.
[0016] The third method involves creating a crack effect through splicing together real-world rock crack images. This is done by overlaying and blending images of real-world rock cracks. This method is limited by the resolution and diversity of the images, and it also struggles to achieve dynamic and logical interaction between the cracks and energy effects.
[0017] In conclusion, the above methods generally suffer from a contradiction between production efficiency, artistic controllability, realistic effects, and specific stylistic expressiveness.
[0018] Based on this, embodiments of the present invention provide a model rendering method, apparatus, and electronic device, which can be applied to the process of adjusting the display effect of a model.
[0019] See Figure 1 First, a model rendering method provided by an embodiment of the present invention will be introduced. The method includes the following steps: Step S102: Determine the target region in the target model; the target model is located in a specified virtual space, and the specified virtual space is set with a patch model.
[0020] The target model described above is a 3D model. The target model can be a model simulating terrain, a building, or a creature; there are no restrictions. The target model typically has preset rendering parameters to ensure that the rendered target model achieves the desired display effect.
[0021] The target area mentioned above can be the entire surface area of the target model, a specified area on the target model, or a randomly determined area. The specific settings can be configured according to requirements. When the target model is applied to a game or interactive scene, the target area can be determined based on the player's perspective.
[0022] In the designated virtual space containing the target model, patch models also need to be set. There can be one or more patch models, which can be set according to requirements. The position of the patch models in the designated virtual space is usually not limited; during subsequent rendering, the vertices of the patch models can be aligned with the surface of the target model to display the crack effect.
[0023] Step S104: Based on the target region, determine the position parameters of the patch model in the specified virtual space.
[0024] When the target region is a preset region in the target model, the position parameters of each vertex in the target region can usually be determined based on the position of the target model in the specified virtual space and the coordinate parameters of the vertices of the target region in the target model's own coordinate system.
[0025] When the target region is randomly determined, or its location is determined based on other non-fixed models, it is difficult to directly determine the position parameters of the target region in the specified virtual space. The target region can be projected onto a known plane. Then, based on the position parameters of each vertex of the projected region corresponding to the target region on the plane in the specified virtual space, and the distance between the projected region and the target region, the distances of each vertex in the target region can be calculated.
[0026] Step S106: Based on the position parameters and the pre-generated crack effect texture parameters, render the face model to control the face model to display the crack effect on the surface of the target model; the crack effect texture parameters are generated based on the stress distribution parameters and crack elements.
[0027] After determining the position parameters of the target region, these parameters need to be converted into texture coordinate parameters. Then, by combining the correspondence between the texture coordinate parameters of the patch model and the target region, the position parameters of the vertices of the patch model during rendering are determined based on the position parameters of the target region. This process is similar to attaching the vertices of the patch model to the surface of the target region during rendering.
[0028] After determining the position parameters of the vertices of the patch model during rendering, the position parameters of the vertices can be adjusted using the vertex shader during rendering. The rendering parameters for each vertex can then be determined from the crack effect texture parameters, thus rendering each vertex of the patch model and achieving overall rendering of the patch model. The target model is usually rendered simultaneously with the patch model; the rendering process for the target model will not be detailed here.
[0029] The crack effect texture parameters described above can be represented by one or more texture maps. When a crack is generated, stress is usually involved, and the distribution of stress typically has a fixed correspondence with the crack's appearance. When generating the crack effect texture parameters, a base map with stress distribution parameters can be generated first. This map can be generated manually or automatically by software; no restrictions are placed here.
[0030] After generating the base map, crack texture elements, either hand-drawn or sampled from images with cracks, can be set in the base map. The position and shape of the crack texture elements in the base map need to match the stress distribution.
[0031] This allows for the generation of necessary color maps and normal maps based on a base map that includes crack texture elements. In generating the color map, the colors corresponding to the cracks and the flat areas are typically used. These two colors are overlaid based on the distribution of crack texture elements in the base map to generate the color map. In generating the normal map, a height map is usually generated from the base map, and then a normal map is generated based on the height map. This determines the crack effect texture parameters that can be used to render the crack effect.
[0032] The aforementioned model rendering method involves determining a target region within a target model; the target model is located in a specified virtual space, which contains patch models; based on the target region, the position parameters of the patch models within the specified virtual space are determined; based on the position parameters and pre-generated crack effect texture parameters, the patch models are rendered to control the display of crack effects on the surface of the target model; the crack effect texture parameters are generated based on stress distribution parameters and crack elements. This method can generate crack effects in the target region of the target model using patch models and crack effect texture parameters. The location of the crack effect can be adjusted as needed without manual modification by relevant personnel, reducing labor costs; the crack texture parameters, generated based on stress distribution parameters and crack elements, possess logicality and a sense of hierarchical structure, resulting in more realistic crack effects and improving the user's visual experience.
[0033] In one specific embodiment, crack effect texture parameters can be generated in the following manner.
[0034] This is achieved through the following steps: (1) Obtain the base texture map and gradient parameters; the base texture map includes stress distribution parameters.
[0035] The aforementioned base texture map typically includes stress distribution parameters. These parameters represent the magnitude and direction of stress at various locations within the base texture map. Stress distribution parameters can be represented by directional information. Specifically, a flow map can be used as the base texture map to simulate uneven surface material density (also known as a "base stress distribution map"). The stress distribution parameters can be used to define the primary growth direction of cracks within the base texture map.
[0036] The gradient parameters mentioned above are typically used to indicate the gradient changes of each pixel in the base texture map, and can be represented by a gradient map or a custom vector map.
[0037] (2) The base texture map is oriented to be distorted based on the gradient parameters to obtain the processed base texture map.
[0038] When performing directional warping on a base texture map, it is usually necessary to rotate and warp the texture map coordinates around a central reference point. Gradient parameters can serve as the direction and intensity of the warping force during the rotation and warping process.
[0039] In practical applications, the directional warp of a base texture map can be achieved using directional warp nodes in graphics software, which are used to distort images. The base texture map can be input into one or more directional warp nodes, and then gradient parameters can be input into the nodes as the direction and intensity of the warp. This simulates stretching or compressive forces from a specific direction, causing the stress field in the base texture map to exhibit a clear striped or stretched texture.
[0040] (3) Generate crack effect texture parameters based on crack texture elements and processed base texture maps.
[0041] To ensure that crack texture elements conform to the logic of crack display, they need to be added to the processed base texture map based on the stress distribution parameters, generating a target texture map. Specifically, crack texture elements can be randomly scattered across the processed base texture map. The orientation of these crack texture elements is then adjusted according to the stress direction to match the influence of ground stress on crack growth. During this adjustment process, rotation information needs to be obtained from oriented textures in the processed base texture map, and the rotation angle is calculated to determine the rotation matrix. This rotation matrix can then be applied to the crack texture elements in the processed base texture map, thus ensuring that the distribution of crack texture elements matches the stress direction.
[0042] To create a layered effect when cracks are displayed, crack texture elements of different sizes and shapes can be added to the processed base texture map.
[0043] In one specific embodiment, a first crack texture element can be added to the processed base texture map based on the stress distribution parameters in the processed base texture map to generate a first texture map. This first crack texture element is typically large in size and is used to generate the main crack.
[0044] Then, based on the stress distribution parameters in the processed base texture map and the distribution parameters of the first crack texture element, the second crack texture element is added to the processed base texture map to generate the second texture map. The size of the second crack texture element is smaller than the size of the first crack texture element. Generally, the second crack texture element also needs to conform to the stress direction in the processed base texture map and be less than the first crack texture element.
[0045] In practical implementation, a distance field to the first crack texture element in the first texture map can be generated. For example, the first texture map is input as the main crack path map into the distance node to generate a distance to the main crack. Based on this distance, regions far from the main crack are identified, and smaller second crack texture elements are added to these regions. These second crack texture elements can be generated using cellular noise or a scratch generator. Typically, it is also necessary to detect the rate of change of values between adjacent pixels in the processed base texture map using a detection operator, and to identify the regions with the most drastic stress changes, compression regions, and stretching regions in the texture map, generating corresponding masks. This can be implemented using the Sobel operator.
[0046] After adding the second crack texture element to the first texture map, the second crack texture element can be distorted based on the regions with the most drastic stress changes, compression regions, and stretching regions in the processed base texture map to match the stress field. In practice, this can also be achieved using a twist node, such as the wrap node.
[0047] After obtaining the first and second texture maps, they need to be overlaid to generate the target texture map. This can be done using either the Add or Max blending modes. The Add blending mode adds color values directly. This brightens the overall image and is often used to simulate light source overlays or enhance brightness. The Max blending mode, on the other hand, takes the maximum value. It independently compares the pixel values of the two texture maps on each color channel and selects the larger one. This mode preserves the brighter pixels in both layers and is suitable for scenes where highlighting details in bright areas is crucial.
[0048] After obtaining the target texture map, it is necessary to generate crack effect texture parameters based on the target texture map.
[0049] In practical applications, the texture parameters for crack effects can include a target height map. First, the display parameters of the crack texture elements in the target texture map need to be adjusted. These display parameters typically include the width and depth of the crack, which can be adjusted using nodes such as Levels and Histogram Range in mapping software. Further, image processing can be performed on the edge regions of the crack texture elements in the adjusted target texture map to generate a preliminary height map. This image processing can include softening, irregularization, or both. Further, a target region can be identified in the preliminary height map, and preset noise can be superimposed on this region to generate the target height map. This preset noise is typically high-frequency, low-intensity environmental noise, such as fractal noise, to simulate the natural erosion and weathering details of a rock surface.
[0050] In practical applications, the crack effect texture parameters mentioned above usually also include a base color map. An energy emission map is typically generated based on the target texture map. The energy emission map, also known as an emissive map, is used to simulate the self-illumination of an object. In cracks, deeper cracks are generally brighter, and the energy emission map can represent the color transition from the crack's core color (e.g., bright white, bright blue) to the edge color (e.g., orange, purple) and then to the color of the extinguished area (black).
[0051] In generating the energy emission map, a target height map can first be generated based on the target texture map. The process of generating the target height map has been described above and will not be repeated here. Then, the target height map needs to be inverted. Image inversion typically refers to inverting the pixel values of an image to generate an image with the opposite brightness or hue to the original image. After inverting the height map, a depth map can be considered generated. Further, the processed target height map can be mapped using a non-linear curve to obtain a first mask map. The purpose of this mapping is to drastically amplify the contrast of the brightest areas while darkening secondary areas, thereby accurately extracting the deepest and widest core region of the crack. This first mask map can be called the "energy core mask." The brightness value of this mask has an exponential or logarithmic relationship with the depth or width of the original crack. Further, a preset gradient image can be processed based on the first mask map to generate the energy emission map. Specifically, the first mask map can be used to drive a gradient map node to generate the energy emission map. Energy emission maps typically enrich color gradations.
[0052] After generating the energy emission map, a base color map needs to be generated based on the energy emission map and a preset color map. The preset first and second color maps are then overlaid on a second mask map to generate an initial color map. The second mask map is based on the stress distribution parameters in the target texture map. As mentioned above, the stress distribution parameters in the target texture map are the same as the stress distribution parameters in the base texture map after directional distortion. The second mask map can indicate the areas with the most drastic stress changes, compression areas, and stretching areas in the processed base texture map.
[0053] When the base texture map is a flow map, for each pixel in the map, the flow vector of the current pixel can be obtained. Then, the flow vectors of the surrounding pixels are calculated, and the gradient between the flow vectors of the current pixel and the flow vectors of the surrounding pixels is calculated. This gradient can represent the degree of stress change corresponding to the pixel, thus identifying the region with the most drastic stress change in the base texture map. The divergence of the pixel can also be calculated based on the flow vectors of the pixel and the surrounding pixels, thereby identifying the squeezed and stretched regions in the base texture map. In specific implementations, if the divergence of a pixel is less than 0, the pixel belongs to the squeezed region; if the divergence of a pixel is greater than 0, the pixel belongs to the stretched region.
[0054] The first color map typically corresponds to the color of the base material, such as the base rock color (corresponding to "dark gray rock"). The second color map typically corresponds to specific color effects during the crack formation process, such as the color of materials "burned" or "crystallized" by energy. The first and second color maps can be blended with different weights in different energy regions using a second mask map to generate an initial color map. Further, the initial color map needs to be overlaid with the energy emission map to generate the base color map. This overlay is usually done using the Add mode.
[0055] To achieve physically-based rendering (PBR), it is typically necessary to generate normal maps and ambient occlusion maps. Normal directions are usually generated by calculating the gradients of adjacent pixels in the target height map and then mapping them onto RGB colors. For example, gradients can be calculated using Sobel or Scharr operators to obtain the X, Y, and Z components, and then the normal map is generated.
[0056] Specifically, an ambient occlusion map can be generated based on the target height map. For example, a horizon occlusion algorithm can be used to calculate the occlusion effect by analyzing the surface geometric details in the target height map. This algorithm can automatically identify recessed areas, gaps, and corners, and enhance shadow effects in these areas, making the rendering result closer to realistic lighting behavior. High-quality AO nodes such as HBAO can be used to process the target height map to generate the ambient occlusion map.
[0057] The following embodiments provide an implementation method for determining a target region in a target model.
[0058] In practical applications, the specified virtual space can also include virtual characters. Virtual characters can typically move on the surface of the target model. In specific implementations, the target area within the target model can be determined based on the virtual character's position in the specified virtual space. For example, the virtual character's field of vision can be determined based on its position, and the surface area of the target model within that field of vision can be defined as the target area. Alternatively, based on the virtual character's position and movement speed, the model area the virtual character is about to enter can be predicted and designated as the target area. Specific settings can be configured according to requirements and are not limited here.
[0059] The following embodiments provide an implementation method for determining the position parameters of a patch model in a specified virtual space based on a target region.
[0060] First, the world position coordinates and depth parameters of the target region can be determined. Then, based on the world position coordinates and depth parameters of the target region, the position parameters of each vertex of the face model are updated in the vertex shader.
[0061] When the target region in the target model is predetermined, the world position coordinates of each vertex in the target region are usually known. When the target region is randomly determined, or determined based on the position of the virtual character in a specified virtual space, it is necessary to determine the world position coordinates and depth parameters of the target region in a certain way.
[0062] In practical implementation, the first vertex in the target region needs to be projected onto a designated plane to obtain the projection point of the first vertex on the designated plane. The normal direction of the designated plane is parallel to the preset vertical direction of the designated virtual space, that is, the designated plane is parallel to the horizon in the designated virtual space. The world position coordinates of a certain position in the designated plane in the designated virtual space are usually known, and this position can be called the designated position.
[0063] In the game, an orthographic camera that vertically views the ground can be placed in front of and above the player character (with an offset of float3(0, height, distance)). The camera's near clipping plane is set to 0.1 or less, and the far clipping plane is positioned to cover the maximum height range of the terrain. The camera plane can be considered as the plane specified above, and the camera's near clipping plane can be approximately equal to the specified plane. A render target (RT) can be created using a virtual camera to store depth values; the RT can be in the format R32_FLOAT or R16_UNORM.
[0064] Furthermore, based on the relative orientation of the projection point to a specified position on a specified plane and the world position coordinates of that specified position, the world position coordinates of the first vertex in the target region within a coordinate plane parallel to the specified plane in the world coordinate system can be determined. And based on the distance between the first vertex and the projection point, the height parameter of the first vertex can be determined.
[0065] Specifically, in the camera's rendering pass, the depth distance from the terrain to the camera plane is remapped to (0, 1) based on its proportion within the near to far planes of the corresponding camera space. The mapping formula is:
[0066] The vertices of the patch model can be transformed from world space to the projection space of the orthographic camera, preparing for subsequent updates to the vertex position parameters of the patch model based on the coordinates of the target region. First, the view-projection matrix (MatVP) and world coordinates (camWorldPos) of the orthographic camera are calculated and passed to the model material. In the shader, the coordinates of the model vertices in the orthographic camera projection space are calculated using the following formula: posInCameraProj = mul(MatVP, float4(worldPos, 1.0)) The formula for converting projected spatial coordinates to UV coordinates (mapping from [-1,1] to [0,1]) is: uv = posInCameraProj.xy∗0.5+0.5 Using the UV sampling RT calculated in the previous step, we obtain the depth parameters (also known as "normalized terrain depth") of the current vertex from the perspective of the orthogonal camera: depthSample = tex2D(_DepthRT, uv).r The depth value is restored to linear depth in camera space. Depth is linear under orthogonal cameras, and the distance from the orthogonal camera to the terrain surface (along the camera's forward axis) can be directly restored through linear interpolation. linearDepth = lerp(near, far, depthSample) The formula for calculating the world coordinate parameters of the terrain surface is: terrainWorldPos=camWorldPos+camForward*linearDepth Furthermore, the vertices of the patch model can be snapped to the target region of the target model. In the vertex shader, the world coordinates can be modified, setting the Y-coordinate (vertical height component) of the patch model to the terrain height while keeping the XZ components unchanged. The formula is: worldPosAdjusted = float3(worldPos.x, terrainWorldPos.y, worldPos.z) The following embodiments provide an implementation method for rendering a face model based on position parameters and pre-generated crack effect texture parameters.
[0067] During the rendering process, to ensure a natural transition between the displayed appearance of the patch model and the target model, the patch model can be rendered based on position parameters, pre-generated crack effect texture parameters, and a third mask map. The third mask map is generated based on the distance between vertices in the patch model and its edges, and is used to control the transparency of various positions on the patch model. Generally speaking, the farther away from the edge of the patch model, the less transparent the position, and the more obvious the crack effect.
[0068] In the actual rendering process, the transparency parameters of each vertex of the face model can be determined based on the third mask texture, and then the face model can be rendered based on the position parameters, the pre-generated crack effect texture parameters, and the transparency parameters.
[0069] The aforementioned third mask texture can be generated as follows: For each vertex in each patch model, calculate the distance between the vertex and the edge of the patch model. This distance is typically the minimum distance between the vertex and the edge of the patch model. Then, map the distance to pixel values, and generate the third mask texture based on the texture map coordinates and pixel values corresponding to each vertex.
[0070] In one specific embodiment, it is necessary to create a crack effect that grows along one direction. The vertex texture coordinates of the patch model can be mapped and arranged along the U-axis and the tangential axes along the v-axis. In this case, the U and V direction information of the UV coordinates of the model vertices can be directly remapped as mask information, and the mapping formula is: Maskedge0=smoothstep(inside0,out0,UV.x∗2−1) Maskedge1=smoothstep(inside1,out1,UV.y∗2−1) Maskedge=Maskedge0*Maskedge1 Alternatively, you can directly sample a mask texture map to more precisely and customize the displayed shape of the crack. The sampling formula is: Masktex = tex2D(MaskTex, uv).r When creating a crack effect that grows in one direction, a progress mask is usually needed to control the display progress of the crack along the curve. The V-direction information of the model's vertex UV coordinates can be directly remapped as mask information. The mapping formula is: Masklevel=smoothsteplerp0−width,1,level,lerp0,1+width,level,UV.y Multiply the xz plane components of the model's world coordinates by a tilling value, and use this as the UV coordinates of the PBR texture of the crack itself. The mapping formula is as follows: UVtex=worldPos.xz∗tilling Use these UV coordinates to sample all the PBR textures that make up the crack. When there are multiple sets of PBR textures (used to create the material differences in the crack from the edge to the center), texture sampling can be performed using the following formula: Albedo0= tex2DAAlbedoTex0, UVtex.xyz Normal0= tex2D(NormalTex0, UVtex).xyz Mix0= tex2D(MixTex0, UVtex).xyz Emission0= tex2D(EmissionTex0, UVtex).xyz Albedo1= tex2D(AlbedoTex1, UVtex).xyz Normal1= tex2D(NormalTex1, UVtex).xyz … Here, Albedo represents the base color texture map, Normal represents the normal map, Mix represents the height map, and Emission represents the ambient occlusion map.
[0071] When multiple PBR textures exist, the edge texture calculated above is used to determine which PBR texture to use for different regions. The blending formula for using two PBR textures is given below: Albedofinal=Albedo0 Normalfinal=Normal0 Mixfinal=Mix0 Emissionfinal=Emission0 PBRmask1=smoothstep(a,b,Maskedge) Albedofinal=lerp(Albedofinal,Albedo1,PBRmask1) Normalfinal=lerp(Normalfinal,Normal1,PBRmask1) Mixfinal=lerp(Mixfinal,Mix1,PBRmask1) Emissionfinal=lerp(Emissionfinal,Emission1,PBRmask1) … After overlaying the third mask texture with a noise waveform, set it as the alpha channel of the material to create a smooth transition with the scene's ground: noise=tex2DNoiseTex0, UVtex.r noise = noise * 2 - 1 Alpha=Maskedge+noiseWeight*noise Finally, multiply the material's alpha channel by a coefficient to control the overall fade-out effect of the cracks: Alpha = Alpha∗alphawhole In practical applications, special effects can be played at the corresponding positions on the curve according to the set playback progress to control the appearance of the ground cracks. For example, effects such as gravel and smoke can be played at the head of the ground cracks to enhance the expressiveness of the crack effect.
[0072] For the above method embodiments, see Figure 2 A model rendering apparatus is shown, the apparatus comprising: The target region determination module 202 is used to determine the target region in the target model; the target model is located in a specified virtual space, and the specified virtual space is set with a patch model. The position parameter determination module 204 is used to determine the position parameters of the patch model in the specified virtual space based on the target region; The rendering module 206 is used to render the face model based on position parameters and pre-generated crack effect texture parameters, so as to control the face model to display crack effect on the surface of the target model; the crack effect texture parameters are generated based on stress distribution parameters and crack elements.
[0073] The aforementioned model rendering device determines a target region within a target model. The target model is located in a designated virtual space, which contains patch models. Based on the target region, the position parameters of the patch models within the designated virtual space are determined. Based on the position parameters and pre-generated crack effect texture parameters, the patch models are rendered to control the display of crack effects on the surface of the target model. The crack effect texture parameters are generated based on stress distribution parameters and crack elements. This method can generate crack effects in the target region of the target model using patch models and crack effect texture parameters. The location of the crack effect can be adjusted as needed without manual modification by relevant personnel, reducing labor costs. The crack texture parameters, generated based on stress distribution parameters and crack elements, possess logical consistency and a hierarchical structure, resulting in more realistic crack effects and improving the user's visual experience.
[0074] The aforementioned device includes a texture parameter generation module, used for: acquiring a base texture map and gradient parameters; the base texture map includes stress distribution parameters; performing directional distortion processing on the base texture map based on the gradient parameters to obtain a processed base texture map; and generating crack effect texture parameters based on crack texture elements and the processed base texture map.
[0075] The aforementioned texture parameter generation module is also used to: add crack texture elements to the processed base texture map based on the stress distribution parameters in the processed base texture map to generate a target texture map; and generate crack effect texture parameters based on the target texture map.
[0076] The texture parameter generation module described above is also used to: add a first crack texture element to the processed base texture map based on the stress distribution parameters in the processed base texture map to generate a first texture map; add a second crack texture element to the processed base texture map based on the stress distribution parameters in the processed base texture map and the distribution parameters of the first crack texture element to generate a second texture map; the size of the second crack texture element is smaller than the size of the first crack texture element; and overlay the first texture map and the second texture map to generate a target texture map.
[0077] The aforementioned crack effect texture parameters include a target height map; the aforementioned texture parameter generation module is also used to: adjust the display parameters of the crack texture elements in the target texture map; perform image processing on the edge areas of the crack texture elements in the adjusted target texture map to generate a preliminary height map; the image processing includes softening processing and / or irregularization processing; determine the target area in the preliminary height map, and superimpose preset noise on the target area to generate a target height map.
[0078] The crack effect texture parameters mentioned above include a base color map; the texture parameter generation module is also used to: generate an energy emission map based on the target texture map; and generate a base color map based on the energy emission map and a preset color map.
[0079] The texture parameter generation module described above is also used to: generate a target height map based on the target texture map; invert the target height map and map the processed target height map using a non-linear curve to obtain a first mask map; and process a preset gradient image based on the first mask map to generate an energy emission map.
[0080] The texture parameter generation module described above is also used to: overlay a preset first color map and a second color map based on a second mask map to generate an initial color map; generate the second mask map based on stress distribution parameters in the target texture map; and overlay the initial color map with an energy emission map to generate a base color map.
[0081] The specified virtual space includes a virtual character; the virtual character moves on the surface of the target model; the target area determination module is also used to: determine the target area in the target model based on the position of the virtual character in the specified virtual space.
[0082] The aforementioned position parameter determination module is also used to: determine the world position coordinates and depth parameters of the target region; and update the position parameters corresponding to each vertex of the face model in the vertex shader based on the world position coordinates and depth parameters of the target region.
[0083] The aforementioned position parameter determination module is also used to: project the first vertex in the target region onto a specified plane to obtain the projection point of the first vertex on the specified plane; the normal direction of the specified plane is parallel to the preset vertical direction of the specified virtual space; based on the relative orientation of the projection point and the specified position of the specified plane, and the world position coordinates of the specified position, determine the world position coordinates of the first vertex in the target region in a coordinate plane parallel to the specified plane in the world coordinate system; and determine the height parameter of the first vertex based on the distance between the first vertex and the projection point.
[0084] The aforementioned rendering module is also used to: render the face model based on position parameters, pre-generated crack effect texture parameters, and a third mask map; the third mask map is generated based on the distance between vertices in the face model and the edges of the face model.
[0085] The aforementioned device also includes a mask generation module, used for: calculating the distance between the vertex and the edge of the patch model for each vertex in each patch model; mapping the distance to a pixel value; and generating a third mask map based on the texture map coordinates and pixel values corresponding to each vertex.
[0086] The rendering module described above is also used to: determine the transparency parameters of each vertex of the facet model based on the third mask texture; and render the facet model based on the position parameters, the pre-generated crack effect texture parameters, and the transparency parameters.
[0087] This embodiment also provides an electronic device, including a processor and a memory. The memory stores machine-executable instructions that can be executed by the processor. The processor executes the machine-executable instructions to implement the above-described model rendering method, for example: The target region in the target model is determined; the target model is located in a specified virtual space, and a patch model is set in the specified virtual space; based on the target region, the position parameters of the patch model in the specified virtual space are determined; based on the position parameters and the pre-generated crack effect texture parameters, the patch model is rendered to control the display of crack effect on the surface of the target model; the crack effect texture parameters are generated based on stress distribution parameters and crack elements.
[0088] The above method can generate crack effects in the target area of the target model using patch models and crack effect texture parameters. The location of the crack effect can be adjusted according to needs without manual modification by relevant staff, thus reducing labor costs. The crack texture parameters are generated based on stress distribution parameters and crack elements, which has logic and a sense of hierarchy, resulting in a more realistic crack effect and improving the user's visual experience.
[0089] Optionally, the crack effect texture parameters mentioned above are generated in the following way: obtaining a base texture map and gradient parameters; the base texture map includes stress distribution parameters; performing directional distortion processing on the base texture map based on the gradient parameters to obtain a processed base texture map; generating crack effect texture parameters based on crack texture elements and the processed base texture map.
[0090] Optionally, the above steps for generating crack effect texture parameters based on crack texture elements and base texture maps include: adding crack texture elements to the processed base texture map based on stress distribution parameters in the processed base texture map to generate a target texture map; and generating crack effect texture parameters based on the target texture map.
[0091] Optionally, the step of adding crack texture elements to the processed base texture map based on the stress distribution parameters in the processed base texture map to generate a target texture map includes: adding a first crack texture element to the processed base texture map based on the stress distribution parameters in the processed base texture map to generate a first texture map; adding a second crack texture element to the processed base texture map based on the stress distribution parameters in the processed base texture map and the distribution parameters of the first crack texture element to generate a second texture map; the size of the second crack texture element is smaller than the size of the first crack texture element; and superimposing the first texture map and the second texture map to generate the target texture map.
[0092] Optionally, the crack effect texture parameters mentioned above include a target height map; the step of generating crack effect texture parameters based on the target texture map includes: adjusting the display parameters of the crack texture elements in the target texture map; performing image processing on the edge regions of the crack texture elements in the adjusted target texture map to generate a preliminary height map; the image processing includes softening processing and / or irregularization processing; determining the target region in the preliminary height map, and superimposing preset noise on the target region to generate a target height map.
[0093] Optionally, the crack effect texture parameters mentioned above include a base color map; the step of generating crack effect texture parameters based on the target texture map includes: generating an energy emission map based on the target texture map; and generating a base color map based on the energy emission map and a preset color map.
[0094] Optionally, the above step of generating an energy emission map based on a target texture map includes: generating a target height map based on the target texture map; inverting the target height map and mapping the processed target height map using a non-linear curve to obtain a first mask map; and processing a preset gradient image based on the first mask map to generate an energy emission map.
[0095] Optionally, the step of generating a base color map based on the energy emission map and the preset color map includes: overlaying the preset first color map and the second color map based on the second mask map to generate an initial color map; generating the second mask map based on the stress distribution parameters in the target texture map; and overlaying the initial color map and the energy emission map to generate the base color map.
[0096] Optionally, the specified virtual space includes a virtual character; the virtual character moves on the surface of the target model; the step of determining the target region in the target model includes: determining the target region in the target model based on the position of the virtual character in the specified virtual space.
[0097] Optionally, the above steps for determining the position parameters of the patch model in the specified virtual space based on the target region include: determining the world position coordinates and depth parameters of the target region; and updating the position parameters corresponding to each vertex of the patch model in the vertex shader based on the world position coordinates and depth parameters of the target region.
[0098] Optionally, the steps for determining the world position coordinates and depth parameters of the target area include: projecting the first vertex in the target area onto a specified plane to obtain the projection point of the first vertex on the specified plane; the normal direction of the specified plane is parallel to the preset vertical direction of the specified virtual space; based on the relative orientation of the projection point and the specified position on the specified plane and the world position coordinates of the specified position, determining the world position coordinates of the first vertex in the target area in a coordinate plane parallel to the specified plane in the world coordinate system; and determining the height parameter of the first vertex based on the distance between the first vertex and the projection point.
[0099] Optionally, the above steps for rendering the face model based on position parameters and pre-generated crack effect texture parameters include: rendering the face model based on position parameters, pre-generated crack effect texture parameters, and a third mask map; the third mask map is generated based on the distance between vertices in the face model and the edges of the face model.
[0100] Optionally, the third mask texture is generated as follows: for each vertex in each patch model, calculate the distance between the vertex and the edge of the patch model; map the distance to a pixel value; and generate the third mask texture based on the texture map coordinates and pixel values corresponding to each vertex.
[0101] Optionally, the above steps for rendering the face model based on position parameters, pre-generated crack effect texture parameters, and a third mask map include: determining the transparency parameters of each vertex of the face model based on the third mask map; and rendering the face model based on position parameters, pre-generated crack effect texture parameters, and transparency parameters.
[0102] See Figure 3 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. The processor 100 executes the machine-executable instructions to implement the above-described model rendering method.
[0103] Furthermore, Figure 3 The electronic device shown also includes a bus 102 and a communication interface 103, with the processor 100, the communication interface 103 and the memory 101 connected via the bus 102.
[0104] The memory 101 may include high-speed random access memory (RAM) and may also include non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 103 (which can be wired or wireless), such as the Internet, wide area network, local area network, metropolitan area network, etc. The bus 102 may be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 3 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.
[0105] Processor 100 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of processor 100 or by instructions in software form. The 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 gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams of the invention in the embodiments of this invention. The general-purpose processor can be a microprocessor or any conventional processor. The method invented in conjunction with the embodiments of this invention can be directly embodied as being executed by a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software module can reside in a mature storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory 101, and processor 100 reads information from memory 101 and, in conjunction with its hardware, completes the method of the aforementioned embodiments.
[0106] This embodiment also provides a machine-readable storage medium storing machine-executable instructions. When the machine-executable instructions are called and executed by the processor, the machine-executable instructions cause the processor to implement the above-described model rendering method.
[0107] The present invention provides a model rendering method, apparatus, and electronic device, including a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the preceding method embodiments, for example: The target region in the target model is determined; the target model is located in a specified virtual space, and a patch model is set in the specified virtual space; based on the target region, the position parameters of the patch model in the specified virtual space are determined; based on the position parameters and the pre-generated crack effect texture parameters, the patch model is rendered to control the display of crack effect on the surface of the target model; the crack effect texture parameters are generated based on stress distribution parameters and crack elements.
[0108] The above method can generate crack effects in the target area of the target model using patch models and crack effect texture parameters. The location of the crack effect can be adjusted according to needs without manual modification by relevant staff, thus reducing labor costs. The crack texture parameters are generated based on stress distribution parameters and crack elements, which has logic and a sense of hierarchy, resulting in a more realistic crack effect and improving the user's visual experience.
[0109] Optionally, the crack effect texture parameters mentioned above are generated in the following way: obtaining a base texture map and gradient parameters; the base texture map includes stress distribution parameters; performing directional distortion processing on the base texture map based on the gradient parameters to obtain a processed base texture map; generating crack effect texture parameters based on crack texture elements and the processed base texture map.
[0110] Optionally, the above steps for generating crack effect texture parameters based on crack texture elements and base texture maps include: adding crack texture elements to the processed base texture map based on stress distribution parameters in the processed base texture map to generate a target texture map; and generating crack effect texture parameters based on the target texture map.
[0111] Optionally, the step of adding crack texture elements to the processed base texture map based on the stress distribution parameters in the processed base texture map to generate a target texture map includes: adding a first crack texture element to the processed base texture map based on the stress distribution parameters in the processed base texture map to generate a first texture map; adding a second crack texture element to the processed base texture map based on the stress distribution parameters in the processed base texture map and the distribution parameters of the first crack texture element to generate a second texture map; the size of the second crack texture element is smaller than the size of the first crack texture element; and superimposing the first texture map and the second texture map to generate the target texture map.
[0112] Optionally, the crack effect texture parameters mentioned above include a target height map; the step of generating crack effect texture parameters based on the target texture map includes: adjusting the display parameters of the crack texture elements in the target texture map; performing image processing on the edge regions of the crack texture elements in the adjusted target texture map to generate a preliminary height map; the image processing includes softening processing and / or irregularization processing; determining the target region in the preliminary height map, and superimposing preset noise on the target region to generate a target height map.
[0113] Optionally, the crack effect texture parameters mentioned above include a base color map; the step of generating crack effect texture parameters based on the target texture map includes: generating an energy emission map based on the target texture map; and generating a base color map based on the energy emission map and a preset color map.
[0114] Optionally, the above step of generating an energy emission map based on a target texture map includes: generating a target height map based on the target texture map; inverting the target height map and mapping the processed target height map using a non-linear curve to obtain a first mask map; and processing a preset gradient image based on the first mask map to generate an energy emission map.
[0115] Optionally, the step of generating a base color map based on the energy emission map and the preset color map includes: overlaying the preset first color map and the second color map based on the second mask map to generate an initial color map; generating the second mask map based on the stress distribution parameters in the target texture map; and overlaying the initial color map and the energy emission map to generate the base color map.
[0116] Optionally, the specified virtual space includes a virtual character; the virtual character moves on the surface of the target model; the step of determining the target region in the target model includes: determining the target region in the target model based on the position of the virtual character in the specified virtual space.
[0117] Optionally, the above steps for determining the position parameters of the patch model in the specified virtual space based on the target region include: determining the world position coordinates and depth parameters of the target region; and updating the position parameters corresponding to each vertex of the patch model in the vertex shader based on the world position coordinates and depth parameters of the target region.
[0118] Optionally, the steps for determining the world position coordinates and depth parameters of the target area include: projecting the first vertex in the target area onto a specified plane to obtain the projection point of the first vertex on the specified plane; the normal direction of the specified plane is parallel to the preset vertical direction of the specified virtual space; based on the relative orientation of the projection point and the specified position on the specified plane and the world position coordinates of the specified position, determining the world position coordinates of the first vertex in the target area in a coordinate plane parallel to the specified plane in the world coordinate system; and determining the height parameter of the first vertex based on the distance between the first vertex and the projection point.
[0119] Optionally, the above steps for rendering the face model based on position parameters and pre-generated crack effect texture parameters include: rendering the face model based on position parameters, pre-generated crack effect texture parameters, and a third mask map; the third mask map is generated based on the distance between vertices in the face model and the edges of the face model.
[0120] Optionally, the third mask texture is generated as follows: for each vertex in each patch model, calculate the distance between the vertex and the edge of the patch model; map the distance to a pixel value; and generate the third mask texture based on the texture map coordinates and pixel values corresponding to each vertex.
[0121] Optionally, the above steps for rendering the face model based on position parameters, pre-generated crack effect texture parameters, and a third mask map include: determining the transparency parameters of each vertex of the face model based on the third mask map; and rendering the face model based on position parameters, pre-generated crack effect texture parameters, and transparency parameters.
[0122] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the system and apparatus described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0123] Furthermore, in the description of the embodiments of the present invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in the present invention based on the specific circumstances.
[0124] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0125] In the description of this invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing the invention and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0126] Finally, it should be noted that the above embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A model rendering method, characterized in that, The method includes: Determine the target region in the target model; the target model is located in a specified virtual space, and the specified virtual space is provided with a patch model; Based on the target region, determine the position parameters of the patch model in the specified virtual space; Based on the position parameters and the pre-generated crack effect texture parameters, the patch model is rendered to control the patch model to display a crack effect on the surface of the target model; the crack effect texture parameters are generated based on stress distribution parameters and crack elements.
2. The method according to claim 1, characterized in that, The crack effect texture parameters are generated in the following way: Obtain the base texture map and gradient parameters; the base texture map includes stress distribution parameters; Based on the gradient parameters, the base texture map is subjected to directional distortion to obtain the processed base texture map. Based on the crack texture element and the processed base texture map, crack effect texture parameters are generated.
3. The method according to claim 2, characterized in that, The steps for generating crack effect texture parameters based on crack texture elements and the base texture map include: Based on the stress distribution parameters in the processed base texture map, crack texture elements are added to the processed base texture map to generate the target texture map. Based on the target texture map, generate crack effect texture parameters.
4. The method according to claim 3, characterized in that, The step of adding crack texture elements to the processed base texture map based on the stress distribution parameters in the processed base texture map to generate the target texture map includes: Based on the stress distribution parameters in the processed base texture map, the first crack texture element is added to the processed base texture map to generate the first texture map. Based on the stress distribution parameters in the processed base texture map and the distribution parameters of the first crack texture element, the second crack texture element is added to the processed base texture map to generate the second texture map; the size of the second crack texture element is smaller than the size of the first crack texture element. The first texture map and the second texture map are overlaid to generate the target texture map.
5. The method according to claim 3, characterized in that, The crack effect texture parameters include the target height map; The step of generating crack effect texture parameters based on the target texture map includes: Adjust the display parameters of the crack texture element in the target texture map; Image processing is performed on the edge regions of the crack texture elements in the adjusted target texture map to generate a preliminary height map; the image processing includes softening processing and / or irregularization processing. The target region in the preliminary height map is determined, and preset noise is superimposed on the target region to generate the target height map.
6. The method according to claim 3, characterized in that, The crack effect texture parameters include a base color map; The step of generating crack effect texture parameters based on the target texture map includes: Based on the target texture map, an energy emission map is generated; Based on the energy emission map and the preset color map, a basic color map is generated.
7. The method according to claim 6, characterized in that, The step of generating an energy emission map based on the target texture map includes: Based on the target texture map, generate a target height map; The target height map is inverted and then mapped using a non-linear curve to obtain a first mask map. Based on the first mask texture, the preset gradient image is processed to generate an energy emission texture.
8. The method according to claim 7, characterized in that, The step of generating a base color map based on the energy emission map and the preset color map includes: An initial color map is generated by overlaying a preset first color map and a second color map based on a second mask map; the second mask map is generated based on the stress distribution parameters in the target texture map. The initial color map is overlaid with the energy emission map to generate a base color map.
9. The method according to claim 1, characterized in that, The designated virtual space includes virtual characters; the virtual characters move on the surface of the target model. The steps for determining the target region in the target model include: Based on the position of the virtual character in the specified virtual space, the target area in the target model is determined.
10. The method according to claim 1, characterized in that, The step of determining the position parameters of the patch model in the specified virtual space based on the target region includes: Determine the world location coordinates and depth parameters of the target area; Based on the world position coordinates and depth parameters of the target region, the position parameters corresponding to each vertex of the patch model are updated in the vertex shader.
11. The method according to claim 10, characterized in that, The steps for determining the world location coordinates and depth parameters of the target area include: The first vertex in the target region is projected onto a designated plane to obtain the projection point of the first vertex on the designated plane; the normal direction of the designated plane is parallel to the preset vertical direction of the designated virtual space; Based on the relative orientation of the projection point and the specified position of the specified plane, and the world position coordinates of the specified position, determine the world position coordinates of the first vertex in the target area in a coordinate plane parallel to the specified plane in the world coordinate system; The height parameter of the first vertex is determined based on the distance between the first vertex and the projection point.
12. The method according to claim 1, characterized in that, The steps for rendering the patch model based on the position parameters and pre-generated crack effect texture parameters include: The patch model is rendered based on the position parameters, the pre-generated crack effect texture parameters, and the third mask map; the third mask map is generated based on the distance between the vertices in the patch model and the edges of the patch model.
13. The method according to claim 12, characterized in that, The third mask texture is generated in the following way: For each vertex in each of the patch models, calculate the distance between the vertex and the edge of the patch model; Map the distance to pixel values; The third mask map is generated based on the texture map coordinates corresponding to each vertex and the pixel value.
14. The method according to claim 12, characterized in that, The steps for rendering the patch model based on the position parameters, pre-generated crack effect texture parameters, and a third mask map include: The transparency parameters of each vertex of the patch model are determined based on the third mask texture. The patch model is rendered based on the position parameters, the pre-generated crack effect texture parameters, and the transparency parameters.
15. A model rendering apparatus, characterized in that, The device includes: The target region determination module is used to determine the target region in the target model; the target model is located in a specified virtual space, and the specified virtual space is provided with a patch model; The position parameter determination module is used to determine the position parameters of the patch model in the specified virtual space based on the target area; The rendering module is used to render the patch model based on the position parameters and pre-generated crack effect texture parameters, so that the patch model displays a crack effect on the surface of the target model; the crack effect texture parameters are generated based on stress distribution parameters and crack elements.
16. An electronic device, characterized in that, It includes a processor and a memory, the memory storing machine-executable instructions that can be executed by the processor, the processor executing the machine-executable instructions to implement the model rendering method according to any one of claims 1-14.
17. A machine-readable storage medium, characterized in that, The machine-readable storage medium stores machine-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the model rendering method according to any one of claims 1-14.