Model rendering method and device, electronic equipment, storage medium and program product

By automatically generating mask maps and dynamically blending textures, the resource consumption and flexibility issues caused by pre-drawn mask maps are resolved, enabling efficient and flexible 3D model rendering and improving rendering effects and resource utilization efficiency.

CN121582418APending Publication Date: 2026-02-27NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511565519.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-29
Publication Date
2026-02-27

AI Technical Summary

Technical Problem

Existing technologies rely on pre-drawn mask textures, resulting in high resource consumption and poor flexibility. They are difficult to dynamically adjust or change according to real-time requirements within the engine, thus limiting the flexibility and diversity of material representation.

Method used

By acquiring the target normal map of the 3D model, edge features are extracted to generate a mask map, the texture fusion region is dynamically calculated, and the preset texture map is fused with the material map to generate the target material map, thus achieving automation and flexibility in mask generation.

Benefits of technology

It greatly saves time and manpower costs in producing art resources, ensures natural alignment between textures and model structures, improves the accuracy and visual realism of rendering effects, optimizes resource utilization efficiency and running performance, and has high flexibility and versatility.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121582418A_ABST
    Figure CN121582418A_ABST
Patent Text Reader

Abstract

The invention discloses a model rendering method and device, electronic equipment, a storage medium and a program product, and relates to the technical field of computers, and the method comprises the steps: obtaining a target normal map corresponding to a to-be-processed three-dimensional model, and a material map corresponding to the three-dimensional model; performing edge feature extraction on the target normal map to generate a mask map for defining a texture fusion range; determining a texture fusion area based on the pixel information of the mask map; fusing the preset texture map and the material map in the texture fusion region to generate a target material map; and rendering the three-dimensional model based on the target material map to obtain a target three-dimensional model. By implementing the technical scheme of the invention, the mask can be automatically generated from the normal map and the texture is fused, so that dynamic and programmed enhancement of model details is realized.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer, in particular to a model rendering method and device, electronic equipment, storage medium and program product. BACKGROUND

[0002] In the model detail processing based on Physically Based Rendering (PBR), in order to express the texture effects such as wear and tear and scratches, it is usually necessary to rely on an art personnel to draw a mask map in advance in a Digital Content Creation (DCC) tool to define the fusion area of different materials or effects.

[0003] However, this method based on pre-drawing masks significantly increases the production cost and resource management complexity of the map. Each additional mask map means higher memory occupation and texture sampling overhead, thereby affecting the rendering performance. Once the production is completed, the shape and distribution of the effect are fixed and it is difficult to dynamically adjust or change according to the real-time requirements in the engine, thereby limiting the flexibility and diversity of material expression. SUMMARY

[0004] Therefore, the present application provides a model rendering method and device, electronic equipment, storage medium and program product to solve the problem of large resource consumption and poor flexibility caused by relying on pre-drawing mask maps in the related art.

[0005] In a first aspect, the present application provides a model rendering method, comprising: obtaining a target normal map corresponding to a three-dimensional model to be processed, and a material map corresponding to the three-dimensional model; performing edge feature extraction on the target normal map to generate a mask map used to define a texture fusion range; determining a texture fusion area based on pixel information of the mask map; fusing a preset texture map and the material map in the texture fusion area to generate a target material map; and rendering the three-dimensional model based on the target material map to obtain a target three-dimensional model.

[0006] In an optional implementation, the edge feature extraction on the target normal map to generate the mask map used to define the texture fusion range comprises: performing edge detection processing on the target normal map to obtain an edge filter map corresponding to the target normal map; and performing enhancement processing on the edge filter map based on a preset gray scale mapping range to obtain the mask map.

[0007] In an optional implementation, edge detection is performed on the target normal map to obtain an edge filtering map corresponding to the target normal map, including: obtaining original texture coordinates corresponding to the three-dimensional model and offset factors of a plurality of preset directions; determining a plurality of sampling coordinates based on a fusion result between each offset factor and the original texture coordinates; sampling the target normal map based on each sampling coordinate to obtain a sampling result corresponding to each sampling coordinate; performing difference processing on adjacent sampling results and extracting gradient information from the difference processing result; and generating the edge filtering map based on a fusion result of the gradient information.

[0008] In an optional implementation, the plurality of preset directions include a first preset direction, a second preset direction, a third preset direction, and a fourth preset direction; the plurality of offset factors include a first offset factor corresponding to the first preset direction, a second offset factor corresponding to the second preset direction, a third offset factor corresponding to the third preset direction, and a fourth offset factor corresponding to the fourth preset direction; and determining the plurality of sampling coordinates based on a fusion result between each offset factor and the original texture coordinates includes: fusing the first offset factor with the original texture coordinates to determine a first sampling coordinate; fusing the second offset factor with the original texture coordinates to determine a second sampling coordinate; fusing the third offset factor with the original texture coordinates to determine a third sampling coordinate; and fusing the fourth offset factor with the original texture coordinates to determine a fourth sampling coordinate; wherein the plurality of sampling coordinates include the first sampling coordinate, the second sampling coordinate, the third sampling coordinate, and the fourth sampling coordinate.

[0009] In an optional implementation, the edge filtering map is enhanced based on a preset gray scale mapping range to obtain a mask map, including: mapping the gray scale value of the edge filtering map to the preset gray scale mapping range to obtain a first intermediate map; performing Gaussian blur processing on the first intermediate map to obtain a second intermediate map; and superimposing the first intermediate map and the second intermediate map to generate the mask map.

[0010] In an optional implementation, a preset texture map and a material map are fused in a texture fusion region to generate a target material map, including: adjusting the preset texture map based on a preset mixing intensity parameter to obtain a target texture map; determining a pixel difference value or a pixel sum value based on a first pixel value of the material map and a second pixel value in the target texture map; generating the target material map by taking the pixel sum value as a target pixel value; or generating the target material map by taking the pixel difference value as the target pixel value.

[0011] In an optional implementation, the target normal map corresponding to the three-dimensional model to be processed is obtained, including: obtaining an original normal map corresponding to the three-dimensional model; converting the original normal map from a tangent space to a world space based on directional attribute information of the three-dimensional model to obtain the target normal map of the three-dimensional model in the world space.

[0012] In a second aspect, the present application provides a model rendering device, comprising: an obtaining module configured to obtain a target normal map corresponding to a three-dimensional model to be processed and a material map corresponding to the three-dimensional model; an extracting module configured to perform edge feature extraction on the target normal map to generate a mask map used to define a texture fusion range; a determining module configured to determine a texture fusion region based on pixel information of the mask map; a fusion module configured to fuse a preset texture map and the material map in the texture fusion region to generate a target material map; and a rendering module configured to render the three-dimensional model based on the target material map to obtain a target three-dimensional model.

[0013] In a third aspect, the present application provides an electronic device, comprising: a memory and a processor, which are communicatively connected, and the memory stores computer instructions, and the processor executes the computer instructions to perform the model rendering method of the first aspect or any of the corresponding embodiments.

[0014] In a fourth aspect, the present application provides a computer readable storage medium, which stores computer instructions, and the computer instructions are used to make a computer execute the model rendering method of the first aspect or any of the corresponding embodiments.

[0015] In a fifth aspect, the present application provides a computer program product, which comprises computer instructions, and the computer instructions are used to make a computer execute the model rendering method of the first aspect or any of the corresponding embodiments.

