Model rendering method, model rendering device, electronic equipment and storage medium

By adjusting the Sobel matrix factor to generate the target Sobel matrix, filtering the normal map and merging it with the base color map, the problem of loss of texture detail information after compression is solved, thus improving rendering quality and detail performance.

CN121120893APending Publication Date: 2025-12-12NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202511202897.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-26
Publication Date
2025-12-12

AI Technical Summary

Technical Problem

In physically based rendering of 3D models, compressed textures lead to a loss of detail information, affecting rendering quality and detail representation.

Method used

The target Sobel matrix is ​​generated by adjusting the factors of the Sobel matrix, the normal map is filtered, and the values ​​are combined with the primary color map to generate a blended map for rendering.

Benefits of technology

More detailed information can be retained after compression, improving the rendering quality and detail of the rendered model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121120893A_ABST
    Figure CN121120893A_ABST
Patent Text Reader

Abstract

The invention discloses a model rendering method, a model rendering device, electronic equipment and a storage medium, and is applied to the technical field of computer graphics. The model rendering method comprises the steps of adjusting each factor of a preset Sobel matrix based on information of a first normal map to obtain a factor deviation value, and generating a target Sobel matrix based on the factor deviation value; based on the target Sobel matrix, filtering the first normal map to generate a second normal map; performing value fusion on the second normal map and the primary color map to obtain a fused map; and performing rendering based on the fused map to generate a rendering model. In this way, the compressed fusion map can reserve more detail information, and then the rendering effect and detail performance of the to-be-rendered model are improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the technical field of computer graphics, and particularly relates to a model rendering method, a model rendering device, an electronic device and a computer readable storage medium. BACKGROUND

[0002] In the process of physically based rendering (PBR) of a 3D model, a large number of models, maps and the like are usually contained in an overall resource package (such as a game package), and the original volume is usually large. In order to reduce storage occupation and increase transmission rate, the resource package is usually compressed. However, the compression operation will cause the precision of the map to be lost.

[0003] When the decompressed map is used to render the model, the details originally contained in the map, such as subtle undulations of surface texture, delicate levels of material transition or subtle changes of light and shadow interaction, are easy to be lost to different degrees, resulting in a decrease in the rendering quality of the model and a lack of detailed performance. SUMMARY

[0004] The present application aims to at least solve one of the technical problems existing in the prior art. To this end, the present application provides a model rendering method, a model rendering device, an electronic device and a computer readable storage medium, so that the fused map after compression can retain more detailed information, thereby improving the rendering effect and detailed performance of the model to be rendered.

[0005] In a first aspect, the present application provides a model rendering method, comprising:

[0006] adjusting each factor of a preset Soble matrix based on the information of a first normal map to obtain a factor offset value, and generating a target Soble matrix based on the factor offset value;

[0007] filtering the first normal map based on the target Soble matrix to generate a second normal map;

[0008] performing value fusion on the second normal map and a base color map to obtain a fused map;

[0009] rendering based on the fused map to generate a rendered model.

[0010] In a second aspect, the present application provides a model rendering device, comprising:

[0011] The generating module is configured to adjust each factor of a preset Soble matrix based on the information of a first normal map to obtain a factor offset value, and generate a target Soble matrix based on the factor offset value;

[0012] a filtering module configured to filter the first normal map based on the target Sobel matrix to generate a second normal map;

[0013] a fusing module configured to fuse the second normal map and a base color map to obtain a fused map;

[0014] a rendering module configured to perform rendering based on the fused map to generate a rendered model.

[0015] In a third aspect, an electronic device is provided, including a memory and a processor;

[0016] The memory is configured to store one or more computer instructions;

[0017] The processor is configured to execute the one or more computer instructions to implement the model rendering method.

[0018] In a fourth aspect, a computer readable storage medium is provided, and one or more computer instructions are stored on the computer readable storage medium, and the computer instructions are executed by a processor to implement the model rendering method.

[0019] The model rendering method, the model rendering device, the electronic device and the computer readable storage medium provided by the embodiments of the present application can adjust each factor of a preset Sobel matrix through the information of the first normal map, and generate a target Sobel matrix according to the adjusted factor offset value; the first normal map can be filtered through the target Sobel matrix, and the detailed information in the first normal map can be extracted; the second normal map obtained after filtering and the base color map are fused in value to obtain a fused map, and many detailed information can be retained after compression and decompression again, and the rendered model is rendered according to the fused map, so that the rendering quality and the detailed performance can be improved.

[0020] Additional aspects and advantages of the embodiments of the present application will be in part apparent and in part pointed out hereinafter. BRIEF DESCRIPTION OF DRAWINGS

