Method, device, electronic device and storage medium for drawing inner lines

By using normal maps and ambient occlusion maps for edge detection and brightness adjustment in the physical rendering model, an inner line map is generated and superimposed with the diffuse map, which solves the problem of low line drawing efficiency in the existing technology and achieves an efficient cartoon effect.

CN113936020BActive Publication Date: 2025-10-10NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111089279.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-16
Publication Date
2025-10-10
Estimated Expiration
2041-09-16

AI Technical Summary

Technical Problem

In existing technologies, in physically based rendering models, the tracing methods for cartoon effects are inefficient and have poor integrity. In particular, the native line method and direct drawing method have the problems of high cost and low efficiency.

Method used

By obtaining the normal map and ambient occlusion map of the target model, edge detection and brightness adjustment are performed to generate an inner line map, which is then superimposed with the diffuse map to achieve fast inner line drawing.

Benefits of technology

Improves the efficiency of inner line mapping of PBR models, avoids manual drawing and model UV coordinate adjustment, and improves the integrity of the map stroke.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113936020B_ABST
    Figure CN113936020B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of image rendering, and discloses an inner hatching drawing method and device, electronic equipment and a storage medium, which are used for improving the inner hatching mapping drawing efficiency of a PBR model and improving the integrity of mapping hatching. The method comprises the following steps: obtaining a physical rendering PBR map of a target model, wherein the PBR map comprises a normal map, an ambient light shading map and a diffuse reflection map; generating an inner hatching according to the normal map and the ambient light shading map to obtain an inner hatching map of the target model; and superimposing the inner hatching map and the diffuse reflection map to obtain an inner hatching image of the target model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image rendering technology, and in particular to a method, device, electronic device and storage medium for drawing an inner line. Background Art

[0002] In the field of non-photorealistic rendering (NPR), characters are often depicted using lines to achieve a cartoon-like effect. However, physically-based rendering (PBR) models lack direct support for non-photorealistic strokes. If you want a PBR model to achieve a cartoon-like effect, supporting NPR strokes on top of PBR is crucial.

[0003] There are two main solutions available: one is to use the Honmura line method to draw UV lines, and the other is to draw directly on the texture. The Honmura line method is costly and inefficient, while the direct drawing method has poor overall quality and low efficiency. Summary of the Invention

[0004] The present invention provides a method, device, electronic device and storage medium for drawing inner lines, which are used to improve the efficiency of drawing inner line maps of PBR models and improve the integrity of map strokes.

[0005] A first aspect of an embodiment of the present invention provides a method for drawing an inner line, comprising: obtaining a physically based rendering (PBR) map of a target model, the PBR map including a normal map, an ambient occlusion map, and a diffuse reflection map; generating inner lines according to the normal map and the ambient occlusion map to obtain an inner line map of the target model; and during the rendering process, superimposing the inner line map with the diffuse reflection map to obtain an inner line image of the target model.

[0006] In a feasible implementation, the generating of inner lines based on the normal map and the ambient occlusion map to obtain the inner line map of the target model includes: stroking the normal map and the ambient occlusion map to generate a first stroke map and a second stroke map; and superimposing the first stroke map and the second stroke map to obtain the inner line map of the target model.

[0007] In a feasible implementation, stroking the normal map and the ambient occlusion map to generate a first stroked map and a second stroked map includes: performing edge detection on the normal map and the ambient occlusion map, respectively, to obtain a first contour image and a second contour image; and performing brightness adjustment on the first contour image and the second contour image, respectively, to obtain a first stroked map and a second stroked map.

[0008] In a feasible implementation, the performing edge detection on the normal map and the ambient occlusion map respectively to obtain a first contour image and a second contour image includes: calling a Prewitt operator with a horizontal radius of 1 and a vertical radius of 1 to perform convolution with the normal map to obtain the first contour image; calling a Prewitt operator with a horizontal radius of 1 and a vertical radius of 1 to perform convolution with the ambient occlusion map to obtain the second contour image.

[0009] In a feasible embodiment, the brightness adjustment of the first contour image and the second contour image is performed respectively to obtain the first stroke map and the second stroke map, including: inverting the first contour image and the second contour image to obtain the first inverted image and the second inverted image; curve adjusting the first inverted image and the second inverted image to obtain the first curve image and the second curve image; and color level filtering the first curve image and the second curve image to obtain the first stroke map and the second stroke map.

[0010] In a feasible implementation, superimposing the first stroke map and the second stroke map to obtain the inner line map of the target model includes: superimposing and synthesizing the first stroke map and the second stroke map by a dodge synthesis method to obtain the inner line map of the target model.

[0011] In a feasible implementation, the first stroke map and the second stroke map are superimposed and synthesized by a dodge synthesis method to obtain the inner stroke map of the target model, including: adjusting the layer property of the first stroke map to a dark color to obtain the adjusted first stroke map; superimposing the adjusted first stroke map on top of the second stroke map and setting the color value to a minimum value to obtain the inner stroke map of the target model.