[0016] The model rendering method provided by the embodiments of the present application converts the geometric structure information in the normal map into mask information for controlling texture fusion, realizes complete programming and automation of mask generation, and completely gets rid of the dependence on traditional manual drawing of masks, thereby greatly saving the time and labor cost of art resource production. Meanwhile, since the mask is derived from the geometric features of the model itself, it can accurately identify the structure edges and contours of the model surface, ensure that any type of preset texture can be naturally aligned with the model structure during fusion, realize smooth transition and rich detail performance, and significantly improve the accuracy and visual realism of the final rendering effect. In addition, the present application dynamically calculates and generates the mask in the rendering process, avoids the memory occupation and sampling overhead caused by introducing additional static mask maps, and optimizes the resource usage efficiency and runtime performance. The present application also has high flexibility and universality, and can easily realize various visual effects by replacing different preset texture maps and adjusting the fusion parameters, showing strong technical universality and scalability, while ensuring high-quality rendering output, and comprehensively improving the automation level and artistic expression of the three-dimensional model rendering process. BRIEF DESCRIPTION OF DRAWINGS

[0017] In order to more clearly illustrate the technical solutions in the specific embodiments or related art, the drawings needed to be used in the specific embodiments or related art description will be briefly introduced. Obviously, the drawings in the following description are some embodiments of the present application, and those skilled in the art can also obtain other drawings without creative labor on the basis of these drawings.

[0018] Figure 1 is a schematic diagram of an application scenario according to an embodiment of the present application; Figure 2 is a first flowchart of a model rendering method according to an embodiment of the present application; Figure 3 is a second flowchart of a model rendering method according to an embodiment of the present application; Figure 4 is a schematic diagram of an original normal map according to an embodiment of the present application; Figure 5 is a schematic diagram of a target normal map according to an embodiment of the present application; Figure 6 is a schematic diagram of an edge filtering map according to an embodiment of the present application; Figure 7 is a schematic diagram of a mask map according to an embodiment of the present application; Figure 8 is a third flowchart of a model rendering method according to an embodiment of the present application; Figure 9is a schematic diagram of a target material map according to an embodiment of the present application; Figure 10 is a schematic diagram of an original gun hard surface model according to an embodiment of the present application; Figure 11 is a schematic diagram of a gun hard surface model with a wear effect according to an embodiment of the present application; Figure 12 is a structural block diagram of a model rendering device according to an embodiment of the present application; Figure 13 is a hardware structure schematic diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0019] To make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the following will be combined with the accompanying drawings for the embodiments of the present application to make a clear and complete description of the technical solutions in the embodiments of the present application. Obviously, the described embodiments are some but not all of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative work fall within the protection scope of the present application.

[0020] It can be understood that, before using the technical solutions disclosed in the embodiments of the present application, the type of personal information involved in the present application, the use range, the use scenario, and the like should be informed to the user and the authorization of the user should be obtained through appropriate means according to relevant laws and regulations.

[0021] The terms “first”, “second”, and the like are only used for descriptive purposes and should not be construed as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined with “first”, “second” can explicitly or implicitly include one or more of the features. In the description of the present application, the meaning of “multiple” is two or more, unless otherwise specifically limited.

[0022] As an optional application scenario of the embodiments of the present application, Figure 1 An application scenario schematic diagram of a surface model rendering system is shown. As Figure 1 shown, the system can include at least one terminal device and at least one server, Figure 1 An exemplary system is shown in FIG. 1, which includes a computer 101, a mobile terminal 102, and a server 103, and the terminal devices such as the computer 101 and the mobile terminal 102 are connected to the server 103 through a network 110.

[0023] Specifically, the terminal device can be a smartphone, tablet, laptop, PDA, desktop computer, game console, smart TV, smart wearable device, in-vehicle terminal, VR (Virtual Reality) device, AR (Augmented Reality) device, etc. Server 103 can be a standalone physical server, a server cluster, a distributed system, or a cloud server providing cloud services. Network 110 can be a wired or wireless network, examples of which include, but are not limited to, the Internet, corporate intranet, local area network, wide area network, mobile communication network, and combinations thereof.

[0024] Taking game or film rendering as an example, the terminal device runs a game engine or rendering application to present extremely realistic virtual scenes and props. For example, in a virtual scene, the wear, scratches, and paint chips on the surface of a battle-hardened assault rifle or a rusty industrial part are key details that enhance the visual realism.

[0025] Currently, achieving such wear effects typically requires artists to manually draw high-precision mask maps in DCC software to define the wear areas, and then import them into the engine for blending with color, roughness, and other texture maps. This method not only heavily relies on the manual labor of artists, resulting in long production cycles, poor flexibility, and difficulty in quickly iterating on different wear styles, but also incurs additional memory overhead and sampling costs for each additional mask map. When there are many assets in a scene that require unique wear effects, the pressure on video memory and performance increases significantly.

[0026] In view of this, the technical solution of this application eliminates the need for manual mask drawing. Instead, it directly obtains the target normal map and material map of the surface model to be processed. By extracting edge features from the target normal map, a mask map is automatically generated, greatly reducing the manual labor of artists and shortening the production cycle. Addressing the issues of increased memory overhead, higher sampling costs, and performance pressure in scenarios with a large number of assets caused by additional mask maps in traditional methods, the mask map in this application is generated based on the target normal map, eliminating the need for additional mask map files and fundamentally avoiding additional memory consumption and sampling costs, effectively alleviating the performance burden. Furthermore, by using the texture blending region determined based on the mask map, this application can fuse the preset texture map and material map to generate the target material map. When iterating different texture styles, only the preset texture map needs to be replaced, without recreating the mask, thus greatly improving the flexibility of texture style iteration.

[0027] According to the embodiments of the present application, a model rendering method is provided. It should be noted that the steps shown in the flowchart can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from here.

[0028] In the embodiments, a model rendering method is provided, which can be used in electronic devices such as computer 101, mobile terminal 102, etc. Figure 2 The flowchart of the model rendering method according to the embodiments of the present application is shown in FIG. 2, which includes the following steps: Figure 2 Step S201, obtaining a target normal map corresponding to a three-dimensional model to be processed, and a material map corresponding to the three-dimensional model.

[0029] The three-dimensional model refers to a 3D object model that needs to be visually enhanced or processed, which can be a hard surface model, for example. The hard surface model is a three-dimensional model formed by mechanical processing, which has clear edges, flat surfaces and regular geometric shapes. The target normal map refers to a map that stores the direction information of the model surface after a specific spatial conversion for subsequent effect calculation. The material map refers to a map that describes the basic material characteristics of the three-dimensional model. Specifically, the target normal map and the material map come from the three-dimensional content creation process. The three-dimensional model itself carries its material information, which has been generated and stored as an independent image file in the modeling or material rendering software. The acquisition process is to load these pre-generated maps from the specified resource library or file path by the rendering system (such as game engine, renderer, etc.) in the electronic device.

[0030] Step S202, edge feature extraction is performed on the target normal map to generate a mask map for defining the texture fusion range.