[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor on the basis of these drawings. Among them:

[0022] Figure 1 is an application scenario diagram of the model rendering method provided by the embodiments of the present application;

[0023] Figure 2 This is a first flowchart illustrating the model rendering method provided in this application embodiment;

[0024] Figure 3 This is a schematic diagram of the first normal map provided in an embodiment of this application;

[0025] Figure 4 This is a schematic diagram of the second process of the model rendering method provided in the embodiments of this application;

[0026] Figure 5 This is a schematic diagram of the third process of the model rendering method provided in the embodiments of this application;

[0027] Figure 6 This is a schematic diagram of the second normal map provided in an embodiment of this application;

[0028] Figure 7 This is a schematic diagram of the fusion texture provided in an embodiment of this application;

[0029] Figure 8 This is a schematic diagram of the third process of the model rendering method provided in the embodiments of this application;

[0030] Figure 9 This is a schematic diagram of the ambient light occlusion texture provided in the embodiments of this application;

[0031] Figure 10 This is a schematic diagram illustrating the rendering effect of the model rendering method provided in the embodiments of this application;

[0032] Figure 11 This is a schematic diagram of a standardized texture template provided in an embodiment of this application;

[0033] Figure 12 This is a schematic diagram of the module of the model rendering apparatus provided in the embodiments of this application;

[0034] Figure 13 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application; and

[0035] Figure 14 This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0036] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0037] It should be noted that the terms "first," "second," "third," etc., in the claims, specification, and drawings of this application are used to distinguish similar objects and are not used to describe a specific order or sequence. Such data are interchangeable where appropriate so that the embodiments of this application described herein can be implemented in a sequence other than that shown or described herein. Furthermore, the terms "comprising," "having," and their variations are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to these processes, methods, products, or apparatuses.

[0038] It should be understood that in the embodiments of this application, "at least one" means one or more, and "more than one" means two or more. "And / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship. "Contains A, B and / or C" means containing any one, two, or three of A, B, and C.

[0039] It should be understood that in the embodiments of this application, "B corresponding to A", "B corresponding to A", "A corresponds to B" or "B corresponds to A" means that B is associated with A, and B can be determined based on A. Determining B based on A does not mean that B is determined solely based on A; B can also be determined based on A and / or other information.

[0040] In view of the problems existing in the background art, the present application provides a model rendering method, a model rendering device, an electronic device, and a computer-readable storage medium.

[0041] The model rendering method provided in this application embodiment can be executed by an electronic device, such as a terminal device or a server. The terminal device can be a smartphone, tablet computer, laptop computer, or similar device.

[0042] A server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.

[0043] In one optional embodiment, when the model rendering method runs on a terminal device, the terminal device may include a display screen and a processor. The display screen is used to present a graphical user interface (GUI), which at least partially displays the model rendering interface. The display screen is also used to receive instructions generated by the user interacting with the model rendering interface. The processor is used to store a model rendering application, run the application, generate the model rendering interface, respond to instructions, and control the display of the model rendering interface on the display screen. When the user operates the model rendering interface through the display screen, the model rendering interface can control the local content of the terminal device in response to the received operation instructions.

[0044] There are several ways in which a terminal device can provide a graphical user interface to a user. For example, it can be rendered and displayed on the terminal device's screen, or the graphical user interface can be presented through holographic projection.

[0045] In some alternative embodiments, when the model rendering method runs on a server, it can be implemented and executed based on a cloud rendering system. A cloud rendering system refers to a model rendering method based on cloud computing.

[0046] A cloud rendering system comprises servers and client devices. The application running the model rendering and the user interface are separate entities. The storage and execution of the model rendering methods are completed on the server. The presentation of the model rendering interface is done on the client. The client is mainly used for receiving and sending data related to model rendering and for displaying the model rendering interface. For example, the client can be a display device with data transmission capabilities located close to the user, such as a mobile terminal, television, computer, PDA, personal digital assistant, or head-mounted display device. However, the terminal device for processing the data of objects related to model rendering is the server in the cloud.

[0047] During model rendering, the user sends instructions to the server via the client. The server then controls the execution of the model rendering application based on the instructions, encodes and compresses data such as the model rendering interface, returns it to the client via the network, and finally decodes and outputs the model rendering interface through the client.

[0048] It should be noted that, in this embodiment, the execution entity of the model rendering method can be a terminal device or a server. The terminal device can be a local terminal device or a client device in the aforementioned cloud rendering system. This embodiment does not limit the type of execution entity.

[0049] For example, in conjunction with the above description, Figure 1An embodiment of this application illustrates a model rendering system 100 for implementing a model rendering method. The model rendering system 100 may include at least one terminal device 10, at least one server 20, at least one database 30, and a network.

[0050] The user's terminal device 10 can connect to different servers 20 via a network. The terminal device 10 is any device with computing hardware capable of supporting and executing the software application tools corresponding to the game.

[0051] In the aforementioned model rendering system 100, the terminal device 10 is used to install and run the model rendering application. In some cases, the model rendering application may not need to be installed in advance on the terminal device 10, and users can directly access the model rendering application through a browser or other client.

[0052] Users can log in to the model rendering application using their registered accounts to control that account and participate in model rendering. When a user logs in to the model rendering application, the terminal device 10 sends a login request to the server 20. The server 20 verifies the user's account and determines the model rendering mechanism and permissions corresponding to the account based on the login request. If the verification is successful, the server 20 returns a login success notification to the terminal device 10.

[0053] During the process of a user participating in model rendering through a model rendering application, the terminal device 10 and the server 20 interact with each other. The terminal device 10 sends various information to the server 20. The server 20 determines the display data of the terminal device 10 based on the stored model rendering mechanism and the received information, and sends the display data to the terminal device 10 so that the display data sent by the server 20 can be displayed to the user through the terminal device 10.

[0054] In possible application scenarios, different terminal devices 10 may be served by different servers 20. Therefore, in order to distinguish the servers 20 corresponding to different terminal devices 10, the embodiments of this application will use the terms "first" and "second" to describe them. In fact, the servers 20 corresponding to different terminal devices 10 can also be the same server 20. Therefore, without distinguishing between the first and second, it can be understood that the terminal devices 10 corresponding to accounts located in the same model rendering scene are served by the same server 20.