[0012] In a feasible implementation, the first stroke map and the second stroke map are superimposed and synthesized by a dodge synthesis method to obtain the inner stroke map of the target model, including: adjusting the layer property of the second stroke map to a dark color to obtain the adjusted second stroke map; superimposing the adjusted second stroke map on top of the first stroke map and setting the color value to a minimum value to obtain the inner stroke map of the target model.

[0013] In a feasible embodiment, during the rendering process, the inner line map is superimposed with the diffuse reflection map to obtain the inner line image of the target model, including: during the rendering process, adding a texture slot corresponding to the inner line map and a texture slot corresponding to the diffuse reflection map in the shader; importing the inner line map and the diffuse reflection map into corresponding texture slots respectively; and synthesizing the inner line map and the diffuse reflection map by a multiply synthesis method to obtain the inner line image of the target model.

[0014] A second aspect of an embodiment of the present invention provides a device for drawing inner lines, including: a texture acquisition module for acquiring a physically rendered PBR texture of a target model, wherein the PBR texture includes a normal map, an ambient occlusion map, and a diffuse reflection map; a texture generation module for generating inner lines based on the normal map and the ambient occlusion map to obtain an inner line texture of the target model; and a texture overlay module for overlaying the inner line texture with the diffuse reflection map during the rendering process to obtain an inner line image of the target model.

[0015] In a feasible embodiment, the map generation module includes: a stroke sub-module, which is used to stroke the normal map and the ambient occlusion map to generate a first stroke map and a second stroke map; and an overlay sub-module, which is used to overlay the first stroke map and the second stroke map to obtain an inner stroke map of the target model.

[0016] In a feasible embodiment, the stroke sub-module includes: an edge detection unit, which is used to perform edge detection on the normal map and the ambient occlusion map respectively to obtain a first contour image and a second contour image; a brightness adjustment unit, which is used to perform brightness adjustment on the first contour image and the second contour image respectively to obtain a first stroke map and a second stroke map.

[0017] In a feasible embodiment, the edge detection unit is specifically used to: call a Prewitt operator with a horizontal radius of 1 and a vertical radius of 1 to convolve with the normal map to obtain a first contour image; call a Prewitt operator with a horizontal radius of 1 and a vertical radius of 1 to convolve with the ambient occlusion map to obtain a second contour image.

[0018] In a feasible embodiment, the brightness adjustment unit is specifically used to: perform inversion adjustment on the first contour image and the second contour image to obtain a first inverted image and a second inverted image; perform curve adjustment on the first inverted image and the second inverted image to obtain a first curve image and a second curve image; perform color level filtering on the first curve image and the second curve image to obtain a first stroke map and a second stroke map.

[0019] In a feasible implementation, the superposition submodule includes: a superposition unit, which superimposes and synthesizes the first stroke map and the second stroke map in a dodge synthesis manner to obtain an inner stroke map of the target model.

[0020] In a feasible embodiment, the overlay unit is specifically used to: adjust the layer properties of the first stroke map to a dark color to obtain an adjusted first stroke map; overlay the adjusted first stroke map on top of the second stroke map and set the color value to a minimum value to obtain an inner stroke map of the target model.

[0021] In a feasible embodiment, the overlay unit is further specifically used to: adjust the layer properties of the second stroke map to a dark color to obtain an adjusted second stroke map; overlay the adjusted second stroke map on top of the first stroke map and set the color value to a minimum value to obtain an inner stroke map of the target model.

[0022] In a feasible implementation, the texture overlay module is specifically used to: during the rendering process, add a texture slot corresponding to the inner line map and a texture slot corresponding to the diffuse reflection map in the shader; import the inner line map and the diffuse reflection map into the corresponding texture slots respectively; synthesize the inner line map and the diffuse reflection map by a positive overlay synthesis method to obtain an inner line image of the target model.

[0023] A third aspect of an embodiment of the present invention provides an electronic device, comprising: a memory and at least one processor, wherein the memory stores instructions; the at least one processor calls the instructions in the memory to enable the electronic device to execute the above-mentioned inner line drawing method.

[0024] A fourth aspect of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the above-mentioned method for drawing an inner line.

[0025] In the technical solution provided by the embodiment of the present invention, a physically based rendering (PBR) map of the target model is obtained. The PBR map includes a normal map, an ambient occlusion map, and a diffuse reflectance map. Inline drawing is generated based on the normal map and the ambient occlusion map to obtain an inline map of the target model. The inline map is superimposed with the diffuse reflectance map to obtain an inline image of the target model. The embodiment of the present invention quickly generates an inline map through edge detection, avoiding the need to manually draw inline lines or adjust the model's UV coordinates, shortening the drawing time, improving the efficiency of drawing the inline map of the PBR model, and enhancing the integrity of the map stroke. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] Figure 1 A schematic diagram of an embodiment of a method for drawing an inner line in an embodiment of the present invention;