[0031] The mask map refers to a grayscale image used to define different processing areas in the image. Specifically, by analyzing the difference between each pixel and its surrounding normal vector in the target normal map, the local feature change area of the model surface is identified and enhanced. For example, the local change rate or difference intensity of the normal direction in the texture space can be quantified by a pre-set quantization rule, and the areas with sharp changes (such as edges, concave, convex edges, etc.) will calculate higher values. Subsequently, a series of post-processing operations are performed on these calculated intensity values, and finally a grayscale image that clearly defines these feature areas is generated, which is the mask map needed to define the texture fusion range.

[0032] Step S203, determining the texture fusion area based on the pixel information of the mask map.

[0033] ​The pixel information refers to key data contained in each pixel of the mask map. The texture fusion region refers to an image region defined by the mask map and needing to be mixed with texture. Specifically, each pixel value in the mask map is regarded as a weight or a mixing coefficient. The pixel information defines the fusion region and the fusion strength. For example, the region with a value closer to 1 (white) indicates a complete fusion region in which the preset texture should completely cover the original attribute map, and the region with a value closer to 0 (black) indicates a non-fusion region in which the original attribute map is retained. By reading these pixel values, a basis is provided for subsequent mixing operations.

[0034] In step S204, the preset texture map is fused with the material map in the texture fusion region to generate a target material map.

[0035] The preset texture map refers to a certain visual effect texture, such as a stain or a scratch, which is made in advance and is expected to be superimposed on the surface of a model. The target material map refers to a map generated by mixing the preset texture map with the original material map of the three-dimensional model and finally used for rendering. Specifically, for each pixel position, the pixel value of the mask map at the point is read as a mixing parameter. The pixel value of the preset texture map and the pixel value of the material map are combined according to the mixing parameter using a preset mixing method. For example, if the mixing coefficient is 1, the value of the preset texture is taken, and if the mixing coefficient is 0, the value of the original attribute map is taken. Finally, a new fused image, i.e., the target material map, is output.

[0036] In step S205, the three-dimensional model is rendered based on the target material map to obtain a target three-dimensional model.

[0037] The target three-dimensional model refers to a rendered model with rich details finally presented after the three-dimensional model applies the target material map. Specifically, the generated target material map is input as a new material attribute of the model surface. During rendering, the rendering system (such as a shader program) directly samples and uses the texture information contained in the target material map to directly define the visual appearance of the model surface, so that the model surface presents new texture details, and finally a target three-dimensional model with required texture characteristics is rendered.

[0038] The model rendering method provided in this application transforms the geometric structure information in the normal map into mask information that controls texture blending, achieving complete proceduralization and automation of mask generation. This completely eliminates the reliance on traditional manual mask drawing, thus significantly saving time and manpower costs in art asset production. Simultaneously, since the mask originates from the model's own geometric features, it can accurately identify the structural edges and contours of the model surface, ensuring that any type of preset texture can naturally align with the model structure during blending, achieving smooth transitions and rich detail, significantly improving the accuracy and visual realism of the final rendering effect. Furthermore, this application dynamically calculates and generates the mask during the rendering process, avoiding the memory consumption and sampling overhead caused by introducing additional static mask textures, optimizing resource utilization efficiency and runtime performance. This application also possesses high flexibility and versatility; by replacing different preset texture maps and adjusting blending parameters, a variety of visual effects can be easily achieved, demonstrating strong technical universality and scalability. While ensuring high-quality rendering output, it comprehensively improves the automation level and artistic expression of the 3D model rendering process.

[0039] This embodiment provides a model rendering method that can be used in electronic devices, such as computer 101, mobile terminal 102, etc. Figure 3 This is a flowchart of a model rendering method according to an embodiment of this application, such as... Figure 3 As shown, the process includes the following steps: Step S301: Obtain the target normal map and the material map corresponding to the 3D model to be processed.

[0040] Specifically, the target normal map corresponding to the 3D model to be processed is obtained, including: Step a1: Obtain the original normal map corresponding to the 3D model.

[0041] The original normal map refers to a texture defined in tangent space that stores the surface normal directions of a 3D model, such as... Figure 4 As shown. Specifically, the raw normal map is generated by artists using DCC software through baking or painting during the 3D model creation stage. The raw normal map stores the normal direction information of the model's surface at each texture coordinate point, usually based on tangent space. The acquisition process involves loading the material resource file corresponding to the 3D model in the rendering pipeline or application, reading and parsing the texture asset named normal map from it.

[0042] Step a2: Based on the orientation attribute information of the 3D model, the original normal map is transformed from tangent space to world space to obtain the target normal map of the 3D model in world space.

[0043] Direction attribute information refers to directional data required for converting a normal from a model local space to a world space. A target normal map refers to normal information map obtained after converting an original normal map from a tangent space to a world space, as shown in Figure 5 Specifically, a transformation matrix can be used to reorient the original normal vector. The normal vector under the tangent space is sampled, and then rotated and transformed using this transformation matrix, so that its direction changes from a direction relative to the model itself to a direction relative to the entire scene world coordinate. The converted normal vector is remapped to the range of [0, 1] and stored as a new map, i.e., a world space normal map, which makes the normal information no longer dependent on the local orientation of the model.

[0044] The model rendering method provided by the embodiments of the present application obtains the original normal map corresponding to the three-dimensional model, and then converts the original normal map from the tangent space to the world space based on the direction attribute information of the three-dimensional model, to obtain the target normal map unified in the world coordinate system. This conversion step converts the normal information from relative data dependent on the local vertex coordinate system of each model to absolute data in a globally fixed world space, so that all subsequent operations such as edge detection, mask generation and texture fusion are based on a stable and unified reference frame, eliminating the risk of misjudgment of the normal information caused by the rotation or movement of the model in the world, improving the reliability and visual accuracy of the generated mask and fusion effect, and laying a solid and high-quality data foundation for the entire method.

[0045] In step S302, edge features of the target normal map are extracted to generate a mask map used to define a texture fusion range.

[0046] Specifically, the above step S302 includes: In step S3021, edge detection processing is performed on the target normal map to obtain an edge filtering map corresponding to the target normal map.

[0047] The edge filtering map refers to a grayscale map used to reflect the edge features of the model surface, which is generated after the edge detection processing on the target normal map, as shown in Figure 6 Specifically, the difference between adjacent pixel normal vectors in the world space normal map is analyzed to identify the abrupt area, i.e., the edge. In the texture space, a plurality of preset directions around the current pixel are sampled, and the difference or gradient between the normal values of these sampling points is calculated to quantify the normal change rate of the point. The area with a large change rate (such as the physical edge of the object, the groove or the steep bend, etc.) will calculate a higher value, while the flat area will have a lower value. Collecting the change rate values of all pixel points forms a single-channel grayscale map, i.e., the edge filtering map.

[0048] In some optional embodiments, the step S3021 comprises: Step b1, obtaining original texture coordinates corresponding to the three-dimensional model and offset factors of a plurality of preset directions.

[0049] The original texture coordinates refer to the basic UV coordinates of the three-dimensional model itself, which are used to map the texture to the surface of the model. The offset factors refer to the preset vectors used to offset the original texture coordinates. Specifically, the original texture coordinates are the properties of the three-dimensional model itself, which define the mapping relationship between the model surface and the texture image, and are usually generated through the UV unfolding process in three-dimensional software and automatically provided by the shader during rendering. The offset factors of a plurality of preset directions are a set of vectors defined in the algorithm in advance, each vector representing a specific sampling direction in the texture space (such as up, down, left, right, diagonal, etc.). The number and specific direction values of these factors are determined according to the convolution kernel of the selected edge detection algorithm (such as Sobel, Prewitt or its variants), and the purpose is to sample the surrounding points of the target normal map.