[0055] Furthermore, when the model rendering system 100 includes multiple terminal devices 10, multiple servers 20, and multiple networks, different terminal devices 10 can be interconnected through different networks and different servers 20. The network can be a wireless network or a wired network, such as a wireless local area network (WLAN), a local area network (LAN), a cellular network, a 2G network, a 3G network, a 4G network, a 5G network, etc.

[0056] In addition, different terminal devices 10 can also use their own Bluetooth network or hotspot network to connect to other terminal devices 10 or connect to the server 20, etc.

[0057] In addition, the model rendering system 100 may include multiple databases 30, which are coupled to different servers 20, and can continuously store information related to model rendering in the databases when different users are performing multi-user model rendering online.

[0058] Optionally, the database 30 may include a relational database (MySQL), a non-relational database (MongoDB), or other databases that can store structured data (such as user operation records, 3D models, etc.). This application embodiment does not limit this.

[0059] It should be noted that in this embodiment, multiple terminal devices 10 run the same model rendering application. Therefore, data interaction between the multiple terminal devices 10 can be achieved through the server 20 of the model rendering application. Thus, sending data from terminal device 1 to terminal device 2 can be understood as: terminal device 1 sends data to the server 20 of the model rendering application, and the server 20 sends the data to terminal device 2. Receiving data from terminal device 2 can be understood as: terminal device 1 receives data sent by the server 20 of the model rendering application, which is the data sent by terminal device 2 to the server 20. Alternatively, there may be no server 20 for the model rendering application, and terminal device 1 directly sends data to terminal device 2.

[0060] It should be noted that, Figure 1 The schematic diagram of the model rendering system shown is merely an example. The model rendering system 100 described in this application embodiment is for the purpose of more clearly illustrating the technical solutions of this application embodiment and does not constitute a limitation on the technical solutions provided in this application embodiment. As those skilled in the art will know, with the evolution of model rendering systems and the emergence of new business scenarios, the technical solutions provided in this application embodiment are also applicable to similar technical problems.

[0061] It should be noted that the triggering operations mentioned in the subsequent detailed description of the model rendering method provided in the embodiments of this application can all be regarded as operations performed by the user through a finger or by controlling a medium such as a mouse, keyboard, or stylus. The specific medium used can be determined according to the type of electronic device. For example, when the electronic device is a touch screen device such as a mobile phone or tablet, the user can perform touch operations on the touch screen using any suitable object or accessory such as a finger or stylus. When the electronic device is a non-touch screen electronic device such as a desktop computer or laptop, the user can operate it through an external device such as a mouse or keyboard.

[0062] The technical solution of this application will be described in detail below through specific embodiments. It should be noted that the following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.

[0063] Please see Figure 2 The model rendering method provided in this application embodiment is implemented by steps 011, 012, 013 and 014, which are described in detail below.

[0064] Step 011: Adjust each factor of the preset Sobel matrix based on the information of the first normal map to obtain factor offset values, and generate the target Sobel matrix based on the factor offset values;

[0065] Step 012: Based on the target Sobel matrix, filter the first normal map to generate the second normal map;

[0066] The first normal map is a texture map that stores information about the normal directions of the object's surface. The first normal map is associated with the model to be rendered; the corresponding first normal map can be queried and accessed through the model.

[0067] In one alternative embodiment, please refer to Figure 3 , Figure 3 This is a schematic diagram of the first normal map. The information of the first normal map includes image size and texture coordinates. Image size refers to the resolution of the first normal map, that is, its width and height (e.g., 1920*1080 pixels); texture coordinates (i.e., UV coordinates) refer to the two-dimensional coordinates that map the first normal map onto the surface of the 3D model to be rendered.

[0068] The preset Sobel matrix refers to two predefined sets of 3x3 convolution kernel matrices. For example, the preset Sobel matrix includes a horizontal 3x3 convolution kernel G. x and a 3x3 convolution kernel G in the vertical direction y ; where G x and G y As shown below:

[0069]

[0070] The factors are elements in the Sobel matrix, such as -1, 0, 1, 2, etc.

[0071] The factor offset value refers to the value after factor offset from the preset Sobel matrix.

[0072] The target Sobel matrix is ​​a matrix composed of multiple factor offset values.

[0073] The second normal map is obtained by filtering the first normal map using the target Sobel matrix. The second normal map contains physical surface normal direction information enhanced from the first normal map.

[0074] Specifically, the first normal map stores the normal direction information of the object's surface. To avoid losing some information in the normal direction information stored in the first normal map during the compression and decompression process, a corresponding matrix is ​​used to enhance the detail representation of the normal direction information in the first normal map.

[0075] By adjusting and iterating the initial factors of the preset Sobel matrix, the obtained factor offset values ​​can be adapted to the distribution of normal direction information in the first normal map, thereby enhancing the effective edge response, suppressing noise or false edges, and reducing the impact of abrupt changes in normal direction information. The target Sobel matrix generated based on the factor offset values ​​can effectively enhance the detail representation of normal direction information in the first normal map.

[0076] The first normal map is filtered by the target Sobel matrix to enhance the gradient changes of the normal direction information in the horizontal and vertical directions, improve the continuity and detail of the normal direction information of the physical surface in the first normal map, and extract the details of the normal direction information of the physical surface in the first normal map as the second normal map.

[0077] In this way, the true normal direction information in the first normal map can be enhanced and extracted.

[0078] Step 013: Merge the second normal map and the base color map to obtain a merged map;

[0079] The primary color map refers to a texture that stores the inherent basic color information of a physical surface. The primary color map is associated with the model to be rendered; the corresponding primary color map can be queried and accessed through the model.