[0027] Figure 2 A schematic diagram of another embodiment of a method for drawing an inner line according to an embodiment of the present invention;

[0028] Figure 3 A schematic diagram of another embodiment of a method for drawing an inner line according to an embodiment of the present invention;

[0029] Figure 4 is a schematic diagram of a normal map in an embodiment of the present invention;

[0030] Figure 5 is the normal map after inversion processing in an embodiment of the present invention;

[0031] Figure 6 is the normal map after curve processing in an embodiment of the present invention;

[0032] Figure 7 is the normal map after color scale processing in an embodiment of the present invention;

[0033] Figure 8 A schematic diagram of an embodiment of a device for drawing an inner line according to an embodiment of the present invention;

[0034] Figure 9 is a schematic diagram of an embodiment of an electronic device according to an embodiment of the present invention;

[0035] Figure 10 Schematic diagram of a target model with the inner line drawing function turned off in an embodiment of the present invention;

[0036] Figure 11Schematic diagram of a target model with the inner line drawing function enabled in an embodiment of the present invention. DETAILED DESCRIPTION

[0037] The present invention provides a method, device, electronic device and storage medium for drawing inner lines, which are used to improve the efficiency of drawing inner line maps of PBR models and improve the integrity of map strokes.

[0038] It is understandable that the present invention can be applied to electronic devices. As an example but not a limitation, the electronic device can be a server. This application is described using a server as an example.

[0039] The terms "first," "second," "third," "fourth," and the like (if any) in the description and claims of the present invention and in the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a particular order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments of the invention described herein can, for example, be implemented in orders other than those illustrated or described herein. In addition, the terms "including" and "having," as well as any variations thereof, are intended to cover non-exclusive inclusions, e.g., a process, method, system, product, or apparatus comprising 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 such processes, methods, products, or apparatus.

[0040] It should be understood that this solution is mainly used in the art production process to render scenes for game character models, implement the tracing function of the NRP model through the PBR model, and then achieve a cartoon effect on the PBR model.

[0041] In one feasible embodiment, the method for drawing an inner line can be executed on a terminal device or a server. The terminal device can be a local terminal device. When the method for drawing an inner line is executed 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 a client device.

[0042] In an embodiment, the cloud interaction system can run various cloud applications, such as cloud gaming. In the cloud gaming, the running subject and the game picture presenting subject are separated, and the storage and running of the method for determining the anti-mis-touch area are completed on the cloud gaming server. The client device is used for receiving and sending data and presenting the game picture. For example, the client device can be a display device close to the user side with a data transmission function, such as a mobile terminal, a television, a computer, a palm computer, etc. However, the terminal device for information processing is the cloud gaming server in the cloud. During the game, the player operates the client device to send operation instructions to the cloud gaming server, the cloud gaming server runs the game according to the operation instructions, encodes and compresses the game picture and other data, returns the data to the client device through the network, and finally decodes and outputs the game picture through the client device.

[0043] In an embodiment, the terminal device can be a local terminal device. For example, the local terminal device stores a game program and is used for presenting a game picture. The local terminal device is used for interacting with the player through a graphical user interface, that is, a conventional game program is downloaded and installed on an electronic device and is run. The local terminal device can provide the graphical user interface to the player in various ways, for example, the graphical user interface can be rendered and displayed on the display screen of the terminal, or the graphical user interface can be provided to the player through holographic projection. For example, the local terminal device can include a display screen for presenting a graphical user interface including a game picture and a processor for running the game, generating the graphical user interface, and controlling the display of the graphical user interface on the display screen.

[0044] In an embodiment, the present application provides a method for drawing an inner stroke, and a graphical user interface is provided through a terminal device. The terminal device can be a local terminal device or a client device in the cloud interaction system.

[0045] Referring to Figure 1 The method for drawing an inner stroke provided by the present application includes the following steps:

[0046] 101. Obtain a physical-based rendering (PBR) map of a target model, the PBR map including a normal map, an ambient occlusion map, and a diffuse map.

[0047] The server first determines a target model that needs to be drawn with an inner stroke, and then calls a PBR baker to bake a PBR map of the target model, wherein the PBR map includes a normal map, an ambient occlusion map, and a diffuse map.

[0048] It should be noted that the normal map, diffuse map, and ambient occlusion (AO) map involved in the embodiments of the present application all have the characteristics of being able to segment images and generate contours under the PBR framework.

[0049] 102. Generate inner lines according to the normal map and the ambient occlusion map to obtain an inner line map of the target model.

[0050] The server performs inner-line rendering on the normal map and the ambient occlusion map respectively to obtain an inner-line image corresponding to the normal map and an inner-line image corresponding to the ambient occlusion map. The inner-line image corresponding to the normal map and the inner-line image corresponding to the ambient occlusion map are then layer-merged to generate an inner-line map of the target model.

