Model rendering method and apparatus, computer device, and computer-readable storage medium
Patent Information
- Application Number
- CN202210978694.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-16
- Publication Date
- 2026-09-11
- Estimated Expiration
- 2042-08-16
AI Technical Summary
[0003]然而,现有的游戏渲染技术流程复杂且成本极高,如包括以下步骤:搭建中模、雕刻高模、做低模、UV(Unique visitor)拆分、烘焙贴图、绘制材质,八猴渲染等
Smart Images

Figure CN115345976B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of game rendering technology, specifically to a model rendering method, apparatus, computer device, and computer-readable storage medium. Background Technology
[0002] With the rapid development of game rendering technology, the effects of game scenes are becoming more and more realistic. Rendering rich visual details in game scenes can not only increase players' interest, but also enhance game interactivity, making it an indispensable step in game production.
[0003] However, existing game rendering technologies are complex and extremely costly, including steps such as: building a mid-poly model, sculpting a high-poly model, creating a low-poly model, UV unwrapping (unique visitor), baking textures, painting materials, and rendering with 8monkeys. It is evident that existing game rendering technologies not only have long production cycles, but also produce uncontrollable normal details and lack depth, failing to achieve the desired effect.
[0004] Therefore, existing game rendering technologies suffer from low rendering accuracy. Summary of the Invention
[0005] Therefore, it is necessary to provide a model rendering method, apparatus, computer equipment, and computer-readable storage medium to address the aforementioned technical problems and improve the accuracy of model rendering.
[0006] Firstly, this application provides a model rendering method, including:
[0007] Obtain the layered image of the target model to be rendered;
[0008] The layered image is converted to normals to obtain the normal map of the target model;
[0009] Based on the channel information of the normal map, the target texture of the target model is obtained; wherein, the target texture includes at least one of the roughness map, metallicity map and ambient occlusion map;
[0010] The target model is rendered and displayed based on the target texture and normal map.
[0011] Secondly, this application provides a model rendering apparatus, comprising:
[0012] The image acquisition module is used to acquire layered images of the target model to be rendered;
[0013] The normal processing module is used to convert layered images into normal maps to obtain the normal map of the target model.
[0014] The texture acquisition module is used to acquire the target texture of the target model based on the channel information of the normal map; wherein, the target texture includes at least one of the roughness map, metallicity map and ambient occlusion map;
[0015] The model rendering module is used to render and display the target model based on the target texture and normal map.
[0016] Thirdly, this application also provides a computer device, comprising:
[0017] One or more processors;
[0018] Memory; and one or more applications, wherein one or more applications are stored in memory and configured to be executed by a processor to implement the model rendering method described above.
[0019] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, the computer program being loaded by a processor to perform the steps in the above-described model rendering method.
[0020] Fifthly, embodiments of this application provide a computer program product or computer program that includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the method provided in the first aspect described above.
[0021] The aforementioned model rendering method, apparatus, computer equipment, and computer-readable storage medium allow a terminal device to obtain a normal map of the target model by acquiring a layered image of the target model to be rendered and performing normal mapping on the layered image. Then, based on the channel information of the normal map, a target texture of the target model can be obtained. The target texture includes at least one of a roughness map, a metallicity map, and an ambient occlusion map. Finally, the target model is rendered and displayed based on the target texture and the normal map. Therefore, this application improves the rendering accuracy of the model by reducing texture production costs and optimizing the texture production process, thereby enhancing the details of the texture. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 This is a flowchart illustrating the model rendering method in an embodiment of this application;
[0024] Figure 2 This is a flowchart illustrating the layered image acquisition steps in an embodiment of this application;
[0025] Figure 3 This is a schematic diagram of the interface of the initial material image in the embodiments of this application;
[0026] Figure 4 This is a flowchart illustrating the steps for obtaining the normal map in an embodiment of this application.
[0027] Figure 5 This is a schematic diagram of the interface of the layered image after normal conversion in an embodiment of this application;
[0028] Figure 6 This is a schematic diagram of the interface between the composite image and the main content image in an embodiment of this application;
[0029] Figure 7 This is a schematic diagram of the processing flow from grayscale image to normal map in an embodiment of this application;
[0030] Figure 8 This is a comparative diagram of model rendering effects in the embodiments of this application;
[0031] Figure 9 This is a schematic diagram of the interface for obtaining the roughness map in an embodiment of this application;
[0032] Figure 10 This is a schematic diagram of the interface for obtaining the metallicity map in an embodiment of this application;
[0033] Figure 11 This is a schematic diagram of the interface of the light-masking image in the embodiments of this application;
[0034] Figure 12 This is a schematic diagram of the spherical rendering effect of the target model in the embodiments of this application;
[0035] Figure 13 This is a schematic diagram of the structure of the model rendering device in the embodiments of this application;
[0036] Figure 14 This is a schematic diagram of the structure of the computer device in the embodiments of this application. Detailed Implementation
[0037] 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.
[0038] In the description of this application, the term "for example" is used to mean "used as an example, illustration, or description." Any embodiment described as "for example" in this application is not necessarily to be construed as being more preferred or advantageous than other embodiments. The following description is provided to enable any person skilled in the art to make and use the invention. Details are set forth in the following description for purposes of explanation. It should be understood that those skilled in the art will recognize that the invention can be made without using these specific details. In other instances, well-known structures and processes will not be described in detail to avoid obscuring the description of the invention with unnecessary detail. Therefore, the invention is not intended to be limited to the embodiments shown, but is consistent with the broadest scope of the principles and features disclosed in this application.
[0039] In some embodiments of this application, the model rendering method provided in this application can run on a terminal device or a server. The terminal device can be a local terminal device. When the model rendering method runs on a server, the method can be implemented and executed based on a cloud interaction system, wherein the cloud interaction system includes a server and client devices.
[0040] In some embodiments of this application, various cloud applications, such as cloud gaming, can run under the cloud interaction system. Taking cloud gaming as an example, cloud gaming refers to a gaming method based on cloud computing. In the cloud gaming operation mode, the main body running the game program and the main body displaying the game screen are separated. The storage and operation of information processing methods are completed on the cloud gaming server. The client device is used for receiving and sending data and displaying the game screen. For example, the client device can be a display device with data transmission function close to the user side, such as a mobile terminal, television, computer, PDA, etc.; however, the terminal device for information processing is the cloud gaming server in the cloud. When playing the game, the player operates the client device to send operation commands to the cloud gaming server. The cloud gaming server runs the game according to the operation commands, encodes and compresses the game screen and other data, returns it to the client device through the network, and finally, the client device decodes and outputs the game screen.
[0041] In some embodiments of this application, the terminal device can be a local terminal device. Taking a game as an example, the local terminal device stores the game program and is used to display the game screen. The local terminal device is used to interact with the player through a graphical user interface, that is, conventionally downloading, installing, and running the game program via an electronic device. The local terminal device can provide the graphical user interface to the player in various ways, such as rendering it on the terminal's display screen, or providing it to the player through holographic projection. For example, the local terminal device can include a display screen and a processor. The display screen is used to display the graphical user interface, which includes the game screen, and the processor is used to run the game, generate the graphical user interface, and control the display of the graphical user interface on the display screen.
[0042] A game scene (or virtual scene) is a virtual scene displayed (or provided) by an application while it is running on a terminal or server. Optionally, the virtual scene is a simulation of the real world, a semi-simulated / semi-fictional virtual environment, or a purely fictional virtual environment. A virtual scene can be either a two-dimensional or three-dimensional virtual scene, and the virtual environment can be the sky, land, ocean, etc., where the land includes environmental elements such as deserts and cities. Among them, a virtual scene is a scene in which the user controls virtual objects and completes the game logic. For example, in a sandbox 3D shooting game, a virtual scene is a 3D game world used by players to control virtual objects to fight. Instances of virtual scenes can include at least one element among mountains, plains, rivers, lakes, oceans, deserts, skies, plants, buildings, and vehicles. For example, in a 2D card game, a virtual scene is a scene used to display and release cards or display the virtual objects corresponding to cards. Instances of virtual scenes can include arenas, battlegrounds, or other "field" elements or other elements that can display the card battle status. For 2D or 3D multiplayer online tactical competitive games, a virtual scene is a 2D or 3D terrain scene used by virtual objects to fight. Instances of virtual scenes can include elements such as canyon-style mountains, lines, rivers, classrooms, desks and chairs, and podiums.
[0043] A game interface refers to the interface of an application provided or displayed through a graphical user interface (GUI). This interface includes a UI for player interaction and a game screen. In optional embodiments, the UI may include game controls (e.g., skill controls, movement controls, function controls), indicators (e.g., direction indicators, character indicators), information display areas (e.g., kill count, match time), or game setting controls (e.g., system settings, shop, coins). In optional embodiments, the game screen is the display screen corresponding to the virtual scene shown on the terminal device. The game screen may include virtual objects such as game characters, NPC characters, and AI characters that execute game logic in the virtual scene.
[0044] It should be noted that the game scenarios described in the embodiments of this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of the present invention, and do not constitute a limitation on the technical solutions provided in the embodiments of this application. As those skilled in the art will know, with the emergence of unusual new business scenarios, the technical solutions provided in the embodiments of the present invention are also applicable to similar technical problems.
[0045] See Figure 1 This application provides a model rendering method, which includes steps S201 to S204, as follows:
[0046] S201, Obtain the layered image of the target model to be rendered.
[0047] The target model can be a two-dimensional or three-dimensional model of any material, such as stone, metal, or plastic, and the specific embodiment of this application is not limited thereto. The layered image can be a model image obtained by layering based on artistic concepts such as "real and virtual," "front and back," and "interweaving."
[0048] In specific implementation, the execution entity in this embodiment can be a terminal device. The terminal device can download the game engine software package, install and log in to the game engine, which can be any game engine; this embodiment does not limit the specific implementation. The layered image acquisition steps involved in this embodiment will be described in detail below.
[0049] In one embodiment, see Figure 2 Step S201 includes: S2011, obtaining the initial material image of the target model to be rendered; S2012, performing hierarchical analysis on the target content in the initial material image based on a preset line interlacing strategy to obtain a layered image; wherein, the target content includes at least one of the main content, background content, and border content.
[0050] The initial source image can be an initial, unlayered image containing the main pattern of the target model. The line interlacing strategy incorporates the artistic concepts of "real and virtual," "front and back," and "interlacing" mentioned above. The main content can be a relatively large human or object image in the image, the background content can be an image that serves as a "background" behind or around the main content, and the border content can be an image that surrounds and differs from the background content and / or the main content.
[0051] For specific implementation details, please refer to [link / reference]. Figure 3 , Figure 3Image "A" in the image is the main view of a target model and can be regarded as the initial source image of the target model. The terminal device performs hierarchical analysis on the target content in the initial source image based on the preset line interlacing strategy and image integrity to obtain a layered image.
[0052] For example, a terminal device can determine that the animal in image "A" should be the main content and should be on the top layer in the layer sequence; the auspicious cloud pattern, as the background content of the animal, should be on the next layer; the gap at the bottom of the auspicious cloud, considered a sub-background content, should be on the third layer; the two circular borders, resembling a window, should be on a layer above the animal; and the convex shape between the two circles should be below the circles but above the animal layer. Therefore, the terminal device can select the pattern using the selection tools in software like Photoshop to obtain... Figure 3 Each image "B" in the image is represented as a layered image. Photoshop can be software pre-installed on the terminal device.
[0053] S202, perform normal mapping on the layered image to obtain the normal map of the target model.
[0054] Normal mapping involves creating normals at every point on the bumpy surface of the original object, using RGB color channels to mark the direction of these normals. It can be understood as another, different surface parallel to the original bumpy surface, but in reality, it's just a smooth plane. Visually, it's more efficient than the original bumpy surface. By applying a light source at a specific location, it can generate highly detailed, precise lighting directions and reflections on surfaces with low detail.
[0055] In practice, the terminal device can use Photoshop to convert each layered image to normal maps to obtain the normal map of the target model. Specifically, the layered images can be opened using the Photoshop plugin "Quixel Suite," and then converted to normal maps. "Quixel Suite" is a texture mapping software that provides various material libraries for better texture creation during model making. The software can automatically generate various masks based on normal maps, ambient occlusion maps, etc., greatly improving work efficiency.
[0056] In one embodiment, see Figure 4 Step S202 includes: S2021, performing normal conversion processing on the layered image to obtain a normalized layered image; S2022, performing detail optimization processing on the normalized layered image according to the layer type of the layered image to obtain an optimized layered image; S2023, performing occlusion compositing processing on the optimized layered image to obtain a normal map.
[0057] The layer type of the layered image may include the main content, background content, and border content described in the above embodiments, and may also include other types, which are specifically determined by the entity content of the target model.
[0058] In specific implementation, the terminal device analyzes and obtains the following: Figure 3 After processing the four layered images shown in Figure "B", you can use Photoshop to convert each layered image to normals, resulting in a layered image with converted normals, as shown below. Figure 5 As shown. At this point, to improve the model rendering accuracy, the terminal device can perform detail optimization processing on the layered image after converting to normals. This can be done using software like Photoshop, which offers functions such as selection, feathering, selecting similar color gamuts, masking, drawing, and erasing, to obtain an optimized layered image. Finally, the optimized layered image is composited using an overlay and occlusion process to obtain the normal map. The detail optimization steps involved in this embodiment will be described in detail below.
[0059] In one embodiment, step S2022 includes: determining the operation mode information and transparency information of each normalized layered image according to the layer type of the layered image; and performing detail optimization processing on the normalized layered image based on the operation mode information and transparency information to obtain an optimized layered image.
[0060] The operation mode information includes, but is not limited to, "overlay mode" and "normal mode". The transparency information includes, but is not limited to, "100%", "90%", "80%", "75%" and "70%".
[0061] In specific implementation, the terminal device analyzes and obtains the following: Figure 5 After converting the layered images to normals, detailed optimization processing needs to be performed on each layered image. For example, for images with the main content as the layer type, the corresponding preset operation mode information is "overlay mode" and the transparency information is "100%"; for images with the background content as the layer type, the corresponding preset operation mode information is "overlay mode" and the transparency information is "70%"; for images with the sub-background content as the layer type, the corresponding preset operation mode information is "normal mode" and the transparency information is "80%"; and for images with the border content as the layer type, the corresponding preset operation mode information is "normal mode" and the transparency information is "90%".
[0062] In addition, the terminal device can also acquire the target model's regular texture normal map (i.e., the texture normal map obtained using existing technology) and standard normal color map (i.e., the mixed primary colors for image processing). Then, it performs detail optimization processing on the regular texture normal map. Specifically, for the regular texture normal map, its operation mode information is preset to "overlay mode" and its transparency information to "75%" to increase texture detail and improve model rendering accuracy. For the standard normal color map, its operation mode information is preset to "normal mode" and its transparency information to "100%". After completing the above detail optimization processing on each image, the optimized layered image can be obtained.
[0063] It should be noted that the intensity of the bump effect changes with the adjustment of the Photoshop layer's opacity. To change the intensity of the bump effect, simply adjust the opacity of the Photoshop layer used for overlay. Since this application proposes optimizing each layered image separately, the opacity can also be flexibly adjusted, thereby effectively improving model rendering efficiency.
[0064] In one embodiment, step S2023 includes: performing occlusion compositing on the optimized layered image to obtain a composite image; wherein the composite image contains the main content obtained through hierarchical analysis; extracting the main content from the composite image to obtain target layer information; and performing detail enhancement processing on the composite image based on the target layer information to obtain a normal map.
[0065] In practice, after the terminal device analyzes and obtains the optimized layered image, it can further perform overlay and occlusion compositing processing on the optimized layered image. That is, using the top and bottom overlay and occlusion function of Photoshop (with layers in "normal mode"), the optimized layered images are composited by overlay and occlusion to obtain the result as shown below. Figure 6 The composite image shown in Figure (a) is then further enhanced by the terminal device using Photoshop's high-pass filter and overlay modes.
[0066] It should be noted that the detail enhancement processing proposed in this application differs from traditional techniques that simply extract grayscale images of the outer contour using high-pass preserving. Instead, it precisely extracts the color gamut range of each channel in the ARGB (typedef DWORD ARGB) image, accurately processing highlight areas, midtone areas, and shadow areas to obtain more precise outer contours and natural gradient blending. The final high-pass preserved image is then overlaid using Photoshop's overlay or soft light modes to achieve detail sharpening, thereby improving model rendering accuracy.
[0067] Furthermore, the terminal equipment processing is obtained Figure 6 After synthesizing the image as shown in Figure (a), the main content can be extracted to obtain the following: Figure 6 The main content image shown in Figure (b) is then used as the target layer information (e.g., copying and merging all layer information within the selected area of the main content into one layer and then pasting it in place). This allows for detail enhancement based on the target layer information, resulting in a normal map. Specific image processing techniques will be explained in detail below.
[0068] In one embodiment, based on the target layer information, the synthesized image is subjected to detail enhancement processing to obtain a normal map, including: obtaining the target color channel information corresponding to the target layer information; performing grayscale processing on the synthesized image based on the target color channel information to obtain a grayscale image; and performing high-pass processing on the grayscale image to obtain a normal map.
[0069] The target color channel information includes red channel information. The selection and determination of red channel information can be written into a program, loaded by the terminal device, and executed automatically.
[0070] In practice, after the terminal device obtains the target layer information, it can switch from layer to channel and display the red channel separately to copy the channel content information within the main content selection area, resulting in... Figure 7 The grayscale image shown in Figure (a) is then processed by the terminal device to preserve high contrast. The radius is preset to "N pixels" (e.g., 5 pixels, but not limited to this), resulting in the image shown below. Figure 7 The processing result is shown in Figure (b). Finally, Figure 7 To obtain the processed result in Figure (b), switch the layer display mode to overlay mode. Figure 7 The normal map shown in Figure (c) is as follows.
[0071] For details, please refer to Figure 8 The detail enhancement method proposed in this application embodiment has a more significant effect on model rendering compared to models that do not use this technology, thereby making the model rendering accuracy higher.
[0072] S203, based on the channel information of the normal map, obtain the target texture of the target model; wherein, the target texture includes at least one of the roughness map, metallicity map and ambient occlusion map.
[0073] Roughness is a factor that causes the visual irregularity of a surface due to light diffusion, and the direction of reflection varies freely according to surface roughness. The rougher the surface, the more diffuse and darker the highlights; the smoother the surface, the more concentrated the highlight reflection. The roughness map can reflect the light reflection situation. The metallicity map acts like a "mask," distinguishing between metal and insulator data in the intrinsic color map. In the metallicity map, 0 (black - 0 sRGB) represents an insulator, while 1 (white - 255 sRGB) represents a metal. Ambient Occlusion (AO) is a shading and rendering technique in computer graphics. The specific image is a black and white image, overlaid using the multiply blending mode, which can beautify shadows (deepen the junctions of object structures and create natural transitions).
[0074] In specific implementation, after the terminal device obtains the normal map of the target model through the method described in the above embodiments, it can use the normal map to adjust the channel and quickly obtain another material map, such as at least one of roughness map, metallicity map and ambient occlusion map, thereby effectively solving the problem of PBR display defects caused by the lack of necessary maps during the model rendering process.
[0075] First, it should be noted that the embodiment of this application proposes that an image integrating a roughness map, a metallicity map, and an ambient light occlusion map can be used as an "m-map". The R channel of the "m-map" is the roughness map, the G channel of the "m-map" is the metallicity map, and the Alpha channel of the "m-map" is the ambient light occlusion map. The acquisition process of each map will be described in detail below.
[0076] In one embodiment, the channel information includes red channel information, and step S203 includes: acquiring the initial material image of the target model to be rendered; performing desaturation and inverse adjustment of the color levels on the initial material image to obtain the target image; acquiring the three-channel layer information of the target image, and mixing the three-channel layer information with the red channel information of the normal map to obtain the roughness map of the target model as the target texture.
[0077] Three channels: Each pixel has 3 values, hence 3 channels. For example, an RGB image is a three-channel image. The RGB color mode is an industry color standard that obtains various colors by varying the red (R), green (G), and blue (B) color channels and superimposing them. RGB represents the colors of the red, green, and blue channels.
[0078] For specific implementation details, please refer to [link / reference]. Figure 9 The terminal device can target the initial source image ( Figure 9 The image (a) in the image is desaturated to obtain the result. Figure 9 Image (b) is shown in the image; then, the color is inverted on the desaturated image to obtain... Figure 9Image (c) in the image; by adjusting the color levels, you can obtain the desired result. Figure 9 The (d) image in the image is the target image; finally, the RGB layer information of the target image is obtained and pasted into the R channel of the "m image" to obtain the roughness map.
[0079] In one embodiment, the channel information includes green channel information, and step S203 includes: acquiring the initial material image of the target model to be rendered; performing desaturation and adjusting the color levels on the initial material image to obtain the target image; acquiring the three-channel layer information of the target image, and mixing the three-channel layer information with the green channel information of the normal map to obtain the metallic map of the target model, which is used as the target texture.
[0080] For specific implementation details, please refer to [link / reference]. Figure 10 The terminal device can target the initial source image ( Figure 10 The image (a) in the image is desaturated to obtain the result. Figure 10 Image (b) is shown in the image; then, adjust the levels of the desaturated image (the whiter the image, the stronger the metallic effect; the darker the image, the weaker the metallic effect) to obtain the desired result. Figure 10 Image (c) in the image is the target image; finally, the RGB layer information of the target image is obtained and pasted into the G channel of the "m image" to obtain the metallicity image.
[0081] Since the target model used in the example of this application has no metal parts, the metallicity map can be filled with black directly. Finally, the other two maps are put into the channel in turn to quickly obtain a matching "m map", that is, a hybrid texture map.
[0082] In one embodiment, the channel information includes grayscale channel information, and step S203 includes: acquiring the light occlusion image of the normal map as the target image; acquiring the three-channel layer information of the target image, and mixing the three-channel layer information and the grayscale channel information to obtain the ambient light occlusion map of the target model as the target texture.
[0083] For specific implementation details, please refer to [link / reference]. Figure 11 To obtain the ambient occlusion map of the target model, the terminal device can import the normal map of the target model into the Photoshop plugin "Quixel SUITE" to directly obtain the occlusion image, such as... Figure 11 As shown. Finally, obtain the RGB layer information of the target image and paste it into the A channel of "m image" to obtain the ambient light occlusion map.
[0084] S204 renders and displays the target model based on the target texture and normal map.
[0085] In a specific implementation, this application embodiment proposes that the terminal device can pre-download the model rendering engine software package, install and log in to the model rendering engine on the terminal device, and then use the model rendering engine to read any target model, normal map, and at least one of roughness map, metallicity map, and ambient occlusion map set according to actual business needs, thereby obtaining, as shown in the figure. Figure 12 The spherical rendering effect shown.
[0086] In one embodiment, step S204 includes: rendering and displaying the target model based on a preset display shape, a target texture map, and a normal texture map; wherein the display shape includes at least one of a sphere, a cube, a cylinder, and a flat circle.
[0087] In practice, after the terminal device obtains the target texture and normal map (and even the color map), it can apply each texture to the designated position on the target model one by one, and display it based on a preset display shape, such as... Figure 12 The spherical effect shown is illustrated. Although only the above-mentioned shapes are listed in the embodiments of this application, other shapes can also be displayed as model rendering technology continues to develop. The specific embodiments of this application are not limited to these shapes.
[0088] In the above embodiments, the terminal device obtains the normal map of the target model by acquiring a layered image of the target model to be rendered and performing normal mapping on the layered image. Then, based on the channel information of the normal map, the target texture of the target model can be obtained. The target texture includes at least one of a roughness map, a metallicity map, and an ambient occlusion map. Finally, the target model is rendered and displayed based on the target texture and the normal map. Therefore, the solution proposed in this application can quickly convert other textures using normal maps, thereby efficiently achieving the PBR effect of the model. This reduces the cost of texture production, thus reducing the model rendering cost, and improves the model rendering accuracy through detail optimization. It perfectly solves the problems of grayness, flatness, and messiness in game scenes, fully meeting the user's game needs.
[0089] It should be understood that, although Figure 1 , Figure 2 , Figure 4 The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order in which these steps are executed, and they can be performed in other orders. Figure 1 , Figure 2 , Figure 4At least some of the steps in the process may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.
[0090] To better implement the model rendering method provided in the embodiments of this application, based on the model rendering method proposed in the embodiments of this application, this application also provides a model rendering apparatus, such as... Figure 13 As shown, the model rendering device 1300 includes:
[0091] Image acquisition module 1310 is used to acquire layered images of the target model to be rendered;
[0092] The normal processing module 1320 is used to convert the layered image into a normal map to obtain the normal map of the target model.
[0093] The texture acquisition module 1330 is used to acquire the target texture of the target model based on the channel information of the normal map; wherein, the target texture includes at least one of the roughness map, metallicity map and ambient occlusion map;
[0094] The model rendering module 1340 is used to render and display the target model based on the target texture and normal map.
[0095] In one embodiment, the image acquisition module 1310 is further configured to acquire an initial material image of the target model to be rendered; based on a preset line interlacing strategy, perform hierarchical analysis on the target content in the initial material image to obtain a layered image; wherein the target content includes at least one of the main content, background content, and border content.
[0096] In one embodiment, the normal processing module 1320 is further configured to perform normal-to-normal processing on the layered image to obtain a normal-to-normal layered image; perform detail optimization processing on the normal-to-normal layered image according to the layer type of the layered image to obtain an optimized layered image; and perform overlay occlusion compositing processing on the optimized layered image to obtain a normal map.
[0097] In one embodiment, the normal processing module 1320 is further configured to determine the operation mode information and transparency information of each layered image after normal conversion according to the layer type of the layered image; and to perform detail optimization processing on the layered images after normal conversion based on the operation mode information and transparency information to obtain an optimized layered image.
[0098] In one embodiment, the normal processing module 1320 is further configured to perform occlusion compositing on the optimized layered image to obtain a composite image; wherein the composite image contains the main content obtained through hierarchical analysis; the main content in the composite image is extracted to obtain target layer information; and based on the target layer information, the composite image is subjected to detail enhancement processing to obtain a normal map.
[0099] In one embodiment, the normal processing module 1320 is further configured to obtain target color channel information corresponding to the target layer information; perform grayscale processing on the synthesized image based on the target color channel information to obtain a grayscale image; and perform high-contrast preservation processing on the grayscale image to obtain a normal map.
[0100] In one embodiment, the channel information includes red channel information. The texture acquisition module 1330 is also used to acquire the initial material image of the target model to be rendered; to perform desaturation and reverse adjustment of the color levels on the initial material image to obtain the target image; to acquire the three-channel layer information of the target image, and to mix the three-channel layer information and the red channel information of the normal map to obtain the roughness map of the target model as the target texture.
[0101] In one embodiment, the channel information includes green channel information. The texture acquisition module 1330 is also used to acquire the initial material image of the target model to be rendered; to perform desaturation and level adjustment processing on the initial material image to obtain the target image; to acquire the three-channel layer information of the target image, and to mix the three-channel layer information and the green channel information of the normal map to obtain the metallic map of the target model as the target texture.
[0102] In one embodiment, the channel information includes grayscale channel information. The texture acquisition module 1330 is also used to acquire the light occlusion image of the normal map as the target image; acquire the three-channel layer information of the target image, and mix the three-channel layer information and the grayscale channel information to obtain the ambient light occlusion map of the target model as the target texture.
[0103] In one embodiment, the model rendering module 1340 is further configured to render and display a target model based on a preset display shape, a target texture map, and a normal texture map; wherein the display shape includes at least one of a sphere, a cube, a cylinder, and a flat circle.
[0104] In the above embodiments, the terminal device obtains the normal map of the target model by acquiring a layered image of the target model to be rendered and performing normal mapping on the layered image. Then, based on the channel information of the normal map, the target texture of the target model can be obtained. The target texture includes at least one of a roughness map, a metallicity map, and an ambient occlusion map. Finally, the target model is rendered and displayed based on the target texture and the normal map. Therefore, the solution proposed in this application can quickly convert other textures using normal maps, thereby efficiently achieving the PBR effect of the model. This reduces the cost of texture production, thus reducing the model rendering cost, and improves the model rendering accuracy through detail optimization. It perfectly solves the problems of grayness, flatness, and messiness in game scenes, fully meeting the user's game needs.
[0105] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 14 As shown, the computer device includes a processor, internal memory, a communication interface, a display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage medium. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, carrier networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements a model rendering method. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad on the computer device's casing, or an external keyboard, touchpad, or mouse.
[0106] Those skilled in the art will understand that Figure 14 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0107] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0108] Obtain the layered image of the target model to be rendered;
[0109] The layered image is converted to normals to obtain the normal map of the target model;
[0110] Based on the channel information of the normal map, the target texture of the target model is obtained; wherein, the target texture includes at least one of the roughness map, metallicity map and ambient occlusion map;
[0111] The target model is rendered and displayed based on the target texture and normal map.
[0112] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0113] Obtain the initial source image of the target model to be rendered; based on the preset line interlacing strategy, perform hierarchical analysis on the target content in the initial source image to obtain a layered image; wherein, the target content includes at least one of the main content, background content, and border content.
[0114] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0115] The layered image is converted to normals to obtain a normalized layered image; according to the layer type of the layered image, the normalized layered image is optimized to obtain an optimized layered image; the optimized layered image is then subjected to occlusion compositing to obtain a normal map.
[0116] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0117] Based on the layer type of the layered image, the operation mode information and transparency information of each layered image after normal conversion are determined; based on the operation mode information and transparency information, the layered images after normal conversion are subjected to detail optimization processing to obtain the optimized layered image.
[0118] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0119] The optimized layered image is subjected to occlusion compositing to obtain a composite image; the composite image contains the main content obtained through hierarchical analysis; the main content in the composite image is extracted to obtain the target layer information; based on the target layer information, the composite image is subjected to detail enhancement processing to obtain a normal map.
[0120] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0121] Obtain the target color channel information corresponding to the target layer information; based on the target color channel information, perform grayscale processing on the synthesized image to obtain a grayscale image; perform high-pass processing on the grayscale image to obtain a normal map.
[0122] In one embodiment, the channel information includes red channel information, and the processor, when executing the computer program, further implements the following steps:
[0123] Obtain the initial source image of the target model to be rendered; perform desaturation and inverse level adjustment on the initial source image to obtain the target image; obtain the three-channel layer information of the target image, and mix the three-channel layer information with the red channel information of the normal map to obtain the roughness map of the target model, which is used as the target texture.
[0124] In one embodiment, the channel information includes green channel information, and the processor, when executing the computer program, further implements the following steps:
[0125] Obtain the initial source image of the target model to be rendered; perform desaturation and level adjustment on the initial source image to obtain the target image; obtain the three-channel layer information of the target image, and mix the three-channel layer information with the green channel information of the normal map to obtain the metallic map of the target model, which is used as the target texture.
[0126] In one embodiment, the channel information includes grayscale channel information, and the processor, when executing the computer program, further implements the following steps:
[0127] Obtain the occlusion image of the normal map as the target image; obtain the three-channel layer information of the target image, and mix the three-channel layer information with the grayscale channel information to obtain the ambient occlusion map of the target model as the target texture.
[0128] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0129] Based on the preset display shape, as well as the target texture and normal map, the target model is rendered and displayed; wherein, the display shape includes at least one of sphere, cube, cylinder and flat circle.
[0130] In the above embodiments, the terminal device obtains the normal map of the target model by acquiring a layered image of the target model to be rendered and performing normal mapping on the layered image. Then, based on the channel information of the normal map, the target texture of the target model can be obtained. The target texture includes at least one of a roughness map, a metallicity map, and an ambient occlusion map. Finally, the target model is rendered and displayed based on the target texture and the normal map. Therefore, the solution proposed in this application can quickly convert other textures using normal maps, thereby efficiently achieving the PBR effect of the model. This reduces the cost of texture production, thus reducing the model rendering cost, and improves the model rendering accuracy through detail optimization. It perfectly solves the problems of grayness, flatness, and messiness in game scenes, fully meeting the user's game needs.
[0131] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:
[0132] Obtain the layered image of the target model to be rendered;
[0133] The layered image is converted to normals to obtain the normal map of the target model;
[0134] Based on the channel information of the normal map, the target texture of the target model is obtained; wherein, the target texture includes at least one of the roughness map, metallicity map and ambient occlusion map;
[0135] The target model is rendered and displayed based on the target texture and normal map.
[0136] In one embodiment, when the computer program is executed by a processor, it further performs the following steps:
[0137] Obtain the initial source image of the target model to be rendered; based on the preset line interlacing strategy, perform hierarchical analysis on the target content in the initial source image to obtain a layered image; wherein, the target content includes at least one of the main content, background content, and border content.
[0138] In one embodiment, when the computer program is executed by a processor, it further performs the following steps:
[0139] The layered image is converted to normals to obtain a normalized layered image; according to the layer type of the layered image, the normalized layered image is optimized to obtain an optimized layered image; the optimized layered image is then subjected to occlusion compositing to obtain a normal map.
[0140] In one embodiment, when the computer program is executed by a processor, it further performs the following steps:
[0141] Based on the layer type of the layered image, the operation mode information and transparency information of each layered image after normal conversion are determined; based on the operation mode information and transparency information, the layered images after normal conversion are subjected to detail optimization processing to obtain the optimized layered image.
[0142] In one embodiment, when the computer program is executed by a processor, it further performs the following steps:
[0143] The optimized layered image is subjected to occlusion compositing to obtain a composite image; the composite image contains the main content obtained through hierarchical analysis; the main content in the composite image is extracted to obtain the target layer information; based on the target layer information, the composite image is subjected to detail enhancement processing to obtain a normal map.
[0144] In one embodiment, when the computer program is executed by a processor, it further performs the following steps:
[0145] Obtain the target color channel information corresponding to the target layer information; based on the target color channel information, perform grayscale processing on the synthesized image to obtain a grayscale image; perform high-pass processing on the grayscale image to obtain a normal map.
[0146] In one embodiment, the channel information includes red channel information, and the computer program, when executed by the processor, further implements the following steps:
[0147] Obtain the initial source image of the target model to be rendered; perform desaturation and inverse level adjustment on the initial source image to obtain the target image; obtain the three-channel layer information of the target image, and mix the three-channel layer information with the red channel information of the normal map to obtain the roughness map of the target model, which is used as the target texture.
[0148] In one embodiment, the channel information includes green channel information, and the computer program, when executed by the processor, further implements the following steps:
[0149] Obtain the initial source image of the target model to be rendered; perform desaturation and level adjustment on the initial source image to obtain the target image; obtain the three-channel layer information of the target image, and mix the three-channel layer information with the green channel information of the normal map to obtain the metallic map of the target model, which is used as the target texture.
[0150] In one embodiment, the channel information includes grayscale channel information, and the computer program, when executed by a processor, further implements the following steps:
[0151] Obtain the occlusion image of the normal map as the target image; obtain the three-channel layer information of the target image, and mix the three-channel layer information with the grayscale channel information to obtain the ambient occlusion map of the target model as the target texture.
[0152] In one embodiment, when the computer program is executed by a processor, it further performs the following steps:
[0153] Based on the preset display shape, as well as the target texture and normal map, the target model is rendered and displayed; wherein, the display shape includes at least one of sphere, cube, cylinder and flat circle.
[0154] In the above embodiments, the terminal device obtains a layered image of the target model to be rendered and performs normal mapping on the layered image to obtain a normal map of the target model. Then, based on the channel information of the normal map, a target texture of the target model can be obtained. The target texture includes at least one of a roughness map, a metallicity map, and an ambient occlusion map. Finally, the target model is rendered and displayed based on the target texture and the normal map. Therefore, the solution proposed in this application can reduce texture creation costs, thereby reducing model rendering costs, and also improve model rendering accuracy through detail optimization, fully meeting the user's game needs.
[0155] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, or optical storage, etc. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.
[0156] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0157] The foregoing has provided a detailed description of a model rendering method, apparatus, computer device, and computer-readable storage medium provided in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A model rendering method, characterized by, include: Obtain a layered image of the target model to be rendered, wherein the layered image is obtained by performing layered analysis on the initial source image of the target model; The layered image is converted to a normal map to obtain the normal map of the target model. Based on the channel information of the normal map, the target texture of the target model is obtained; wherein, the target texture includes at least one of a roughness map, a metallicity map, and an ambient occlusion map; The target model is rendered and displayed based on the target texture and the normal map; the target model is a model with PBR effect. The step of converting the layered image to normals to obtain the normal map of the target model includes: The layered image is converted to normals to obtain a layered image after normal conversion; Based on the layer type of the layered image, the layered image after normal conversion is subjected to detail optimization processing to obtain an optimized layered image; The optimized layered image is subjected to occlusion synthesis processing to obtain the normal map; The process of obtaining the layered image of the target model to be rendered includes: Obtain the initial source images of the target model to be rendered; Based on a preset line interlacing strategy, a hierarchical analysis is performed on the target content in the initial material image to obtain the layered image; The target content includes at least one of the main content, background content, and border content.
2. The method as described in claim 1, characterized in that, The step of performing detail optimization processing on the converted layered image according to the layer type of the layered image to obtain an optimized layered image includes: Based on the layer type of the layered image, determine the operation mode information and transparency information of each layered image after normal conversion; Based on the operation mode information and the transparency information, the layered image after normal conversion is subjected to detail optimization processing to obtain the optimized layered image.
3. The method as described in claim 1, characterized in that, The step of performing occlusion synthesis on the optimized layered image to obtain the normal map includes: The optimized layered image is subjected to occlusion compositing processing to obtain a composite image; wherein the composite image contains the main content obtained through hierarchical analysis; Extract the main content from the synthesized image to obtain the target layer information; Based on the target layer information, the synthesized image is subjected to detail enhancement processing to obtain the normal map.
4. The method as described in claim 3, characterized in that, The step of performing detail enhancement processing on the synthesized image based on the target layer information to obtain the normal map includes: Obtain the target color channel information corresponding to the target layer information; Based on the target color channel information, the synthesized image is converted to grayscale to obtain a grayscale image; The grayscale image is subjected to high-contrast preservation processing to obtain the normal map.
5. The method as described in claim 1, characterized in that, The channel information includes red channel information. Obtaining the target texture of the target model based on the channel information of the normal map includes: Obtain the initial source images of the target model to be rendered; The initial source image is desaturated and its levels are adjusted in reverse to obtain the target image; The three-channel layer information of the target image is obtained, and the three-channel layer information is mixed with the red channel information of the normal map to obtain the roughness map of the target model, which is used as the target texture.
6. The method as described in claim 1, characterized in that, The channel information includes green channel information. Obtaining the target texture of the target model based on the channel information of the normal map includes: Obtain the initial source images of the target model to be rendered; The initial source image is desaturated and its levels are adjusted to obtain the target image; The three-channel layer information of the target image is obtained, and the three-channel layer information is mixed with the green channel information of the normal map to obtain the metallic map of the target model, which is used as the target texture.
7. The method as described in claim 1, characterized in that, The channel information includes grayscale channel information. Obtaining the target texture of the target model based on the channel information of the normal map includes: Obtain the light occlusion image of the normal map as the target image; The three-channel layer information of the target image is obtained, and the three-channel layer information and the grayscale channel information are mixed to obtain the ambient light occlusion map of the target model, which is used as the target texture.
8. The method as described in claim 1, characterized in that, The step of rendering and displaying the target model based on the target texture and the normal map includes: Based on the preset display shape, as well as the target texture and the normal texture, the target model is rendered and displayed. The display shape includes at least one of a sphere, a cube, a cylinder, and a flat circle.
9. A model rendering device, characterized in that, include: The image acquisition module is used to acquire layered images of the target model to be rendered. The layered images are obtained by performing layered analysis on the initial source images of the target model. The normal processing module is used to convert the layered image into a normal map to obtain the normal map of the target model. The texture acquisition module is used to acquire the target texture of the target model based on the channel information of the normal map; wherein, the target texture includes at least one of a roughness map, a metallicity map, and an ambient occlusion map; The model rendering module is used to render and display the target model based on the target texture and the normal map; the target model is a model with PBR effect; The step of converting the layered image to normals to obtain the normal map of the target model includes: The layered image is converted to normals to obtain a layered image after normal conversion; Based on the layer type of the layered image, the layered image after normal conversion is subjected to detail optimization processing to obtain an optimized layered image; The optimized layered image is subjected to occlusion synthesis processing to obtain the normal map; The process of obtaining the layered image of the target model to be rendered includes: Obtain the initial source images of the target model to be rendered; Based on a preset line interlacing strategy, a hierarchical analysis is performed on the target content in the initial material image to obtain the layered image; The target content includes at least one of the main content, background content, and border content.
10. A computer device, characterized in that, include: One or more processors; Memory; and one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to implement the model rendering method of any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that, It stores a computer program, which is loaded by a processor to perform the steps of the model rendering method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Method for calculating surface roughness map of object
CN112700527A
Terrain model rendering method and device, electronic equipment and storage medium
CN113546410A
Seat map rendering method and device, seat map editing method and device and terminal equipment
CN113947450A