[0080] Among them, the blended texture is a texture that is directly used to render the model after the second normal map and the base color map are blended.

[0081] Specifically, the second normal map provides information on the normal direction of the surface of the model to be rendered (i.e., the lighting and shadow details of the bumps), while the base color map provides the inherent basic color information of the surface of the model to be rendered (such as texture and tone). Merging the second normal map and the base color map allows the color representation to match the lighting and shadow changes of the surface bumps, retaining more detail information, making the material visual effect of the rendered model more coherent and realistic, avoiding a disconnect between color and three-dimensionality, and ultimately enhancing the immersive experience of the rendered image.

[0082] Step 014: Render based on the blended texture to generate the rendered model.

[0083] The rendered model refers to the final model obtained after the model to be rendered has undergone texture blending and rendering.

[0084] Specifically, the blended texture and the model to be rendered are imported into a preset rendering engine (such as Maya or a game engine). A new material is created in the material editor of the preset rendering engine. The base color information from the blended texture is split into the diffuse channel of the material, and the normal direction information from the blended texture is split into the normal channel of the material. Simultaneously, it is ensured that the coordinates of the blended texture are correctly associated with the UVs of the model to be rendered. This generates the rendered model. Subsequently, by setting scene lighting and adjusting the parameters of the material (such as roughness and metallicity), the rendered model's appearance can be displayed on the user's graphical interface.

[0085] In this way, the details of both the bright and dark areas of the surface of the model to be rendered can be preserved at the same time, improving the rendering effect and detail of the model.

[0086] Please see Figure 4 In one optional embodiment, step 011 includes steps 0111, 0112, and 0113, which are described in detail below.

[0087] Step 0111: Multiply each factor of the preset Sobel matrix by the inverse of the image size to generate the first factor offset value corresponding to each factor.

[0088] The first factor offset value is obtained by multiplying the factor of the preset Sobel matrix by the reciprocal of the image size of the first normal map.

[0089] Specifically, the preset Sobel matrix includes a horizontal 3x3 convolution kernel G. x and a 3x3 convolution kernel G in the vertical direction y ; Horizontal convolution kernel G x Each factor in the equation is multiplied by the reciprocal of the width of the first normal map; the vertical convolution kernel G... y Each factor in the formula is multiplied by the reciprocal of the image height of the first normal map.

[0090] For example, the first normal map is an image composed of 100*50 = 5000 pixels, with a width of 100 and a height of 50. Then the horizontal convolution kernel G... x The corresponding first factor offset values ​​for the first column are -0.01, -0.02, -0.01; the first factor offset values ​​for the second column are 0, 0, 0; and the first factor offset values ​​for the third column are 0.01, 0.02, 0.01. The vertical convolution kernel G... y The corresponding first factor offset values ​​for the first row are -0.01, -0.02, -0.01; the first factor offset values ​​for the second row are 0, 0, 0; and the first factor offset values ​​for the third row are 0.01, 0.02, 0.01.

[0091] In this way, the influence of different resolutions of the first normal map can be eliminated, and the gradient calculation of the normal direction information of the first normal map can be standardized.

[0092] Step 0112: For each texture coordinate, superimpose the texture coordinate and each first factor offset value to obtain the second factor offset value corresponding to each first factor offset value;

[0093] Step 0113: Generate the target Sobel matrix based on the offset values ​​of each second factor.

[0094] The second factor offset value is the sum of the texture coordinates and the first factor offset value.

[0095] Specifically, each pixel in the first normal map has corresponding UV coordinates. The UV coordinates of each pixel in the first normal map are superimposed with each first factor offset value to obtain each second factor offset value for each pixel. The second factor offset values ​​for each pixel form a 3*3 matrix as the target Sobel matrix for that pixel.

[0096] For example, if the UV coordinates of a pixel are (0.5, 0.5), the horizontal convolution kernel G... x The corresponding first factor offset values ​​in the first column are -0.01, -0.02, -0.01; the first factor offset values ​​in the second column are 0, 0, 0; and the first factor offset values ​​in the third column are 0.01, 0.02, 0.01.

[0097] The second factor offset values ​​in the horizontal direction corresponding to this pixel are 0.49, 0.48, 0.49 in the first column; 0.5, 0.5, 0.5 in the second column; and 0.51, 0.52, 0.51 in the third column. The second factor offset values ​​in the horizontal direction corresponding to this pixel together form a 3*3 target Sobel matrix.

[0098] The method for determining the offset values ​​of each second factor in the vertical direction corresponding to the pixel, i.e., the corresponding target Sobel matrix, is basically similar to that for the horizontal direction. To avoid repetition, it will not be elaborated here.

[0099] In this way, the generated target Sobel matrix can accurately locate the normal direction information of the neighboring pixels required by the current pixel, providing accurate data for subsequent calculations.

[0100] Please see Figure 4 In one optional embodiment, step 012 includes step 0121, which is described in detail below.

[0101] Step 0121: Based on multiple factor offset values, filter each pixel of the first normal map sequentially to generate the second normal map.

[0102] In one alternative embodiment, the plurality of factor offset values ​​include eight, which are located to the right, upper right, above, upper left, left, lower left, below, and lower right of the center element of the target Sobel matrix, respectively.