[0050] Step b2, determining a plurality of sampling coordinates based on the fusion results between each offset factor and the original texture coordinates.

[0051] The sampling coordinates refer to the new UV coordinates obtained by calculating the original texture coordinates and the offset factors, which are used to sample the normal map. Specifically, for each offset factor, multiply it by a coefficient (or step) that controls the sampling distance, and then add it to the original texture coordinates to obtain a new sampling coordinate in that direction. This calculation process generates a unique sampling point for each offset direction, and the collection of all these sampling points forms a sampling pattern around the original coordinates, which is used to detect the change of the normal direction of the region.

[0052] Step b3, sampling the target normal map based on each sampling coordinate to obtain a sampling result corresponding to each sampling coordinate.

[0053] The sampling result refers to the normal vector value obtained from the target normal map at the sampling coordinate position. Specifically, after determining all the sampling coordinates, the target normal map is sampled using these coordinates. Each sampling coordinate returns a normal vector value at that coordinate point. Finally, a set of normal vectors is obtained, each vector corresponding to the surface normal information in its respective offset direction.

[0054] Step b4, performing difference processing on adjacent sampling results and extracting gradient information from the difference processing results.

[0055] Gradient information refers to the vector calculated by comparing the normal values of adjacent sampling points, which represents the rate and direction of the normal direction change. Specifically, adjacent refers to those sampling points that are opposite or paired in a predetermined sampling pattern. The difference processing is to calculate the difference between the normal vectors corresponding to the paired sampling points. For example, it can be the normal value of one sampling point minus the normal value of another sampling point in the opposite direction. This difference vector (difference processing result) intuitively reflects the direction and rate of normal change in two opposite directions, i.e., the gradient of the direction. From all such paired difference results, gradient information in different dimensions (such as horizontal, vertical, diagonal, etc.) of the texture space can be extracted.

[0056] Step b5, generating an edge filter map based on the fusion result of the gradient information.

[0057] The gradient information extracted from each direction is combined into a single intensity value. Specifically, the modulus of all gradient vectors is calculated, i.e., the change rate of each direction is integrated to obtain a comprehensive change intensity. The area with high intensity means that the normal changes dramatically in multiple directions, corresponding to the edges or sharp features of the model; the area with low intensity means that the normal direction changes gently, corresponding to the flat area. Finally, the comprehensive intensity value of all pixel points is output as a single-channel grayscale image, which is the edge filter map. The bright area in the edge filter map clearly indicates the edges of the model.

[0058] In the above embodiment, different sampling coordinates are calculated by obtaining the original texture coordinates and combining the offset factors of multiple predetermined directions, which ensures that the edge detection can perceive the edges from multiple different directions of the model surface, avoiding the problem that single-direction detection may miss edge information. Then, the normal map is sampled based on these sampling coordinates to obtain the sampling results of each point, which is essentially to obtain the data of the normal vector in multiple predetermined directions, laying a foundation for subsequent accurate calculation. Then, the difference processing is performed on the adjacent sampling results, which is a direct and efficient method to calculate the change rate of the normal vector between adjacent pixels, so that the gradient information can be accurately extracted from these difference results, and the gradient is the key mathematical quantity representing the edge strength. By fusing all these gradient information to generate an edge filter map, the final edge information is no longer single-direction, but comprehensive and reliable geometric edge data that integrates multi-directional changes, providing accurate and stable input for generating high-quality mask maps.

[0059] In some optional embodiments, the plurality of preset directions comprises a first preset direction, a second preset direction, a third preset direction and a fourth preset direction; the plurality of offset factors comprises a first offset factor corresponding to the first preset direction, a second offset factor corresponding to the second preset direction, a third offset factor corresponding to the third preset direction and a fourth offset factor corresponding to the fourth preset direction; and the step b3 comprises: Step b31, fusing the first offset factor and the original texture coordinate to determine a first sampling coordinate.

[0060] Step b32, fusing the second offset factor and the original texture coordinate to determine a second sampling coordinate.

[0061] Step b33, fusing the third offset factor and the original texture coordinate to determine a third sampling coordinate.

[0062] Step b34, fusing the fourth offset factor and the original texture coordinate to determine a fourth sampling coordinate.

[0063] The plurality of sampling coordinates comprises the first sampling coordinate, the second sampling coordinate, the third sampling coordinate and the fourth sampling coordinate.

[0064] When fusing the offset factor and the original texture coordinate, the offset factor needs to be multiplied by a preset coefficient (for example, 0.05, which has an influence on the accuracy), then added to the original texture coordinate, and a preset offset amount (for example, 0.1) is superimposed, and the first sampling coordinate is calculated by “first offset factor x preset coefficient + original texture coordinate ± preset offset amount”.

[0065] For example, when using a reconstructed Sobel operator, the plurality of preset directions specifically refers to four directions of up, down, left and right, which correspond to the first preset direction, the second preset direction, the third preset direction and the fourth preset direction respectively, and the offset factors corresponding to the four preset directions are four factors of the reconstructed Sobel operator, i.e. the first offset factor is (0, -1), the second offset factor is (0, 1), the third offset factor is (-1, 0) and the fourth offset factor is (1, 0). These offset factors are core parameters for realizing edge detection, aiming to save the detection time of the traditional Sobel operator and ensure consistent effect.

[0066] When fusing the first offset factor (0, -1) and the original texture coordinate, the first offset factor needs to be multiplied by a preset coefficient, then added to the original texture coordinate, and a preset offset amount is superimposed, and the first sampling coordinate UV1 is calculated by “(0, -1) x preset coefficient + original texture coordinate + preset offset amount”.

[0067] The same preset coefficient multiplication processing is performed on the second offset factor (0, 1), and then added to the original texture coordinates, and then superimposed with a preset offset, to obtain the second sampling coordinate UV2 through the calculation of "(0, 1) x preset coefficient + original texture coordinates - preset offset".

[0068] The third offset factor (-1, 0) is subjected to preset coefficient multiplication processing, added to the original texture coordinates, and superimposed with a preset offset, to obtain the third sampling coordinate UV3 through the calculation of "(-1, 0) x preset coefficient + original texture coordinates + preset offset".

[0069] The fourth offset factor (1, 0) is subjected to preset coefficient multiplication processing, added to the original texture coordinates, and superimposed with a preset offset, to obtain the fourth sampling coordinate UV4 through the calculation of "(1, 0) x preset coefficient + original texture coordinates - preset offset". The specific formula is as follows: UV1 = (0, -1) x 0.05 + uv + 0.1; UV2 = (0, 1) x 0.05 + uv - 0.1; UV3 = (-1, 0) x 0.05 + uv + 0.1; UV4 = (1, 0) x 0.05 + uv - 0.1.

