Virtual model rendering method and device, electronic equipment and storage medium
By performing binarization of screen images of virtual models and eliminating outline information, the problem that the existing technology cannot stroke the light and dark boundary lines of the virtual model is solved, and an efficient artistic style rendering effect is achieved.
Patent Information
- Application Number
- CN202411997964.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-04-11
AI Technical Summary
The prior art cannot stroke the light and dark junction of the virtual model, resulting in the artistic rendering of the light and dark junction of the object itself.
By binarizing the screen image of the target virtual model, multiple offset binarization results and unoffset binarization results are obtained. Based on these results, the contour line and the light and dark junction line are determined, and the contour line is eliminated using geometric edge information, and only the light and dark junction line is retained for rendering.
It realizes hand-painted line strokes on the shadow areas in the virtual model, enhances light and dark contrast, and achieves an artistic style cartoon rendering effect.
Smart Images

Figure CN119810290A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer graphics technology, and in particular to a rendering method, device, electronic equipment and storage medium for a virtual model. Background Art
[0002] Cartoon rendering is an artistic style that restores a two-dimensional plane in a three-dimensional scene. Among them, the stroke technology in cartoon rendering is one of the key parts to achieve cartoon rendering. Through the stroke technology, the inner and outer contours of virtual objects in the three-dimensional scene can be made clearer, achieving the visual effect of simulating the lines in hand-drawn animations or comics.
[0003] In the related art, the main stroke solutions used include the following two: one is to use post-processing materials to detect the edges of objects and add stroke effects to the detected edges; the other is to use custom material shaders to add stroke effects to the edges of objects.
[0004] However, the above two stroke solutions can only stroke the outer contour of the virtual object, but cannot stroke the light and dark boundary line of the object itself. Summary of the invention
[0005] The purpose of the present invention is to provide a virtual model rendering method, device, electronic device and storage medium to address the deficiencies in the above-mentioned prior art, so as to solve the problem that the related art cannot outline the light and dark boundary lines of the object itself.
[0006] To achieve the above purpose, the technical solution adopted in the embodiment of the present application is as follows:
[0007] In a first aspect, an embodiment of the present application provides a method for rendering a virtual model, the method comprising:
[0008] Binarization is performed on the screen image of the target virtual model to obtain a binarization result of the screen image, wherein the binarization result includes: a plurality of offset binarization results and a non-offset binarization result; each of the offset binarization results is a binarization result obtained by binarizing the screen image after offsetting it along a preset direction;
[0009] Determine the stroke information of the target virtual model according to the binarization result, wherein the stroke information includes: the contour line and the light-dark boundary line of the target virtual model;
[0010] Determine geometric edge information of the target virtual model, wherein the geometric edge information includes: a contour line of the target virtual model;
[0011] According to the contour line of the target virtual model in the geometric edge information, the contour line of the target virtual model in the stroke information is removed to obtain the light and dark boundary line of the target virtual model, and according to the light and dark boundary line of the target virtual model, the target virtual model is rendered and displayed.
[0012] In a second aspect, an embodiment of the present application further provides a virtual model rendering device, the method comprising:
[0013] A processing module, used for performing binarization processing on the screen image of the target virtual model to obtain a binarization result of the screen image, wherein the binarization result includes: a plurality of offset binarization results and non-offset binarization results; each of the offset binarization results is a binarization result obtained by binarizing the screen image after offsetting it along a preset direction;
[0014] A determination module is used to determine the stroke information of the target virtual model according to the binarization result, the stroke information including: the contour line and the light-dark boundary line of the target virtual model; determine the geometric edge information of the target virtual model, the geometric edge information including: the contour line of the target virtual model; according to the contour line of the target virtual model in the geometric edge information, remove the contour line of the target virtual model in the stroke information to obtain the light-dark boundary line of the target virtual model;
[0015] A rendering module is used to render and display the target virtual model according to the light and dark boundary line of the target virtual model.
[0016] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor. When the electronic device is running, the processor and the storage medium communicate through the bus, and the processor executes the machine-readable instructions to perform the virtual model rendering method provided in the first aspect.
[0017] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method for rendering a virtual model as provided in the first aspect is executed.
[0018] The beneficial effects of this application are:
[0019] The present application provides a virtual model rendering method, device, electronic device and storage medium, the method comprising: binarizing a screen image of a target virtual model to obtain a binarization result of the screen image, the binarization result comprising: a plurality of offset binarization results and a non-offset binarization result; each offset binarization result is a binarization result obtained by binarizing the screen image after offsetting it along a preset direction; determining, according to the binarization result, the stroke information of the target virtual model, the stroke information comprising: a contour line and a light-dark boundary line of the target virtual model; obtaining geometric edge information of the target virtual model, the geometric edge information comprising: a contour line of the target virtual model; according to the contour line of the target virtual model in the geometric edge information, removing the contour line of the target virtual model in the stroke information, determining the light-dark boundary line of the target virtual model, and rendering and displaying the target virtual model according to the light-dark boundary line of the target virtual model. In this scheme, considering that the target virtual model to be rendered is affected by illumination and is expressed as a two-order color of light and dark, it is proposed that the screen image of the target virtual model can be subjected to a light and dark binarization process to obtain a binarization result of the screen image, and the binarization result includes: a plurality of offset binarization results and an unoffset binarization result; each offset binarization result is a binarization result obtained by binarizing the screen image after offsetting it in different directions; then, according to the plurality of offset binarization results and the unoffset binarization result, the contour line and the light and dark boundary line in the target virtual model are obtained, and the contour line of the target virtual model in the geometric edge information is used to remove the outer contour line and the inner contour line in the stroke information, so as to obtain the light and dark boundary line of the target virtual model; finally, the light and dark boundary line of the target virtual model is used to render the target virtual model, so as to achieve a hand-painted style line stroke for the shadow area in the target virtual model, achieve a rendering effect of enhancing light and dark contrast, achieve a cartoon rendering effect with an artistic style, and solve the problem that the related technology cannot stroke the light and dark boundary line of the object itself. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0021] Figure 1 A schematic diagram of a flow chart of a method for rendering a virtual model provided in an embodiment of the present application;
[0022] Figure 2 A schematic diagram of a binarization result of a screen image of a target virtual model provided in an embodiment of the present application;
[0023] Figure 3 Schematic diagram of the stroke information of the target virtual model provided in the embodiment of the present application Figure 1 ;
[0024] Figure 4 A schematic diagram of a flow chart of another method for rendering a virtual model provided in an embodiment of the present application;
[0025] Figure 5 A schematic diagram of a flow chart of another method for rendering a virtual model provided in an embodiment of the present application;
[0026] FIG6(a) and FIG6(b) are schematic diagrams showing changes in light illumination of a target virtual model provided in an embodiment of the present application;
[0027] Figure 7 A schematic diagram of a flow chart of another method for rendering a virtual model provided in an embodiment of the present application;
[0028] Figure 8 A schematic diagram of a flow chart of another method for rendering a virtual model provided in an embodiment of the present application;
[0029] Fig. 9 Schematic diagram of the stroke information of the target virtual model provided in the embodiment of the present application Figure 2 ;
[0030] Fig.10 A schematic diagram of a flow chart of a method for rendering a virtual model provided in an embodiment of the present application;
[0031] Figure 11(a)-Figure 11(c) A schematic diagram of geometric edge information of a target virtual model provided in an embodiment of the present application;
[0032] Fig.12 A schematic diagram of a flow chart of another method for rendering a virtual model provided in an embodiment of the present application;
[0033] Fig.13 Schematic diagram of rendering the light-dark boundary line in the target virtual model provided in the embodiment of the present application Figure 1 ;
[0034] Fig.14 Schematic diagram of rendering the light-dark boundary line in the target virtual model provided in the embodiment of the present application Figure 2 ;
[0035] Fig.15 A schematic diagram of the structure of a virtual model rendering device provided in an embodiment of the present application;
[0036] Fig.16 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0037] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the drawings in the present application only serve the purpose of explanation and description and are not used to limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn in real proportion. The flowchart used in this application shows the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowchart can be implemented out of sequence, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, those skilled in the art can add one or more other operations to the flowchart under the guidance of the content of the present application, or remove one or more operations from the flowchart.
[0038] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0039] It should be noted that the term "comprising" will be used in the embodiments of the present application to indicate the existence of the features declared thereafter, but does not exclude the addition of other features.
[0040] First, the professional terms involved in this application are introduced.
[0041] 1. The boundary between light and dark is the boundary between the gray and dark parts in the sketch. Although the boundary between light and dark is called a "line", it is actually a surface. It is generated at the volume of the object due to light, and its width varies according to the brightness and shape of the object.
[0042] However, the rendering method of the virtual model provided in the present application is mainly applied to the second-order color rendering of cartoons, and the light and dark changes of the object are sudden. Therefore, the light and dark boundary line in the rendering method of the virtual model provided in the present application is a clear boundary line.
[0043] Secondly, the background technology involved in this application is introduced.
[0044] Usually, in the game development engine (Unreal Engine 5, UE5 for short), the commonly used stroke solutions include the following two:
[0045] The first type is post-processing material, which uses post-processing material to detect the edge of the object, and then adds the stroke in post-processing. Generally, the edge of the object is calculated through normals, depth information, Sobel operator or other edge detection algorithms.
[0046] The second type, the outline shader, uses a custom material shader to add a stroke to the edge of the object. The stroke effect can be achieved by extending the normal of the object or using the Fresnel effect.
[0047] However, the above two solutions can only stroke the outer contour of the object, but cannot stroke the light and dark boundary line of the object itself.
[0048] Based on the above problems, the embodiment of the present application proposes a rendering method for a virtual model. The scheme is based on UE5 cartoon rendering, and takes into account that the target virtual model to be rendered is affected by light and dark two-order colors. Therefore, the screen image of the target virtual model can be subjected to light and dark binarization processing to obtain a plurality of offset binarization results and non-offset binarization results of the screen image, and the plurality of offset binarization results are binarization results obtained by binarizing the screen image after offsetting it in different directions; then, based on the plurality of offset binarization results and the non-offset binarization results, the stroke information of the target virtual model is obtained, and the stroke information includes: Therefore, based on the contour line of the target virtual model in the geometric edge information, the contour line in the stroke information can be eliminated, and only the light and dark boundary line of the target virtual model can be retained; finally, the light and dark boundary line of the target virtual model is made to render the target virtual model, and hand-painted style line strokes are performed on the shadow area (including the backlit surface and the projected area of the object) in the target virtual model, especially the hand-painted style strokes of the shadow area, so as to achieve the rendering effect of enhancing the light and dark contrast, realize the cartoon rendering effect with artistic style, and solve the problem that the related technology cannot stroke the light and dark boundary line of the object itself.
[0049] The specific implementation of the virtual model rendering method of the present application will be described in detail below through multiple embodiments.
[0050] Figure 1 A flow chart of a method for rendering a virtual model provided in an embodiment of the present application. Optionally, the execution subject of the method may be a terminal device with a data processing function, and a game development engine, such as Unreal Engine (UE for short), is installed on the terminal device.
[0051] It should be noted that the virtual model rendering method provided in this application is not based on Figure 1It should be understood that in other embodiments, the order of some steps in the virtual model rendering method provided by the present application can be interchanged according to actual needs, or some steps can be omitted or deleted. Figure 1 As shown, the method includes:
[0052] S101 , performing binarization processing on the screen image of the target virtual model to obtain a binarization result of the screen image.
[0053] The binarization results include: a plurality of offset binarization results and non-offset binarization results; each offset binarization result is a binarization result obtained by binarizing the screen image after offsetting it along a preset direction.
[0054] The target virtual model is a three-dimensional model to be rendered in the application scene.
[0055] Optionally, in this solution, an intermediate storage structure, such as Gbuffer (geometry buffer), is used to store the geometry and material information of each pixel in the target virtual model. Therefore, the screen image of the target virtual model can be obtained by reading the GBuffer data. The screen image stores the color value of each pixel in the target virtual model.
[0056] Understandable, reference Figure 2 The figure shows the binarization result of the screen image of the target virtual model, which is a black-and-white image of the screen image, in which light and dark areas are marked. That is, the light-dark boundary of the target virtual model can be extracted from the binarization result of the screen image.
[0057] In this solution, it is considered that the target virtual model to be rendered is affected by the illumination and is expressed as a two-order color of light and dark. Therefore, it is proposed that the screen image of the target virtual model can be subjected to a light and dark binarization process to obtain a binarization result of the screen image. Exemplarily, for example, an image binarization process can be used to binarize the screen image to obtain an un-offset binarization result; and each pixel point on the screen image is offset in different directions to obtain an offset image after being offset in different directions, and then an image binarization process is used to binarize the offset image after being offset in different directions to obtain multiple offset binarization results.
[0058] S102: Determine the stroke information of the target virtual model according to the binarization result.
[0059] The stroke information includes: the contour line and the light-dark boundary line of the target virtual model. The contour line includes: the outer contour line and the inner contour line, and the light-dark boundary line is the shadow boundary line on the target virtual model.
[0060] Optionally, the strokes of the target virtual model in different directions can be obtained according to a plurality of offset binarization results and non-offset binarization results. Figure 3 As shown, the strokes on the target virtual model are all set to white, that is, the strokes include: an outer contour line, an inner contour line, and a light-dark boundary line.
[0061] S103: Acquire geometric edge information of the target virtual model.
[0062] The geometric edge information includes: the contour line of the target virtual model. The contour line includes: an outer contour line and an inner contour line. The outer contour line refers to the boundary line outside the target virtual model, and the inner contour line refers to the boundary line inside the target virtual model.
[0063] In one feasible method, for example, the outer contour line of the target virtual model can be detected using geometric methods such as edge detection and the normal direction of the target virtual model; and shader technology, such as using a screen space shader (such as a post-processing shader) to detect the inner contour line of the target virtual model.
[0064] S104 , according to the contour line of the target virtual model in the geometric edge information, the contour line of the target virtual model in the stroke information is removed to obtain the light-dark boundary line of the target virtual model, and according to the light-dark boundary line of the target virtual model, the target virtual model is rendered and displayed.
[0065] Optionally, based on the above-mentioned embodiment, the outer contour lines and inner contour lines in the stroke information can be eliminated according to the inner contour lines and outer contour lines of the target virtual model in the geometric edge information to obtain the light and dark boundary lines of the target virtual model; then, the light and dark boundary lines of the target virtual model are used to render the target virtual model, thereby achieving hand-painted line strokes on the shadow areas in the target virtual model, achieving a rendering effect with enhanced light and dark contrast, and achieving a cartoon rendering effect with an artistic style, which solves the problem that the related technology cannot stroke the light and dark boundary lines of the object itself.
[0066] In summary, the embodiment of the present application provides a method for rendering a virtual model. In this scheme, considering that the target virtual model to be rendered is affected by light and dark and is expressed as a two-order color, it is proposed that the screen image of the target virtual model can be subjected to light and dark binarization processing to obtain a plurality of offset binarization results and unoffset binarization results of the screen image, wherein each offset binarization result is a binarization result obtained by binarizing the screen image after offsetting it in different directions; then, according to the plurality of offset binarization results and the unoffset binarization result, the contour line and the light and dark boundary line in the target virtual model are obtained, and the contour line of the target virtual model in the geometric edge information is used to remove the outer contour line and the inner contour line in the stroke information, thereby obtaining the light and dark boundary line of the target virtual model; finally, the light and dark boundary line of the target virtual model is used to render the target virtual model, thereby achieving a hand-painted style line stroke for the shadow area in the target virtual model, achieving a rendering effect of enhancing light and dark contrast, achieving a cartoon rendering effect with an artistic style, and solving the problem that the related technology cannot stroke the light and dark boundary line of the object itself.
[0067] Optionally, the preset direction includes: left, right, upward or downward on the plane where the screen is located.
[0068] The process of performing binarization processing on the screen image of the target virtual model to obtain the binarization result of the screen image includes:
[0069] The screen image is shifted by one or more pixels along each preset direction to obtain a plurality of shifted images; each shifted image is binarized to obtain a plurality of shifted binarization results.
[0070] Optionally, in order to obtain the strokes in the four directions of up, down, left, and right in the target virtual model, the present solution proposes that each pixel point in the screen image can be offset in different directions to obtain an offset image after being offset in each direction.
[0071] In one feasible method, taking the plane where the screen is located as a reference, taking the offset of one pixel as an example, the u coordinates of all the pixels (u, v) on the screen image are offset to the right by one pixel, that is, (1, 0), to obtain a right-offset image; the u coordinates of all the pixels (u, v) on the screen image are translated to the left by one pixel, that is, (-1, 0), to obtain a left-offset image. Also, the v coordinates of all the pixels (u, v) on the screen image are offset upward by one pixel, that is, (0, -1), to obtain an upward-offset image; the v coordinates of all the pixels (u, v) on the screen image are offset downward by one pixel, that is, (0, 1), to obtain a downward-offset image. Therefore, each pixel in the screen image can be offset by one pixel (or multiple pixels) up, down, left, and right, respectively, to obtain an offset image after the four directions of offset, and each time the offset occurs, the offset normal of each offset image is stored in the RGB channel of the four-dimensional vector and the binarization result is stored in the A channel.
[0072] Then, an image binarization method is used to perform binarization processing on the offset images corresponding to each direction, and a binarization result corresponding to each offset image is obtained.
[0073] The following example will explain in detail how to obtain the binarization result of the screen image.
[0074] Optionally, refer to Figure 4 As shown, the above step S101 includes:
[0075] S401, obtaining material information of the target virtual model on the current screen.
[0076] Among them, material information includes: screen image, diffuse color and world space normal.
[0077] S402: Binarize the screen image of the target virtual model according to the material information to obtain a binarization result of the screen image.
[0078] Optionally, Ue5 uses deferred rendering, which means that the material information of the target virtual model is stored in the GBuffer in the form of a texture. Therefore, the screen image (PostProcessInput0), diffuse color (DiffuseColor) and space normal (WorldNormal) of the target virtual model on the current screen can be obtained by reading the GBuffer data.
[0079] The screen image refers to the image of the target virtual model displayed on the current screen. Therefore, in Ue5, the screen image of the target virtual model can be binarized based on the material information of the target virtual model to obtain the binarization result of the screen image, that is, the binarization result of the screen image is a black and white image marked with light and dark areas in the target virtual model.
[0080] Optionally, refer to Figure 5 As shown, the above step S401 includes:
[0081] S501, determining the ratio of the screen image to the diffuse reflection color.
[0082] Among them, the ratio result is used to characterize the lighting and darkness information of the target virtual model.
[0083] By dividing the screen image (PostProcessInput0) by the diffuse color (DiffuseColor) of the object and decolorizing the result, we can obtain the pure colorless light brightness change of the object in the scene, as shown in the figure 1 to Figure 2 changes.
[0084] S502 : Decolorize the contrast value result to obtain a lighting image of the target virtual model.
[0085] The purpose of decolorization is to reduce the saturation of the target virtual model.
[0086] In one achievable method, for example, the screen image is divided by the diffuse color to obtain a ratio result, and the Desaturation node provided in Ue5 is used to desaturate the ratio result to obtain a lighting image of the target virtual model, so as to obtain a pure colorless light brightness change of the target virtual model in the scene, such as Figure 6(a) to Figure 6(b) changes.
[0087] S503: Binarize the illumination image to obtain an unbiased binarized result.
[0088] In one achievable method, the step function can be used to binarize the illumination image to obtain an unbiased binarized result. Figure 2 The following is the unbiased binarization result. Figure 2 The brightest part is 1, and the darkest part is 0.
[0089] It can be understood that the boundary between light and dark is Figure 2 The boundary between the dark and light parts in the image.
[0090] The above steps perform binarization processing on each offset image to obtain multiple offset binarization results, including:
[0091] S504: Obtain offset material information corresponding to each offset image.
[0092] S505 . Obtain offset binarization results corresponding to each direction according to the offset material information of each offset image.
[0093] The offset material information includes: offset screen image, offset diffuse color and offset space normal.
[0094] In one achievable manner, the processing process shown in the above steps S501-S503 can be used to perform illumination change processing, decolorization processing and binarization processing on the offset material information of each offset image, respectively, to obtain the offset binarization results corresponding to each direction. For example, taking the right-offset image as an example, specifically, based on the offset material information of the right-offset image, the rightward ratio result of the right-offset screen image and the right-offset diffuse color can be obtained, and then the rightward ratio result is decolorized, and the decolorization result is binarized using the step function to obtain the offset binarization result corresponding to the right-offset image.
[0095] Optionally, refer to Figure 7 As shown, the above step S504 includes:
[0096] S701. Obtain a randomly generated noise value.
[0097] Exemplarily, the noise value may be randomly generated when sampling the screen image and may have a certain degree of randomness.
[0098] S702: Determine the product of the noise value and the offset pixel points after each pixel point in the screen image is offset in different directions.
[0099] S703: Based on the product result, obtain the shifted image after shifting in each direction.
[0100] Optionally, in order to enhance the randomness of generating each offset image, this solution proposes that when offsetting each pixel in the screen image in different directions, a preset noise value can be used to process each pixel in the screen image, that is, the noise value is multiplied with the offset pixel after each pixel in the screen image is offset in different directions, and based on the product result, the offset image after offset in each direction is obtained. In this way, the stroke generated subsequently produces a distorted effect, that is, an intermittent result is produced, which enhances the randomness of the offset image.
[0101] Specifically, for example, the randomly generated noise value is A. Taking the pixel point (u1, v1) in the screen image as an example, the pixel value of the pixel point (u1, v1) is B. Then, when the pixel point (u1, v1) in the screen image is offset to the right, the pixel point corresponding to the pixel point (u1, v1) after the pixel point (u1, v1) is offset to the right is (u1+1, v1). The product of the noise value A and the pixel value B of the pixel point (u1, v1) can be used as the pixel value corresponding to the pixel point (u1+1, v1) after the pixel point (u1, v1) is offset to the right, that is, A*B; therefore, using the above method, the pixel value of the pixel point (u1+1, v1) corresponding to each pixel point after the offset can be obtained, and based on the pixel value of the pixel point (u1+1, v1) corresponding to each pixel point after the offset, a right-shifted image can be obtained.
[0102] Optionally, the above step S102 includes:
[0103] The non-offset binarization result is subjected to difference processing with the offset binarization result corresponding to each direction, so as to obtain the stroke information of the target virtual model in each direction.
[0104] Optionally, the offset binarization result corresponding to each direction may be subtracted from the non-offset binarization result to obtain the stroke information of the target virtual model in four directions.
[0105] The following embodiments will explain in detail how to obtain the stroke information of the target virtual model in four directions.
[0106] Optionally, the multiple offset binarization results include: an upward offset binarization result, a downward offset binarization result, a leftward offset binarization result, and a rightward offset binarization result; Figure 8 As shown, the above-mentioned non-offset binarization result is subjected to difference processing with the offset binarization result corresponding to each direction, and the stroke information of the target virtual model in each direction is obtained, including:
[0107] S801 , determining a first difference between an upwardly offset binarization result and a non-offset binarization result, and using the first difference as lower side stroke information of a target virtual model.
[0108] Optionally, in order to obtain the bottom stroke information of the target virtual model, the binarization result that is not offset can be subtracted from the binarization result that is not offset to obtain a first difference, and the first difference is used as the bottom stroke information of the target virtual model. The specific principle is: if the background is white, after offsetting 1 pixel upward, there will be 1 pixel at the bottom inner edge of the target virtual model to display the white background, that is, after subtracting the binarization result that is offset upward from the binarization result that is not offset, the result obtained is the bottom stroke information of the target virtual model.
[0109] S802: Determine a second difference between the binarization result with downward shift and the binarization result without shift, and use the second difference as upper stroke information of the target virtual model.
[0110] Optionally, in order to obtain the upper stroke information of the target virtual model, the binarization result that is not offset can be subtracted from the binarization result that is not offset to obtain a second difference, and the second difference is used as the upper stroke information of the target virtual model. The specific principle is: if the background is white, after offsetting 1 pixel downward, there will be 1 pixel on the upper inner edge of the target virtual model to display the white background, that is, after subtracting the binarization result that is offset downward from the binarization result that is not offset, the result obtained is the upper stroke information of the target virtual model.
[0111] S803: Determine a third difference between the binarization result shifted to the left and the binarization result not shifted to the left, and use the third difference as right stroke information of the target virtual model.
[0112] Optionally, in order to obtain the right stroke information of the target virtual model, the left-shifted binarization result can be subtracted from the unshifted binarization result to obtain a third difference, and the third difference is used as the right stroke information of the target virtual model. The specific principle is: the background is white, and after shifting 1 pixel to the left, there will be 1 pixel on the right inner edge of the target virtual model to show the white background, that is, after subtracting the left-shifted binarization result and the unshifted binarization result, the result obtained is the right stroke information of the target virtual model.
[0113] S804: Determine a fourth difference between the binarization result shifted to the right and the binarization result not shifted to the right, and use the third difference as left side stroke information of the target virtual model.
[0114] Optionally, in order to obtain the left stroke information of the target virtual model, the right-shifted binarization result can be subtracted from the unshifted binarization result to obtain a fourth difference, and the fourth difference is used as the left stroke information of the target virtual model. The specific principle is: the background is white, and after shifting 1 pixel to the right, there will be 1 pixel on the left inner edge of the target virtual model to show the white of the background, that is, after subtracting the right-shifted binarization result and the unshifted binarization result, the result obtained is the left stroke information of the target virtual model.
[0115] S805 , determining a sum of the bottom stroke information, the top stroke information, the right stroke information, and the left stroke information, and performing an inversion operation on the sum to obtain the stroke information of the target virtual model.
[0116] Optionally, the bottom stroke information, top stroke information, right stroke information and left stroke information obtained above may be added to obtain a sum result; since the stroke is black, the sum result may also be inverted, that is, the following is obtained: Fig. 9 The stroke information of the white background and black border of the target virtual model is shown.
[0117] Optionally, refer to Fig.10 As shown, the above step S103 includes:
[0118] S1001. Obtain an unbiased normal corresponding to a screen image of a target virtual model in a current screen, and obtain unbiased edge light information of the target virtual model based on the unbiased normal.
[0119] The non-offset edge light information includes: an outer contour line and an inner contour line on the target virtual model.
[0120] In one achievable manner, for example, by substituting the unbiased normal corresponding to the screen image into the fresnel calculation formula, the unbiased edge light information of the target virtual model can be obtained, as shown in FIG. 11( a ).
[0121] S1002, obtaining the offset normal corresponding to the offset image after offset in each direction, and obtaining the offset edge light information corresponding to the target virtual model after offset in each direction according to the offset normal corresponding to the offset image after offset in each direction.
[0122] The offset edge light information includes an inner contour line on the target virtual model.
[0123] Optionally, it can be observed from FIG. 11(a) above that the inner contour edge light of the target virtual model obtained by the processing method of step S1001 above is not clear. Therefore, in this solution, it is proposed that the offset edge light information corresponding to the offset image after offset in each direction can be obtained according to the offset normal corresponding to the offset image after offset in each direction, as shown in FIG. 11(b).
[0124] S1003: Determine the sum of the unshifted edge light information and the shifted edge light information after shifting in each direction, and use the sum as the geometric edge information of the target virtual model.
[0125] Optionally, the unshifted edge light information and the shifted edge light information after shifting in each direction may be added, and the summed result may be used as the geometric edge information of the target virtual model, as shown in FIG. 11( c ).
[0126] Optionally, refer to Fig.12 As shown, the above step S104 includes:
[0127] S1201. Set the geometric edge information to a preset value to obtain reset geometric edge information.
[0128] S1202: Determine the difference result between the reset geometric edge and the stroke information, and use the difference result as the light-dark boundary line of the target virtual model.
[0129] Optionally, since the stroke information of the target virtual model obtained in the above steps is displayed in black, and the geometric edge information of the target virtual model is displayed in white, in order to uniformly process, the geometric edge information can be set to 0, that is, the white line of the geometric edge information is changed to black, and the reset geometric edge information is obtained. Then, the stroke information is subtracted from the reset geometric edge, so that the inner contour line and the outer contour line in the stroke information can be eliminated, and only the light-dark boundary line in the shadow area is retained.
[0130] Optionally, the light-dark boundary line obtained above is multiplied with the screen image, and the product result is the stroked area in the target virtual model. The stroked area in the screen image becomes 0 and displays black, thereby achieving the stroke of the light-dark boundary line in the shadow area of the target virtual model. Fig.13 shown.
[0131] Optionally, Fig.14 As shown, the rendering effect obtained after adding noise when each pixel in the screen image is offset in different directions produces an intermittent result.
[0132] Based on the same inventive concept, the embodiments of the present application also provide a rendering device for a virtual model corresponding to the rendering method for a virtual model. Since the principle of solving the problem by the device in the embodiments of the present application is similar to the rendering method for a virtual model in the embodiments of the present application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0133] Fig.15 A schematic diagram of the structure of a virtual model rendering device provided in an embodiment of the present application, referring to Fig.15 As shown, the device comprises:
[0134] The processing module 1501 is used to perform binarization processing on the screen image of the target virtual model to obtain a binarization result of the screen image, wherein the binarization result includes: a plurality of offset binarization results and non-offset binarization results; each of the offset binarization results is a binarization result obtained by binarizing the screen image after offsetting it along a preset direction;
[0135] The determination module 1502 is used to determine the stroke information of the target virtual model according to the binarization result, the stroke information including: the contour line and the light-dark boundary line of the target virtual model; determine the geometric edge information of the target virtual model, the geometric edge information including: the contour line of the target virtual model; according to the contour line of the target virtual model in the geometric edge information, remove the contour line of the target virtual model in the stroke information, and determine the light-dark boundary line of the target virtual model;
[0136] The rendering module 1503 is used to render and display the target virtual model according to the light and dark boundary line of the target virtual model.
[0137] Optionally, the preset direction includes: left, right, upward or downward on the plane where the screen is located;
[0138] The processing module 1501 is specifically used for:
[0139] The screen image is shifted by one or more pixels along each preset direction to obtain a plurality of shifted images;
[0140] Binarization is performed on each of the offset images to obtain the multiple offset binarization results.
[0141] Optionally, the processing module 1501 is specifically configured to:
[0142] Acquire material information of the target virtual model on the current screen, wherein the material information includes: screen image, diffuse reflection color and space normal;
[0143] According to the material information, a binarization process is performed on the screen image of the target virtual model to obtain a binarization result of the screen image.
[0144] Optionally, the processing module 1501 is specifically configured to:
[0145] Determine a ratio result of the screen image and the diffuse reflection color;
[0146] Decolorizing the ratio result to obtain an illuminated image of the target virtual model;
[0147] Binarizing the illumination image to obtain the unbiased binarization result;
[0148] Obtain the offset material information corresponding to each of the offset images, and obtain the offset binarization result corresponding to each direction according to the offset material information corresponding to each of the offset images, wherein the offset material information includes: an offset screen image, an offset diffuse color, and an offset space normal.
[0149] Optionally, the determining module 1502 is specifically configured to:
[0150] Get the randomly generated noise value;
[0151] Determine a product result of the noise value and the offset pixel points after each pixel point in the screen image is offset along different directions;
[0152] Based on the multiplication result, the shifted image after shifting in each direction is obtained.
[0153] Optionally, the determining module 1502 is specifically configured to:
[0154] The non-offset binarization result is subjected to difference processing with the offset binarization result corresponding to each direction, so as to obtain the stroke information of the target virtual model in each direction.
[0155] Optionally, the multiple offset binarization results include: an upward offset binarization result, a downward offset binarization result, a leftward offset binarization result, and a rightward offset binarization result;
[0156] The determining module 1502 is specifically configured to:
[0157] Determine a first difference between the upward-shifted binarization result and the unshifted binarization result, and use the first difference as the lower side stroke information of the target virtual model;
[0158] Determine a second difference between the downward-shifted binarization result and the unshifted binarization result, and use the second difference as upper side stroke information of the target virtual model;
[0159] Determine a third difference between the left-shifted binarization result and the unshifted binarization result, and use the third difference as right side stroke information of the target virtual model;
[0160] Determine a fourth difference between the rightward-shifted binarization result and the unshifted binarization result, and use the third difference as left side stroke information of the target virtual model;
[0161] A sum of the lower stroke information, the upper stroke information, the right stroke information, and the left stroke information is determined, and an inversion operation is performed on the sum result to obtain the stroke information of the target virtual model.
[0162] Optionally, the determining module 1502 is specifically configured to:
[0163] Acquire an unbiased normal corresponding to the screen image of the target virtual model in the current screen, and obtain unbiased edge light information of the target virtual model according to the unbiased normal;
[0164] Obtaining the offset normal corresponding to the offset image after the offset in each of the directions, and obtaining the offset edge light information corresponding to the target virtual model after the offset in each of the directions according to the offset normal corresponding to the offset image after the offset in each of the directions;
[0165] A summation result of the unshifted edge light information and the shifted edge light information after shifting in each of the directions is determined, and the summation result is used as the geometric edge information of the target virtual model.
[0166] Optionally, the determining module 1502 is specifically configured to:
[0167] The geometric edge information is set to a preset value to obtain reset geometric edge information;
[0168] A subtraction result between the reset geometric edge and the stroke information is determined, and the subtraction result is used as a light-dark boundary line of the target virtual model.
[0169] The above-mentioned device is used to execute the method provided by the aforementioned embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.
[0170] The above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASIC), or one or more digital singnal processors (DSP), or one or more field programmable gate arrays (FPGA). For another example, when a module is implemented in the form of a processing element scheduling program code, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).
[0171] Fig.16 This is a structural diagram of an electronic device provided in an embodiment of the present application. The electronic device includes: a processor 1601, a storage medium 1602 and a bus 1603. The storage medium 1602 stores machine-readable instructions executable by the processor 1601. When the electronic device is running, the processor 1601 communicates with the storage medium 1602 through the bus 1603. The processor 1601 executes the machine-readable instructions to perform the following steps:
[0172] Binarization is performed on the screen image of the target virtual model to obtain a binarization result of the screen image, wherein the binarization result includes: a plurality of offset binarization results and a non-offset binarization result; each of the offset binarization results is a binarization result obtained by binarizing the screen image after offsetting it along a preset direction;
[0173] Determine the stroke information of the target virtual model according to the binarization result, wherein the stroke information includes: the contour line and the light-dark boundary line of the target virtual model;
[0174] Acquire geometric edge information of the target virtual model, wherein the geometric edge information includes: a contour line of the target virtual model;
[0175] According to the contour line of the target virtual model in the geometric edge information, the contour line of the target virtual model in the stroke information is removed to obtain the light and dark boundary line of the target virtual model, and according to the light and dark boundary line of the target virtual model, the target virtual model is rendered and displayed.
[0176] Optionally, the preset direction includes: left, right, upward or downward on the plane where the screen is located;
[0177] The processor 1601 performs the binarization processing on the screen image of the target virtual model to obtain the binarization result of the screen image, which is specifically used for:
[0178] The screen image is shifted by one or more pixels along each preset direction to obtain a plurality of shifted images;
[0179] Binarization is performed on each of the offset images to obtain the multiple offset binarization results.
[0180] Optionally, the processor 1601 performs binarization processing on the screen image of the target virtual model to obtain a binarization result of the screen image, which is specifically used for:
[0181] Acquire material information of the target virtual model on the current screen, wherein the material information includes: screen image, diffuse reflection color and space normal;
[0182] According to the material information, a binarization process is performed on the screen image of the target virtual model to obtain a binarization result of the screen image.
[0183] Optionally, the processor 1601 performs binarization processing on the screen image of the target virtual model according to the material information to obtain a binarization result of the screen image, which is specifically used for:
[0184] Determine a ratio result of the screen image and the diffuse reflection color;
[0185] Decolorizing the ratio result to obtain an illuminated image of the target virtual model;
[0186] Binarizing the illumination image to obtain the unbiased binarization result;
[0187] The processor 1601 performs binarization processing on each of the offset images to obtain the multiple offset binarization results, which is specifically used for:
[0188] Obtaining offset material information corresponding to each of the offset images;
[0189] According to the offset material information corresponding to each of the offset images, the offset binarization result corresponding to each direction is obtained, and the offset material information includes: an offset screen image, an offset diffuse reflection color and an offset space normal.
[0190] Optionally, the processor 1601 executes the step of determining each offset image after each pixel point in the screen image is offset along different directions, specifically for:
[0191] Get the randomly generated noise value;
[0192] Determine a product result of the noise value and the offset pixel points after each pixel point in the screen image is offset along different directions;
[0193] Based on the multiplication result, the shifted image after shifting in each direction is obtained.
[0194] Optionally, the processor 1601 performs the step of determining the stroke information of the target virtual model according to the binarization result, specifically for:
[0195] The non-offset binarization result is subjected to difference processing with the offset binarization result corresponding to each direction, so as to obtain the stroke information of the target virtual model in each direction.
[0196] Optionally, the multiple offset binarization results include: an upward offset binarization result, a downward offset binarization result, a leftward offset binarization result, and a rightward offset binarization result;
[0197] The processor 1601 performs the difference processing between the non-offset binarization result and the offset binarization result corresponding to each direction to obtain the stroke information of the target virtual model in each direction, which is specifically used for:
[0198] Determine a first difference between the upward-shifted binarization result and the unshifted binarization result, and use the first difference as the lower side stroke information of the target virtual model;
[0199] Determine a second difference between the downward-shifted binarization result and the unshifted binarization result, and use the second difference as upper side stroke information of the target virtual model;
[0200] Determine a third difference between the left-shifted binarization result and the unshifted binarization result, and use the third difference as right side stroke information of the target virtual model;
[0201] Determine a fourth difference between the rightward-shifted binarization result and the unshifted binarization result, and use the third difference as left side stroke information of the target virtual model;
[0202] A sum of the lower stroke information, the upper stroke information, the right stroke information, and the left stroke information is determined, and an inversion operation is performed on the sum result to obtain the stroke information of the target virtual model.
[0203] Optionally, the processor 1601 executes the step of acquiring geometric edge information of the target virtual model, specifically for:
[0204] Acquire an unbiased normal corresponding to the screen image of the target virtual model in the current screen, and obtain unbiased edge light information of the target virtual model according to the unbiased normal;
[0205] Obtaining the offset normal corresponding to the offset image after the offset in each of the directions, and obtaining the offset edge light information corresponding to the target virtual model after the offset in each of the directions according to the offset normal corresponding to the offset image after the offset in each of the directions;
[0206] A summation result of the unshifted edge light information and the shifted edge light information after shifting in each of the directions is determined, and the summation result is used as the geometric edge information of the target virtual model.
[0207] Optionally, the processor 1601 performs the step of removing the contour line of the target virtual model in the stroke information according to the contour line of the target virtual model in the geometric edge information to obtain the light-dark boundary line of the target virtual model, specifically for:
[0208] The geometric edge information is set to a preset value to obtain reset geometric edge information;
[0209] A subtraction result between the reset geometric edge and the stroke information is determined, and the subtraction result is used as a light-dark boundary line of the target virtual model.
[0210] Optionally, the present invention further provides a program product, such as a computer-readable storage medium, comprising a program, which is used to perform when executed by a processor, and the processor performs the following steps:
[0211] Binarization is performed on the screen image of the target virtual model to obtain a binarization result of the screen image, wherein the binarization result includes: a plurality of offset binarization results and a non-offset binarization result; each of the offset binarization results is a binarization result obtained by binarizing the screen image after offsetting it along a preset direction;
[0212] Determine the stroke information of the target virtual model according to the binarization result, wherein the stroke information includes: the contour line and the light-dark boundary line of the target virtual model;
[0213] Acquire geometric edge information of the target virtual model, wherein the geometric edge information includes: a contour line of the target virtual model;
[0214] According to the contour line of the target virtual model in the geometric edge information, the contour line of the target virtual model in the stroke information is removed to obtain the light and dark boundary line of the target virtual model, and according to the light and dark boundary line of the target virtual model, the target virtual model is rendered and displayed.
[0215] Optionally, the preset direction includes: left, right, upward or downward on the plane where the screen is located;
[0216] The processor executes the process of performing binarization processing on the screen image of the target virtual model to obtain the binarization result of the screen image, which is specifically used for:
[0217] The screen image is shifted by one or more pixels along each preset direction to obtain a plurality of shifted images;
[0218] Binarization is performed on each of the offset images to obtain the multiple offset binarization results.
[0219] Optionally, the processor performs binarization processing on the screen image of the target virtual model to obtain a binarization result of the screen image, which is specifically used for:
[0220] Acquire material information of the target virtual model on the current screen, wherein the material information includes: screen image, diffuse reflection color and space normal;
[0221] According to the material information, a binarization process is performed on the screen image of the target virtual model to obtain a binarization result of the screen image.
[0222] Optionally, the processor performs binarization processing on the screen image of the target virtual model according to the material information to obtain a binarization result of the screen image, which is specifically used for:
[0223] Determine a ratio result of the screen image and the diffuse reflection color;
[0224] Decolorizing the ratio result to obtain an illuminated image of the target virtual model;
[0225] Binarizing the illumination image to obtain the unbiased binarization result;
[0226] The processor 1601 performs binarization processing on each of the offset images to obtain the multiple offset binarization results, which is specifically used for:
[0227] Obtaining offset material information corresponding to each of the offset images;
[0228] According to the offset material information corresponding to each of the offset images, the offset binarization result corresponding to each direction is obtained, and the offset material information includes: an offset screen image, an offset diffuse reflection color and an offset space normal.
[0229] Optionally, the processor executes the step of determining each offset image after each pixel point in the screen image is offset along different directions, specifically for:
[0230] Get the randomly generated noise value;
[0231] Determine a product result of the noise value and the offset pixel points after each pixel point in the screen image is offset along different directions;
[0232] Based on the multiplication result, the shifted image after shifting in each direction is obtained.
[0233] Optionally, the processor performs the step of determining the stroke information of the target virtual model according to the binarization result, specifically for:
[0234] The non-offset binarization result is subjected to difference processing with the offset binarization result corresponding to each direction, so as to obtain the stroke information of the target virtual model in each direction.
[0235] Optionally, the multiple offset binarization results include: an upward offset binarization result, a downward offset binarization result, a leftward offset binarization result, and a rightward offset binarization result;
[0236] The processor performs the subtraction processing of the un-offset binarization result and the offset binarization result corresponding to each direction to obtain the stroke information of the target virtual model in each direction, which is specifically used for:
[0237] Determine a first difference between the upward-shifted binarization result and the unshifted binarization result, and use the first difference as the lower side stroke information of the target virtual model;
[0238] Determine a second difference between the downward-shifted binarization result and the unshifted binarization result, and use the second difference as upper side stroke information of the target virtual model;
[0239] Determine a third difference between the left-shifted binarization result and the unshifted binarization result, and use the third difference as right side stroke information of the target virtual model;
[0240] Determine a fourth difference between the rightward-shifted binarization result and the unshifted binarization result, and use the third difference as left side stroke information of the target virtual model;
[0241] A sum of the lower stroke information, the upper stroke information, the right stroke information, and the left stroke information is determined, and an inversion operation is performed on the sum result to obtain the stroke information of the target virtual model.
[0242] Optionally, the processor executes the step of acquiring geometric edge information of the target virtual model, specifically for:
[0243] Acquire an unbiased normal corresponding to the screen image of the target virtual model in the current screen, and obtain unbiased edge light information of the target virtual model according to the unbiased normal;
[0244] Obtaining the offset normal corresponding to the offset image after the offset in each of the directions, and obtaining the offset edge light information corresponding to the target virtual model after the offset in each of the directions according to the offset normal corresponding to the offset image after the offset in each of the directions;
[0245] A summation result of the unshifted edge light information and the shifted edge light information after shifting in each of the directions is determined, and the summation result is used as the geometric edge information of the target virtual model.
[0246] Optionally, the processor executes the step of removing the contour line of the target virtual model in the stroke information according to the contour line of the target virtual model in the geometric edge information to obtain the light-dark boundary line of the target virtual model, specifically for:
[0247] The geometric edge information is set to a preset value to obtain reset geometric edge information;
[0248] A subtraction result between the reset geometric edge and the stroke information is determined, and the subtraction result is used as a light-dark boundary line of the target virtual model.
[0249] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0250] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0251] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0252] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (English: processor) to perform some steps of the method described in each embodiment of the present invention. The above-mentioned storage medium includes: a USB flash drive, a mobile hard disk, a read-only memory (English:
[0253] Read-Only Memory, referred to as ROM), Random Access Memory (English: Random Access
[0254] Memory, referred to as RAM), magnetic disks or optical disks, etc., which can store program codes.
Claims
1. A method for rendering a virtual model, characterized in that: The method comprises: Binarization is performed on the screen image of the target virtual model to obtain a binarization result of the screen image, wherein the binarization result includes: a plurality of offset binarization results and a non-offset binarization result; each of the offset binarization results is a binarization result obtained by binarizing the screen image after offsetting it along a preset direction; Determine the stroke information of the target virtual model according to the binarization result, wherein the stroke information includes: the contour line and the light-dark boundary line of the target virtual model; Acquire geometric edge information of the target virtual model, wherein the geometric edge information includes: a contour line of the target virtual model; According to the contour line of the target virtual model in the geometric edge information, the contour line of the target virtual model in the stroke information is removed to obtain the light and dark boundary line of the target virtual model, and according to the light and dark boundary line of the target virtual model, the target virtual model is rendered and displayed.
2. The method according to claim 1, characterized in that: The preset direction includes: left, right, upward or downward on the plane where the screen is located; The process of performing binarization processing on the screen image of the target virtual model to obtain the binarization result of the screen image includes: The screen image is shifted by one or more pixels along each preset direction to obtain a plurality of shifted images; Binarization is performed on the multiple offset images to obtain the multiple offset binarization results.
3. The method according to claim 1, characterized in that The binarization process is performed on the screen image of the target virtual model to obtain the binarization result of the screen image, including: Acquire material information of the target virtual model on the current screen, wherein the material information includes: screen image, diffuse reflection color and space normal; According to the material information, a binarization process is performed on the screen image of the target virtual model to obtain a binarization result of the screen image.
4. The method according to claim 3, characterized in that: The step of performing binarization processing on the screen image of the target virtual model according to the material information to obtain a binarization result of the screen image includes: Determine a ratio result of the screen image and the diffuse reflection color; Decolorizing the ratio result to obtain an illuminated image of the target virtual model; Binarizing the illumination image to obtain the unbiased binarization result; Binarization is performed on the plurality of offset images to obtain the plurality of offset binarization results, including: Obtaining offset material information corresponding to each of the offset images; According to the offset material information corresponding to each of the offset images, the offset binarization result corresponding to each direction is obtained, and the offset material information includes: an offset screen image, an offset diffuse reflection color and an offset space normal.
5. The method according to claim 4, characterized in that The determining each offset image after each pixel point in the screen image is offset along different directions includes: Get the randomly generated noise value; Determine a product result of the noise value and the offset pixel points after each pixel point in the screen image is offset along different directions; Based on the multiplication result, the shifted image after shifting in each direction is obtained.
6. The method according to claim 4, characterized in that Determining the stroke information of the target virtual model according to the binarization result includes: The non-offset binarization result is subjected to difference processing with the offset binarization result corresponding to each direction, so as to obtain the stroke information of the target virtual model in each direction.
7. The method according to claim 6, characterized in that The multiple offset binarization results include: an upward offset binarization result, a downward offset binarization result, a leftward offset binarization result, and a rightward offset binarization result; The step of performing difference processing on the un-offset binarization result and the offset binarization result corresponding to each direction to obtain the stroke information of the target virtual model in each direction includes: Determine a first difference between the upward-shifted binarization result and the unshifted binarization result, and use the first difference as the lower side stroke information of the target virtual model; Determine a second difference between the downward-shifted binarization result and the unshifted binarization result, and use the second difference as upper side stroke information of the target virtual model; Determine a third difference between the left-shifted binarization result and the unshifted binarization result, and use the third difference as right side stroke information of the target virtual model; Determine a fourth difference between the rightward-shifted binarization result and the unshifted binarization result, and use the third difference as left side stroke information of the target virtual model; A sum of the lower stroke information, the upper stroke information, the right stroke information, and the left stroke information is determined, and an inversion operation is performed on the sum result to obtain the stroke information of the target virtual model.
8. The method according to claim 1, characterized in that: The step of obtaining geometric edge information of the target virtual model includes: Acquire an unbiased normal corresponding to the screen image of the target virtual model in the current screen, and obtain unbiased edge light information of the target virtual model according to the unbiased normal; Obtaining the offset normal corresponding to the offset image after the offset in each of the directions, and obtaining the offset edge light information corresponding to the target virtual model after the offset in each of the directions according to the offset normal corresponding to the offset image after the offset in each of the directions; A summation result of the unshifted edge light information and the shifted edge light information after shifting in each of the directions is determined, and the summation result is used as the geometric edge information of the target virtual model.
9. The method according to claim 1, characterized in that: The step of removing the contour line of the target virtual model in the stroke information according to the contour line of the target virtual model in the geometric edge information to obtain the light-dark boundary line of the target virtual model includes: The geometric edge information is set to a preset value to obtain reset geometric edge information; A subtraction result between the reset geometric edge and the stroke information is determined, and the subtraction result is used as a light-dark boundary line of the target virtual model.
10. A virtual model rendering device, characterized in that: The device comprises: A processing module, used for performing binarization processing on the screen image of the target virtual model to obtain a binarization result of the screen image, wherein the binarization result includes: a plurality of offset binarization results and non-offset binarization results; each of the offset binarization results is a binarization result obtained by performing binarization processing on the screen image after offsetting it along a preset direction; A determination module is used to determine the stroke information of the target virtual model according to the binarization result, the stroke information including: the contour line and the light-dark boundary line of the target virtual model; determine the geometric edge information of the target virtual model, the geometric edge information including: the contour line of the target virtual model; according to the contour line of the target virtual model in the geometric edge information, remove the contour line of the target virtual model in the stroke information, and determine the light-dark boundary line of the target virtual model; A rendering module is used to render and display the target virtual model according to the light and dark boundary line of the target virtual model.
11. An electronic device, characterized in that: include: A processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the machine-readable instructions to perform the steps of the virtual model rendering method as described in any one of claims 1-9.
12. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method for rendering a virtual model as described in any one of claims 1 to 9 is executed.