[0103] Specifically, the target Sobel matrix is ​​a 3x3 matrix, with the central element being the element in the second row and second column of the target Sobel matrix, and the eight factor offset values ​​being the remaining eight elements of the target Sobel matrix. The normal direction information (i.e., the x, y, and z components) of each pixel is parsed from the RGB channels of the first normal map. The x component represents the horizontal change, the y component represents the vertical change, and the z component represents the depth direction information, which is weakly correlated with the planar changes of the object's surface. Each pixel is filtered through the target Sobel matrix composed of multiple factor offset values ​​to obtain the gradient changes corresponding to each pixel, thereby generating the second normal map.

[0104] Optionally, the x-direction component of the current pixel and the x-direction components of its eight nearest neighbors in eight directions (i.e., directly right, upper right 45°, directly above, upper left 45°, directly left, lower left 45°, directly below, and lower right 45°) are extracted into a 3x3 matrix. This matrix is ​​then convolved with the horizontal 3x3 convolution kernel G in the target Sobel matrix. x Multiplying these results in the gradient of the current pixel in the horizontal direction.

[0105] Extract the y-direction component of the current pixel and the y-direction components of its eight nearest neighbors in eight directions (right, upper right, upper, upper left, left, lower left, lower, and lower right) into a 3x3 matrix. Then, convolve this matrix with the 3x3 kernel G in the vertical direction of the target Sobel matrix. y Multiply them to obtain the gradient of the current pixel in the vertical direction.

[0106] The gradient magnitude of the current pixel is the sum of the absolute values ​​of its gradient in the horizontal direction and the absolute values ​​of its gradient in the vertical direction. A larger gradient magnitude indicates more pronounced edge features. The gradient magnitude is calculated for each pixel in the first normal map as the current pixel. These gradient magnitudes, as single-channel data, correspond to each pixel, and the resulting grayscale image is the second normal map.

[0107] In this way, by extracting the normal direction information of the neighborhood around the current pixel through multiple factor offset values, the gradient changes of each pixel in the horizontal and vertical directions can be obtained, accurately capturing the edge details of the first normal map and storing them in the generated second normal map.

[0108] Please see Figure 5 In one optional embodiment, step 0121 includes step 01211, which is described in detail below.

[0109] Step 01211: Obtain the pixel values ​​of the target pixel and its neighboring pixels;

[0110] The target pixel is any pixel in the first normal map; the neighboring pixels of the target pixel are the pixels that are adjacent to the target pixel in eight directions (i.e., right, upper right, top, upper left, left, lower left, bottom, and lower right).

[0111] Specifically, the normal direction information (i.e., the components in the x, y, and z directions) of each pixel is parsed from the RGB channels of the first normal map. The x component represents the horizontal change, the y component represents the vertical change, and the z component represents the depth direction information, which is less correlated with the planar changes of the object's surface. Filtering the first normal map using the target Sobel matrix primarily focuses on changes in the horizontal and vertical directions relative to the first normal map; therefore, the x and y components of the target pixel and its neighboring pixels are obtained.

[0112] Step 01212: Calculate multiple first differences based on the difference between the products of two factor offset values ​​separated by one factor offset value and the pixel value of the corresponding pixel;

[0113] Specifically, the upper left and upper right are separated by a factor offset value. The factor offset value corresponding to the upper left element in the horizontal convolution kernel of the target Sobel matrix is ​​multiplied by the x component of the pixel to the upper left of the current pixel. The factor offset value corresponding to the upper right element in the horizontal convolution kernel of the target Sobel matrix is ​​multiplied by the x component of the pixel to the upper right of the current pixel. The difference between the product corresponding to the upper left and the product corresponding to the upper right is a first difference value.

[0114] Similarly, the process of subtracting the product of the factor offset value and the pixel value corresponding to the lower left from the product of the factor offset value and the pixel value corresponding to the lower right to obtain a first difference is basically the same as the principle of subtracting the product corresponding to the upper left from the product corresponding to the upper right to obtain a first difference. To avoid repetition, it will not be elaborated here.

[0115] Specifically, the upper left and lower left are separated by a factor offset value. The factor offset value corresponding to the upper left element in the vertical direction of the target Sobel matrix convolution kernel is multiplied by the y component of the upper left pixel of the current pixel. The factor offset value corresponding to the lower left element in the vertical direction of the target Sobel matrix convolution kernel is multiplied by the y component of the upper right pixel of the current pixel. The difference between the product corresponding to the upper left and the product corresponding to the lower left is a first difference value.

[0116] Similarly, the process of subtracting the product of the factor offset value and the pixel value corresponding to the upper right from the product of the upper right and the lower right to obtain a first difference is basically the same as the principle of subtracting the product corresponding to the lower left from the product corresponding to the upper left to obtain a first difference. To avoid repetition, it will not be elaborated here.

[0117] Step 01213: Calculate the second difference based on the difference between the products of the two factor offset values ​​of the horizontally spaced center element and the pixel values ​​of the corresponding pixels;

[0118] Specifically, the left and right sides are positioned with their center elements aligned horizontally. The left factor offset value in the horizontal convolution kernel of the target Sobel matrix is ​​multiplied by the x-component of the pixel to the left of the current pixel, and the right factor offset value in the horizontal convolution kernel of the target Sobel matrix is ​​multiplied by the x-component of the pixel to the right of the current pixel. The difference between the product corresponding to the left and the product corresponding to the right is a second difference value.

[0119] Step 01214: Calculate the third difference based on the difference between the products of the two factor offset values ​​of the vertically spaced center element and the pixel values ​​of the corresponding pixels;