[0070] After obtaining the first sampling coordinate UV1, the second sampling coordinate UV2, the third sampling coordinate UV3, and the fourth sampling coordinate UV4, the four sampling coordinates are used to sample the target normal map, and the specific implementation is realized through the Sampler2D sampling function: the first sampling coordinate is input as a sampling parameter into the Sampler2D function to sample the target normal map to obtain the first sampling result G1; similarly, the second sampling coordinate is input into the Sampler2D function to obtain the second sampling result G2, the third sampling coordinate is input to obtain the third sampling result G3, and the fourth sampling coordinate is input to obtain the fourth sampling result G4. The core of this step is to extract the normal data of the positions corresponding to the four sampling coordinates from the target normal map to provide original data for subsequent edge feature calculation. The specific formula is as follows: G1 = Sampler2D(NormalMap, UV1); G2 = Sampler2D(NormalMap, UV2); G3 = Sampler2D(NormalMap, UV3); G4 = Sampler2D(NormalMap, UV4).

[0071] After sampling, adjacent sampling results need to be differentially processed to capture normal changes (i.e., edge features). Specifically, the second sampling result G2 is subtracted from the first sampling result G1 to obtain the difference result S1; the fourth sampling result G4 is subtracted from the third sampling result G3 to obtain the difference result S2. Then, further calculations are performed based on these two difference results, extracting the x-component (S1.x) of S1 and the y-component (S2.y) of S2. These two components are added together, and the sum is first multiplied by a preset coefficient (e.g., 0.5) for scaling, and then a preset offset value (e.g., 0.5) is added for numerical offset, finally obtaining the calculated result S. This result S is the pixel data in single-channel grayscale form. Multiple such S values ​​together constitute the edge filtering map corresponding to the target normal map. The specific formula is shown below: S1 = G2 - G1; S2 = G4 - G3; S = (S1.x + S2.y) × 0.5 + 0.5.

[0072] Step S3022: Enhance the edge filter map based on the preset grayscale mapping range to obtain the mask map.

[0073] The preset grayscale mapping range refers to the range of output grayscale values ​​that are pre-set to enhance contrast. Specifically, by using a preset remapping function, the original grayscale values ​​of the edge filter map are compressed or expanded from the original range to a preset, narrower high-contrast range. This can significantly increase the difference in brightness between the edge and non-edge areas, thereby obtaining a mask map with clear edge definition.

[0074] In some optional implementations, step S3022 above includes: Step c1: Map the grayscale values ​​of the edge filter map to a preset grayscale mapping range to obtain the first intermediate image.

[0075] The first intermediate image refers to an image with enhanced contrast obtained by mapping the gray values of the edge-filtered map to a preset range. Specifically, by using a preset remapping function, the originally widely distributed gray value range in the edge-filtered map is compressed or expanded to a certain preset target range that is narrower and has higher contrast, for example, [0.5, 1.0]. A mapping function is selected, which will convert the original gray value of each pixel in the input image according to the preset input minimum value (InputMin), input maximum value (InputMax), output minimum value (OutputMin), and output maximum value (OutputMax). Among them, the input value is first clamped (Clamp) to the [InputMin, InputMax] interval, then linearly normalized to [0, 1], then a power function (Gamma) is applied to adjust the distribution of intermediate tones, and finally linearly mapped to the final [OutputMin, OutputMax] range. After this operation, the originally not obvious gray difference area is "stretched", so that the contrast between the edge feature area (high value area) and the non-feature area (low value area) is more distinct, thereby generating a high-contrast intermediate image, i.e., the first intermediate image.

[0076] For example, when the preset gray mapping range [0.5, 1.0] is set, the specific formula is as follows: output = pow((clamp(input, inputMin, inputMax) - inputMin) / (inputMax - inputMin), 1.0 / gamma) 13 (outputMax - outputMin) + outputMin; wherein InputMin = 0.5, InputMax = 1.0, and the range of 0.5-1 can maximize the contrast between black and white.

[0077] Step c2, performing Gaussian blur processing on the first intermediate image to obtain a second intermediate image.

[0078] The second intermediate image refers to an image with softened edges obtained by performing Gaussian blur on the first intermediate image. Specifically, Gaussian blur is a linear smoothing filter whose principle is to perform convolution operation on the input image (i.e., the first intermediate image) using a convolution kernel generated according to a two-dimensional Gaussian function. The weights of the convolution kernel are normally distributed with a high center and a low periphery. When processing each pixel, the gray values of the pixel itself and its surrounding pixels are weighted and averaged according to the corresponding weights of the convolution kernel, and the result is taken as the new value of the pixel in the output image (i.e., the second intermediate image). This process effectively reduces the noise and details in the image, smooths the sharp edges, and produces a natural feathering effect in the highlight area, preparing for the subsequent superimposition and blending.

[0079] Step c3, superimposing the first intermediate image and the second intermediate image to generate a mask map.

[0080] The first intermediate image retains clear and high-contrast edge boundaries, while the second intermediate image provides smooth and soft transition areas. The superimposition operation can use linear interpolation or similar blending modes. Specifically, the second intermediate image (the softened image after blur) is taken as the base, and the first intermediate image (the clear high-contrast image) is taken as the upper influencing source. The values of each corresponding pixel of the two images are blended according to a predetermined rule, for example, using a fixed blending coefficient, or using the brightness of the upper layer as the Alpha value, etc. This blending makes the finally generated mask map both retain the intensity and clarity of the first intermediate image in the core edge area and blend the smooth transition of the second intermediate image in the edge periphery, thereby forming a high-quality mask with clear boundaries and natural gradation, as shown in Figure 7 .

[0081] In the above embodiments, by mapping the gray values of the edge filter map to a predetermined specific range, this operation can accurately stretch and optimize the contrast distribution of the image, thereby obtaining a first intermediate image with clear black and white and highlighted key points, which sets the tone for the enhancement effect. Then, performing Gaussian blur on the first intermediate image can effectively smooth the noise or harsh transitions that may occur in the previous step, generating a soft second intermediate image, which avoids the occurrence of jagged or unnatural hard edges in the final mask. Superimposing the clear and sharp first intermediate image and the soft transition second intermediate image, this fusion process skillfully combines the advantages of the previous two, so that the generated mask map retains clear edge details and has smooth gray transitions, thereby becoming an excellent mask that can accurately guide texture fusion.

[0082] Step S303, determining a texture fusion region based on the pixel information of the mask map. For details, please refer to step S203 of the embodiment shown in Figure 2 , which will not be described here again.

[0083] Step S304, the preset texture map is fused with the material map in the texture fusion area to generate a target material map. For details, please refer to Figure 2 Step S204 of the embodiment shown will not be repeated here.

[0084] Step S305, rendering the three-dimensional model based on the target material map to obtain a target three-dimensional model. For details, please refer to Figure 2 Step S205 of the embodiment shown will not be repeated here.

[0085] The model rendering method provided in the embodiments of the present application can accurately extract pixel information corresponding to the normal vector mutation area by performing edge detection processing on the target normal map, thereby generating an edge filtering map specially marking all geometric edges and contours of the model surface. This step lays the objectivity and accuracy of the entire mask generation process and ensures that the subsequent fusion area is based on the real geometric structure of the model rather than artificial speculation. Then, the edge filtering map is enhanced based on the preset gray scale mapping range. By adjusting the range of gray scale mapping, the strength and contrast of the edge signal can be systematically controlled, so that it can be flexibly determined which edges need to be highlighted, which need to be weakened or ignored in the final mask. This makes the generated mask map not only faithfully reflect the geometric information, but also accurately adjust according to the final required artistic effect or technical requirement, finally obtaining a high-quality and high-availability mask, which provides a solid and superior data basis for subsequent accurate texture fusion.