[0051] It is understandable that the target model may be an object or a character in the game image, which is not specifically limited here.

[0052] 103. During the rendering process, the inner line map is superimposed with the diffuse reflection map to obtain the inner line image of the target model.

[0053] During the rendering process, the server places the diffuse map at the bottom and superimposes the inner line map directly above the diffuse map, thereby obtaining an inner line image of the target model.

[0054] The embodiments of the present invention quickly generate an inner line map through edge detection, avoiding manual drawing of inner lines or adjusting the UV coordinates of the model, shortening the drawing time, improving the efficiency of inner line map drawing of the PBR model, and improving the integrity of the map stroke.

[0055] See also Figure 2 , another flow chart of the method for drawing an inner line provided by an embodiment of the present invention, specifically comprising:

[0056] 201. Obtain the physically based rendering PBR map of the target model. The PBR map includes a normal map, an ambient occlusion map, and a diffuse map.

[0057] The server first determines the target model that needs to be drawn inline, and then calls the PBR baker to bake the PBR map of the target model, where the PBR map includes the normal map, ambient occlusion map and diffuse map.

[0058] It should be noted that the normal map, diffuse map, and AO map involved in the embodiments of the present application all have the characteristics of being able to segment images and generate contours under the PBR framework.

[0059] 202. Stroke the normal map and the ambient occlusion map to generate a first stroke map and a second stroke map.

[0060] Specifically, the server performs edge detection on the normal map and the ambient occlusion map respectively to obtain a first contour image and a second contour image; the server performs brightness adjustment on the first contour image and the second contour image respectively to obtain a first stroke map and a second stroke map.

[0061] The server performs edge detection on the normal map and the ambient occlusion map respectively to obtain the first contour image and the second contour image, which may include:

[0062] The server calls a Prewitt operator with a horizontal radius of 1 and a vertical radius of 1 to convolve with the normal map to obtain a first contour image; the server calls a Prewitt operator with a horizontal radius of 1 and a vertical radius of 1 to convolve with the ambient occlusion map to obtain a second contour image.

[0063] The above-mentioned Prewitt operator generally uses the grayscale value difference of the upper and lower pixels and the left and right pixels of the pixel to perform two convolutions on the X-axis and Y-axis of the image space to extract the edge of the object. In this embodiment, the Prewitt operator is used to extract the contour of the target model from the normal map and the ambient occlusion map. It can be understood that in addition to using the Prewitt operator, other operators can also be used for contour extraction, such as the Roberts operator or the Laplacian operator. Specifically, compared with the Prewitt operator, the Roberts operator will introduce some noise because the template used is 2*2 in size, but it can also complete the extraction of edge contours.

[0064] It should be noted that in this embodiment, the horizontal radius and vertical radius of the Prewitt operator can only be 1 and cannot be other values. There are generally strokes with a pixel size of 1 in the texture. If set to other values, the extraction of strokes with smaller pixels will fail.

[0065] It can be understood that there is no necessary order for the processing of the normal map and the ambient occlusion map. The normal map can be stroked first to obtain a first stroked map corresponding to the normal map, and then the ambient occlusion map can be stroked to obtain a second stroked map corresponding to the ambient occlusion map. The ambient occlusion map can also be stroked first to obtain a second stroked map corresponding to the ambient occlusion map, and then the normal map can be stroked to obtain a first stroked map corresponding to the normal map. The strokes can also be performed simultaneously, and the specific order is not limited here.

[0066] 203. Superimpose the first stroke map and the second stroke map to obtain an inner stroke map of the target model.

[0067] Specifically, the server superimposes and synthesizes the first stroke map and the second stroke map by a fade-out synthesis manner to obtain an inner stroke line map of the target model. It should be noted that there is no specific requirement for the synthesis order of the first stroke map and the second stroke map. The first stroke map can be placed in the lower layer, and the second stroke map can be placed in the upper layer, or the first stroke map can be placed in the upper layer, and the second stroke map can be placed in the lower layer. The specific place is not limited here.

[0068] 204、In the rendering process, the inner stroke line map is superimposed with the diffuse reflection map to obtain an inner stroke line image of the target model.

[0069] Specifically, in the rendering process, the server adds a map slot corresponding to the inner stroke line map and a map slot corresponding to the diffuse reflection map in the shader; the server imports the inner stroke line map and the diffuse reflection map into the corresponding map slots respectively; the server synthesizes the inner stroke line map and the diffuse reflection map by a positive-negative synthesis manner to obtain an inner stroke line image of the target model. As an example but not limitation, the diffuse reflection map is placed at the bottom, and the inner stroke line map is superimposed directly above the diffuse reflection map, so as to obtain an inner stroke line image of the target model.

[0070] In the embodiment of the application, the inner stroke line map is quickly generated by edge detection, manual drawing of the inner stroke line or adjustment of the model UV coordinates is avoided, the drawing time is shortened, the efficiency of drawing the inner stroke line map of the PBR model is improved, and the integrity of the map stroke is improved.