[0120] Specifically, "above" and "below" are relative to each other in the vertical direction with their center elements aligned. The factor offset value of the upper part of the vertical convolution kernel of the target Sobel matrix is ​​multiplied by the y-component of the pixel above the current pixel, and the factor offset value of the lower part of the vertical convolution kernel of the target Sobel matrix is ​​multiplied by the y-component of the pixel below the current pixel. The difference between the corresponding product of the upper part and the corresponding product of the lower part is a third difference value.

[0121] Step 01215: Calculate the sum of multiple first differences, second differences, and third differences, and multiply it by a preset intensity coefficient to update the pixel value of the target pixel;

[0122] Step 01216: Generate a second normal map based on the updated pixel values ​​of each pixel in the first normal map.

[0123] The preset intensity coefficient is an empirical value or a user-defined value. It is an adjustable variable, and the display range of filtered details can be controlled by adjusting the value of the preset intensity coefficient.

[0124] Specifically, the absolute values ​​of the first, second, and third differences corresponding to the target pixel are taken, and then summed. This sum is multiplied by a preset intensity coefficient to obtain the pixel value of the target pixel. Multiplying by the preset intensity coefficient maximizes the extraction of details from the first normal map. Since this pixel value is a single numerical value, the resulting second normal map is a grayscale image, such as... Figure 6 As shown, the grayscale image of the second normal map contains the gradient intensity of the enhanced geometric details of the object's surface, which helps to improve rendering quality.

[0125] Please see Figure 4 In one optional embodiment, step 013 includes steps 0131, 0132 and 0133, which are described in detail below.

[0126] Step 0131: Multiply the second normal map with the target Sobel matrix to obtain multiple third normal maps;

[0127] Specifically, the target Sobel matrix includes two 3x3 convolution kernels in the horizontal and vertical directions, and the second normal map is a grayscale image. The second normal map is multiplied by the 3x3 convolution kernels in the horizontal and vertical directions, respectively, to obtain two different gradient maps, which are the third normal map.

[0128] Step 0132: Superimpose the maximum and minimum pixel values ​​of pixels at the same position in multiple third normal maps to generate a fourth normal map;

[0129] Specifically, the two resulting third normal maps highlight edge variations in the horizontal and vertical directions, respectively. The pixel value (i.e., the gradient magnitude at that location) corresponding to each pixel in the third normal map is extracted, and the maximum and minimum values ​​are summed to obtain the pixel value for the fourth normal map. The sum of the maximum and minimum pixel values ​​for each pixel is calculated sequentially to generate the fourth normal map.

[0130] In this way, the details of both the bright and dark areas in the second normal map can be preserved at the same time, enhancing the edge effect.

[0131] Step 0133: Merge the fourth normal map and the base color map to obtain a merged map.

[0132] Specifically, the pixel values ​​of corresponding pixels in the fourth normal map and the base color map are calculated to obtain the pixel values ​​of corresponding pixels at each position in the blended map. For example, this can be achieved by multiplying the normalized grayscale value of the fourth normal map by the RGB values ​​of the base color map, or by proportionally brightening or darkening the corresponding base color RGB values ​​based on the normalized grayscale value of the fourth normal map and a preset threshold.

[0133] In this way, the resulting blended texture can reduce the proportion of storage space and retain more detailed information after compression and decompression.

[0134] Please see Figure 5 In one optional embodiment, step 0133 includes step 01331, which is described in detail below.

[0135] Step 01331: Add the pixel values ​​at the same position in the fourth normal map and the base color map to obtain the blended map.

[0136] Specifically, the pixel values ​​corresponding to the RGB three channels of the target pixel in the primary color map are added to the single-channel pixel values ​​of the corresponding positions in the fourth normal map to obtain temporary three-channel pixel values. The largest and smallest channel pixel values ​​are then iterated through all pixels, with the largest channel pixel value normalized to 1 and the smallest channel pixel value normalized to 0. These temporary three-channel pixel values ​​for each pixel are then normalized to the range of 0-1 and used as the pixel values ​​for the blending map to obtain the blending map, as shown below. Figure 7 As shown, the surface details of objects contained in the blended texture are more obvious, which can improve the rendering quality.

[0137] Please see Figure 8 In an optional embodiment, the model rendering method further includes steps 015 and 016, which are described in detail below.

[0138] Step 015: Convert the first normal map to generate the corresponding ambient occlusion map;

[0139] Among them, the Ambient Occlusion (AO) map is a map used to simulate the surface of an object due to mutual occlusion or its own depression.

[0140] Specifically, the first normal map is first converted into a height map, and then the height map is converted into an AO map.

[0141] First, the RGB channels of the first normal map are parsed, and the pixel values ​​in the RGB channels are mapped from [0, 255] to [-1, 1] to obtain the normal vector (x, y, z). The horizontal and vertical gradients of the height map corresponding to the x and y components are used to calculate the height value by integrating the gradients (horizontal and vertical gradients) of adjacent pixels (such as calculating the height value through the height reconstruction function of PS software). After processing the boundary error, the height map is generated.

[0142] The height of each pixel is determined based on the grayscale values ​​of the height map. For each pixel, surrounding points are sampled within the hemispherical region. The height difference between these surrounding pixels determines whether the fiber is obstructed. The obstruction ratio is calculated and then mapped to grayscale (bright areas represent low obstruction, dark areas represent high obstruction) to generate an AO map. The generated AO map is shown below. Figure 9 As shown, the bright areas are areas where ambient light can provide sufficient illumination, while the dark areas are areas with severe occlusion. The information contained in the AO map helps to improve the rendering model's ability to simulate the effect of light occlusion in a real environment, thereby enhancing the spatial hierarchy and detail of the rendering model.