[0086] In the embodiments, a model rendering method is provided, which can be used in electronic devices such as computers 101, mobile terminals 102, etc. Figure 8 is a flowchart of the model rendering method according to the embodiments of the present application, as shown in Figure 8 The flowchart includes the following steps: Step S801, obtaining a target normal map corresponding to a three-dimensional model to be processed, and a material map corresponding to the three-dimensional model. For details, please refer to Figure 3 Step S301 of the embodiment shown will not be repeated here.

[0087] Step S802, performing edge feature extraction on the target normal map to generate a mask map for defining a texture fusion range. For details, please refer to Figure 3 Step S302 of the embodiment shown will not be repeated here.

[0088] Step S803, determining a texture fusion area based on the pixel information of the mask map. For details, please refer to Figure 3 Step S303 of the embodiment shown will not be repeated here.

[0089] Step S804, fusing the preset texture map and the material map in the texture fusion region to generate a target material map.

[0090] Specifically, the step S804 includes: Step S8041, adjusting the preset texture map based on a preset blending strength parameter to obtain a target texture map.

[0091] The preset blending strength parameter refers to a scalar value that can be adjusted by a user to control the display strength of the preset texture map in the blending process, which can be a scalar value between 0 and 1, or a mask map that controls the strength, without specific limitation. The target texture map refers to a new texture obtained by fusing each pixel value of the preset texture map with the corresponding preset blending strength parameter. Specifically, the preset blending strength parameter serves as a blending weight. The fusion process is performed pixel by pixel, and the color value (or the value of each channel) of each pixel in the preset texture map is multiplied by the corresponding preset blending strength parameter.

[0092] If the preset blending strength parameter is a single scalar, the scalar is multiplied by each pixel of the entire texture, and the preset blending strength parameter Opacity can be 0.4, for example. If it is a mask map, the multiplication is performed pixel by pixel. Finally, a new map, i.e., the target texture map, is generated, in which the brightness (or influence) of the original preset texture has been proportionally attenuated by the blending strength parameter.

[0093] Step S8042, determining a pixel difference value or a pixel sum value based on a first pixel value of the material map and a second pixel value in the target texture map.

[0094] The first pixel value refers to the pixel data at a certain position on the material map of the three-dimensional model. The second pixel value refers to the pixel data at the corresponding position of the first pixel value on the target texture map. Specifically, for each corresponding pixel position of the texture, a color value (i.e., the first pixel value) is sampled from the original material map, and another color value (i.e., the second pixel value) is sampled from the target texture map generated above. Subsequently, according to the visual effect to be achieved, an arithmetic operation is performed on the two values channel by channel. If a darkening or erosion effect (such as simulating color loss at a worn-out place) is to be achieved, the pixel difference is calculated. If a brightening or deposition effect (such as simulating stain accumulation) is to be achieved, the pixel sum is calculated. This calculation is performed independently on each channel of RGB.

[0095] Step S8043, generating a target material map with the pixel sum value as the target pixel value, or generating a target material map with the pixel difference value as the target pixel value.

[0096] The target pixel value refers to the final pixel data used to generate the target material map. Specifically, after the pixel-by-pixel calculation is completed, the calculation result (pixel difference or pixel sum) is directly taken as the new color value at the pixel position on the final output map according to the selected blending mode, i.e., the target pixel value. In order to prevent the calculation result from exceeding the effective range of color values (such as [0, 1]), a clamp function can be used to limit the target pixel value within this range. Finally, by performing the above operation for each pixel on the texture, a brand new and complete target material map is generated, as shown in Figure 9 The map can be obtained by subtractive blending, showing the effect of partially removing the original properties, or by additive blending, showing the effect of adding additional details, thereby achieving the purpose of programmatically fusing preset texture effects onto the original material.

[0097] When determining the pixel sum, the additive blending formula is: result = clamp (first pixel value + second pixel value, 0, 1).

[0098] When determining the pixel difference, the subtractive blending formula is: result = clamp (first pixel value - second pixel value, 0, 1).

[0099] Step S805, rendering the three-dimensional model based on the target material map to obtain a target three-dimensional model. For details, please refer to the step S305 of the embodiment shown in the figure, which will not be repeated here.

[0100] The model rendering method provided by the embodiment of the application fuses the preset blending strength parameter with the preset texture map to generate a target texture map, so that the subsequent blending strength can be dynamically and finely adjusted, rather than simply superimposed or subtracted. Then, based on the first pixel value of the material map and the second pixel value in the target texture map, mathematical calculation of the pixel difference or the pixel sum is performed, which provides two completely different blending modes to adapt to different artistic effect requirements. The pixel sum or pixel difference calculated is taken as the target pixel value to generate the final target material map. This fusion method based on pixel-level mathematical operation not only has high calculation efficiency and low resource consumption, but also ensures the natural transition and visual accuracy of the blending result, thereby achieving precise and diversified programmable control of the appearance of the three-dimensional model without increasing additional texture resources.

[0101] In the following embodiment, the programmable wear effect of a certain firearm hard surface model will be used to illustrate the above model rendering method.

[0102] As shown in Figure 10 ​Figure 10 As a schematic diagram of a gun hard surface model to be processed, the corresponding basic resources of the gun hard surface model to be processed are obtained, including an original normal map (tangent space) and a material map. The material map includes a base color map, a metal degree map, a roughness map, etc. The base color map is used to define the gun body metal color and the component color block. The metal degree map is used to distinguish the metalization degree of the gun metal components and plastic components. The roughness map is used to control the texture of the smooth area and the frosted area of the gun surface. This process starts with obtaining the original normal map of the model in the tangent space, and then converts it to the world space based on the transformation matrix of the model (i.e. the orientation attribute information), to obtain a world space normal map, which is the target normal map, which eliminates the influence of the model orientation on the subsequent calculation.

[0103] Next, using the reconstructed Sobel operator, the edge feature extraction is performed on the target normal map to generate a mask map. First, the edge detection process is performed to obtain the original texture coordinates (UV) of the model and the offset factors of four preset directions (up, down, left, right), such as (0, -1), (0, 1), (-1, 0), (1, 0). Multiply each offset factor by a small coefficient (such as 0.05) and then fuse (add) it with the original UV coordinates, and apply a small fixed offset (such as ±0.1), to determine the four sampling coordinates. Using these coordinates, the target normal map is sampled to obtain four sampling results (normal vectors).

[0104] Then, the difference (subtraction) processing is performed on the adjacent sampling results (such as a pair of up and down, and another pair of left and right), and the gradient information is extracted (taking the X or Y component) from the difference result. Add the extracted gradient information and remap it to the range [0, 1] to generate an edge filter map representing the edge intensity. Thereafter, the contrast of the edge filter map is maximized and stretched based on the preset gray scale mapping range [0.5, 1.0] to obtain a first intermediate map with high contrast. The first intermediate map is subjected to Gaussian blur processing to soften the edges and expand the area, to obtain a smooth second intermediate map. Finally, the first intermediate map and the second intermediate map are linearly superimposed to generate a final mask map with clear edges and soft transitions. The pixel information (gray value) of this mask map accurately determines the area and intensity of the subsequent texture fusion.