[0071] Please refer to Figure 3 The embodiment of the application provides another flowchart of the drawing method of the inner stroke line, and specifically includes:

[0072] 301、Obtain a physical-based rendering (PBR) map of a target model, and the PBR map includes a normal map, an ambient occlusion (AO) map and a diffuse reflection map.

[0073] The server first determines a target model that needs to be drawn with an inner stroke line, and then calls a PBR baker to bake a PBR map of the target model, wherein the PBR map includes a normal map, an ambient occlusion (AO) map and a diffuse reflection map.

[0074] It should be noted that the normal map, the diffuse reflection map and the AO map involved in the embodiment of the application all have the characteristics of a separable image and a generated contour under the PBR framework.

[0075] 302、Perform edge detection on the normal map and the ambient occlusion map respectively to obtain a first contour image and a second contour image.

[0076] The server performs edge detection on the normal map and the ambient occlusion map respectively to obtain the first contour image and the second contour image, which may include:

[0077] The server calls the Prewitt operator with a horizontal radius of 1 and a vertical radius of 1 and a normal map (such as Figure 4 The server calls a Prewitt operator with a horizontal radius of 1 and a vertical radius of 1 to perform convolution with the ambient occlusion map to obtain a second contour image.

[0078] For example, the first contour image G is obtained by convolving the X-axis template and the Y-axis template of the Prewitt operator with the normal map A, where

[0079] It is understandable that in this embodiment, the X-axis template and the Y-axis template in the Prewitt operator are selected, and other templates, such as the diagonal template, are not used in this embodiment because they easily cause edge jaggedness.

[0080] It should be noted that in this embodiment, the values ​​of the horizontal radius and the vertical radius can only be 1 and cannot be other values. There are generally strokes of 1 pixel in the texture. If set to other values, the extraction of strokes with smaller pixels will fail.

[0081] Image edges are the most fundamental features of images. Edges are defined as discontinuities in local image characteristics, such as sudden changes in grayscale or structure. In image processing, numerous operators can be used to extract image contours, including first-order and second-order operators. First-order operators include the Roberts operator, Sobel operator, Prewitt operator, and Kirsch operator, while second-order operators include the Laplacian operator and Canny operator. Each operator has distinct characteristics. For example, the Roberts operator, because its template only focuses on the changes of the 2*2 matrix, is not as comprehensive as Prewitt's 3*3 matrix, and its performance is inferior to the Prewitt operator. It has a good effect on processing steep low-noise images; for example, the Sobel operator adds weights on the basis of the Prewitt operator. The distance between adjacent points in the Sobel operator has different effects on the current pixel point. The closer the pixel point, the greater the influence on the current pixel, thereby achieving image sharpening and highlighting edge contours. It also has a certain smoothing effect while detecting edge contours, and has a good effect on images with grayscale gradients and more noise; for example, the Kirsch operator Similar to the Sobel operator, the Kirsch operator uses 8 convolution templates to calculate the gradient amplitude and direction of 8 directions of a certain point, and uses the maximum convolution value as the grayscale value of the point. It has a good effect on images with grayscale gradients and more noise. For example, the Laplacian operator has only one template, which makes it less sensitive to edges than the Prewitt operator and the Roberts operator. Slight changes are regarded as edges, thus introducing a lot of noise. For example, the Canny operator is not easily affected by noise, and different thresholds can be used to detect strong edges and weak edges respectively. The optimal edge profile is obtained by combining strong edges and weak edges. In the embodiment of the present application, the Prewitt operator is used as the optimal implementation method, and the Prewitt operator is used for edge extraction, which can clearly extract edges without introducing too much noise. Other operators can also be used to implement edge detection functions according to actual conditions, and there is no specific limitation here.

[0082] 303 : Perform brightness adjustment on the first outline image and the second outline image respectively to obtain a first stroke map and a second stroke map.

[0083] Specifically, the server performs inversion adjustment on the first contour image and the second contour image to obtain a first inverted image and a second inverted image; the server performs curve adjustment on the first inverted image and the second inverted image to obtain a first curve image and a second curve image; the server performs color level filtering on the first curve image and the second curve image to obtain a first stroke map and a second stroke map.

[0084] For example, the server can use a preset Krita tool to decolorize the first outline image and perform inversion adjustment to obtain a first inverted image (eg, Figure 5 As shown), the first inverted image has the opposite hue to the first outline image, and then the curve tool is used to brighten the first outline image as a whole, setting the input to 146 and the output to 225 to obtain the first curve image (as shown Figure 6 As shown), finally call the color level tool to filter the first curve image, set the input color level to 171-255, and set the output color level to 0-255 to obtain the first stroke map (as shown Figure 7 As shown in the figure, it is understood that when using the Curves and Scales tools to adjust an image, the input and output parameters can be set to other values ​​according to the actual situation. This embodiment is the optimal implementation method. The Curves tool is used to increase the overall brightness of the image, and the Scales tool uses a Scale method to filter the lower intensity portions of the lines extracted by the Prewitt operator.

[0085] It should be noted that, in the embodiment of the present invention, in addition to using the Krita tool, other software with a decolorization function may also be used, for example, Photoshop and other graphics software, which are not specifically limited here. Figure 5 As shown, the first contour image obtained after inversion adjustment is the black and white mask.

[0086] 304. The first stroke map and the second stroke map are superimposed and synthesized by a dodge synthesis method to obtain an inner stroke map of the target model.

[0087] Specifically, the server adjusts the layer property of the first stroke map to a dark color to obtain the adjusted first stroke map; the server overlays the adjusted first stroke map on top of the second stroke map and sets the color value to the minimum value to obtain the inner stroke map of the target model; or, the server adjusts the layer property of the second stroke map to a dark color to obtain the adjusted second stroke map; the server overlays the adjusted second stroke map on top of the first stroke map and sets the color value to the minimum value to obtain the inner stroke map of the target model.

[0088] It should be noted that there is no specific requirement for the synthesis order of the first stroke map and the second stroke map. The layer properties of the first stroke map can be set to normal and placed on the lower layer, and the layer properties of the second stroke map can be set to dark and placed on the upper layer. Alternatively, the layer properties of the first stroke map can be set to dark and placed on the upper layer, and the layer properties of the second stroke map can be set to normal and placed on the lower layer. There is no specific limitation here.

[0089] It can be understood that the final inner stroke map consists of the normal part (first stroke map) and the AO part (second stroke map), which are merged into the final output through the darkened layer, O=O(A N )+O(A AO ), where A N For the normal map part, A AO This is the ambient occlusion map part.

[0090] During the rendering process, the inner line map is superimposed on the diffuse reflection map to obtain an inner line image of the target model.

[0091] Specifically, the server adds a texture slot corresponding to the inner line map and a texture slot corresponding to the diffuse map in the shader; the server imports the inner line map and the diffuse map into the corresponding texture slots; and the server synthesizes the inner line map and the diffuse map using a multiply synthesis method to obtain an inner line image of the target model. By way of example and not limitation, the diffuse map is placed at the bottom and the inner line map is superimposed directly above the diffuse map to obtain an inner line image of the target model, which is then used as the final rendered image.

[0092] In one feasible embodiment, before obtaining the physically based rendering (PBR) map of the target model, the method further includes: obtaining a user instruction, wherein the activation instruction is used to instruct to turn on or off the inner line drawing function. When the acquired instruction information is an activation instruction, the above-mentioned inner line drawing method is executed, that is, steps 101-103, steps 201-204, or steps 301-305 are executed; when the acquired instruction information is an activation instruction, the inner line drawing method is replaced by calling the PBR map of the target model.

[0093] The embodiments of the present invention quickly generate an inner line map through edge detection, avoiding manual drawing of inner lines or adjusting the UV coordinates of the model, shortening the drawing time, improving the efficiency of inner line map drawing of the PBR model, and improving the integrity of the map stroke.

[0094] The above describes the method for drawing inner lines in the embodiment of the present invention. The following describes the device for drawing inner lines in the embodiment of the present invention. Figure 8 An embodiment of the device for drawing an inner line in an embodiment of the present invention includes:

[0095] A texture acquisition module 801 is used to acquire a physically based rendering (PBR) texture of a target model, wherein the PBR texture includes a normal map, an ambient occlusion map, and a diffuse map;

[0096] A texture generation module 802 is configured to generate an inner line drawing according to the normal map and the ambient occlusion map to obtain an inner line drawing map of the target model;

[0097] The map superposition module 803 is used to superimpose the inner line map and the diffuse reflection map to obtain an inner line image of the target model.

[0098] Optionally, the texture generation module 802 includes:

[0099] A stroke submodule 8021 is configured to stroke the normal map and the ambient occlusion map to generate a first stroke map and a second stroke map;

[0100] The superposition submodule 8022 is configured to superimpose the first stroke map and the second stroke map to obtain an inner stroke map of the target model.

[0101] Optionally, the stroke submodule 8021 includes:

[0102] An edge detection unit 80211 is configured to perform edge detection on the normal map and the ambient occlusion map to obtain a first contour image and a second contour image;

[0103] The brightness adjustment unit 80212 is configured to perform brightness adjustment on the first contour image and the second contour image respectively to obtain a first stroke map and a second stroke map.

[0104] Optionally, the edge detection unit 80211 is specifically configured to:

[0105] A Prewitt operator with a horizontal radius of 1 and a vertical radius of 1 is called to convolve with the normal map to obtain a first contour image; a Prewitt operator with a horizontal radius of 1 and a vertical radius of 1 is called to convolve with the ambient occlusion map to obtain a second contour image.

[0106] Optionally, the brightness adjustment unit 80212 is specifically configured to:

[0107] Performing inversion adjustment on the first contour image and the second contour image to obtain a first inverted image and a second inverted image;

[0108] Performing curve adjustment on the first inverted image and the second inverted image to obtain a first curve image and a second curve image;

[0109] Color scale filtering is performed on the first curve image and the second curve image to obtain a first stroke map and a second stroke map.

[0110] Optionally, the superposition submodule 8022 includes:

[0111] The superimposition unit 80221 has superimposed and synthesized the first outline map and the second outline map by means of a fade-out synthesis manner to obtain an inner outline map of the target model.

[0112] Optionally, the superimposition unit 80221 is specifically configured to:

[0113] adjust a layer attribute of the first outline map to be dark to obtain an adjusted first outline map;

[0114] superimpose the adjusted first outline map above the second outline map and set a color value to be the minimum value to obtain the inner outline map of the target model.

[0115] Optionally, the superimposition unit 80221 is specifically further configured to:

[0116] adjust a layer attribute of the second outline map to be dark to obtain an adjusted second outline map;

[0117] superimpose the adjusted second outline map above the first outline map and set a color value to be the minimum value to obtain the inner outline map of the target model.

[0118] Optionally, the map superimposition module 803 is specifically further configured to:

[0119] in a rendering process, increase a map slot corresponding to the inner outline map and a map slot corresponding to the diffuse reflection map in a shader;

[0120] import the inner outline map and the diffuse reflection map into the corresponding map slots, respectively;

[0121] synthesize the inner outline map and the diffuse reflection map by means of a positive-negative film superimposition synthesis manner to obtain an inner outline image of the target model.

[0122] In the embodiment of the application, the inner outline map is quickly generated through edge detection, manual drawing of the inner outline or adjustment of the model UV coordinate is avoided, the drawing time is shortened, the inner outline map drawing efficiency of the PBR model is improved, and the integrity of the map outline is improved.

[0123] Figure 9: is a structural diagram of an electronic device provided by an embodiment of the present invention. The electronic device 900 may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 910 (for example, one or more processors) and a memory 920, and one or more storage media 930 (for example, one or more mass storage devices) storing application programs 933 or data 932. Among them, the memory 920 and the storage medium 930 can be temporary storage or permanent storage. The program stored in the storage medium 930 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the electronic device 900. Furthermore, the processor 910 can be configured to communicate with the storage medium 930 to execute a series of instruction operations in the storage medium 930 on the electronic device 900.

[0124] The electronic device 900 may further include one or more power supplies 940, one or more wired or wireless network interfaces 950, one or more input and output interfaces 960, and / or one or more operating devices 931, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, etc. It will be understood by those skilled in the art that Figure 9 The illustrated structure of the electronic device does not limit the electronic device and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0125] As an example and not a limitation, the electronic device 900 may be a server or a terminal device.

[0126] It should be noted that the inner drawing line image of the target model can be generated or closed in real time according to the user's instructions. For example, when the inner drawing line function of the target model is closed, the target model Figure 10 As shown in FIG, in response to the user's instruction to turn on the inner drawing function, the physically based rendering PBR map of the target model is obtained. The PBR map includes a normal map, an ambient occlusion map, and a diffuse map. The inner drawing is generated according to the preset Prewitt operator, the normal map, and the ambient occlusion map to obtain the inner drawing map of the target model. The inner drawing map is superimposed with the diffuse map to obtain the inner drawing image of the target model. The inner drawing image of the target model is shown in FIG. Figure 11 shown.

[0127] The present invention also provides a computer-readable storage medium, which can be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. The computer-readable storage medium stores instructions, which, when executed on a computer, cause the computer to execute the steps of the inner line drawing method.

[0128] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0129] In addition, in the description of the embodiments of the present invention, unless otherwise expressly specified or limited, the terms "mounted," "connected," and "connected" should be understood in a broad sense. For example, they may refer to fixed connections, detachable connections, or integral connections; they may refer to mechanical connections or electrical connections; they may refer to direct connections or indirect connections through an intermediate medium; and they may refer to internal communication between two components. Those skilled in the art will understand the specific meanings of the above terms in the present invention based on the specific circumstances.