[0143] Step 016: Blend the ambient occlusion map into the alpha channel of the blend map to update the blend map.

[0144] The alpha channel (A channel for short) is a transparency channel used to characterize the transparency of each pixel in the texture.

[0145] Specifically, copying the grayscale values ​​of each pixel in the AO map to the A channel of the base color map completes the blending. This avoids the storage cost of adding another map and creates natural shadows in the gaps, wrinkles, and other depressions of the model being rendered, enhancing the three-dimensionality and realism of the surface details and improving the overall rendering quality and detail.

[0146] Please see Figure 10 , Figure 10 This is a schematic diagram illustrating the rendering effect of the model rendering method provided in this application embodiment. As can be seen, the rendered model obtained by the model rendering method after compression and decompression has strong detail representation. Under ambient light, it can naturally present shadows in areas such as corners and gaps, which can enhance the user's immersion.

[0147] This application also provides a standardized texture template, please refer to [link / reference]. Figure 11 , Figure 11This is a schematic diagram of a standardized texture template provided in an embodiment of this application. The input information for the standardized texture template includes a first normal map, a preset Sobel matrix, preset intensity coefficients, and a base color map. The standardized texture template processes the input information according to the model rendering method provided in this embodiment of the application, and finally outputs a blended texture for rendering the model to be rendered.

[0148] To facilitate better implementation of the model rendering method of this application embodiment, this application embodiment also provides a model rendering apparatus. Please refer to... Figure 12 , Figure 12 This is a schematic diagram of the structure of a model rendering apparatus provided in an embodiment of this application. The model rendering apparatus 200 can provide a graphical user interface (GUI) via a terminal device. The GUI includes at least a portion of a game scene and at least one virtual character. The model rendering apparatus 200 may include:

[0149] The generation module 201 is used to adjust each factor of the preset Sobel matrix based on the information of the first normal map to obtain factor offset values, and generate the target Sobel matrix based on the factor offset values.

[0150] The filtering module 202 is used to filter the first normal map based on the target Sobel matrix to generate the second normal map;

[0151] The fusion module 203 is used to fuse the values ​​of the second normal map and the base color map to obtain a fused map;

[0152] Rendering module 204 is used to render based on the blended texture to generate a rendered model.

[0153] It should be noted that the specific details of each module unit in the above-mentioned model rendering device have been described in detail in the embodiments of the above-mentioned model rendering method, and will not be repeated here.

[0154] In this application embodiment, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.

[0155] In one optional embodiment, the model rendering device in this application embodiment can be implemented in hardware, such as an electronic device or a component in an electronic device, such as an integrated circuit or a chip; the model rendering device can also be implemented in software, such as as an application installed in an electronic device.

[0156] This application also provides an electronic device, including a memory and a processor. The memory stores one or more computer instructions, and the processor executes one or more computer instructions to implement the model rendering method described above.

[0157] In one alternative embodiment, please refer to Figure 13 , Figure 13 This is a schematic diagram of the terminal device provided in an embodiment of this application. The terminal device 300 includes a processor 301, a memory 302, and a display 303. The display 303 is used to display a graphical user interface. The memory 302 stores a computer program 304 that can run on the processor 301. When the processor 301 executes the computer program 304, it implements the various processes of the embodiments of the above-described model rendering method and achieves the same technical effect. To avoid repetition, it will not be described again here.

[0158] Please see Figure 14 , Figure 14 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application. The electronic device can be a terminal or a server. Exemplarily, the electronic device 400 includes a central processing unit (CPU) 401, a system memory 404 including random access memory (RAM) 402 and read-only memory (ROM) 403, and a system bus 405 connecting the system memory 404 and the central processing unit 401.

[0159] In an alternative embodiment, the electronic device 400 may further include a basic input / output system 406 that helps transfer information between various devices within the computer, and a mass storage device 407 for storing the operating system 413, application programs 414, and other program modules 415.

[0160] In one alternative embodiment, the basic input / output system 406 includes a display 408 for displaying information and an input device 409 for user input, such as a touch panel and other input devices. A touch panel is also called a touchscreen. A touch panel may include both a touch device and a touch controller. Other input devices may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, and joysticks, which will not be elaborated further here.

[0161] Both the display 408 and the input device 409 are connected to the central processing unit 401 via an input / output controller 410 connected to the system bus 405. The basic input / output system 406 may also include the input / output controller 410 for receiving and processing input from touch panels, other input devices, etc. Similarly, the input / output system 406 also includes output devices such as displays, printers, or other types of output devices.

[0162] Mass storage device 407 is connected to central processing unit 401 via a mass storage controller (not shown) connected to system bus 405. Mass storage device 407 and its associated computer-readable media provide non-volatile storage for electronic device 400. That is, mass storage device 407 may include computer-readable media (not shown) such as hard disk or compact disc read-only memory (CD-ROM) drive.

[0163] According to various embodiments of this application, electronic device 400 can also be connected to a remote computer on network 417 via a network such as the Internet. That is, electronic device 400 can be connected to network 417 via network interface unit 416 connected to system bus 405, or network interface unit 416 can be used to connect to other types of networks or remote computer systems (not shown).

[0164] This application also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the various processes of the above-described model rendering method embodiments and achieves the same technical effect. To avoid repetition, it will not be described again here.

[0165] The processor can be the processor in the electronic device described in the above embodiments. The computer-readable storage medium can be a computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk, etc.