[0105] Then, the map fusion is performed. In this example, the preset texture map is a texture showing wear marks, such as scratches and paint loss. An adjustable preset blending intensity parameter (for example, 0.4) is fused (multiplied) with the wear texture to obtain a target texture map with the intensity attenuated. Then, taking the base color map as an example, based on the color value (first pixel value) of the original base color map at a certain pixel point and the color value (second pixel value) of the target texture map at the corresponding point, a subtraction operation is performed to determine the pixel difference between the two, simulating the effect of color wear and loss. With the calculated pixel difference as the target pixel value, a new target base color map with wear effect is generated pixel by pixel. Similarly, this fusion process (addition or subtraction can be selected according to artistic requirements) also acts on the metal degree map and the roughness map in parallel, thereby generating a new set of target material maps containing programmatic wear information.

[0106] Finally, based on the texture information of the target material map, the hard surface model of the gun is rendered in the rendering engine. The shader samples these new maps containing programmatic wear details, and finally obtains a target three-dimensional model that visually presents natural wear marks and has a high degree of realism, such as Figure 11 without the need for artists to pre-draw masks, saving texture memory and sampling overhead.

[0107] The model rendering method provided in the embodiments of the present application makes full use of the original normal map and various attribute maps in the model's own basic resources, converts the tangent space normal map into a world space normal map according to a world space conversion step, ensures that all subsequent calculations are not affected by changes in the orientation and position of the model, and lays a solid foundation for the stability of the algorithm and the consistency of the results. Then, a simplified Soble operator is reconstructed, only four basic direction offset factors are needed, and through a series of accurate coordinate fusion, sampling, difference and gradient information extraction operations, a filtering map accurately representing the geometric edge is efficiently generated. Subsequently, the edge contrast is maximized by stretching through a preset gray range mapping, and then a high-quality mask map with sharp edge details and soft transition regions is finally generated through Gaussian blur and linear superposition processing. The mask can accurately identify the structure region where wear is prone to occur, and the gray value of the mask naturally defines the intensity of wear, providing an extremely accurate and hierarchical control basis for subsequent fusion. In the map fusion stage, a preset mixing strength parameter and a preset wear texture are fused, so that the artist can dynamically control the intensity of the wear effect. Then, based on the generated mask, the base color map, the metal degree map and the roughness map are selectively fused at the pixel level. This process does not require any additional texture sampling, and a new target material map containing rich programmed wear details is generated directly in the memory. Therefore, the present application discards the dependence on hand-drawn masks, not only provides a large dynamic adjustment space for artistic creation, realizes real-time effect iteration of what you see is what you get, but also significantly saves texture memory occupation and sampling overhead. Finally, a high-quality gun model with high realism, natural wear details and dynamic adjustment is output in the rendering engine, which improves the visual performance and greatly optimizes the production process and running performance.

[0108] A model rendering apparatus is also provided in the embodiments. The apparatus is configured to implement the embodiments and preferred embodiments described above. The term "module" as used below can be a combination of software and / or hardware that implements a predetermined function. Although the apparatus described in the embodiments below is preferably implemented in software, implementation in hardware or a combination of software and hardware is also possible and contemplated.

[0109] The embodiments provide a model rendering apparatus, as shown in Figure 12 The apparatus includes: The obtaining module 1201 is configured to obtain a target normal map corresponding to a three-dimensional model to be processed and a material map corresponding to the three-dimensional model. The extraction module 1202 is configured to perform edge feature extraction on the target normal map to generate a mask map used to define a texture fusion range. The determining module 1203 is configured to determine a texture fusion region based on pixel information of the mask map. The fusing module 1204 is configured to fuse the preset texture map and the material map in the texture fusion region to generate a target material map. The rendering module 1205 is configured to render the three-dimensional model based on the target material map to obtain a target three-dimensional model.

[0110] In some optional embodiments, the extracting module 1202 includes: The detecting sub-module is configured to perform edge detection processing on the target normal map to obtain an edge filtering map corresponding to the target normal map. The enhancing sub-module is configured to perform enhancement processing on the edge filtering map based on a preset grayscale mapping range to obtain the mask map.

[0111] In some optional embodiments, the detecting sub-module includes: The obtaining unit is configured to obtain original texture coordinates corresponding to the three-dimensional model and offset factors of a plurality of preset directions. The determining unit is configured to determine a plurality of sampling coordinates based on fusion results between each offset factor and the original texture coordinates. The sampling unit is configured to sample the target normal map based on each sampling coordinate to obtain a sampling result corresponding to each sampling coordinate. The difference unit is configured to perform difference processing on adjacent sampling results and extract gradient information from the difference processing result. The generating unit is configured to generate the edge filtering map based on a fusion result of the gradient information.

[0112] In some optional embodiments, the plurality of preset directions include a first preset direction, a second preset direction, a third preset direction, and a fourth preset direction; the plurality of offset factors include a first offset factor corresponding to the first preset direction, a second offset factor corresponding to the second preset direction, a third offset factor corresponding to the third preset direction, and a fourth offset factor corresponding to the fourth preset direction; and the determining unit includes: The first determining sub-unit is configured to fuse the first offset factor and the original texture coordinates to determine a first sampling coordinate. The second determining sub-unit is configured to fuse the second offset factor and the original texture coordinates to determine a second sampling coordinate. The third determining sub-unit is configured to fuse the third offset factor and the original texture coordinates to determine a third sampling coordinate. The fourth determining sub-unit is configured to fuse the fourth offset factor and the original texture coordinates to determine a fourth sampling coordinate. The plurality of sampling coordinates include a first sampling coordinate, a second sampling coordinate, a third sampling coordinate, and a fourth sampling coordinate.

[0113] In some optional embodiments, the enhancer module includes: The mapping unit is configured to map the grayscale values of the edge filtering map to a preset grayscale mapping range to obtain a first intermediate map. The blur processing unit is configured to perform Gaussian blur processing on the first intermediate map to obtain a second intermediate map. The superimposition unit is configured to superimpose the first intermediate map and the second intermediate map to generate a mask map.

[0114] In some optional embodiments, the fusion module 1204 includes: The adjustment sub-module is configured to adjust the preset texture map based on a preset blending strength parameter to obtain a target texture map. The determination sub-module is configured to determine a pixel difference value or a pixel sum value based on a first pixel value of the material map and a second pixel value in the target texture map. The generation sub-module is configured to generate a target material map by taking the pixel sum value as a target pixel value, or generate a target material map by taking the pixel difference value as a target pixel value.

[0115] In some optional embodiments, the acquisition module 1201 includes: The acquisition sub-module is configured to acquire an original normal map corresponding to the three-dimensional model. The conversion sub-module is configured to convert the original normal map from a tangent space to a world space based on directional attribute information of the three-dimensional model to obtain a target normal map of the three-dimensional model in the world space.

[0116] The model rendering apparatus provided in the embodiments of the present application can execute the model rendering method provided in any of the embodiments of the present application, and has the corresponding function modules and beneficial effects of the execution method. The further function description of each of the above modules and units is the same as that of the corresponding embodiments, and will not be repeated here.

[0117] Figure 13 A structural schematic diagram of an electronic device provided in the embodiments of the present application.