[0130] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0131] In the description of the present invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicating orientations or positional relationships, are based on the orientations or positional relationships shown in the accompanying drawings and are intended solely to facilitate and simplify the description of the present invention. They are not intended to indicate or imply that the devices or components referred to must have, be constructed, or operate in a specific orientation, and therefore should not be construed as limitations on the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.

[0132] Finally, it should be noted that the above embodiments are only specific implementation methods of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that any person skilled in the art can modify or easily conceive of changes to the technical solutions described in the above embodiments within the technical scope disclosed by the present invention, or replace some of the technical features therein with equivalents. Such modifications, changes or replacements do not deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.

Claims

1. A method for drawing an inner line, characterized in that: include: Obtain a physically based rendering (PBR) map of the target model, wherein the PBR map includes a normal map, an ambient occlusion map, and a diffuse map, and the PBR map is obtained by baking the target model; Generate an inner line according to the normal map and the ambient occlusion map to obtain an inner line map of the target model, wherein the inner line map is generated by edge detection; During the rendering process, the inner line map is superimposed on the diffuse reflection map to obtain an inner line image of the target model.

2. The method for drawing an inner line according to claim 1, wherein: The generating of the inner drawing line according to the normal map and the ambient occlusion map to obtain the inner drawing line map of the target model includes: Stroke the normal map and the ambient occlusion map to generate a first stroke map and a second stroke map; The first stroke map and the second stroke map are superimposed to obtain an inner stroke map of the target model.

