Ink-wash style image rendering method and device
Through edge detection, texture map and lighting calculation, the outline, texture and dyeing process of ink painting is simulated, and the problem of insufficient detail control and dynamic effects in ink-style image rendering is solved, achieving high-quality rendering effects and immersive experience.
Patent Information
- Application Number
- CN202510301012.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-14
- Publication Date
- 2025-07-22
- Estimated Expiration
- 2045-03-14
AI Technical Summary
In ink-style image rendering, the details control is limited and the dynamic effect is insufficient, making it difficult to achieve high-quality rendering effects.
The outline features are obtained by edge detection of the rendered image, combined with the preset noise texture map for outline and smudge, and texture map based on the scene space position mapping method, and finally illumination calculations are performed to control the smudge effect to achieve ink-style target rendering.
It improves the detail and diversity of ink-style image rendering, and provides an immersive virtual pen and ink painting experience to meet the application needs in virtual scenes.
Smart Images

Figure CN119832138B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer vision technology, and particularly to an ink painting style image rendering method and apparatus. Background Art
[0002] With the in-depth development of computer vision technology, image style transfer has received extensive attention, and the demand for ink painting style image rendering is also increasing.
[0003] However, in some ink painting style image rendering practices, there are phenomena such as limited detail control and insufficient support for dynamic effects. Summary of the Invention
[0004] The present disclosure provides an ink painting style image rendering method, apparatus, electronic device and medium.
[0005] According to one aspect of the present disclosure, there is provided an ink painting style image rendering method, the method including: performing edge detection on a target object in an image to be rendered to obtain a contour line feature of the target object; performing line drawing and shading on the target object according to the contour line feature and / or a preset noise texture map to obtain an initial rendered image; mapping a texture map of the scribbling method to a screen space where the initial rendered image is located based on a scene space position to obtain an intermediate rendered image; and controlling a shading effect of the intermediate rendered image based on a result of light calculation to obtain a target rendered image in ink painting style.
[0006] By adopting technologies such as edge detection in image space, screen mapping, and lighting shading, digital simulation of the three core painting links of "line drawing, scribbling, and shading" in traditional Chinese ink painting is beneficial to improving the detail and diversity of ink painting style image rendering, can effectively improve the rendering quality of ink painting style images, is beneficial to providing an immersive virtual ink painting experience, and can meet the application requirements of ink painting style image rendering in virtual scenes.
[0007] In some embodiments, the performing edge detection on a target object in an image to be rendered to obtain a contour line feature of the target object includes: performing edge detection on the target object based on scene depth information to obtain an outer contour feature of the target object; and performing edge detection on the target object based on the normal of the object surface to obtain an inner contour feature of the target object, and the outer contour feature and the inner contour feature constitute the contour line feature of the target object.
[0008] In some embodiments, the contour line feature includes contour line pixel coordinates and contour line pixel sizes. The method of performing contour line shading on the target object according to the contour line feature and / or a preset noise texture map to obtain an initial rendered image includes: performing contour line shading on the target object in at least one of the following ways to obtain the initial rendered image: adjusting the contour line pixel coordinates and / or the contour line pixel sizes of the target object; mapping the noise texture map to the screen space where the image to be rendered is located, and adjusting the pixel coordinates corresponding to the noise texture map to displace, rotate, and scale the noise texture map; and performing a multiplication operation on the contour line feature and the noise texture map to generate a simulated brushstroke with a flying white shading effect.
[0009] In some embodiments, the method of mapping a texture map of the texture strokes to the screen space where the initial rendered image is located based on the scene space position to obtain an intermediate rendered image includes: mapping the texture map of the texture strokes to the screen space where the initial rendered image is located in at least one of the following ways to obtain the intermediate rendered image: mapping the texture map of the texture strokes to the inner contour position of the target object in the initial rendered image; adjusting the pixel coordinates corresponding to the texture map of the texture strokes to displace, rotate, and scale the texture map of the texture strokes; and using the lighting information as a mask to map the texture map of the texture strokes to the shadow area in the initial rendered image.
[0010] In some embodiments, the method further includes: scanning the initially drawn texture map of the texture strokes to obtain an intermediate texture map of the texture strokes; and adjusting at least one of the following parameters of the intermediate texture map of the texture strokes to obtain the texture map of the texture strokes: texture, size, resolution, and color depth.
[0011] In some embodiments, the method of controlling the shading effect based on the lighting calculation result on the intermediate rendered image to obtain a target rendered image in an ink painting style includes: obtaining the inherent color information of the target object from the diffuse color buffer; obtaining the screen space-based picture color information of the intermediate rendered image from the post-processing input buffer; calculating the lighting buffer result according to the picture color information and the inherent color information; and controlling the shading effect on the intermediate rendered image according to the lighting buffer result to obtain the target rendered image in the ink painting style.
[0012] In some embodiments, the step of calculating the lighting buffer result according to the picture color information and the inherent color information includes: performing a division operation on the picture color information and the inherent color information to obtain the lighting intensity information in the intermediate rendered image as the lighting buffer result.
[0013] In some embodiments, performing a shading effect control on the intermediate rendered image according to the light buffer result to obtain the target rendered image in an ink-wash style includes: performing a noise texture map masking control and a shading effect intensity control on the intermediate rendered image according to the light buffer result to obtain the target rendered image in an ink-wash style, and the shading effect intensity control includes a masking intensity control and a shadow intensity control.
[0014] In some embodiments, the method further includes: in response to an image rendering instruction received, providing a global control interface and a local control interface for image rendering control, where the global control interface is used to edit the scene appearance parameters of the image rendering, and the local control interface is used to edit the line drawing and shading parameters, the texture parameters of the texture strokes, and the color adjustment parameters of the image rendering.
[0015] In some embodiments, the method further includes: in response to a parameter editing instruction received, providing a material parameter setting node for image rendering control, where the material parameter setting node includes at least one of a scalar parameter setting node, a vector parameter setting node, a texture parameter setting node, and a boolean value setting node.
[0016] In some embodiments, the method further includes: in response to an image rendering instruction received, creating a dynamic material instance, where the dynamic material instance includes the material parameters involved in the image rendering process, and the dynamic material instance supports setting the material parameters in a graphical interface.
[0017] According to another aspect of the present disclosure, there is provided an ink-wash style image rendering apparatus, including: a first processing module configured to perform edge detection on a target object in an image to be rendered to obtain a contour line feature of the target object; a second processing module configured to perform line drawing and shading on the target object according to the contour line feature and / or a preset noise texture map to obtain an initial rendered image; a third processing module configured to map a texture stroke map to the screen space where the initial rendered image is located based on the scene spatial position to obtain an intermediate rendered image; and a fourth processing module configured to perform a shading effect control on the intermediate rendered image based on a light calculation result to obtain a target rendered image in an ink-wash style.
[0018] According to another aspect of the present disclosure, there is provided an electronic device, including: at least one processor and a memory communicatively connected to the at least one processor. Wherein, the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the above image rendering method.
[0019] According to another aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium storing computer instructions for causing the computer to execute the above-described image rendering method.
[0020] According to another aspect of the present disclosure, there is provided a computer program product including a computer program which, when executed by a processor, implements the above-described image rendering method.
[0021] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it used to limit the scope of the present disclosure. Other features of the present disclosure will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The drawings are used to better understand the solution and do not constitute a limitation to the present disclosure. Among them:
[0023] Figure 1 Schematically shows the system architecture of an ink-wash style image rendering method and apparatus according to an embodiment of the present disclosure;
[0024] Figure 2 Schematically shows the flowchart of an ink-wash style image rendering method according to an embodiment of the present disclosure;
[0025] Figure 3 Schematically shows a schematic diagram of a Perlin noise texture map according to an embodiment of the present disclosure;
[0026] Figure 4 Schematically shows a schematic diagram of a texture map of the texture of the ink-wash strokes according to an embodiment of the present disclosure;
[0027] Figure 5 Schematically shows the schematic architecture diagram of an image rendering system according to an embodiment of the present disclosure;
[0028] Figure 6 Schematically shows the block diagram of an image rendering apparatus according to an embodiment of the present disclosure;
[0029] Figure 7 Schematically shows the block diagram of an electronic device for executing an ink-wash style image rendering method according to an embodiment of the present disclosure. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0030] The following describes exemplary embodiments of the present disclosure in conjunction with the accompanying drawings. Various details of the embodiments of the present disclosure are included to assist in understanding, and they should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted below.
[0031] The terms used herein are for the purpose of describing particular embodiments only and are not intended to limit the present disclosure. The terms such as "including", "comprising" and the like used herein indicate the presence of the described features, steps, operations and / or components, but do not preclude the presence or addition of one or more other features, steps, operations or components.
[0032] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those of ordinary skill in the art, unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification, and should not be interpreted in an idealized or overly rigid manner.
[0033] In the case of using expressions such as "at least one of A, B, and C, etc.", generally, it should be interpreted according to the meaning commonly understood by those of ordinary skill in the art (for example, "a system having at least one of A, B, and C" should include, but not be limited to, a system having only A, only B, only C, having A and B, having A and C, having B and C, and / or having A, B, and C, etc.).
[0034] With the in-depth development of computer vision technology, image style transfer has received extensive attention, and the demand for ink-wash style image rendering is also increasing. However, in some ink-wash style image rendering practices, there are phenomena such as limited detail control and insufficient support for dynamic effects.
[0035] Embodiments of the present disclosure provide an ink-wash style image rendering method, apparatus, and computer-readable storage medium. The image rendering apparatus can be integrated into an electronic device, and the electronic device can be a terminal device or a server. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, network acceleration services (Content Delivery Network, CDN), and big data and artificial intelligence platforms. The terminal device can be a mobile phone, a computer, a tablet computer, a smart screen, a smart home appliance, a vehicle-mounted terminal, etc.
[0036] According to an ink-wash style image rendering method of an embodiment of the present disclosure, edge detection is performed on a target object in an image to be rendered to obtain the contour line features of the target object. According to the contour line features and / or a preset noise texture map, line drawing and shading are performed on the target object to obtain an initial rendered image. Based on the scene space position, a texture map of the texture strokes is mapped into the screen space where the initial rendered image is located to obtain an intermediate rendered image. And, the shading effect control based on the light calculation result is performed on the intermediate rendered image to obtain the target rendered image in the ink-wash style.
[0037] Figure 1 Schematically shows the system architecture of an ink-wash style image rendering method and apparatus according to an embodiment of the present disclosure. It should be noted that, Figure 1 The shown is only an example of the system architecture to which the embodiments of the present disclosure can be applied to help those skilled in the art understand the technical content of the present disclosure, but it does not mean that the embodiments of the present disclosure cannot be used in other devices, systems, environments or scenarios.
[0038] The system architecture 100 according to this embodiment may include a client 101, a network 102, and a server 103. The network 102 is used to provide a medium for a communication link between the client 101 and the server 103. The network 102 may include various connection types, such as wired, wireless communication links, or fiber optic cables, etc. The server 103 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud computing, network services, and middleware services.
[0039] The client 101 interacts with the server 103 through the network 102 to receive or send data, etc. The client 101 is used, for example, to receive an image rendering instruction from a user and send the image to be rendered indicated by the image rendering instruction to the server 103.
[0040] The server 103 may be a server that provides various services. For example, it may be a processing server that performs ink-wash style rendering on the image to be rendered (only an example).
[0041] For example, the server 103 is used to perform edge detection on a target object in the image to be rendered to obtain the contour line features of the target object. The server 103 is also used to perform line drawing and shading on the target object according to the contour line features and / or a preset noise texture map to obtain an initial rendered image. And, based on the scene space position, a texture map of the texture strokes is mapped into the screen space where the initial rendered image is located to obtain an intermediate rendered image. Then, the shading effect control based on the light calculation result is performed on the intermediate rendered image to obtain the target rendered image in the ink-wash style.
[0042] It should be noted that the method for rendering an ink-wash style image provided in the embodiments of the present disclosure can be executed by the server 103. Correspondingly, the image rendering device provided in the embodiments of the present disclosure can be set in the server 103. The method for rendering an ink-wash style image provided in the embodiments of the present disclosure can also be executed by a server or a server cluster different from the server 103 and capable of communicating with the client 101 and / or the server 103. Correspondingly, the image rendering device provided in the embodiments of the present disclosure can also be set in a server or a server cluster different from the server 103 and capable of communicating with the client 101 and / or the server 103.
[0043] It should be understood that Figure 1 the numbers of clients, networks, and servers in
[0044] The embodiments of the present disclosure provide a method for rendering an ink-wash style image. The following will describe the method for rendering an ink-wash style image according to the exemplary embodiments of the present disclosure in conjunction with Figure 1 the system architecture of Figures 2 to 7 and with reference to Figure 1 The method for rendering an ink-wash style image of the embodiments of the present disclosure can be executed, for example, by
[0045] Figure 2 The server 103 shown in
[0046] As Figure 2 shown, the method 200 for rendering an ink-wash style image of the embodiments of the present disclosure can include, for example, operation S210 to operation S240.
[0047] Operation S210: Perform edge detection on the target object in the image to be rendered to obtain the contour line features of the target object.
[0048] Operation S220: Perform line drawing and shading on the target object according to the contour line features and / or a preset noise texture map to obtain an initial rendered image.
[0049] Operation S230: Map the texture map of the texture strokes to the screen space where the initial rendered image is located based on the scene spatial position to obtain an intermediate rendered image.
[0050] Operation S240: Control the shading effect of the intermediate rendered image based on the result of the lighting calculation to obtain the target rendered image in the ink-wash style.
[0051] The following will exemplarily illustrate the example processes of the operations of the method for rendering an ink-wash style image of this embodiment.
[0052] Operation S210: Perform edge detection on the target object in the image to be rendered to obtain the contour line features of the target object.
[0053] Exemplarily, edge detection based on the scene depth information can be performed on the target object to obtain the outer contour features of the target object. Edge detection based on the object surface normal can be performed on the target object to obtain the inner contour features of the target object. The outer contour features and the inner contour features, for example, constitute the contour line features of the target object.
[0054] For example, the depth edge detection technology can be used to perform edge detection on the target object based on the scene depth information to obtain the outer contour features of the target object. Specifically, the depth map of the image to be rendered can be obtained, and Gaussian kernel convolution processing can be performed on the depth map to obtain the smoothed depth map. Gradient calculation is performed on the smoothed depth map to obtain the gray gradient values at each pixel point in the image to be rendered. The gray gradient value indicates the gray change rate at the corresponding pixel point. When the gray gradient value is greater than the preset gradient value threshold, it is determined that the corresponding pixel point is located on the outer contour line of the target object.
[0055] The object surface normal can be used to indicate the orientation of the object surface, and the direction difference between the object surface normals can be used to identify the object contour. For example, when there is a significant difference in the surface normal directions of adjacent pixel points, it is determined that the corresponding pixel point is located at the object contour position. Normal edge detection can be used to detect the external contour line of the object, can also be used to detect the internal contour line of the object, and can also be used to assist in internal texture stroking to restore the texture effect.
[0056] Exemplarily, edge detection based on the object surface normal is performed on the target object to obtain the inner contour features of the target object. Assume that the object surface normal at the target pixel point in the image to be rendered is p. Based on the target pixel point, preset coordinate units are offset in the up, down, left, and right directions to obtain adjacent pixel points. Assume that the object surface normals at the adjacent pixel points are p1, p2, p3, and p4 respectively, and calculate the vector dot product result .
[0057] It is possible to determine whether the corresponding pixel point is located on a given plane according to the vector dot product result. When the vector dot product result is greater than zero, it is determined that the corresponding pixel point is not located on the given plane. When the vector dot product result is greater than the preset threshold, it is determined that the corresponding pixel point is located on the contour line of the target object. Among them, the threshold selection has an important impact on the sensitivity and anti-noise performance of the contour detection result.
[0058] By performing edge detection on the target object in the image to be rendered, the pixel coordinates and pixel dimensions of the contour line of the target object are obtained as the contour line features. The contour line pixel coordinates indicate the position of the contour line of the target object, and the contour line pixel dimensions indicate the size value of a single pixel in the contour line of the target object.
[0059] Operation S220: According to the contour line features and / or the preset noise texture map, perform line drawing and shading on the target object to obtain the initial rendered image.
[0060] Exemplarily, at least one of the following methods is used to perform line drawing and shading on the target object to obtain the initial rendered image: adjusting the contour line pixel coordinates and / or the contour line pixel dimensions of the target object; mapping the noise texture map to the screen space where the image to be rendered is located, and adjusting the pixel coordinates corresponding to the noise texture map to displace, rotate, and scale the noise texture map; and performing a product operation on the contour line features and the noise texture map to generate simulated brushstrokes with a splatter shading effect.
[0061] For example, according to the contour line pixel coordinates of the target object, a two-dimensional vector offset operation in directions such as up, down, left, and right can be performed on the current pixel position of the contour line to change the position of the contour line of the target object. In addition, a multiplication operation with the number of pixels n can be performed on the contour line pixel dimensions of the target object to adjust the width of the contour line of the target object. By adjusting the position and width of the contour line of the target object, a visual effect of dissolution or shading can be produced, which is beneficial to increasing the flexibility and diversity of the rendering effect.
[0062] As an alternative, a preset noise texture map can be mapped to the screen space where the image to be rendered is located. The noise texture map can be, for example, a Perlin noise texture map. Figure 3 A schematic diagram of a Perlin noise texture map according to an embodiment of the present disclosure is schematically shown. Perlin noise is a gradient noise generation algorithm widely used in computer graphics. As a procedural texture, Perlin noise can be used to generate smooth and coherent noise patterns, and the Perlin noise texture map is visually closer to the textures and forms in nature.
[0063] During the process of mapping the noise texture map to the screen space, the pixel coordinates corresponding to the noise texture map can be adjusted to displace, rotate, and scale the noise texture map to achieve more precise control of the visual appearance of the image or shape.
[0064] Optionally, an integration operation can also be performed on the contour line feature and the noise texture map to generate simulated brushstrokes with a flying white shading effect. For example, alpha blending can be performed on the outer contour pixel coordinates and the inner contour pixel coordinates of the target object to obtain the contour pixel coordinates of the target object. The contour pixel coordinates are multiplied by the noise texture map to generate a visual representation simulating the flying white brushstroke effect.
[0065] For example, for any pair of closest contour pixels of the target object, assuming the coordinates of the outer contour pixel in the contour pixel pair are , and the coordinates of the inner contour pixel are , alpha blending is performed on the outer contour pixel coordinates and the inner contour pixel coordinates to obtain the contour pixel coordinates of the target object, where α is a preset alpha blending coefficient.
[0066] In addition, alpha blending can be performed on the outer contour pixel size and the inner contour pixel size of the target object to obtain the contour pixel size of the target object. Multiplying the contour pixel size by the noise texture map can independently control the intensity and range of the shading effect in the X and Y directions.
[0067] For example, for any pair of closest contour pixels of the target object, assuming the size of the outer contour pixel in the contour pixel pair is , and the size of the inner contour pixel is , alpha blending is performed on the outer contour pixel size and the inner contour pixel size to obtain the contour pixel size C = α + (1 - α) , where α is a preset alpha blending coefficient.
[0068] Based on the contour line feature of the target object and / or a preset noise texture map, contour outlining and shading are performed on the target object to obtain an initial rendered image, which is beneficial for achieving excellent realism and artistry in simulating the contours of Chinese ink paintings and can effectively enhance the visual diversity of Chinese ink style image rendering.
[0069] Operation S230: Based on the scene space position, map the texture map of the texture strokes to the screen space where the initial rendered image is located to obtain an intermediate rendered image.
[0070] In the practice of rendering Chinese ink style images, to accurately reproduce the effect of texture strokes, not only the fineness of the picture lines needs to be considered, but also the ink color density and the paper texture need to be considered to achieve an effect as close as possible to traditional Chinese ink paintings.
[0071] Exemplarily, at least one of the following methods can be adopted to map the texture map of the cun method to the screen space where the initial rendered image is located to obtain an intermediate rendered image: mapping the texture map of the cun method to the inner contour position of the target object in the initial rendered image; adjusting the pixel coordinates corresponding to the texture map of the cun method to displace, rotate, and scale the texture map of the cun method; and using the lighting information as a mask to map the texture map of the cun method to the shadow area in the initial rendered image.
[0072] Figure 4 Schematically shows a schematic diagram of the texture map of the cun method according to an embodiment of the present disclosure. The texture map of the cun method can be mapped to the inner contour position of the target object in the initial rendered image, and by adjusting the cun method texture intensity, direction, and diffusivity, various simulated Chinese ink painting effects can be achieved.
[0073] The pixel coordinates corresponding to the texture map of the cun method can be adjusted to displace, rotate, and scale the texture map of the cun method, which is beneficial to further achieve flexible adjustment and diverse changes in texture performance.
[0074] Since the cun method is usually used to simulate the texture characteristics of the dark part of an object, and the cun method effect in the bright part area is often not significant. In the embodiments of the present disclosure, a lighting calculation technology can be introduced, and the lighting information is used as a mask to map the texture map of the cun method to the shadow area in the initial rendered image. This design can not only make the application of the cun method effect more targeted, but also further approximate the traditional expression techniques of light and shadow and contrast between light and dark in Chinese ink paintings.
[0075] As an optional method, the lighting information is used as a mask to map the texture map of the cun method to the shadow area in the initial rendered image. During the image rendering process, the lighting information can be used as a mask to control the occlusion or display of specific areas in the image. Using the lighting information as a mask can ensure that the cun method texture mapping mainly takes effect in the shadow area of the initial rendered image.
[0076] Optionally, the user can adopt the method of manually drawing the texture of the cun method to draw the initial texture of the cun method on rice paper with a writing brush and Chinese ink. The drawn initial texture of the cun method can be scanned to obtain an intermediate texture of the cun method. And, at least one of the following parameters of the intermediate texture of the cun method is adjusted to obtain the texture map of the cun method: texture, size, resolution, and color depth. This design can effectively improve the diversity and layering of the image rendering effect, which is beneficial to ensuring the excellent performance of the rendering of Chinese ink style images.
[0077] In operation S240, the bleeding effect control based on the lighting calculation result is performed on the intermediate rendered image to obtain the target rendered image in Chinese ink style.
[0078] Exemplarily, the intrinsic color information of the target object can be obtained from the diffuse color buffer, and the screen space-based scene color information of the intermediate rendered image can be obtained from the post-processing input buffer. According to the scene color information and the intrinsic color information, the light buffer result is calculated. Further, according to the light buffer result, the intermediate rendered image is subjected to a shading effect control to obtain the target rendered image in an ink painting style.
[0079] The diffuse color buffer stores the base color information of the object, and the base color information can be the color information of the object before being affected by any light and before post-processing effects. The base color information can reflect the diffuse properties of each object in the screen space, that is, the intrinsic color information of the object under the condition of lack of light. The diffuse color buffer can be the basic data source for obtaining the color information of each object in the scene.
[0080] When calculating the light buffer result according to the scene color information and the intrinsic color information, the scene color information and the intrinsic color information can be divided to obtain the light intensity information in the intermediate rendered image as the light buffer result.
[0081] For example, the relationship between the scene color information and the intrinsic color information is represented by Equation (1):
[0082] Diffuse Color×Light = FinalInput Equation (1)
[0083] Wherein, Diffuse Color represents the intrinsic color information of the target object, FinalInput represents the scene color information of the target object, and Light represents the light intensity information in the intermediate rendered image. The light intensity information, for example, constitutes the light buffer result.
[0084] Optionally, according to the light buffer result, the intermediate rendered image can be subjected to noise texture map masking control and shading effect intensity control to obtain the target rendered image in an ink painting style, wherein the shading effect intensity control includes masking intensity control and shadow intensity control.
[0085] For the masking control of the noise texture map on the intermediate rendered image, for example, the pixel coordinates corresponding to the noise texture map can be adjusted to displace, rotate, and scale the noise texture map. In addition, the dissolution intensity control of the noise texture map can also be performed.
[0086] By adopting technologies such as image space edge detection, screen mapping, and lighting shading, digital simulation is carried out on the three core painting links of "gou (outline), cun (texture stroke), and ran (dyeing)" of traditional Chinese ink paintings, which is beneficial to improving the detail and diversity of the rendering of ink-style images, can effectively improve the rendering quality of ink-style image rendering, is beneficial to providing an immersive virtual brush painting experience, and can meet the application requirements of ink-style image rendering in virtual scenes.
[0087] As an optional method, the image rendering method of the embodiments of the present disclosure may further include: in response to the received image rendering instruction, providing a global control interface and a local control interface for image rendering control. The local control interface includes, for example, a gou rendering control interface, a cun rendering control interface, and a ran rendering control interface.
[0088] Exemplarily, the global control interface can be used to edit the scene appearance parameters of image rendering, and the local control interface can be used to edit the outline and shading parameters, texture stroke parameters, and color adjustment parameters of image rendering.
[0089] Figure 5 Schematically shows the architecture diagram of an image rendering system according to an embodiment of the present disclosure. As Figure 5 shown, the image rendering system can, for example, provide a global control interface, a local control interface, and a post-processing component.
[0090] The global control interface includes, for example, a scene appearance control interface, and the scene appearance control interface can be used to edit the scene appearance parameters of image rendering. The scene appearance control interface can be used to uniformly adjust the material appearance in the scene, for example, to adjust parameters such as image brightness, image contrast, rice paper texture, background material, and pen and ink color.
[0091] The gou rendering control interface is used, for example, to edit the outline and shading parameters of image rendering. The gou rendering control interface can, for example, provide functions such as gou rendering global control, shading control, and flying white control. This design is beneficial to achieving a more refined outline and shading effect, and can effectively enhance the naturalness and prominence of the object edge.
[0092] The cun rendering control interface is used, for example, to edit the texture stroke parameters of image rendering. The cun rendering control interface can, for example, provide functions such as cun rendering global control, shading control, and mask control. This design is beneficial to better reproducing the texture details and surface texture of the object surface, and can effectively enhance the authenticity of ink-style image rendering.
[0093] The dyeing rendering control interface is used to edit, for example, the color adjustment parameters for image rendering. The rendering control interface can provide functions such as global rendering control and dissolution effect control. This design is conducive to achieving delicate control over the color changes on the surface of an object, thereby achieving rich color levels and visual effects.
[0094] As an alternative, in response to a received parameter editing instruction, a material parameter setting node for image rendering control is provided. The material parameter setting node includes at least one of a scalar parameter setting node, a vector parameter setting node, a texture parameter setting node, and a boolean value setting node.
[0095] Exemplarily, the embodiments of the present disclosure have focused on implementing four sub-directions of material control: parameter management for global control, edge outlining (gou), texture refinement (cun), and color adjustment (ran). Each sub-direction involves fine management of specific material attributes and requires systematic configuration based on the adjustable parameters and their identifiers in the material instance. The adjustable parameters in the material instance can cover four types of parameters: scalar, vector, texture, and boolean.
[0096] The embodiments of the present disclosure provide a material parameter setting node for image rendering control. The material parameter setting node can include a scalar parameter setting node, a vector parameter setting node, a texture parameter setting node, and a boolean value setting node. This design is conducive to enhancing the flexibility and application scope of the material instance, conducive to constructing a highly flexible and customizable dynamic material system, and can provide sufficient support for the precise control and personalized adjustment of post-processing effects.
[0097] As Figure 5 shown, the image rendering system can also provide a post-processing component. The post-processing component can provide functions such as switch selection, rendering range control, and dynamic instance update. As an alternative, in response to a received image rendering instruction, a dynamic material instance is created. The dynamic material instance includes the material parameters involved in the image rendering process, and the dynamic material instance supports setting the material parameters in a graphical interface.
[0098] Figure 6 The block diagram of an image rendering device according to an embodiment of the present disclosure is schematically shown.
[0099] As Figure 6 shown, the ink-wash style image rendering device 600 of the embodiments of the present disclosure includes, for example, a first processing module 610, a second processing module 620, a third processing module 630, and a fourth processing module 640.
[0100] The first processing module 610 performs edge detection on the target object to obtain the contour line features of the target object. The second processing module 620 is used to perform line drawing and shading on the target object according to the contour line features and / or a preset noise texture map to obtain an initial rendered image. The third processing module 630 is used to map the texture map of the texture strokes to the screen space where the initial rendered image is located based on the scene space position to obtain an intermediate rendered image. And the fourth processing module 640 is used to control the shading effect of the intermediate rendered image based on the result of the lighting calculation to obtain the target rendered image in the ink painting style.
[0101] By adopting technologies such as edge detection in the image space, screen mapping, and lighting shading, digital simulation of the three core painting steps of "line drawing, texture strokes, and shading" in traditional Chinese ink painting is carried out, which is beneficial to improving the detail and diversity of the rendering of images in the ink painting style, can effectively improve the rendering quality of images in the ink painting style, is beneficial to providing an immersive virtual ink painting experience, and can meet the application requirements of the rendering of images in the ink painting style in virtual scenes.
[0102] In some embodiments, the first processing module includes: a first processing sub-module for performing edge detection on the target object based on the scene depth information to obtain the outer contour features of the target object; and a second processing sub-module for performing edge detection on the target object based on the surface normal of the object to obtain the inner contour features of the target object, and the outer contour features and the inner contour features constitute the contour line features of the target object.
[0103] In some embodiments, the contour line features include the contour line pixel coordinates and the contour line pixel size. The second processing module includes: a third processing sub-module for adjusting the contour line pixel coordinates and / or the contour line pixel size of the target object; a fourth processing sub-module for mapping the noise texture map to the screen space where the image to be rendered is located and adjusting the pixel coordinates corresponding to the noise texture map to displace, rotate, and scale the noise texture map; and a fifth processing sub-module for performing a multiplication operation on the contour line features and the noise texture map to generate a simulated brush stroke with a flying white shading effect.
[0104] In some embodiments, the third processing module includes: a sixth processing sub-module for mapping the texture map of the texture strokes to the inner contour position of the target object in the initial rendered image; a seventh processing sub-module for adjusting the pixel coordinates corresponding to the texture map of the texture strokes to displace, rotate, and scale the texture map of the texture strokes; and an eighth processing sub-module for using the lighting information as a mask to map the texture map of the texture strokes to the shadow area in the initial rendered image.
[0105] In some embodiments, the device further includes a fifth processing module, configured to scan the initially drawn texture of the cracked strokes to obtain an intermediate texture of the cracked strokes; and to adjust at least one of the following parameters of the intermediate texture of the cracked strokes to obtain a texture map of the cracked strokes: texture, size, resolution, and color depth.
[0106] In some embodiments, the fourth processing module includes: a ninth processing sub-module, configured to obtain the inherent color information of the target object from the diffuse color buffer; a tenth processing sub-module, configured to obtain the screen-space scene color information of the intermediate rendered image from the post-processing input buffer; an eleventh processing sub-module, configured to calculate a lighting buffer result according to the scene color information and the inherent color information; and a twelfth processing sub-module, configured to control the shading effect of the intermediate rendered image according to the lighting buffer result to obtain a target rendered image in an ink-wash style.
[0107] In some embodiments, the eleventh processing sub-module includes: a first processing unit, configured to perform a division operation on the scene color information and the inherent color information to obtain the lighting intensity information in the intermediate rendered image as the lighting buffer result.
[0108] In some embodiments, the twelfth processing sub-module includes: a second processing unit, configured to control the noise texture map masking and the shading effect intensity of the intermediate rendered image according to the lighting buffer result to obtain a target rendered image in an ink-wash style, and the shading effect intensity control includes masking intensity control and shadow intensity control.
[0109] In some embodiments, the device further includes a sixth processing module, configured to provide a global control interface and a local control interface for image rendering control in response to a received image rendering instruction, where the global control interface is used to edit the scene appearance parameters of the image rendering, and the local control interface is used to edit the line drawing and shading parameters, the cracked stroke texture parameters, and the color adjustment parameters of the image rendering.
[0110] In some embodiments, the sixth processing module includes a thirteenth processing sub-module, configured to provide a material parameter setting node for image rendering control in response to a received parameter editing instruction, where the material parameter setting node includes at least one of a scalar parameter setting node, a vector parameter setting node, a texture parameter setting node, and a boolean value setting node.
[0111] In some embodiments, the device further includes a seventh processing module, configured to create a dynamic material instance in response to a received image rendering instruction, where the dynamic material instance includes the material parameters involved in the image rendering process, and the dynamic material instance supports setting the material parameters in a graphical interface.
[0112] It should be noted that in the technical solutions of the present disclosure, the processing of information collection, storage, use, processing, transmission, provision, and disclosure complies with the provisions of relevant laws and regulations and does not violate public order and good customs.
[0113] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0114] Figure 7 A block diagram of an electronic device for performing an ink painting style image rendering method according to an embodiment of the present disclosure is schematically shown.
[0115] Figure 7 A schematic block diagram of an example electronic device 700 that can be used to implement embodiments of the present disclosure is shown. The electronic device 700 is intended to represent various forms of digital computers, such as, a laptop computer, a desktop computer, a workbench, a personal digital assistant, a server, a blade server, a mainframe computer, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as, a personal digital processor, a cellular phone, a smart phone, a wearable device, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0116] As Figure 7 shown, the device 700 includes a computing unit 701, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 702 or a computer program loaded from a storage unit 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the device 700 can also be stored. The computing unit 701, the ROM 702, and the RAM 703 are connected to each other through a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0117] A plurality of components in the device 700 are connected to the I / O interface 705, including: an input unit 706, such as a keyboard, a mouse, etc.; an output unit 707, such as various types of displays, speakers, etc.; a storage unit 708, such as a magnetic disk, an optical disk, etc.; and a communication unit 709, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 709 allows the device 700 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0118] The computing unit 701 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 701 executes the various methods and processes described above, such as the ink-wash style image rendering method. For example, in some embodiments, the ink-wash style image rendering method can be implemented as a computer software program tangibly embodied in a machine-readable medium, such as the storage unit 708. In some embodiments, part or all of the computer program can be loaded and / or installed onto the device 700 via the ROM 702 and / or the communication unit 709. When the computer program is loaded into the RAM 703 and executed by the computing unit 701, one or more steps of the ink-wash style image rendering method described above can be executed. Alternatively, in other embodiments, the computing unit 701 can be configured to execute the ink-wash style image rendering method by any other suitable means (e.g., by means of firmware).
[0119] Various embodiments of the systems and techniques described above in this document can be implemented in digital electronic circuitry, integrated circuit systems, field-programmable gate arrays (FPGA), application-specific integrated circuits (ASIC), application-specific standard products (ASSP), systems-on-a-chip (SOC), complex programmable logic devices (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special or general programmable processor, receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting the data and instructions to the storage system, the at least one input device, and the at least one output device.
[0120] The program code for implementing the methods of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable ink-wash style image rendering device, such that when the program codes are executed by the processor or controller, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The program code can be executed entirely on the machine, partially on the machine, as an independent software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0121] In the context of this disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0122] To provide for interaction with an object, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the object; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the object can provide input to the computer. Other kinds of devices can also be used to provide for interaction with the object; for example, feedback provided to the object can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the object can be received in any form (including acoustic, speech, or tactile input).
[0123] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., an object computer having a graphical user interface or a web browser through which the object can interact with an implementation of the systems and techniques described herein), or in a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0124] A computer system can include a client and a server. The client and the server are generally remote from each other and typically interact through a communication network. The client-server relationship is generated by computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, a server of a distributed system, or a server incorporating a blockchain.
[0125] It should be understood that the various forms of processes shown above can be used, with steps reordered, added or deleted. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and no limitations are imposed herein.
[0126] The above specific embodiments do not constitute a limitation on the protection scope of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub - combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure shall be included within the protection scope of this disclosure.
Claims
1. An ink-wash style image rendering method, characterized in that, The method includes: Performing edge detection on a target object in the image to be rendered to obtain the contour line features of the target object; Performing line drawing and shading on the target object according to the contour line features and / or a preset noise texture map to obtain an initial rendered image; Mapping a texture map of the texture strokes to the screen space where the initial rendered image is located based on the scene spatial position to obtain an intermediate rendered image; and Controlling the shading effect of the intermediate rendered image based on the result of the lighting calculation to obtain a target rendered image in an ink painting style; Wherein, the controlling the shading effect of the intermediate rendered image based on the result of the lighting calculation to obtain a target rendered image in an ink painting style includes: Obtaining the inherent color information of the target object from the diffuse color buffer; Obtaining the screen space-based picture color information of the intermediate rendered image from the post-processing input buffer; Calculating the lighting buffer result according to the picture color information and the inherent color information; Controlling the noise texture map mask and the shading effect intensity of the intermediate rendered image according to the lighting buffer result to obtain the target rendered image in the ink painting style, Wherein, the shading effect intensity control includes mask intensity control and shadow intensity control; The calculating the lighting buffer result according to the picture color information and the inherent color information includes: Performing a division operation on the picture color information and the inherent color information to obtain the lighting intensity information in the intermediate rendered image as the lighting buffer result.
2. The method according to claim 1, wherein The performing edge detection on a target object in the image to be rendered to obtain the contour line features of the target object includes: Performing edge detection on the target object based on the scene depth information to obtain the outer contour features of the target object; and Performing edge detection on the target object based on the surface normal of the object to obtain the inner contour features of the target object, The outer contour features and the inner contour features constitute the contour line features of the target object.
3. The method according to claim 1, characterized in that, The contour line features include contour line pixel coordinates and contour line pixel dimensions. The performing line drawing and shading on the target object according to the contour line features and / or a preset noise texture map to obtain an initial rendered image includes: Performing line drawing and shading on the target object in at least one of the following ways to obtain the initial rendered image: Adjusting the contour line pixel coordinates and / or the contour line pixel dimensions of the target object; Mapping the noise texture map to the screen space where the image to be rendered is located, and adjusting the pixel coordinates corresponding to the noise texture map to displace, rotate, and scale the noise texture map; and Performing a multiplication operation on the contour line features and the noise texture map to generate a simulated brushstroke with a flying white shading effect.
4. The method according to claim 1, wherein The mapping a texture map of the texture strokes to the screen space where the initial rendered image is located based on the scene spatial position to obtain an intermediate rendered image includes: Mapping the texture map of the texture strokes to the screen space where the initial rendered image is located in at least one of the following ways to obtain the intermediate rendered image: Map the texture map of the texture strokes to the inner contour position of the target object in the initial rendered image; Adjust the pixel coordinates corresponding to the texture map of the texture strokes to displace, rotate, and scale the texture map of the texture strokes; and Use the lighting information as a mask to map the texture map of the texture strokes to the shadow area in the initial rendered image.
5. The method according to claim 4, characterized in that The method further includes: Scan the initially drawn texture strokes to obtain an intermediate texture map of the texture strokes; and Adjust at least one of the following parameters of the intermediate texture map of the texture strokes to obtain the texture map of the texture strokes: texture, size, resolution, and color depth.
6. The method according to claim 1, wherein The method further includes: In response to the received image rendering instruction, provide a global control interface and a local control interface for image rendering control, wherein the global control interface is used to edit the scene appearance parameters of the image rendering, and the local control interface is used to edit the line drawing and shading parameters, the texture stroke parameters, and the color adjustment parameters of the image rendering.
7. The method according to claim 6, wherein The method further includes: In response to the received parameter editing instruction, provide a material parameter setting node for image rendering control, wherein the material parameter setting node includes at least one of a scalar parameter setting node, a vector parameter setting node, a texture parameter setting node, and a boolean value setting node.
8. The method according to claim 7, wherein The method further includes: In response to the received image rendering instruction, create a dynamic material instance, wherein the dynamic material instance includes the material parameters involved in the image rendering process, and the dynamic material instance supports setting the material parameters in the graphical interface.
9. An ink-wash style image rendering device, characterized in that, The apparatus includes: A first processing module, configured to perform edge detection on a target object in the image to be rendered to obtain the contour line features of the target object; A second processing module, configured to perform line drawing and shading on the target object according to the contour line features and / or a preset noise texture map to obtain an initial rendered image; A third processing module, configured to map the texture map of the texture strokes to the screen space where the initial rendered image is located based on the scene space position to obtain an intermediate rendered image; and A fourth processing module, configured to control the shading effect of the intermediate rendered image based on the lighting calculation result to obtain a target rendered image in the ink painting style; wherein, controlling the shading effect of the intermediate rendered image based on the lighting calculation result to obtain a target rendered image in the ink painting style includes: Obtain the inherent color information of the target object from the diffuse color buffer; Obtain the screen space-based picture color information of the intermediate rendered image from the post-processing input buffer; Calculate the lighting buffer result according to the picture color information and the inherent color information; According to the lighting buffer result, perform noise texture map mask control and shading effect intensity control on the intermediate rendered image to obtain the target rendered image in the ink painting style, wherein the shading effect intensity control includes mask intensity control and shadow intensity control; The calculating the lighting buffer result according to the picture color information and the inherent color information includes: Performing a division operation on the screen color information and the inherent color information to obtain the illumination intensity information in the intermediate rendered image as the illumination buffer result.
10. An electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein, the memory stores instructions executable by the at least one processor, and when the instructions are executed by the at least one processor, the at least one processor is enabled to execute the image rendering method according to any one of claims 1 to 8.
11. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to execute the image rendering method according to any one of claims 1 to 8.
Citation Information
Patent Citations
3D scene wash and ink painting style rendering method based on 3dsmax
CN115880413A