[0118] The following will be specifically described with reference to Figure 13Fig. 13 shows a structural schematic diagram of an electronic device suitable for implementing the electronic device in the embodiments of the present application. The electronic device can include a processor (e.g., a central processing unit, a graphics processing unit, etc.) 1301, which can perform various appropriate actions and processes according to programs stored in a read-only memory (ROM) 1302 or loaded from a memory 1308 into a random access memory (RAM) 1303. In the RAM 1303, various programs and data required for operation of the electronic device are also stored. The processor 1301, the ROM 1302, and the RAM 1303 are connected to each other through a bus 1304. An input / output (I / O) interface 1305 is also connected to the bus 1304.

[0119] Generally, the following devices can be connected to the I / O interface 1305: an input device 1306 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 1307 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage 1308 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1309. The communication device 1309 can allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although Figure 13 The electronic device is shown with various devices, but it should be understood that all of the shown devices are not required, and more or less devices can alternatively be implemented.

[0120] In particular, according to the embodiments of the present application, the processes described above with reference to the flowcharts can be implemented as a computer software program. For example, the embodiments of the present application include a computer program product including a computer program carried on a non-transitory computer readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network through the communication device 1309, or installed from the memory 1308, or installed from the ROM 1302. When the computer program is executed by the processor 1301, the above-mentioned functions defined in the model rendering method of the embodiments of the present application are performed.

[0121] Figure 13 The electronic device shown is merely an example and should not impose any limitation on the functions and scope of use of the embodiments of the present application.

[0122] The embodiments of the present application further provide a computer readable storage medium, and the method according to the embodiments of the present application can be implemented in hardware, firmware, or recorded in a storage medium, or be implemented as computer code originally stored in a remote storage medium or a non-transitory machine readable storage medium and downloaded through a network and stored in a local storage medium, so that the method described herein can be processed by such software on a storage medium using a general purpose computer, a special purpose processor, or programmable or special hardware. The storage medium can be a magnetic disk, an optical disk, a read-only memory, a random access memory, a flash memory, a hard disk, or a solid state disk, etc. Further, the storage medium can also include a combination of the above-mentioned types of memories. It can be understood that the computer, the processor, the microprocessor controller, or the programmable hardware includes a storage component that can store or receive software or computer code, when the software or computer code is accessed and executed by the computer, the processor, or the hardware, the model rendering method shown in the above embodiments is implemented.

[0123] Part of the present application can be applied as a computer program product, for example, computer program instructions, when executed by a computer, through the operation of the computer, the method and / or technical solutions according to the present application can be called or provided. Those skilled in the art should understand that the form of computer program instructions in a computer readable medium includes but is not limited to source files, executable files, installation package files, etc. Correspondingly, the way of executing computer program instructions by computer includes but is not limited to: the computer directly executes the instructions, or the computer compiles the instructions and then executes the corresponding compiled program, or the computer reads and executes the instructions, or the computer reads and installs the instructions and then executes the corresponding installed program. Here, the computer readable medium can be any available computer readable storage medium or communication medium accessible to the computer.

[0124] Although the embodiments of the present application are described in conjunction with the accompanying drawings, various modifications and changes can be made by those skilled in the art without departing from the spirit and scope of the present application, and such modifications and changes fall within the scope defined by the appended claims.

Claims

1. A model rendering method, characterized in that, The method includes: Obtain the target normal map corresponding to the 3D model to be processed, and the material map corresponding to the 3D model; Edge features are extracted from the target normal map to generate a mask map used to define the texture fusion range; Based on the pixel information of the mask map, the texture fusion region is determined; The preset texture map and the material map are blended in the texture blending area to generate the target material map; The 3D model is rendered based on the target material texture to obtain the target 3D model.

2. The method according to claim 1, characterized in that, The step of extracting edge features from the target normal map to generate a mask map for defining the texture fusion range includes: Edge detection processing is performed on the target normal map to obtain the edge filtering map corresponding to the target normal map; The edge filter map is enhanced based on a preset grayscale mapping range to obtain the mask map.

3. The method according to claim 2, characterized in that, The step of performing edge detection processing on the target normal map to obtain the edge-filtered map corresponding to the target normal map includes: Obtain the original texture coordinates and offset factors of multiple preset directions corresponding to the three-dimensional model; Based on the fusion result between each of the offset factors and the original texture coordinates, multiple sampling coordinates are determined; The target normal map is sampled based on each of the sampling coordinates to obtain the sampling results corresponding to each of the sampling coordinates; The adjacent sampling results are differentially processed, and gradient information is extracted from the differential processing results; The edge filtering map is generated based on the fusion result of the gradient information.

4. The method according to claim 3, characterized in that, The plurality of preset directions include a first preset direction, a second preset direction, a third preset direction, and a fourth preset direction; the plurality of offset factors include a first offset factor corresponding to the first preset direction, a second offset factor corresponding to the second preset direction, a third offset factor corresponding to the third preset direction, and a fourth offset factor corresponding to the fourth preset direction; The determination of multiple sampling coordinates based on the fusion result between each of the offset factors and the original texture coordinates includes: The first offset factor is fused with the original texture coordinates to determine the first sampling coordinates; The second offset factor is fused with the original texture coordinates to determine the second sampling coordinates; The third offset factor is fused with the original texture coordinates to determine the third sampling coordinates; The fourth offset factor is fused with the original texture coordinates to determine the fourth sampling coordinates; The plurality of sampling coordinates includes the first sampling coordinate, the second sampling coordinate, the third sampling coordinate, and the fourth sampling coordinate.

5. The method according to claim 2, characterized in that, The enhancement process based on a preset grayscale mapping range to obtain the mask texture includes: The grayscale values ​​of the edge filter map are mapped to the preset grayscale mapping range to obtain the first intermediate image; The first intermediate image is subjected to Gaussian blurring to obtain the second intermediate image; The first intermediate image and the second intermediate image are overlaid to generate the mask texture.

6. The method according to claim 1, characterized in that, The step of fusing the preset texture map and the material map in the texture blending area to generate the target material map includes: The preset texture map is adjusted based on the preset blending intensity parameters to obtain the target texture map; Based on the first pixel value of the material map and the second pixel value of the target texture map, determine the pixel difference or pixel sum value; The target material map is generated using the sum of the pixels as the target pixel value; or the target material map is generated using the pixel difference as the target pixel value.

7. The method according to any one of claims 1 to 6, characterized in that, The process of obtaining the target normal map corresponding to the 3D model to be processed includes: Obtain the original normal map corresponding to the 3D model; Based on the directional attribute information of the 3D model, the original normal map is transformed from tangent space to world space to obtain the target normal map of the 3D model in world space.

8. A model rendering apparatus, characterized in that, The device includes: The acquisition module is used to acquire the target normal map corresponding to the 3D model to be processed, and the material map corresponding to the 3D model; The extraction module is used to extract edge features from the target normal map and generate a mask map to define the texture fusion range. The determination module is used to determine the texture fusion region based on the pixel information of the mask map; The fusion module is used to fuse the preset texture map and the material map in the texture fusion area to generate the target material map; The rendering module is used to render the 3D model based on the target material texture to obtain the target 3D model.

9. An electronic device, characterized in that, include: A memory and a processor are communicatively connected, the memory stores computer instructions, and the processor executes the model rendering method of any one of claims 1 to 7 by executing the computer instructions.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing a computer to execute the model rendering method according to any one of claims 1 to 7.

11. A computer program product, characterized in that, Includes computer instructions for causing a computer to perform the model rendering method according to any one of claims 1 to 7.