3. The method for drawing an inner line according to claim 2, wherein: The step of stroking the normal map and the ambient occlusion map to generate a first stroke map and a second stroke map includes: Performing edge detection on the normal map and the ambient occlusion map respectively to obtain a first contour image and a second contour image; Brightness adjustment is performed on the first contour image and the second contour image respectively to obtain a first stroke map and a second stroke map.

4. The method for drawing an inner line according to claim 3, wherein: The performing edge detection on the normal map and the ambient occlusion map respectively to obtain a first contour image and a second contour image includes: Calling a Prewitt operator with a horizontal radius of 1 and a vertical radius of 1 to perform convolution on the normal map to obtain a first contour image; A Prewitt operator with a horizontal radius of 1 and a vertical radius of 1 is called to perform convolution with the ambient occlusion map to obtain a second contour image.

5. The method for drawing an inner line according to claim 3, wherein: The step of adjusting the brightness of the first contour image and the second contour image respectively to obtain a first stroke map and a second stroke map includes: Performing inversion adjustment on the first contour image and the second contour image to obtain a first inverted image and a second inverted image; performing curve adjustment on the first inverted image and the second inverted image to obtain a first curve image and a second curve image; Color scale filtering is performed on the first curve image and the second curve image to obtain a first stroke map and a second stroke map.

