A method and device for rendering a grid model, and a storage medium
By configuring preset width lines in the vertex color of the mesh model and rendering twice, the complex lighting formula problem caused by multiple lights participating in lighting in the prior art is solved, which reduces GPU load, reduces performance waste, and improves rendering efficiency.
Patent Information
- Application Number
- CN202110895641.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-05
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2041-08-05
AI Technical Summary
In the prior art, when multiple lights participate in lighting, when rendering a three-dimensional grid model of a virtual digital human, the lighting formula is complicated, which increases the calculation amount of the rendering device, thereby increasing the load on the GPU, and causing performance waste.
By configuring preset width lines in the model vertex color of the mesh model, two renderings are performed: first render the background lines to obtain the underlying rendering model; then color rendering the underlying rendering model to obtain the virtual image model. This method uses simple rendering formulas to reduce the computational effort.
It effectively reduces the load on the GPU in the mesh model rendering device, reduces the waste of GPU performance, and improves the rendering efficiency.
Smart Images

Figure CN113590330B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of mesh model rendering, and in particular, to a mesh model rendering method, apparatus, and storage medium. Background Art
[0002] Virtual digital humans have been continuously developing since the birth of computer graphics and are gradually applied to various fields such as medicine, film and television, education, and shopping guides.
[0003] In the prior art, a multi-light illumination method is used to render the three-dimensional mesh model of a virtual digital human. However, the illumination formula in the existing multi-light illumination method is complex. When using the complex illumination formula to perform multi-light illumination rendering on the three-dimensional mesh model of a virtual digital human, it will increase the computational load of the rendering device, thereby increasing the load on the Graphics Processing Unit (GPU) in the rendering device and resulting in waste of GPU performance. Summary of the Invention
[0004] To solve the above technical problems, embodiments of the present invention are expected to provide a mesh model rendering method, apparatus, and storage medium that can reduce the load on the GPU in the mesh model rendering device and reduce waste of GPU performance.
[0005] The technical solution of the present invention is implemented as follows:
[0006] An embodiment of the present application provides a mesh model rendering method, and the mesh model rendering method includes:
[0007] When the mesh model of the target object is obtained, use the preset-width lines configured in the model vertex colors of the mesh model to render the background lines of the mesh model to obtain an underlying rendered model;
[0008] Perform coloring rendering on the underlying rendered model to obtain the virtual image model corresponding to the target object.
[0009] An embodiment of the present application provides a mesh model rendering apparatus, and the apparatus includes:
[0010] A rendering unit, configured to, when the mesh model of the target object is obtained, use the preset-width lines configured in the model vertex colors of the mesh model to render the background lines of the mesh model to obtain an underlying rendered model; perform coloring rendering on the underlying rendered model to obtain the virtual image model corresponding to the target object.
[0011] An embodiment of the present application provides a mesh model rendering apparatus, and the apparatus includes:
[0012] A memory, a processor, and a communication bus. The memory communicates with the processor via the communication bus. The memory stores a program for rendering a mesh model executable by the processor. When the program for rendering the mesh model is executed, the above-mentioned mesh model rendering method is performed by the processor.
[0013] An embodiment of the present application provides a storage medium, on which a computer program is stored, which is applied to a mesh model rendering device. The computer program, when executed by a processor, implements the above-mentioned mesh model rendering method.
[0014] An embodiment of the present invention provides a mesh model rendering method, device, and storage medium. The mesh model rendering method includes: when a mesh model of a target object is obtained, using a preset-width line configured in the vertex color of the mesh model to render the background lines of the mesh model to obtain an underlying rendering model; performing coloring rendering on the underlying rendering model to obtain a virtual image model corresponding to the target object. By adopting the above method implementation solution, the mesh model rendering device can perform two renderings on the mesh model using a preset-width line configured in the vertex color of the mesh model. Moreover, the formulas in these two rendering methods are simple, reducing the computational amount when the mesh model rendering device renders the mesh model, thereby reducing the load on the GPU in the mesh model rendering device and reducing GPU performance waste. Description of the Drawings
[0015] Figure 1 It is a flowchart of a mesh model rendering method provided by an embodiment of the present application;
[0016] Figure 2 It is an exemplary configured light and dark effect gradient map provided by an embodiment of the present application;
[0017] Figure 3(a) is an exemplary preset main color map provided by an embodiment of the present application;
[0018] Figure 3(b) is an exemplary preset dark part color map provided by an embodiment of the present application;
[0019] Figure 4 It is a flowchart of an exemplary line drawing provided by an embodiment of the present application;
[0020] Figure 5 It is a flowchart of an exemplary cartoon color level drawing provided by an embodiment of the present application;
[0021] Figure 6 It is a schematic composition structure of a mesh model rendering device provided by an embodiment of the present application Figure 1 ;
[0022] Figure 7 Schematic diagram of the composition structure of a mesh model rendering device provided by an embodiment of the present application Figure 2 。 Detailed implementation manners
[0023] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0024] Virtual digital humans have been continuously developing since the birth of computer graphics and are gradually applied to various fields such as medicine, film and television, education, and shopping guides.
[0025] Generally, a virtual digital human system is composed of five modules: a character image, voice generation, animation generation, audio-visual synthesis display, and interaction. The image rendering and performance of virtual digital humans have become an important point in the current real-time display of the digital world. In order to make the image more acceptable to the public, various rendering methods for mesh models have emerged in an endless stream. Among them, cartoon painting art is an art form that is relatively popular among the general public.
[0026] In the prior art, it is also possible to render the three-dimensional mesh model of a virtual digital human by sampling the color of a simple texture map. Rendering the three-dimensional mesh model by sampling the color of a simple texture map has certain limitations and cannot display the lines and rich colors of the virtual digital human.
[0027] In view of the problems existing in the prior art, the mesh model rendering method in Embodiment 1 can be used to solve them.
[0028] Embodiment 1
[0029] The embodiment of the present application provides a mesh model rendering method Figure 1 For the flowchart of a mesh model rendering method provided by an embodiment of the present application, as Figure 1 shown, the mesh model rendering method may include:[[]]
[0030] S101. When the mesh model of the target object is obtained, use the preset-width lines configured in the model vertex colors of the mesh model to render the background lines of the mesh model to obtain an underlying rendered model.
[0031] The mesh model rendering method provided by the embodiment of the present application is applicable to the scenario of rendering the mesh model of the target object.
[0032] In the embodiments of the present application, the mesh model rendering device can be implemented in various forms. For example, the mesh model rendering device described in the present application can include devices such as mobile phones, cameras, tablet computers, laptop computers, handheld computers, personal digital assistants (PDAs), portable media players (PMPs), navigation devices, wearable devices, smart bracelets, pedometers, etc., as well as devices such as digital TVs, desktop computers, servers, etc.
[0033] In the embodiments of the present application, the target object can be a 3D digital human; the target object can also be a 2D digital human; the target object can also be a 3D digital dog; the specific target object can be determined according to the actual situation, and the embodiments of the present application do not limit this.
[0034] In the embodiments of the present application, if the target object is a 3D digital human, the mesh model of the target object can be the mesh model of a 3D virtual digital human.
[0035] In the embodiments of the present application, the preset width line is the width (thickness) of the line defined in the vertex color of the mesh model. Specifically: the producer can use model-making software to assign colors to the vertices of the mesh model, and different colors can represent the thickness of the line. Generally, the process of defining color data is performed following the principle that the lines at the top of the mesh model are thin and the lines near the shadow area of the mesh model are thick.
[0036] Exemplarily, the mesh model rendering device can set the width of the line to three width values: namely, thin line, group line, and a line (general line) between the thick line and the thin line. Correspondingly, the mesh model rendering device can use the three colors of black, gray, and white to correspond to the thin line, general line, and thick line respectively to achieve the process of representing the thickness of the line with different colors.
[0037] In the embodiments of the present application, the rendering method of the mesh model rendering device using the preset width line to render the background line of the mesh model to obtain the underlying rendered model can be the cull front method of front face culling, rendering the back of the model and expanding a certain proportion along the normal direction according to the definition of the vertex color.
[0038] In the embodiments of the present application, the mesh model rendering device can also use the preset width line to render the background line of the mesh model in other rendering methods to obtain the underlying rendered model. Specifically, the method of the mesh model rendering device using the preset width line to render the background line of the mesh model to obtain the underlying rendered model can be determined according to the actual situation, and the embodiments of the present application do not limit this.
[0039] In an embodiment of the present application, the process of the mesh model rendering device rendering the background lines of the mesh model by using a preset-width line configured in the model vertex color of the mesh model includes: the mesh model rendering device renders at least one mesh in the mesh model by using the preset-width line to obtain at least one rendered mesh; the mesh model rendering device combines the at least one rendered mesh to obtain a bottom-layer rendering model.
[0040] It should be noted that the at least one mesh is all the meshes in the mesh model. Specifically, when the mesh model of the target object is divided into one mesh, the number of meshes of the at least one mesh is 1; when the mesh model of the target object is divided into two meshes, the number of meshes of the at least one mesh is 2; when the mesh model of the target object is divided into multiple meshes, the number of meshes of the at least one mesh is multiple.
[0041] In an embodiment of the present application, the process of the mesh model rendering device rendering at least one mesh in the mesh model by using a preset-width line to obtain at least one rendered mesh includes: the mesh model rendering device determines at least one mesh position corresponding to the at least one mesh and at least one normal direction corresponding to the at least one mesh; the mesh model rendering device obtains at least one color information configured for the at least one mesh; the mesh model rendering device determines at least one first line configured for the at least one mesh corresponding to the at least one mesh from the preset-width line; the mesh model rendering device renders the at least one mesh along the at least one normal direction at the at least one mesh position according to the at least one color information and the at least one first line to obtain at least one rendered mesh.
[0042] In an embodiment of the present application, at least one mesh position corresponding to the at least one mesh may be the vertex coordinate position of the at least one mesh in the projection space; at least one normal direction corresponding to the at least one mesh may be the normal direction of the at least one mesh in the projection space.
[0043] In an embodiment of the present application, if the mesh model rendering device uses different colors to represent the thickness of the lines, the process of the mesh model rendering device determining at least one color corresponding to the at least one mesh from the model vertex color is the process of determining at least one first line configured for the at least one mesh corresponding to the at least one mesh from the preset-width line.
[0044] In the embodiment of the present application, the method by which the mesh model rendering device renders at least one mesh along at least one normal direction at at least one mesh position according to at least one color information and at least one first line to obtain at least one rendered mesh may be that the mesh model rendering device first obtains the difference between twice of at least one color information and 0.5, and then the mesh model rendering device obtains the product of at least one direction vector corresponding to at least one normal direction and the difference and at least one first line (at least one thickness value corresponding to at least one first line), and finally the mesh model rendering device obtains the sum of at least one mesh position and the product, so as to obtain at least one rendered mesh.
[0045] Exemplarily, if the number of at least one mesh is multiple, the mesh model rendering device may determine at least one mesh position corresponding to at least one mesh and at least one normal direction corresponding to at least one mesh; the mesh model rendering device obtains at least one color information configured for at least one mesh; the mesh model rendering device determines at least one first line configured for at least one mesh from the preset width lines; the mesh model rendering device renders at least one mesh along at least one normal direction at at least one mesh position according to at least one color information and at least one first line to obtain at least one rendered mesh. If the number of at least one mesh is 1, the method by which the mesh model rendering device renders at least one mesh along at least one normal direction at at least one mesh position according to at least one color information and at least one first line to obtain at least one rendered mesh may be as shown in formula (1):
[0046] pVert.xy = pVert.xy + pNorm.xy * (vCol.r * 2.0 - 0.5) * Outline (1)
[0047] It should be noted that pVert may be the vertex coordinate position (at least one mesh position) in the projection space; pNorm may be the normal direction (at least one normal direction) in the projection space; vCol may be the vertex color (at least one color information) defined in the previous step; Outline may be the value of the line thickness degree input by the user (at least one first line).
[0048] S102. Perform coloring rendering on the underlying rendering model to obtain the virtual image model corresponding to the target object.
[0049] In an embodiment of the present application, after the grid model rendering device renders the background lines of the grid model by using preset-width lines configured in the model vertex colors of the grid model to obtain the underlying rendered model, the grid model rendering device can perform coloring rendering on the underlying rendered model to obtain the virtual image model corresponding to the target object.
[0050] In an embodiment of the present application, the grid model rendering device can be a terminal, the grid model rendering device can also be a web end, and the grid model rendering device can also be a PC end. When the grid model rendering device renders the grid model of the target object to obtain the virtual image model corresponding to the target object, the virtual image model corresponding to the target object is displayed by using the grid model rendering device.
[0051] In an embodiment of the present application, the rendering method for the grid model rendering device to perform coloring rendering on the underlying rendered model to obtain the virtual image model corresponding to the target object can be the cull back back-face culling method. The front of the digital human model is rendered by using the cull back back-face culling method, and this rendering will cover the main color of the middle area rendered for the first time, thereby forming lines with rich variations.
[0052] In an embodiment of the present application, the grid model rendering device uses other rendering methods to perform coloring rendering on the underlying rendered model to obtain the virtual image model corresponding to the target object, which can be specifically determined according to the actual situation, and the embodiments of the present application do not limit this.
[0053] In an embodiment of the present application, the process for the grid model rendering device to perform coloring rendering on the underlying rendered model to obtain the virtual image model corresponding to the target object includes: the grid model rendering device obtains the main color map and the dark part color map configured for the underlying rendered model; determines the light and dark effect of the light irradiating on the surface of the underlying rendered model to obtain the light and dark effect value; the grid model rendering device obtains the configured light and dark effect gradient map and samples the light and dark effect gradient map to obtain the sampled gradient light and dark value; the grid model rendering device uses the sampled gradient light and dark value to perform interpolation processing on the main color map and the dark part color map respectively to obtain the virtual image model.
[0054] Exemplarily, the configured light and dark effect gradient map is as Figure 2 shown: the light and dark effect is divided into 3 gradients. The first gradient is black ( Figure 2 the leftmost color gradient), representing dark light; the third gradient is white ( Figure 2 the rightmost color gradient), representing bright light; the second gradient is gray ( Figure 2 the middle color gradient), representing the light between dark light and bright light.
[0055] In the embodiments of the present application, the method by which the mesh model rendering device interpolates the main color map and the dark part color map respectively using the sampled gradient shading values may be the lerp interpolation method; the method by which the mesh model rendering device interpolates the main color map and the dark part color map respectively using the sampled gradient shading values may also be other interpolation methods; specifically, it can be determined according to the actual situation, and the embodiments of the present application do not limit this.
[0056] Exemplarily, the method by which the mesh model rendering device interpolates the main color map and the dark part color map respectively using the sampled gradient shading values to obtain the virtual image model is shown in formula (2):
[0057] Colfinal = lerp(col1, col0, val) (2)
[0058] It should be noted that Colfinal is the virtual image model, lerp is the lerp interpolation method, col0 represents the main color map, col1 represents the dark part color map, and val is the sampled gradient shading value.
[0059] In the embodiments of the present application, the process by which the mesh model rendering device obtains the main color map and the dark part color map configured for the underlying rendering model includes: the mesh model rendering device obtains a preset main color map and a preset dark part color map; the mesh model rendering device samples the preset main color map to obtain the main color map; the mesh model rendering device samples the preset dark part color map to obtain the dark part color map.
[0060] In the embodiments of the present application, the preset main color map is shown in FIG. 3(a); the preset dark part color map is shown in FIG. 3(b). Specifically, the image contents of the preset main color map and the preset dark part color map are the same, and the image color of the preset main color map is lighter, while the image color of the preset dark part color map is darker.
[0061] It can be understood that the dark part color and the main color form a cold-warm color difference, aiming to make the colors more rich.
[0062] In the embodiments of the present application, the mesh model rendering device may respectively collect the preset main color map and the preset dark part color map by means of UV sampling mapping to obtain the main color map and the dark part color map; the mesh model rendering device may also sample the preset main color map and the preset dark part color map respectively using other sampling methods to obtain the main color map and the dark part color map; specifically, the method by which the mesh model rendering device samples the preset main color map and the preset dark part color map can be determined according to the actual situation, and the embodiments of the present application do not limit this.
[0063] In the embodiment of the present application, the process by which the mesh model rendering device samples a preset main color map to obtain the main color map is shown in formula (3); the process by which the mesh model rendering device samples a preset dark part color map to obtain the dark part color map is shown in formula (4).
[0064] col0 = tex2D(tex0, uv) (3)
[0065] col1 = tex2D(tex1, uv) (4)
[0066] It should be noted that col0 represents the main color map, col1 represents the dark part color map, Tex2D represents the texture sampling function; Tex0 represents the texture of the main color map; Tex1 represents the texture of the dark part color map; uv represents the 2D coordinate.
[0067] In the embodiment of the present application, the process by which the mesh model rendering device determines the light and dark effect of the light irradiating on the surface of the underlying rendering model to obtain the light and dark effect value includes: the mesh model rendering device obtains the light direction vector of a configured light direction and determines the normal vector corresponding to each mesh in the underlying rendering model; the mesh model rendering device obtains the light and dark effect value corresponding to each mesh according to the light direction vector and the normal vector; and obtains the light and dark effect value according to the light and dark effect value corresponding to each mesh.
[0068] In the embodiment of the present application, the mesh model rendering device can calculate the light and dark effect of the digital human model using the half Lambert illumination formula to obtain the light and dark effect value within the range of 0-1. Specifically, as shown in formula (5):
[0069] Diffuse = dot(wNormal, wLightDir) * 0.5 + 0.5 (5)
[0070] It should be noted that Diffuse can be the light and dark effect value, wNormal can be the normal vector, and wLightDir can be the light direction vector.
[0071] Exemplarily, as Figure 4 shown: the configured preset width line can be Figure 4 the leftmost figure. Using the preset width line configured in the model vertex color of the mesh model to render the background line of the mesh model, the underlying rendering model obtained can be Figure 4 the middle figure. Performing coloring rendering on the underlying rendering model, the virtual image model corresponding to the target object obtained can be Figure 4 the rightmost figure.
[0072] Exemplarily, the process of the mesh model rendering device performing coloring rendering on the underlying rendering model to obtain the virtual image model corresponding to the target object is as follows Figure 5 as shown Figure 5 The upper left figure is the main color texture map;
[0073] Figure 5 The lower left figure is the dark part color texture map; Figure 5 The middle figure is the figure obtained by sampling the main color texture map and the dark part color texture map, Figure 5 The right figure is the virtual image model corresponding to the target object.
[0074] It can be understood that the mesh model rendering device can perform two renderings on the mesh model by using the preset-width lines configured in the vertex colors of the mesh model, and the formulas in these two rendering methods are simple, reducing the calculation amount when the mesh model rendering device renders the mesh model, thereby reducing the load on the GPU in the mesh model rendering device and reducing the waste of GPU performance.
[0075] Embodiment 2
[0076] Based on the same inventive concept as Embodiment 1, the embodiment of the present application provides a mesh model rendering device 1, corresponding to a mesh model rendering method; Figure 6 The following is a schematic composition structure of a mesh model rendering device provided by the embodiment of the present application Figure 1 The mesh model rendering device 1 may include:
[0077] A rendering unit 11, configured to, when obtaining the mesh model of the target object, use the preset-width lines configured in the model vertex colors of the mesh model to render the background lines of the mesh model to obtain an underlying rendering model; and perform coloring rendering on the underlying rendering model to obtain the virtual image model corresponding to the target object.
[0078] In some embodiments of the present application, the device further includes a combining unit;
[0079] The rendering unit 11 is configured to use the preset-width lines to render at least one mesh in the mesh model to obtain at least one rendered mesh;
[0080] The combining unit is configured to combine the at least one rendered mesh to obtain the underlying rendering model.
[0081] In some embodiments of the present application, the device further includes a determining unit and an obtaining unit;
[0082] The determining unit is configured to determine at least one grid position corresponding to the at least one grid and at least one normal direction corresponding to the at least one grid; and determine at least one first line configured for the at least one grid from the preset width lines.
[0083] The obtaining unit is configured to obtain at least one color information configured for the at least one grid.
[0084] The rendering unit 11 is configured to render the at least one grid along the at least one normal direction at the at least one grid position according to the at least one color information and the at least one first line, so as to obtain the at least one rendered grid.
[0085] In some embodiments of the present application, the device further includes a sampling unit and an interpolation unit.
[0086] The obtaining unit is configured to obtain a main color map and a dark part color map configured for the underlying rendering model; and obtain a gradient map of the light and dark effect of the configured lighting.
[0087] The determining unit is configured to determine the light and dark effect irradiated on the surface of the underlying rendering model to obtain a light and dark effect value.
[0088] The sampling unit is configured to sample the gradient map of the light and dark effect of the lighting to obtain a sampled gradient light and dark value.
[0089] The interpolation unit is configured to perform interpolation processing on the main color map and the dark part color map respectively by using the sampled gradient light and dark value to obtain the virtual image model.
[0090] In some embodiments of the present application, the obtaining unit is configured to obtain a preset main color map and a preset dark part color map.
[0091] The sampling unit is configured to sample the preset main color map to obtain the main color map; and sample the preset dark part color map to obtain the dark part color map.
[0092] In some embodiments of the present application, the obtaining unit is configured to obtain a light direction vector of a configured lighting direction.
[0093] The determining unit is configured to determine a normal vector corresponding to each grid in the underlying rendering model; obtain each grid light and dark effect value corresponding to each grid according to the light direction vector and the normal vector; and obtain the light and dark effect value according to each grid light and dark effect value.
[0094] It should be noted that in practical applications, the above-mentioned rendering unit 11 can be implemented by the processor 12 on the mesh model rendering device 1, specifically implemented by a CPU (Central Processing Unit), an MPU (Microprocessor Unit), a DSP (Digital Signal Processing), or a field programmable gate array (FPGA, Field Programmable Gate Array), etc.; the above-mentioned data storage can be implemented by the memory 13 on the mesh model rendering device 1.
[0095] An embodiment of the present invention also provides a mesh model rendering device 1, as Figure 7 shown, the mesh model rendering device 1 includes: a processor 12, a memory 13, and a communication bus 14. The memory 13 communicates with the processor 12 through the communication bus 14. The memory 13 stores programs executable by the processor 12. When the program is executed, the mesh model rendering method as described above is executed by the processor 12.
[0096] In practical applications, the above-mentioned memory 13 can be a volatile memory, such as a random access memory (Random-Access Memory, RAM); or a non-volatile memory, such as a read-only memory (Read-Only Memory, ROM), a flash memory, a hard disk (Hard Disk Drive, HDD), or a solid-state drive (Solid-State Drive, SSD); or a combination of the above types of memories, and provides instructions and data to the processor 12.
[0097] An embodiment of the present invention provides a computer-readable storage medium with a computer program thereon. When the program is executed by the processor 12, the mesh model rendering method as described above is implemented.
[0098] It can be understood that the mesh model rendering device can perform two renderings on the mesh model by using the preset-width lines configured in the vertex colors of the mesh model. Moreover, the formulas in these two rendering methods are simple, reducing the computational amount when the mesh model rendering device renders the mesh model, thereby reducing the load on the GPU in the mesh model rendering device and reducing the waste of GPU performance.
[0099] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, a system, or a computer program product. Therefore, the present invention can take the form of a hardware embodiment, a software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) containing computer-usable program code.
[0100] The present invention is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to the embodiments of the present invention. It should be understood that each flow and / or block in the flowchart and / or block diagram, and the combination of flows and / or blocks in the flowchart and / or block diagram, can be realized by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate a device for realizing the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0101] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured article including an instruction device, and the instruction device realizes the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0102] These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process. Thus, the instructions executed on the computer or other programmable device provide steps for realizing the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0103] As mentioned above, it is only the preferred embodiment of the present invention, and is not used to limit the protection scope of the present invention.
Claims
1. A method for rendering a mesh model, characterized in that, the method includes: When the mesh model of the target object is obtained, at least one mesh in the mesh model is rendered by using a preset-width line configured in the model vertex color of the mesh model to obtain at least one rendered mesh; the at least one rendered mesh is combined to obtain a bottom-layer rendering model; the at least one mesh is all meshes in the mesh model; wherein, rendering at least one mesh in the mesh model by using the preset-width line to obtain at least one rendered mesh includes: determining at least one mesh position corresponding to the at least one mesh and at least one normal direction corresponding to the at least one mesh; obtaining at least one color information configured for the at least one mesh; determining at least one first line configured for the at least one mesh from the preset-width line; and rendering the at least one mesh along the at least one normal direction at the at least one mesh position according to the at least one color information and the at least one first line to obtain the at least one rendered mesh; Performing coloring rendering on the bottom-layer rendering model to obtain a virtual image model corresponding to the target object.
2. The method according to claim 1, characterized in that, performing coloring rendering on the bottom-layer rendering model to obtain a virtual image model corresponding to the target object includes: obtaining a main color map and a dark part color map configured for the bottom-layer rendering model; and determining the light and dark effect of the light irradiating on the surface of the bottom-layer rendering model to obtain a light and dark effect value; obtaining a configured light and dark effect gradient map and sampling the light and dark effect gradient map to obtain a sampled gradient light and dark value; Performing interpolation processing on the main color map and the dark part color map respectively by using the sampled gradient light and dark value to obtain the virtual image model.
3. The method according to claim 2, characterized in that, obtaining a main color map and a dark part color map configured for the bottom-layer rendering model includes: obtaining a preset main color map and a preset dark part color map; sampling the preset main color map to obtain the main color map; sampling the preset dark part color map to obtain the dark part color map.
4. The method according to claim 2, characterized in that, determining the light and dark effect of the light irradiating on the surface of the bottom-layer rendering model to obtain a light and dark effect value includes: obtaining a light direction vector of a configured light direction and determining a normal vector corresponding to each mesh in the bottom-layer rendering model; obtaining each mesh light and dark effect value corresponding to each mesh according to the light direction vector and the normal vector; and obtaining the light and dark effect value according to each mesh light and dark effect value.
5. A mesh model rendering device, characterized in that, the device includes: A rendering unit, configured to, when obtaining a mesh model of a target object, render at least one mesh in the mesh model by using a preset-width line configured in the model vertex color of the mesh model, so as to obtain at least one rendered mesh; combine the at least one rendered mesh to obtain a bottom-layer rendering model; perform coloring rendering on the bottom-layer rendering model to obtain a virtual image model corresponding to the target object; where the at least one mesh is all meshes in the mesh model. Wherein, the rendering unit is further configured to: determine at least one mesh position corresponding to the at least one mesh and at least one normal direction corresponding to the at least one mesh; obtain at least one color information configured for the at least one mesh; determine at least one first line configured for the at least one mesh from the preset-width line; and render the at least one mesh in the at least one mesh position along the at least one normal direction according to the at least one color information and the at least one first line, so as to obtain the at least one rendered mesh.
6. A mesh model rendering device Characterized in that The device includes: A memory, a processor, and a communication bus. The memory communicates with the processor through the communication bus. The memory stores a program for mesh model rendering executable by the processor. When the program for mesh model rendering is executed, the method according to any one of claims 1 to 4 is executed by the processor.
7. A storage medium, on which a computer program is stored and applied to a mesh model rendering device Characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
A rendering method and a terminal for simulating illumination
CN109427088A
Model rendering method and device and readable storage medium
CN111402381A