[0166] Computer-readable media can include computer storage media and communication media. Computer storage media includes volatile and non-volatile, removable and non-removable media implemented by any method or technology for storing information such as computer-readable instructions, data structures, program modules, or other data. Computer storage media include RAM, ROM, erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other solid-state storage technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape cassettes, magnetic tape, disk storage, or other magnetic storage devices. Of course, those skilled in the art will recognize that computer storage media are not limited to the above-mentioned types.

[0167] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described model rendering method. The processor may be a processor in the electronic device described in the above embodiments. When executed by the processor, the computer program implements the various processes of the embodiments of the above-described model rendering method and achieves the same technical effects; therefore, to avoid repetition, further details are omitted here.

[0168] It is understood that in the specific implementation of this application, data related to user identity or characteristics is involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0169] Any process or method description in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing a particular logical function or process, and the scope of the preferred embodiments of this application includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order according to the functions involved, as should be understood by those skilled in the art to which embodiments of this application pertain.

[0170] Although embodiments of this application have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of this application, the scope of which is defined by the claims and their equivalents.

Claims

1. A model rendering method, characterized in that, include: Based on the information from the first normal map, the factors of the preset Sobel matrix are adjusted to obtain factor offset values, and the target Sobel matrix is ​​generated based on the factor offset values. Based on the target Sobel matrix, the first normal map is filtered to generate a second normal map; The second normal map and the base color map are combined and their values ​​are merged to obtain a merged map; Rendering is performed based on the fused texture to generate a rendering model.

2. The model rendering method according to claim 1, characterized in that, The information in the first normal map includes image size and texture coordinates. The step of adjusting various factors of the preset Sobel matrix based on the information in the first normal map to obtain factor offset values, and generating the target Sobel matrix based on the factor offset values, includes: Each factor of the preset Sobel matrix is ​​multiplied by the reciprocal of the image size to generate a first factor offset value corresponding to each factor. For each texture coordinate, the texture coordinate and each of the first factor offset values ​​are superimposed to obtain the second factor offset value corresponding to each of the first factor offset values; The target Sobel matrix is ​​generated based on each of the second factor offset values.

3. The model rendering method according to claim 1, characterized in that, The target Sobel matrix includes multiple factor offset values. The step of filtering the first normal map based on the target Sobel matrix to generate a second normal map includes: Based on multiple factor offset values, each pixel of the first normal map is filtered sequentially to generate the second normal map.

4. The model rendering method according to claim 3, characterized in that, The plurality of factor offset values ​​are arranged sequentially around the central element of the target Sobel matrix. The step of filtering each pixel of the first normal map sequentially based on the plurality of factor offset values ​​to generate the second normal map includes: Obtain the pixel values ​​of the target pixel and its neighboring pixels, wherein the target pixel is any pixel of the first normal map; A plurality of first differences are calculated based on the difference between the products of two factor offset values ​​spaced apart by one factor offset value and the pixel value of the corresponding pixel. The second difference is calculated based on the difference between the products of the two factor offset values ​​separated by the center element in the horizontal direction and the pixel values ​​of the corresponding pixels. The third difference is calculated based on the difference between the products of the two factor offset values ​​that are vertically separated by the center element and the pixel values ​​of the corresponding pixels. Calculate the sum of multiple first differences, second differences, and third differences, and multiply it by a preset intensity coefficient to update the pixel value of the target pixel; The second normal map is generated based on the updated pixel values ​​of each pixel in the first normal map.

5. The model rendering method according to claim 3 or 4, characterized in that, The plurality of factor offset values ​​include eight, and the eight factor offset values ​​are respectively located to the right, upper right, above, upper left, left, lower left, below, and lower right of the center element of the target Sobel matrix.

6. The model rendering method according to any one of claims 1-5, characterized in that, The step of fusing the second normal map and the base color map to obtain a fused map includes: Multiply the second normal map with the target Sobel matrix to obtain multiple third normal maps; The maximum and minimum pixel values ​​of pixels at the same position in multiple third normal maps are superimposed to generate a fourth normal map. The values ​​of the fourth normal map and the base color map are merged to obtain a merged map.

7. The model rendering method according to claim 6, characterized in that, The step of fusing the fourth normal map and the base color map to obtain a fused map includes: The pixel values ​​at the same position in the fourth normal map and the base color map are added together to obtain the blended map.

8. The model rendering method according to claim 1, characterized in that, Also includes: The first normal map is converted to generate the corresponding ambient occlusion map; The ambient occlusion map is blended into the alpha channel of the blended map to update the blended map.

9. A model rendering device, characterized in that, include: The generation module is used to adjust each factor of the preset Sobel matrix based on the information of the first normal map to obtain factor offset values, and generate the target Sobel matrix based on the factor offset values. A filtering module is used to filter the first normal map based on the target Sobel matrix to generate a second normal map; The fusion module is used to fuse the values ​​of the second normal map and the base color map to obtain a fused map; The rendering module is used to render based on the fused texture to generate a rendering model.

10. An electronic device, characterized in that, include: Memory and processor; The memory is used to store one or more computer instructions; The processor is used to execute the one or more computer instructions to implement the model rendering method as described in any one of claims 18.

11. A computer-readable storage medium storing one or more computer instructions thereon, characterized in that, The computer instructions are executed by the processor to implement the model rendering method as described in any one of claims 18.

Citation Information

Cited By

  • Vehicle head avoidance method, device and system, storage medium and program product

    CN121600050A