6. The method for drawing an inner line according to claim 2, wherein: The step of superimposing the first stroke map and the second stroke map to obtain an inner stroke map of the target model includes: The first stroke map and the second stroke map are superimposed and synthesized by a dodge synthesis method to obtain an inner stroke map of the target model.

7. The method for drawing an inner line according to claim 6, wherein: The step of synthesizing the first stroke map and the second stroke map by superimposing them in a dodge synthesis manner to obtain an inner stroke map of the target model includes: Adjusting the layer attribute of the first stroke map to a dark color to obtain an adjusted first stroke map; The adjusted first stroke map is superimposed on the second stroke map and the color value is set to a minimum value to obtain the inner stroke map of the target model.

8. The method for drawing an inner line according to claim 6, wherein: The step of synthesizing the first stroke map and the second stroke map by superimposing them in a dodge synthesis manner to obtain an inner stroke map of the target model includes: Adjusting the layer attribute of the second stroke map to a dark color to obtain an adjusted second stroke map; The adjusted second stroke map is superimposed on the first stroke map and the color value is set to a minimum value to obtain the inner stroke map of the target model.

9. The method for drawing an inner line according to any one of claims 1 to 8, characterized in that: In the rendering process, the inner line map is superimposed with the diffuse reflection map to obtain an inner line image of the target model, including: During the rendering process, a texture slot corresponding to the inner line map and a texture slot corresponding to the diffuse map are added to the shader; Import the inner line map and the diffuse reflection map into corresponding map slots respectively; The inner line map and the diffuse reflection map are synthesized by a multiply synthesis method to obtain an inner line image of the target model.

10. A device for drawing inner lines, characterized in that: include: A texture acquisition module is used to obtain a physically based rendering (PBR) texture of a target model, wherein the PBR texture includes a normal map, an ambient occlusion map, and a diffuse map. The PBR texture is obtained by baking the target model. a map generation module, configured to generate an inner line according to the normal map and the ambient occlusion map to obtain an inner line map of the target model, wherein the inner line map is generated by edge detection; The texture overlay module is used to overlay the inner line texture with the diffuse reflection texture during the rendering process to obtain an inner line image of the target model.

11. An electronic device, characterized in that: The electronic device includes: a memory and at least one processor, wherein instructions are stored in the memory, and the memory and the at least one processor are interconnected via a line; The at least one processor calls the instruction in the memory to enable the electronic device to execute the inner line drawing method according to any one of claims 1 to 9.

12. A computer-readable storage medium, characterized in that The computer-readable storage medium stores instructions, and when the instructions are executed by a processor, the method for drawing an inner line according to any one of claims 1 to 9 is implemented.

Citation Information

Patent Citations

  • Three-dimensional model stroking processing method and device, processor and terminal

    CN110473281A

  • Stylized rendering method and device, readable storage medium and electronic equipment

    CN113240783A