Rendering method, device, computer device and storage medium

CN114549719BActive Publication Date: 2026-10-23BEIJING SWEET SUGARSOFT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210168440.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-23
Publication Date
2026-10-23
Estimated Expiration
2042-02-23

AI Technical Summary

Technical Problem

这种渲染方式存在渲染效果差的问题

Benefits of technology

[0087]关于上述渲染装置、计算机设备、及计算机可读存储介质的效果描述参见上述渲染方法的说明,这里不再赘述。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114549719B_ABST
    Figure CN114549719B_ABST
Patent Text Reader

Abstract

The present disclosure provides a rendering method, device, computer equipment and storage medium, wherein the method comprises: obtaining a three-dimensional model of a target object and an original map of the three-dimensional model; the original map comprises an original color map, an original shadow tendency map and an original light map; generating a shadow color map of the three-dimensional model based on the original light map, the original shadow tendency map and a light direction corresponding to the three-dimensional model; generating a highlight rendering map corresponding to the three-dimensional model based on the original light map and the light direction; and determining an edge light rendering map corresponding to the three-dimensional model based on a virtual camera direction corresponding to the three-dimensional model and the light direction; and rendering the three-dimensional model based on the shadow color map, the highlight rendering map, the edge light rendering map and a color map to generate a target rendering model of the target object.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of image processing technology, and more specifically, to a rendering method, apparatus, computer device, and storage medium. Background Technology

[0002] When rendering two-dimensional objects such as cartoon characters, the following method is typically used: a 3D model of the two-dimensional object is built, and color maps, shadow texture maps, and light maps are manually drawn for the 3D model. Then, using these manually drawn textures, the 3D model is rendered to obtain a rendered image of the two-dimensional object, which exhibits shadow, highlight, and color effects. This rendering method suffers from poor rendering quality. Summary of the Invention

[0003] This disclosure provides at least one rendering method, apparatus, computer device, and storage medium.

[0004] In a first aspect, embodiments of this disclosure provide a rendering method, comprising: acquiring a three-dimensional model of a target object and an original texture map of the three-dimensional model; the original texture map including an original color map, an original shadow tendency map, and an original lighting map; generating a shadow color map of the three-dimensional model based on the original lighting map, the original shadow tendency map, and a lighting direction corresponding to the three-dimensional model; the shadow color map being used to describe the shadow rendering of the three-dimensional model; generating a specular rendering map corresponding to the three-dimensional model based on the original lighting map and the lighting direction; the specular rendering map being used to describe the specular rendering of the three-dimensional model; and determining an eccentric light rendering map corresponding to the three-dimensional model based on a virtual camera direction corresponding to the three-dimensional model and the lighting direction; the eccentric light rendering map being used to describe the eccentric light rendering of the three-dimensional model; and rendering the three-dimensional model based on the shadow color map, the specular rendering map, the eccentric light rendering map, and the color map to generate a target rendering model of the target object.

[0005] In this way, by using the shadow color map, the specular rendering map, the rim light rendering map, and the color map to render the 3D model, a target rendering model of the target object is generated, which has a more natural and realistic lighting effect.

[0006] In one optional implementation, the original lighting map includes: an original shadow map; the pixel value of each pixel in the original shadow map is used to characterize the original shadow intensity information of the vertex corresponding to that pixel in the 3D model; generating a shadow color map of the 3D model based on the original lighting map and the lighting direction corresponding to the 3D model includes: determining a lighting model corresponding to the 3D model based on the 3D model and the lighting direction corresponding to the 3D model; the lighting model is used to characterize the shadow intensity information corresponding to multiple vertices of the 3D model; the lighting direction is corrected on the original shadow map using the lighting model to obtain a target shadow map of the 3D model; and the target shadow map is subjected to light and shadow mapping processing using the original shadow tendency map to obtain a shadow color map corresponding to the 3D model.

[0007] In this way, the shadow map obtained by the above method, compared with the shadow map determined by manual drawing, can flexibly adjust the shadow depth and shadow color, and can be corrected according to the direction of the light. Therefore, when rendering the target object using the obtained shadow map, the shadow effect is more controllable.

[0008] In one optional implementation, the step of correcting the lighting direction of the original shadow map using the lighting model to obtain the target shadow map of the 3D model includes: using the shadow intensity information corresponding to each vertex in the lighting model to remap the original shadow intensity information corresponding to each vertex in the 3D model to obtain an intermediate shadow map of the 3D model; using the intermediate shadow map as the target shadow map, or performing at least one of the following processing on the intermediate shadow map: shadow range adjustment processing, shadow depth correction processing, and shadow color correction processing to obtain the target shadow map.

[0009] In one optional implementation, the step of correcting the lighting direction of the original shadow map using the lighting model to obtain the target shadow map of the three-dimensional model includes: remapping the original shadow tendency map to the intermediate shadow map to obtain the shadow color map of the three-dimensional model.

[0010] In one optional implementation, the original lighting map further includes: a specular material map and a specular shape map; the specular shape map describes the specular shape of the target object during specular rendering, and the specular material map describes whether the constituent materials of various parts of the target object are reflective; generating a specular rendering map of the 3D model based on the original lighting map, the original shadow tendency map, and the lighting direction corresponding to the 3D model includes: determining initial specular rendering information corresponding to the 3D model based on the lighting direction corresponding to the 3D model and the virtual camera direction corresponding to the 3D model; and generating the specular rendering map based on the specular material map, the specular shape map, and the initial specular rendering information.

[0011] In this way, by adding a specular shape map corresponding to the 3D model of the target object for specular rendering, the final generated specular range meets the personalized rendering requirements. Compared with specular rendering based solely on the direction of illumination, the final rendering effect is more able to meet the user's personalized rendering needs for virtual objects such as 2D objects.

[0012] In one optional implementation, determining the initial specular rendering information of the 3D model based on the lighting direction corresponding to the 3D model and the virtual camera direction corresponding to the 3D model includes: determining the normal direction corresponding to each vertex in the 3D model; for any vertex, determining the initial specular rendering information corresponding to the vertex based on the virtual camera direction, the lighting direction, and the normal direction corresponding to the vertex; wherein the initial specular rendering information is used to describe the lighting intensity of the vertex under the virtual camera direction and the lighting direction.

[0013] In one optional implementation, generating the specular rendering map based on the specular material map, the specular shape map, and the initial specular rendering map includes: determining an intermediate rendering map based on the specular material map and the initial specular rendering map; wherein the intermediate rendering map is used to characterize whether specular highlights need to be added to various parts of the 3D model; and determining the target specular rendering map based on the specular shape map and the intermediate rendering map.

[0014] In one optional implementation, determining the edge lighting rendering map corresponding to the 3D model based on the virtual camera orientation corresponding to the 3D model and the lighting direction includes: determining edge rendering information of the target object under the virtual camera orientation based on the virtual camera orientation corresponding to the 3D model; the edge rendering information is used to characterize the probability that each vertex of the 3D model is an edge; determining an edge region map to characterize the edge lighting rendering area corresponding to the target object based on the edge rendering information; and determining the backlight rendering information of the target object based on the 3D model and the lighting direction corresponding to the 3D model, wherein the backlight rendering information is used to characterize the probability that each vertex of the 3D model is located on the backlight surface under the lighting direction; and generating the edge lighting rendering map based on the edge region map and the backlight rendering information.

[0015] In one optional implementation, the edge rendering information corresponding to the target object includes: edge rendering information corresponding to multiple vertices of the 3D model; determining the edge rendering information of the target object under the virtual camera direction based on the virtual camera direction corresponding to the 3D model includes: determining the normal direction corresponding to each vertex in the 3D model; and for any vertex, determining the edge rendering information corresponding to that vertex based on the virtual camera direction corresponding to the 3D model and the normal direction corresponding to that vertex.

[0016] In this way, by adding backlight rendering information based on the 3D model and the corresponding lighting direction of the 3D model for edge lighting rendering, the final generated edge light is only on the backlight of the target object, without affecting the light and shadow levels of the illuminated surface of the target object, resulting in a better edge lighting rendering effect.

[0017] In one optional implementation, determining the edge rendering information corresponding to any vertex based on the virtual camera direction corresponding to the 3D model and the normal direction corresponding to the vertex includes: for any vertex, performing an exponentiation operation on the edge rendering information corresponding to the vertex based on a preset second target parameter to obtain the edge rendering information corresponding to the vertex; wherein, the second target parameter is used to characterize the exponent size when performing the exponentiation operation.

[0018] In one optional implementation, determining the backlight rendering information of the target object based on the 3D model and the corresponding lighting direction includes: determining the normal direction corresponding to each vertex in the 3D model; for any vertex, determining the illuminated surface rendering information corresponding to that vertex based on the lighting direction and the normal direction corresponding to that vertex; the illuminated surface rendering information is used to characterize the size of the illuminated surface area of ​​the target object; and determining the backlight rendering information corresponding to each vertex based on the illuminated surface rendering information corresponding to each vertex.

[0019] In one optional implementation, the step of rendering the 3D model based on the shadow color map, the specular rendering map, the rim light rendering map, and the color map to generate a target rendering model of the target object includes: performing shading preprocessing rendering on the 3D model to obtain a first rendering model; performing position offset processing on the vertices of the 3D model according to the corresponding vertex normal direction, and rendering processing with preset colors to obtain a second rendering model; performing display overlay processing on the first rendering model and the second rendering model to obtain an outer edge rendering image of the target object; and rendering the 3D model based on the shadow color map, the specular rendering map, the rim light rendering map, the color map, and the outer edge rendering image to generate a target rendering model of the target object.

[0020] In this way, the resulting target rendering model can not only fully display the target object, but also display the outer outline rendered by the second rendering model, so as to add more style effects to the target object.

[0021] In one optional implementation, the step of performing position offset processing on vertices in the 3D model corresponding to the vertex normal direction includes: obtaining the offset amount of the position offset processing; the offset amount is used to characterize the distance between the target vertex's position after offset and its position before offset; and using the offset amount to perform position offset processing on vertices in the 3D model corresponding to the vertex normal direction.

[0022] In one optional implementation, rendering a vertex in the 3D model with a preset color includes: obtaining the rendering range when rendering the vertex with the preset color; and rendering the vertex in the 3D model with the preset color based on the rendering range.

[0023] In one optional implementation, the original lighting map further includes: a self-illuminating mask map; the pixel value of each first pixel in the self-illuminating mask map is used to characterize the luminous intensity of a second pixel corresponding to the first pixel; wherein the second pixel is located in the original color map, and its position in the original color map is consistent with the position of the corresponding first pixel in the self-illuminating mask map; the step of rendering the 3D model based on the shadow color map, the specular rendering map, the rim lighting rendering map, and the original color map to generate a target rendering model of the target object includes: performing self-illumination processing on the color map based on the self-illuminating mask map to obtain a target color map with luminous effect; and rendering the 3D model based on the shadow color map, the specular rendering map, the rim lighting rendering map, and the target color map to generate a target rendering model of the target object.

[0024] In this way, since the area to be rendered with a glowing effect can be accurately determined by using a self-illuminating mask map, and the corresponding glowing intensity can be determined by using grayscale values, the area to be displayed with glowing effect on the target object can be directly determined in this way. Then, the self-illuminating mask map and color map are used to perform self-illumination processing to obtain a target color map with a glowing effect. In this way, the target color map can be used to directly render the glowing effect on the target object, which is more realistic.

[0025] In one optional implementation, the step of performing self-illumination processing on the color map based on the self-illuminating mask map to obtain a target color map with an illuminating effect includes: determining the illuminating attribute information of each second pixel based on target illuminating configuration information and the pixel values ​​of the first pixels corresponding to each second pixel in the color map; determining the target pixel values ​​corresponding to each second pixel based on the illuminating attribute information and the pixel values ​​corresponding to each second pixel; and generating the target color map based on the target pixel values ​​corresponding to each second pixel.

[0026] Secondly, embodiments of this disclosure also provide a rendering apparatus, including:

[0027] The acquisition module is used to acquire the 3D model of the target object and the original texture of the 3D model; the original texture includes: original color texture, original shadow tendency texture, and original lighting texture;

[0028] The first rendering module is used to generate a shadow color map of the three-dimensional model based on the original light map, the original shadow tendency map, and the lighting direction corresponding to the three-dimensional model; the shadow color map is used to describe the shadow rendering of the three-dimensional model.

[0029] The second rendering module is used to generate a specular rendering map corresponding to the 3D model based on the original lighting map and the lighting direction; the specular rendering map is used to describe the specular rendering of the 3D model.

[0030] The third rendering module is used to determine the edge light rendering map corresponding to the 3D model based on the virtual camera direction corresponding to the 3D model and the lighting direction; the edge light rendering map is used to describe the edge light rendering of the 3D model;

[0031] The processing module is used to render the 3D model based on the shadow color map, the specular rendering map, the rim light rendering map, and the color map, to generate a target rendering model of the target object.

[0032] In one possible implementation, the original light map includes: an original shadow map; the pixel value of each pixel in the original shadow map is used to characterize the original shadow degree information of the vertex corresponding to that pixel in the three-dimensional model.

[0033] The first rendering module, when generating the shadow color map of the 3D model based on the original light map and the lighting direction corresponding to the 3D model, is used for:

[0034] Based on the three-dimensional model and the lighting direction corresponding to the three-dimensional model, a lighting model corresponding to the three-dimensional model is determined; the lighting model is used to characterize the shadow intensity information corresponding to multiple vertices of the three-dimensional model.

[0035] The original shadow map is corrected for lighting direction using the lighting model to obtain the target shadow map of the three-dimensional model;

[0036] The original shadow tendency map is used to perform light and shadow mapping on the target shadow map to obtain the shadow color map corresponding to the three-dimensional model.

[0037] In one possible implementation, the first rendering module, when correcting the lighting direction of the original shadow map using the lighting model to obtain the target shadow map of the 3D model, is used to:

[0038] Using the shadow intensity information corresponding to multiple vertices included in the lighting model, the original shadow intensity information corresponding to each vertex in the three-dimensional model is remapped to obtain the intermediate shadow map of the three-dimensional model.

[0039] Use the intermediate shadow map as the target shadow map, or

[0040] The intermediate shadow map is subjected to at least one of the following processes: shadow range adjustment, shadow depth correction, and shadow color correction, to obtain the target shadow map.

[0041] In one possible implementation, the first rendering module, when correcting the lighting direction of the original shadow map using the lighting model to obtain the target shadow map of the 3D model, is used to:

[0042] The original shadow tendency map is remapped onto the intermediate shadow map to obtain the shadow color map of the 3D model.

[0043] In one possible implementation, the original lightmap further includes: a specular material map and a specular shape map; the specular shape map is used to describe the specular shape of the target object during specular rendering, and the specular material map is used to describe whether the constituent materials of various parts of the target object are reflective.

[0044] The second rendering module, when generating the specular rendering map of the 3D model from the original light map, the original shadow tendency map, and the lighting direction corresponding to the 3D model, is used for:

[0045] Based on the lighting direction corresponding to the 3D model and the virtual camera direction corresponding to the 3D model, the initial specular rendering information corresponding to the 3D model is determined;

[0046] The specular rendering map is generated based on the specular material map, the specular shape map, and the initial specular rendering information.

[0047] In one possible implementation, the second rendering module, when determining the initial specular rendering information corresponding to the 3D model based on the lighting direction corresponding to the 3D model and the virtual camera direction corresponding to the 3D model, is used to:

[0048] Determine the normal direction corresponding to each vertex in the three-dimensional model;

[0049] For any vertex, based on the virtual camera direction, lighting direction, and normal direction corresponding to the vertex in the 3D model, the initial specular rendering information corresponding to the vertex is determined; wherein, the initial specular rendering information is used to describe the lighting intensity of the vertex under the virtual camera direction and the lighting direction.

[0050] In one possible implementation, the second rendering module, when generating the specular rendering map based on the specular material map, the specular shape map, and the initial specular rendering map, is used to:

[0051] Based on the specular material map and the initial specular rendering map, an intermediate rendering map is determined; wherein, the intermediate rendering map is used to characterize whether specular highlights need to be added to various parts of the 3D model;

[0052] The target specular rendering map is determined based on the specular shape map and the intermediate rendering map.

[0053] In one possible implementation, the third rendering module, when determining the edge light rendering map corresponding to the 3D model based on the virtual camera orientation corresponding to the 3D model and the lighting direction, is used to:

[0054] Based on the virtual camera orientation corresponding to the 3D model, the edge rendering information of the target object under the virtual camera orientation is determined; the edge rendering information is used to characterize the probability that each vertex of the 3D model is an edge; based on the edge rendering information, an edge region texture is determined to characterize the edge light rendering area corresponding to the target object;

[0055] And based on the three-dimensional model and the lighting direction corresponding to the three-dimensional model, determine the backlight rendering information of the target object, wherein the backlight rendering information is used to characterize the probability that each vertex of the three-dimensional model is located on the backlight surface under the lighting direction;

[0056] The edge light rendering map is generated based on the edge region texture and the backlight surface rendering information.

[0057] In one possible implementation, the third rendering module, when determining the edge rendering information corresponding to the target object, includes: edge rendering information corresponding to multiple vertices of the 3D model; and when determining the edge rendering information of the target object under the virtual camera direction based on the virtual camera direction corresponding to the 3D model, it is used to:

[0058] Determine the normal direction corresponding to each vertex in the three-dimensional model;

[0059] For any given vertex, the edge rendering information corresponding to that vertex is determined based on the virtual camera orientation corresponding to the 3D model and the normal orientation corresponding to that vertex.

[0060] In one possible implementation, the third rendering module, when determining the edge rendering information corresponding to any vertex based on the virtual camera direction corresponding to the 3D model and the normal direction corresponding to the vertex, is used to:

[0061] For any of the aforementioned vertices, the edge rendering information corresponding to the vertex is subjected to an exponentiation operation based on a preset second target parameter to obtain the edge rendering information corresponding to the vertex; wherein, the second target parameter is used to characterize the exponent size when performing the exponentiation operation.

[0062] In one possible implementation, the third rendering module, when determining the backlight rendering information of the target object based on the 3D model and the corresponding lighting direction, is used to:

[0063] Determine the normal direction corresponding to each vertex in the three-dimensional model;

[0064] For any given vertex, the lighting surface rendering information corresponding to that vertex is determined based on the lighting direction and the normal direction corresponding to that vertex; the lighting surface rendering information is used to characterize the size of the lighting surface range of the target object;

[0065] Based on the rendering information of the lit surface corresponding to each vertex, the rendering information of the backlit surface corresponding to each vertex is determined.

[0066] In one possible implementation, the processing module, when rendering the 3D model based on the shadow color map, the specular rendering map, the rim light rendering map, and the color map to generate the target rendering model of the target object, is used to:

[0067] The three-dimensional model is pre-processed with shading to obtain a first rendered model; and

[0068] The vertices of the three-dimensional model are subjected to position offset processing of the corresponding vertex normal direction and rendering processing of preset colors to obtain a second rendering model;

[0069] The first rendering model and the second rendering model are overlaid to obtain the outer edge rendering image of the target object;

[0070] Based on the shadow color map, the specular rendering map, the rim light rendering map, the color map, and the outer edge rendering image, the 3D model is rendered to generate the target rendering model of the target object.

[0071] In one possible implementation, the processing module, when performing position offset processing on vertices in the 3D model according to their corresponding vertex normal directions, is used to:

[0072] Obtain the offset amount from the position offset processing; the offset amount is used to characterize the distance between the target vertex's position after the offset and its position before the offset.

[0073] Using the offset, the vertices in the 3D model are offset in the direction of their corresponding vertex normals.

[0074] In one possible implementation, the processing module, when performing preset color rendering on the vertices of the 3D model, is used to:

[0075] Obtain the rendering range when rendering the vertex using the preset color;

[0076] Based on the rendering range, the vertices in the 3D model are rendered with preset colors.

[0077] In one possible implementation, the original lighting map further includes: a self-illuminating mask map; the pixel value of each first pixel in the self-illuminating mask map is used to characterize the luminous intensity of a second pixel corresponding to the first pixel; wherein the second pixel is located in the original color map, and its position in the original color map is consistent with the position of the corresponding first pixel in the self-illuminating mask map;

[0078] The processing module, when rendering the 3D model based on the shadow color map, the specular rendering map, the rim light rendering map, and the original color map to generate the target rendering model of the target object, is used for:

[0079] Based on the self-illuminating mask texture, the color texture is subjected to self-illuminating processing to obtain a target color texture with luminous effect;

[0080] Based on the shadow color map, the specular rendering map, the rim light rendering map, and the target color map, the 3D model is rendered to generate the target rendering model of the target object.

[0081] In one possible implementation, when the processing module performs self-illumination processing on the color map based on the self-illuminating mask map to obtain a target color map with an illuminating effect, it is used to:

[0082] Based on the target luminescence configuration information and the pixel values ​​of the first pixels corresponding to each second pixel in the color map, the luminescence attribute information of each second pixel is determined.

[0083] Based on the light emission attribute information corresponding to each of the second pixels and the pixel value corresponding to each of the second pixels, the target pixel value corresponding to each of the second pixels is determined.

[0084] The target color map is generated based on the target pixel values ​​corresponding to each of the second pixel points.

[0085] Thirdly, an optional implementation of this disclosure also provides a computer device, a processor, and a memory, wherein the memory stores machine-readable instructions executable by the processor, and the processor is configured to execute the machine-readable instructions stored in the memory. When the machine-readable instructions are executed by the processor, the steps of the first aspect above, or any possible implementation of the first aspect, are performed.

[0086] Fourthly, an optional implementation of this disclosure also provides a computer-readable storage medium storing a computer program that, when run, performs the steps of the first aspect or any possible implementation of the first aspect.

[0087] For a description of the effects of the above-mentioned rendering apparatus, computer equipment, and computer-readable storage media, please refer to the description of the rendering method above, which will not be repeated here.

[0088] It should be understood that the above general description and the following detailed description are merely exemplary and explanatory, and are not intended to limit the technical solutions of this disclosure.

[0089] To make the above-mentioned objects, features and advantages of this disclosure more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0090] To more clearly illustrate the technical solutions of the embodiments of this disclosure, the accompanying drawings used in the embodiments will be briefly described below. These drawings are incorporated in and constitute a part of this specification. They illustrate embodiments conforming to this disclosure and, together with the specification, serve to explain the technical solutions of this disclosure. It should be understood that the following drawings only show some embodiments of this disclosure and should not be considered as limiting the scope. Those skilled in the art can obtain other related drawings based on these drawings without creative effort.

[0091] Figure 1 A flowchart of a rendering method provided by an embodiment of this disclosure is shown;

[0092] Figure 2A specific example of a three-dimensional model of the target object provided in the embodiments of this disclosure is shown;

[0093] Figure 3 This document shows a specific example of the original texture map corresponding to the three-dimensional model provided in the embodiments of this disclosure;

[0094] Figure 4 A schematic diagram of a sphere that can reflect shadow intensity information provided in an embodiment of this disclosure is shown;

[0095] Figure 5 A schematic diagram of a display interface for adjusting shadow effects provided in an embodiment of this disclosure is shown;

[0096] Figure 6 This illustration shows a schematic diagram of a rendered image obtained after shadow rendering of a target object, as provided in an embodiment of the present disclosure.

[0097] Figure 7 A schematic diagram illustrating rendering based on shadow color mapping provided in an embodiment of this disclosure is shown;

[0098] Figure 8 A schematic diagram of a settings page for specular rendering parameters provided in an embodiment of this disclosure is shown;

[0099] Figure 9 A schematic diagram of the edge light rendering parameter information setting page provided in an embodiment of this disclosure is shown;

[0100] Figure 10 This illustration shows a schematic diagram of adding an outer outline to a two-dimensional image according to an embodiment of the present disclosure;

[0101] Figure 11 This diagram illustrates an operation interface for selecting a preset color when rendering vertices in a 3D model using a preset color, as provided in an embodiment of this disclosure.

[0102] Figure 12 A schematic diagram of a rendered image with an outer outline effect provided in the disclosed embodiment is shown;

[0103] Figure 13 A schematic diagram of an operation interface for adjusting light emission configuration information provided in a disclosed embodiment is shown;

[0104] Figure 14 This illustration shows a specific example of obtaining a target rendering model after rendering a target object using the rendering method provided in this embodiment of the present disclosure;

[0105] Figure 15 A schematic diagram of the rendering apparatus provided in the disclosed embodiments is shown;

[0106] Figure 16 A schematic diagram of a computer device provided in an embodiment of this disclosure is shown. Detailed Implementation

[0107] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this disclosure, and not all of them. The components of the embodiments of this disclosure described and shown herein can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this disclosure is not intended to limit the scope of the claimed disclosure, but merely represents selected embodiments of this disclosure. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without inventive effort are within the scope of protection of this disclosure.

[0108] Research has found that to improve the realism of rendered 2D objects, lighting and shadow effects are typically added during the rendering process. Currently, when adding lighting and shadow effects to 2D objects, shadow and specular maps are usually defined, and then used to render the shadows and lighting. Here, shadow and specular maps are usually hand-drawn grayscale images. After manually determining the areas where shadows will be added, different grayscale values ​​can be used to reflect the areas where the 2D object should exhibit shadows and highlights. In such shadow and specular maps, the areas where shadows and highlights are rendered on the 2D object are relatively fixed. However, when generating continuously changing scenes using 2D objects, the size and intensity of these shadow and highlight areas may need to be adjusted as the direction of light illuminating the 2D object changes or as the 2D object moves, to ensure the reasonableness of the shadow and highlight areas. Currently, the method of rendering the lighting effects of two-dimensional objects is to draw shadow maps and specular maps separately for each frame of the image, which results in poor realism.

[0109] Based on the above research, this disclosure provides a rendering method. After obtaining the 3D model of the target object and its corresponding original color map, original shadow tendency map, and original lighting map, the method generates a shadow color map of the 3D model using the original lighting map, the original shadow tendency map, and the lighting direction corresponding to the 3D model. It then generates a specular rendering map of the 3D model using the original lighting map and the lighting direction. Finally, it determines the rim light rendering map of the 3D model using the virtual camera direction and the lighting direction. The shadow color map describes the shadow rendering of the 3D model, the specular rendering map describes the specular rendering of the 3D model, and the rim light rendering map describes the rim light rendering of the 3D model. The 3D model is rendered using the shadow color map, the specular rendering map, the rim light rendering map, and the color map to generate a target rendering model of the target object, resulting in a more natural and realistic lighting effect.

[0110] The shortcomings of the above solutions are the result of the inventor's practical experience and careful research. Therefore, the discovery process of the above problems and the solutions proposed in this disclosure below should be considered as the inventor's contribution to this disclosure.

[0111] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.

[0112] To facilitate understanding of the technical solutions disclosed herein, the application scenarios of the embodiments of this disclosure will be described first. The rendering method provided by the embodiments of this disclosure can be used to render virtual characters, virtual buildings, virtual items, etc. in games; it can also be used to render various virtual objects in each frame of an animation; in addition, it can also be used to render two-dimensional objects displayed on a live streaming interface during a live stream.

[0113] To facilitate understanding of this embodiment, a rendering method disclosed in this disclosure will first be described in detail. The rendering method provided in this disclosure generally executes a computer device with certain computing capabilities. This computer device may include, for example, a terminal device, a server, or other processing devices. The terminal device may be a user equipment (UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (PDA), a handheld device, a computing device, an in-vehicle device, a wearable device, etc. In some possible implementations, this rendering method can be implemented by the processor calling computer-readable instructions stored in memory.

[0114] The rendering method provided in the embodiments of this disclosure will be described below.

[0115] See Figure 1 The diagram shows a flowchart of a rendering method provided in an embodiment of this disclosure. The method includes steps S101 to S105, wherein:

[0116] S101: Obtain the 3D model of the target object and the original texture of the 3D model; the original texture includes: original color texture, original shadow tendency texture, and original lighting texture;

[0117] S102: Based on the original light map, the original shadow tendency map, and the lighting direction corresponding to the 3D model, generate a shadow color map of the 3D model; the shadow color map is used to describe the shadow rendering of the 3D model;

[0118] S103: Based on the original lighting map and the lighting direction, generate a specular rendering map corresponding to the 3D model; the specular rendering map is used to describe the specular rendering of the 3D model;

[0119] S104: Based on the virtual camera orientation corresponding to the 3D model and the lighting direction, determine the edge light rendering texture corresponding to the 3D model; the edge light rendering texture is used to describe the edge light rendering of the 3D model;

[0120] S105: Based on the shadow color map, the specular rendering map, the rim light rendering map, and the color map, render the 3D model to generate the target rendering model of the target object.

[0121] The following provides a detailed explanation of S101 to S105.

[0122] Regarding S101 above, the target object includes, for example, two-dimensional objects that need to be rendered in different application scenarios; for example, in a game scenario, the target object includes, for example, virtual characters controlled by the player, virtual characters controlled by non-players, buildings, vegetation, terrain, etc. in the game scene. In an animation scenario, the target object includes, for example, virtual characters in the animation.

[0123] Taking a two-dimensional object as a virtual character as an example, since a two-dimensional object is a virtual object and does not actually exist, we can determine the physical characteristics of the two-dimensional object, such as its height and weight, by constructing a three-dimensional model corresponding to the two-dimensional object, and use the determined three-dimensional model to simulate the image that the two-dimensional object would like to present in the real world.

[0124] For example, see Figure 2 The diagram shown is a schematic representation of a three-dimensional model of a target object provided in an embodiment of this disclosure. The three-dimensional model shown here is an artificially constructed virtual model. Specifically, the three-dimensional model can be further refined to represent facial features and clothing characteristics. Figure 2 The image is not shown. Furthermore, different 3D models can be determined for different 2D objects.

[0125] A 3D model typically consists of multiple vertices located on the surface of the 3D model, and meshes formed by the interconnections between the vertices.

[0126] The original textures of the 3D model include, for example, original color maps, original shadow tendency maps, and original lighting maps. These original textures can be generated, for example, by hand-painting. After the original textures are generated, the execution entity performing the rendering method disclosed herein can obtain the relevant image data corresponding to the original textures.

[0127] Among them, color mapping, also known as texture mapping, uses the pixel values ​​of each pixel in the texture mapping to represent the color information (texture information) of each vertex in the 3D model.

[0128] The pixel values ​​of each pixel in the shadow tendency map are used to represent the shadow tendency information of each vertex in the 3D model.

[0129] The original lightmap describes the lighting information for each vertex in the 3D model. This lighting information includes, for example, the textures corresponding to the following four channels:

[0130] R channel: Light texture map, specifying whether the material type of the illuminated area is reflective through grayscale. The pixel values ​​of each pixel in the light texture map are used to characterize whether the corresponding vertex in the 3D model is a reflective material.

[0131] G channel: Shadow map, with a grayscale value of 128 in the middle. For areas with a grayscale value of 128, the larger the value, the earlier it will enter the shadow area; for areas with a grayscale value higher than 128, the smaller the value, the less likely it is to enter the shadow area.

[0132] B channel: Specular shape map, which maps the hand-drawn specular area shape onto the model surface. The pixel value of each pixel in the specular shape map is used to characterize whether the corresponding vertex in the 3D model belongs to the specular area.

[0133] Channel A: Self-illuminating mask texture, using grayscale values ​​to filter the location and range of self-illumination.

[0134] like Figure 3 The example shown provides a specific example of the original texture corresponding to the target object. Figure 3 In the text 'a', the original color map is represented (the actual color map has color values, but not like a...). Figure 3 (The grayscale value shown in 'a' is the grayscale value). Figure 3 The 'b' in the middle represents the original shadow tendency map; Figure 3 The 'c' in the middle represents the original lightmap; Figure 3 In the middle, 'd' represents the lighting material map; Figure 3 The 'e' in the middle represents the shadow map; Figure 3 In the middle, 'f' represents the specular shape map; Figure 3 The 'g' in the middle represents a self-illuminating mask texture.

[0135] Regarding S102 above: the original lighting map includes: the original shadow map; the pixel value of each pixel in the original shadow map is used to characterize the original shadow degree information of the vertex corresponding to that pixel in the three-dimensional model.

[0136] In this embodiment, for example, steps 21 to 23 are used to generate a shadow color map of the 3D model based on the original shadow map, the original shadow tendency map, and the lighting direction corresponding to the 3D model:

[0137] Step 21: Based on the three-dimensional model and the lighting direction corresponding to the three-dimensional model, determine the lighting model corresponding to the three-dimensional model; the lighting model is used to characterize the shadow intensity information corresponding to multiple vertices of the three-dimensional model.

[0138] In a specific implementation, the lighting model can be determined in the following way: determine the normal directions corresponding to multiple vertices in the three-dimensional model; for each vertex, perform a dot product operation on the normal direction and the lighting direction corresponding to each vertex to obtain the shadow level information corresponding to each vertex; and obtain the lighting model based on the shadow level information corresponding to the multiple vertices.

[0139] For multiple vertices in the 3D model and the normal directions corresponding to these vertices, see [link to documentation]. Figure 2 As shown, some vertices and their corresponding normal directions are labeled in the illustrated 3D model. Since the 3D model is deterministic, multiple vertices can be determined on the outer contour of the 3D model, and the normal directions of each vertex can be determined based on their respective positions on the 3D model.

[0140] In another embodiment of this disclosure, a specific method for determining the illumination direction is also provided. Specifically, the position information of the target light source in the model coordinate system corresponding to the three-dimensional model can be determined, and then the illumination direction corresponding to the three-dimensional model can be determined based on the light source position information.

[0141] The target light source can include a virtual light source. When determining the illumination direction of the target light source, the relative positional relationship between the target light source and the 3D model is involved because the illumination direction specifically affects the 3D model. Therefore, to more accurately determine the illumination direction, a corresponding model coordinate system can be established based on the 3D model, and the light source position information of the target light source can be determined within this model coordinate system. In this way, for the target light source and the 3D model within the same model coordinate system, the relative positional relationship between the target light source and the 3D model can be accurately determined, thereby enabling the determination of the illumination direction corresponding to the 3D model.

[0142] Given a defined lighting direction, for each of the multiple vertices, a dot product operation can be performed using the normal direction and the lighting direction to obtain the shadow intensity information for each vertex. By determining the shadow intensity information for each of the multiple vertices, a lighting model can be obtained. Specifically, the shadow intensity information reflected in the lighting model indicates whether each vertex appears in a shadow area after rendering, and if so, whether the shadow color is darker or lighter.

[0143] See Figure 4 The diagram shown is a schematic representation of a sphere that can reflect shadow intensity information according to an embodiment of this disclosure. A simple sphere 41 is used to represent a three-dimensional model for illustration. Figure 4 The diagram also shows the target light source 42. For the sphere 41, multiple vertices on the surface can be determined, and the normal vector corresponding to each vertex can be identified. In the diagram, three special vertices a1, a2, and a3 are labeled, and their corresponding normal vectors are represented as N1, N2, and N3, respectively. For the target light source 42, the corresponding illumination direction is represented as L.

[0144] Thus, according to Figure 4The diagram showing the shadow effect of the sphere reveals that the normal vector N1 corresponding to vertex a1 is in the opposite direction to L, resulting in no shadow at vertex a1. The normal vector N2 corresponding to vertex a2 is perpendicular to L, resulting in a gray shadow at vertex a1. For vertices where the angle between their corresponding normal vector and L is greater than 90 degrees and less than 180 degrees, different shades of gray are observed, with a darker gray shadow appearing as the angle increases. The normal vector N3 corresponding to vertex a3 is in the same direction as L, resulting in a black shadow at vertex a3. Furthermore, all vertices where the angle between their corresponding normal vector and L is less than 90 degrees are also black. Based on this deduction, given the lighting direction L and the normal vector Na corresponding to each vertex a, it is possible to determine whether each vertex a is in a shadow region and, if so, the appropriate shadow color.

[0145] Step 22: Use the lighting model to correct the lighting direction of the original shadow map to obtain the target shadow map of the three-dimensional model.

[0146] In specific implementations, for example, the lighting model can be used to correct the lighting direction of the original shadow map to obtain the target shadow map of the three-dimensional model:

[0147] Using the shadow intensity information corresponding to multiple vertices included in the lighting model, the original shadow intensity information corresponding to each vertex in the three-dimensional model is remapped to obtain the intermediate shadow map of the three-dimensional model.

[0148] Use the intermediate shadow map as the target shadow map, or

[0149] The intermediate shadow map is subjected to at least one of the following processes: shadow range adjustment, shadow depth correction, and shadow color correction, to obtain the target shadow map.

[0150] Specifically, the remapping process involves remapping the original shadow intensity information across the grayscale range, which can be achieved using linear interpolation. This allows the use of shadow intensity information corresponding to multiple vertices under a lighting model that reflects the direction of illumination. Through remapping, the original shadow intensity information in the original shadow map also retains the influence of the lighting direction, resulting in an intermediate shadow map that reflects the effect of the lighting direction on the target object model.

[0151] The intermediate shadow map can be directly used as the target shadow map.

[0152] In addition, in order to obtain a more realistic shadow effect, at least one of the following processes can be performed on the intermediate shadow map: (1) shadow range adjustment processing and (2) shadow color correction processing, to obtain the target shadow map.

[0153] (1): When correcting the shadow depth of the intermediate shadow map, the following method can be used, for example:

[0154] In response to a received shadow range adjustment command, the shadow range of the intermediate shadow map is adjusted. This shadow range adjustment command carries a target shadow partition grayscale threshold. Here, the target shadow partition grayscale threshold is a grayscale value that controls the shadow tendency of the corresponding area of ​​each pixel in the intermediate shadow map on the 3D model. In one possible scenario, if the target shadow partition grayscale threshold is determined to be 128, then pixels with grayscale values ​​less than 128 in the intermediate shadow map will be less likely to produce shadows in the corresponding area of ​​the 3D model, while pixels with grayscale values ​​greater than 128 in the intermediate shadow map will be more likely to produce shadows in the corresponding area of ​​the 3D model.

[0155] Here, the shadow range adjustment command may include, for example, a target shadow zone grayscale threshold, meaning the target shadow zone grayscale threshold is adjustable. Specifically, the shadow range adjustment command can be determined in response to receiving an input command to the input box corresponding to the target shadow zone grayscale threshold or an operation command to the adjustment knob. See also Figure 5 The diagram shows a display interface for adjusting shadow effects according to an embodiment of this disclosure. A table labeled "Target Shadow Zone Grayscale Threshold" includes adjustment buttons. By sliding the buttons left and right, the grayscale threshold value of the target shadow zone can be changed. Sliding the adjustment buttons generates a shadow range adjustment command. Furthermore, after a sliding operation, the currently set target shadow zone grayscale threshold value is displayed in a table next to it, for example, "128" as shown.

[0156] When partitioning the intermediate shadow map using the target shadow partition grayscale threshold, pixels in the intermediate shadow map with grayscale values ​​greater than or equal to the target shadow partition grayscale threshold can be assigned to the first partition, and pixels in the intermediate shadow map with grayscale values ​​less than the target shadow partition grayscale threshold can be assigned to the second partition.

[0157] Since the grayscale threshold of the target shadow partition can be adjusted, the shadow map can be flexibly adjusted by adjusting the grayscale threshold of the target shadow partition within a certain range, given a fixed target shadow map.

[0158] Specifically, the range of grayscale threshold values ​​for the target shadow partition can be limited in the following manner: receiving a first value range adjustment instruction corresponding to the grayscale threshold value of the target shadow partition; determining a first target value range for the grayscale threshold value of the target shadow partition based on the first value range adjustment instruction; the grayscale threshold value of the target shadow partition carried in the shadow range adjustment instruction is located within the first target value range.

[0159] For example, see Figure 5 As shown, the table labeled "Value Range" also includes an adjustment knob. Sliding this knob determines an adjustment command for the first value range corresponding to the grayscale threshold of the target shadow region. Here, the determined first value range is also the selectable range of the target shadow region grayscale threshold described above during adjustment. For example, for... Figure 5 The “Area Range” shown in the table indicates that the current first target value range is 150, which means that the maximum grayscale threshold of the target shadow partition can be selected to be 150. In other words, when the adjustment knob in the “Target Shadow Partition Grayscale Threshold” table is slid to the maximum, the grayscale threshold that can be selected is 150.

[0160] (2) When correcting the shadow color of the intermediate shadow map, the following methods can be used, for example:

[0161] Obtain a shadow color adjustment instruction; the shadow color adjustment instruction carries a color grayscale threshold; use the color grayscale threshold to perform a second correction process on the shadow color of the intermediate shadow map to obtain a third target shadow map.

[0162] Among them, see Figure 5 As shown, the table labeled "Shadow Color" contains a color picker button for the shadow color and a color chart for the currently selected shadow color. In response to the color picker operation, a shadow color adjustment command is generated, which carries the confirmed grayscale threshold for the color selected in the current color picker operation, for example... Figure 5 The "Shadow Color" table displays the shadow colors. Using a defined color grayscale threshold, a second correction process can be applied to the chosen shadow color. For example, if the selected grayscale threshold is high, the corresponding reaction will adjust the intermediate shadow map to display a lighter shadow; if the selected grayscale threshold is low, the corresponding reaction will adjust the intermediate shadow map to display a darker shadow.

[0163] In addition, similar to the target shadow partition grayscale threshold described above, the selection range of shadow colors can also be limited by determining the shadow color adjustment range. In specific implementation, a second value range adjustment instruction corresponding to the color grayscale threshold can be received; based on the second value range adjustment instruction, a second target value range of the color grayscale threshold is determined; the color grayscale threshold carried in the shadow color adjustment instruction is located within the second target value range.

[0164] See Figure 5 As shown, in the table labeled "Shadow Color Adjustment Range," there is a color picker button for adjusting the shadow color adjustment range. Responding to the selection of the shadow color adjustment range using this color picker button, a second value range adjustment instruction corresponding to the color grayscale threshold can be determined, thereby determining the second target value range of the shadow color. For example, Figure 5 The color chart showing the range of shadow color adjustments indicates the deepest possible shadow color that can be selected.

[0165] The above describes two adjustment ranges for the target shadow partition grayscale threshold and shadow color setting. In scenarios where multiple people work together, by limiting the value range of the first target and the value range of the second target, the degree of adjustment that can be made when multiple people adjust the shadow depth and / or shadow color of the target shadow map can be limited to a certain range. This can reduce the situation where the shadow is too dark or too deep due to differences in personal style or preference.

[0166] The shadow map generation method provided in this embodiment provides a shadow map that, compared to a shadow map determined by manual drawing, allows for flexible adjustment of shadow depth and color, and can be corrected according to the direction of illumination. Therefore, when rendering a target object using the obtained shadow map, the shadow effect is more controllable.

[0167] For example, see Figure 6 The diagram shown is a schematic representation of a rendered image obtained after shadow rendering of a target object according to an embodiment of this disclosure. Figure 6 Image (a) shows the rendered image of the target object after the shadow map, which was determined directly by manual drawing, is rendered. Compared to Figure 6 The rendered image shown in (b) is not natural in its shadow representation, as it is obtained by the shadow mapping generation method provided in this embodiment. Figure 6 The rendered image shown in (b) is more in line with the lighting logic in reality in terms of shadow representation, and therefore more natural and able to enhance the realism of the target object.

[0168] Step 23: Use the original shadow tendency map to perform light and shadow mapping processing on the target shadow map to obtain the shadow color map corresponding to the three-dimensional model.

[0169] In practical implementation, for example, the original shadow tendency map can be used to perform light and shadow mapping processing on the target shadow map to obtain the shadow color map corresponding to the 3D model:

[0170] The original shadow tendency map is remapped onto the intermediate shadow map to obtain the shadow color map of the 3D model.

[0171] In practical implementation, remapping can be used when performing lighting and shadow mapping. For example, a shadow tendency map can be remapped onto a target shadow map to obtain a shadow color map for the 3D model. Here, linear interpolation can be used to calculate the remapping of the map.

[0172] Since the obtained shadow color map is obtained by remapping, it can retain the characteristics of the target shadow map, that is, it has the shadow characteristics under a certain lighting direction. In addition, it can also retain the characteristics of the shadow tendency map, so that the shadow color map also has the light and shadow effect of subsurface scattering in the shadow part after rendering, thereby improving the realism of the light and shadow effect of rendering two-dimensional objects.

[0173] This method requires less computing power and is suitable for general computer equipment. Therefore, it is relatively easy to add subsurface scattering effects to two-dimensional objects, making the lighting and shadow effects of the resulting two-dimensional objects closer to the real effect.

[0174] For example, see Figure 7 The diagram shown illustrates a rendering method based on a shadow color map according to an embodiment of this disclosure; specifically, the shadow color map is used to render the hand. Figure 7 Image (a) shows a rendered image obtained after rendering a target object without using the texture generation method provided in the embodiments of this disclosure. Figure 7 Image (b) shows a rendered image of a hand obtained after rendering using the method provided in this embodiment of the present disclosure. A comparison clearly shows that... Figure 7 Region 72 in the rendered image shown in (b) is compared to Figure 7 The corresponding area 71 in (a) has a subsurface scattering effect due to lighting, which can make the hand more reflective of the "medium" effect, that is, can improve the realism of the lighting and shadow effects of the two-dimensional object rendering.

[0175] Regarding the aforementioned S103: original lighting map, it also includes: specular material map and specular shape map. The specular shape map specifically includes a grayscale image, composed of pixels at different grayscale values, which can reflect whether each vertex in the 3D model needs specular rendering; for example, such as... Figure 3 As shown in Figure f, this is a schematic diagram of a specular shape texture provided in an embodiment of this disclosure. Figure 3 In the diagram, the black areas are areas that do not require specular rendering, while the gray areas are areas that require specular rendering. The specular shape map can be drawn by the developers, so that the final specular effect can better meet personalized rendering needs.

[0176] Specular texture maps specifically include grayscale images, composed of pixels at different grayscale values, which can reflect whether the constituent materials of each vertex in a 3D model are reflective. For example, ... Figure 3 As shown in Figure d, this is a schematic diagram of a material texture provided in an embodiment of this disclosure. Figure 3 In the d-value, different gray values ​​represent different materials in the region. The higher the gray value, the higher the reflectivity of the material in that region, and the lower the gray value, the lower the reflectivity of the material in that region.

[0177] For example, steps 31 to 32 below can be used to generate a specular rendering map of the 3D model based on the original light map, the original shadow tendency map, and the lighting direction corresponding to the 3D model:

[0178] Step 31: Based on the lighting direction corresponding to the 3D model and the virtual camera direction corresponding to the 3D model, determine the initial specular rendering information corresponding to the 3D model.

[0179] In specific implementation, the initial specular rendering information corresponding to the three-dimensional model can be determined in the following way: determine the normal direction corresponding to each vertex in the three-dimensional model;

[0180] For any vertex, based on the virtual camera direction, lighting direction, and normal direction corresponding to the vertex in the 3D model, the initial specular rendering information corresponding to the vertex is determined; wherein, the initial specular rendering information is used to describe the lighting intensity of the vertex under the virtual camera direction and the lighting direction.

[0181] Here, the normal direction of the vertex can be as follows: Figure 2 As shown, for any given vertex, the vertex normal direction can be determined based on the vertex's position information in the 3D model. The vertex normal direction can be represented using vector coordinates in the Cartesian coordinate system corresponding to the 3D model, for example, the normal direction is (1, 1, 1).

[0182] The virtual camera direction corresponding to the 3D model can be represented using vector coordinates in the Cartesian coordinate system corresponding to the 3D model. For example, the virtual camera direction a is (0, 0, 1); the lighting direction can be represented using vector coordinates in the Cartesian coordinate system corresponding to the 3D model. For example, the lighting direction b is (1, 1, 0).

[0183] When determining the initial specular rendering information of a vertex based on the virtual camera direction, lighting direction, and normal direction corresponding to the vertex in the 3D model, the virtual camera direction and the lighting direction can be superimposed to obtain the target tangent; the target tangent is normalized, and the normalized target tangent is multiplied by the normal direction corresponding to the vertex to obtain the initial specular rendering information of the vertex.

[0184] For example, taking the virtual camera direction as (0, 0, 1), the lighting direction as (1, 1, 0), and the normal direction of vertex A as (1, 1, 1), the superposition of the virtual camera direction and the lighting direction can be processed to obtain the target tangent as (1, 1, 1), and the normalized target tangent as (1 / 3, 1 / 3, 1 / 3). Then, the normalized target tangent and the normal direction of vertex A are clicked to obtain the initial specular rendering information corresponding to vertex A as 1 / 3×1+1 / 3×1+1 / 3×1=1.

[0185] Step 32: Generate the specular rendering map based on the specular material map, the specular shape map, and the initial specular rendering information.

[0186] In specific implementations, for example, the specular rendering map can be generated based on the specular material map, the specular shape map, and the initial specular rendering map in the following manner:

[0187] Based on the specular material map and the initial specular rendering map, an intermediate rendering map is determined; wherein, the intermediate rendering map is used to characterize whether specular highlights need to be added to various parts of the 3D model;

[0188] The target specular rendering map is determined based on the specular shape map and the intermediate rendering map.

[0189] In a specific implementation, one possible approach is that when determining the intermediate rendering texture, the initial specular rendering information corresponding to each vertex in the initial specular rendering model can be remapped based on the reflection information stored in the specular material texture to obtain the intermediate specular rendering information corresponding to each vertex.

[0190] Here, when remapping the initial specular rendering information corresponding to each vertex in the initial specular rendering model based on the reflection information stored in the specular material map, algorithms such as linear interpolation can be used to remap the initial specular rendering information within the range corresponding to the reflection information stored in the specular material map (that is, the grayscale value range corresponding to the specular material map) to obtain the intermediate specular rendering information corresponding to each vertex.

[0191] In this way, by remapping the initial specular rendering model according to the material texture, the final specular rendering effect can be made more realistic, ensuring that the final specular effect conforms to the reflection law of objects in nature.

[0192] When determining the target specular rendering map based on the specular shape map and the intermediate rendering map, the intermediate specular rendering information corresponding to each vertex in the intermediate rendering map can be remapped according to the specular shape information stored in the specular shape map to obtain the target specular rendering information corresponding to each vertex; the target specular rendering information corresponding to each vertex constitutes the target specular rendering map.

[0193] Here, when remapping the intermediate specular rendering information corresponding to each vertex in the intermediate rendering texture according to the specular shape information stored in the specular shape texture, algorithms such as linear interpolation can be used to remap the initial specular rendering information within the range corresponding to the specular shape information stored in the specular shape texture (that is, the grayscale value range corresponding to the specular shape texture) to obtain the target specular rendering information corresponding to each vertex.

[0194] In this way, by adding a specular shape map corresponding to the 3D model of the target object for specular rendering, the final generated specular range meets the personalized rendering requirements. Compared with specular rendering based solely on the direction of illumination, the final rendering effect is more able to meet the user's personalized rendering needs for virtual objects such as 2D objects.

[0195] In practical applications, the specular rendering effect often cannot immediately meet the rendering needs of developers. Therefore, after performing specular rendering based on the target specular rendering texture, a specular rendering effect adjustment instruction can be received, and specular rendering can be performed based on the specular rendering parameter information in the specular rendering effect adjustment instruction.

[0196] In one possible implementation, specular rendering parameter information corresponding to the 3D model can be received, and specular rendering of the target object can be performed based on the target specular rendering texture and the specular rendering parameter information.

[0197] Here, the specular rendering parameter information may include at least one of specular intensity information, specular range information, and specular color information.

[0198] Specifically, when adjusting the specular intensity of the specular rendering effect, the target specular rendering information in the target specular rendering texture can be updated based on the specular intensity parameters carried in the specular intensity information; when adjusting the specular range of the specular rendering effect, the target specular rendering information in the target specular rendering texture can be updated based on the specular range parameters carried in the specular range information; when adjusting the specular color of the specular rendering effect, specular rendering can be performed based on the specular color corresponding to the specular color information and the target specular rendering information in the target specular rendering texture to obtain the specular rendering effect after adjusting the specular color.

[0199] For example, the settings page for the specular rendering parameters can be as follows: Figure 8 As shown, Figure 8 It includes adjustment areas for the highlight intensity parameter, highlight range parameter, and highlight color parameter, respectively. The highlight intensity parameter is set to "0.8", the highlight range parameter is set to "1", and the highlight color is set to "gray".

[0200] In this way, the specular rendering effect can be adjusted more flexibly by adjusting the specular rendering parameters to obtain the desired specular rendering effect.

[0201] In the above specular rendering process, by adding material textures corresponding to the 3D model of the target object, the final specular rendering effect is made more realistic, ensuring that the final specular effect conforms to the reflection law of objects in nature. On the other hand, by adding specular shape textures corresponding to the 3D model of the target object for specular rendering, the final generated specular range meets the personalized rendering requirements. Compared with specular rendering based solely on the direction of illumination, the final rendering effect is more able to meet the user's personalized rendering needs for virtual objects such as two-dimensional objects.

[0202] Regarding S104 above: For example, steps 41 to 43 below can be used to determine the edge light rendering texture corresponding to the 3D model based on the virtual camera direction corresponding to the 3D model and the lighting direction:

[0203] Step 41: Determine the edge rendering information of the target object under the virtual camera direction based on the virtual camera direction corresponding to the 3D model; the edge rendering information is used to characterize the probability that each vertex of the 3D model is an edge; based on the edge rendering information, determine the edge region texture to characterize the edge light rendering area corresponding to the target object.

[0204] In specific implementations, for example, the edge rendering information of the target object in the virtual camera direction corresponding to the 3D model can be determined in the following manner:

[0205] Determine the normal direction corresponding to each vertex in the three-dimensional model;

[0206] For any given vertex, the edge rendering information corresponding to that vertex is determined based on the virtual camera orientation corresponding to the 3D model and the normal orientation corresponding to that vertex.

[0207] When determining the edge rendering information corresponding to a vertex based on the virtual camera direction corresponding to the 3D model and the normal direction corresponding to the vertex, the virtual camera direction and the normal direction corresponding to the vertex can be used to perform a dot product operation to obtain the initial probability (range 0 to 1, with vertices close to or equal to 0 being edges) representing that the target object is not an edge under the virtual camera direction. By subtracting the initial probability from the initial probability, the edge rendering information that can represent the probability that the vertex is an edge can be obtained.

[0208] It should be noted that, in order to make the obtained edge rendering information better represent the probability that each vertex of the 3D model is an edge, in the process of determining the edge rendering information, processing methods such as remapping and normalization can be used to process the intermediate data so that the numerical range of the obtained edge rendering information is 0 to 1.

[0209] When determining the edge region texture to characterize the edge lighting rendering area corresponding to the target object based on the edge rendering information, the following method can be used, for example:

[0210] For any of the aforementioned vertices, the edge rendering information corresponding to that vertex can be subjected to exponentiation based on a preset second target parameter; wherein, the second target parameter is used to characterize the exponent size when performing exponentiation, and the edge rendering information corresponding to each vertex after exponentiation constitutes the edge region texture.

[0211] Here, since the values ​​corresponding to the edge rendering information are between 0 and 1, in order to make the determined edge light rendering area more accurate, the edge rendering information can be processed to better filter out the edge light range that the target object needs to be edge-lit. The target range of the edge rendering information corresponding to each vertex within the edge light range can be preset, and the vertices whose corresponding edge rendering information is located within the target range are the vertices that need to be edge-lit.

[0212] For example, if the edge rendering information corresponding to vertex A is 0.8 and the second target parameter is 3, then the edge rendering information after exponentiation is 0.8 × 0.8 × 0.8 = 0.512.

[0213] In this way, by performing an exponentiation operation on the edge rendering information, the numerical difference between each edge rendering information can be increased, thereby accurately determining the edge light range that needs to be rendered, resulting in a better edge light rendering effect.

[0214] Step 42: Based on the 3D model and the corresponding lighting direction, determine the backlight rendering information of the target object, wherein the backlight rendering information is used to characterize the probability that each vertex of the 3D model is located on the backlight surface under the lighting direction.

[0215] In specific implementations, the backlight rendering information of the target object can be determined, for example, in the following manner: The normal direction corresponding to each vertex in the 3D model is determined. For any given vertex, based on the lighting direction and the normal direction corresponding to that vertex, the illuminated surface rendering information corresponding to that vertex is determined; the illuminated surface rendering information is used to characterize the size of the illuminated surface area of ​​the target object. Based on the illuminated surface rendering information corresponding to each vertex, the backlight rendering information corresponding to each vertex is determined.

[0216] For any given vertex, perform a dot product operation between the lighting direction and the normal direction corresponding to that vertex to obtain the rendering information of the lit surface corresponding to that vertex.

[0217] Specifically, when determining the backlighting information of each vertex based on the lighting information of each vertex, a subtraction operation is performed between the lighting information and the backlighting information to obtain the backlighting information that represents the probability that the vertex is located on the backlighting surface under the illumination direction.

[0218] In this way, by adding backlight rendering information based on the 3D model and the corresponding lighting direction of the 3D model for edge lighting rendering, the final generated edge light is only on the backlight of the target object, without affecting the light and shadow levels of the illuminated surface of the target object, resulting in a better edge lighting rendering effect.

[0219] Step 43: Generate the edge light rendering map based on the edge region texture and the backlight surface rendering information.

[0220] In specific implementations, for example, the edge light rendering map can be generated based on the edge region map and the backlight surface rendering information in the following manner:

[0221] The backlight rendering information and the edge region texture are overlaid to obtain the edge light rendering texture.

[0222] Here, for any vertex in the three-dimensional model, when superimposing the backlight rendering information and the edge region texture, the backlight rendering information in the backlight rendering information corresponding to the vertex and the edge rendering information in the edge region texture corresponding to the vertex can be added or multiplied to obtain the target rendering information corresponding to the vertex. The target rendering information corresponding to each vertex constitutes the edge light rendering texture.

[0223] For example, if the edge rendering information corresponding to vertex A is 0.6 and the backlight rendering information corresponding to vertex A is 0.2, and the superposition process is addition, then the target rendering information corresponding to vertex A is 0.8.

[0224] In this way, by overlaying the backlight rendering information and the edge region texture, the final edge light rendering texture can meet the rendering requirements in multiple dimensions, resulting in a better edge light rendering effect.

[0225] In one possible implementation, after determining the edge region texture, a range adjustment command can be responded to to obtain a first target parameter corresponding to the edge rendering information carried in the range adjustment command; wherein, the first target parameter is used to adjust the edge range; the edge light range of the target object is updated based on the first target parameter, and the target object is rendered according to the updated edge light range.

[0226] Here, when updating the edge light range of the target object based on the first target parameter, the edge rendering information can be processed according to the first target parameter, and the edge light range of the target object can be re-determined according to the processed edge rendering information.

[0227] For example, if the edge rendering information corresponding to vertex A is 0.8 and the first target parameter is 0.9, then the edge rendering information after data processing based on the first target parameter can be 0.8 × 0.9 = 0.72.

[0228] Furthermore, it can also receive edge color information corresponding to the 3D model, and perform edge light rendering on the target object based on the edge light rendering texture and edge color information.

[0229] Here, the edge color information can be set by the user in the edge light rendering parameter settings page according to actual needs.

[0230] For example, a schematic diagram of the edge light rendering parameter information setting page can be shown as follows: Figure 9 As shown, Figure 9 It includes adjustment areas for the first target parameter, the second target parameter, and the edge light color, respectively. The first target parameter is set to "0.8", the second target parameter is set to "0.5", and the edge light color is set to "gray".

[0231] In this way, the edge lighting rendering effect can be adjusted more flexibly by adjusting the edge lighting rendering parameter information to obtain the desired edge lighting rendering effect.

[0232] In the above-mentioned edge lighting rendering process, edge rendering information determined by the virtual camera direction corresponding to the 3D model is added for rendering, making the final edge lighting rendering effect more realistic and ensuring that the final edge lighting effect conforms to the reflection law of objects in nature. On the other hand, edge lighting rendering is performed by adding backlight rendering information determined by the 3D model and the lighting direction corresponding to the 3D model, so that the final generated edge light is only on the backlight surface of the target object, without affecting the light and shadow level of the illuminated surface of the target object. Compared with edge lighting rendering based solely on the virtual camera direction, the final rendering effect is more in line with the user's rendering needs for virtual objects such as two-dimensional objects, and the edge lighting rendering effect is better.

[0233] Regarding S105 above: When generating the target rendering model, for example, the three-dimensional model can be directly rendered based on the shadow color map, the specular rendering map, the rim light rendering map, and the color map to obtain the target rendering model.

[0234] In another possible implementation, an outer outline can be added to the two-dimensional object. To achieve this, steps 51-54 below can be used, for example, to render the three-dimensional model based on the shadow color map, the specular rendering map, the rim light rendering map, and the color map, generating a target rendering model of the target object:

[0235] Step 51: Perform shading preprocessing rendering on the three-dimensional model to obtain the first rendered model.

[0236] In practice, for example, the original color map can be used for shading preprocessing rendering of the 3D model. For color maps, see [link to documentation]. Figure 3 As shown in Figure a, this is a schematic diagram of a color map provided in an embodiment of the present disclosure. In fact, different areas on the color map have different colors. The color map can add color effects to the three-dimensional model corresponding to the target object during rendering, that is, to achieve the coloring process of the three-dimensional model.

[0237] Therefore, after rendering the 3D model of the target object using color mapping, the generated first rendered model can reflect the patterns and corresponding colors of facial features, clothing, etc. In one possible case, if it is not necessary to add outline rendering to the target object, the obtained first rendered model can also be directly used to render an image that can fully display the target object.

[0238] Step 52: Perform position offset processing on the vertices of the three-dimensional model according to the corresponding vertex normal direction, and render the model with a preset color to obtain the second rendering model.

[0239] In practice, since the 3D model is fixed, multiple vertices can be determined on the outer contour of the 3D model. Based on the positions of these vertices on the 3D model, the normal direction corresponding to each vertex can be determined. The specific method for determining the normal direction will not be elaborated here.

[0240] By performing position offset processing on the vertices in the 3D model and rendering processing with preset colors, a second rendering model for displaying the outer stroke outline can be obtained. Since the order of position offset processing and preset color rendering processing can be changed, in specific implementations, for example, the following two different methods (a) or (b) can be used:

[0241] (a): First, determine the target vertex to be offset from multiple vertices in the 3D model, and then perform position offset processing and preset color rendering on the determined target vertex.

[0242] In specific implementation, the following method can be adopted: based on the current display view of the three-dimensional model, a target vertex is determined from the multiple vertices included in the three-dimensional model, and the target vertex is offset in the corresponding vertex normal direction to obtain an intermediate three-dimensional model; the intermediate three-dimensional model is rendered using the preset color to generate a second rendering model.

[0243] Specifically, when determining the target vertex from multiple vertices of the 3D model based on the current display view of the 3D model, the following method can be adopted: based on the current display view and the position information of multiple vertices in the 3D model in the corresponding model coordinate system, vertices that are not visible under the current display view are selected from the multiple vertices of the 3D model as the target vertex.

[0244] Specifically, when determining the current display viewpoint, for example, the shooting pose of the virtual camera capturing the 3D model can be determined in the model coordinate system corresponding to the 3D model. Then, based on the shooting pose of the virtual camera, the current display viewpoint of the 3D model can be determined. Here, the virtual camera can be understood as a virtual camera used to capture images of the target object; setting or adjusting the shooting parameters of the virtual camera can correspondingly change the shooting pose.

[0245] Here, since determining the current display viewpoint involves the relative positional relationship between the virtual camera and the target object, a corresponding model coordinate system can be established based on the 3D model to more accurately determine the current display viewpoint. The position information of the virtual camera within this model coordinate system can then be determined. Furthermore, by using the virtual camera's shooting parameters, such as a shooting elevation angle of 45 degrees, the shooting posture of the virtual camera can be determined. Thus, based on the virtual camera's position information and shooting posture, the shooting pose of the virtual camera can be determined.

[0246] Therefore, due to the change in shooting posture, the current display perspective corresponding to the target object changes; for example, it changes from showing the front of the target object to showing its side. The "front" and "side" mentioned here actually refer to showing at least one vertex corresponding to the front and side of the target object. Since the distribution area of ​​currently visible vertices in the model coordinate system can be determined using the current display perspective, and the position information of multiple vertices in the 3D model in the model coordinate system can be determined, the position information corresponding to multiple vertices can be used to filter out vertices that are not visible from the current display perspective from the multiple vertices in the 3D model, and these can be used as target vertices.

[0247] Given a target vertex, the position offset of the target vertex in the corresponding vertex offset direction can be processed first to obtain an intermediate 3D model. Specifically, the position offset processing can be performed as follows: obtain the offset amount; the offset amount represents the distance between the target vertex's position after the offset and its position before the offset; using the offset amount, perform position offset processing on the vertices in the 3D model in the corresponding vertex normal direction.

[0248] Specifically, the offset affects the distance between the outer stroke of the second rendered model and the outermost edge (i.e., the outline of the target object) of the rendered target object after the second rendered model is used to obtain the target rendered model. Generally, when rendering the outer stroke of the target object, the outer stroke is drawn close to the outline of the target object. A simplified explanation using a two-dimensional image is provided here; see [link to image]. Figure 10The diagram shown is a schematic representation of adding an outer outline to a two-dimensional image according to an embodiment of this disclosure. Figure 10 Image (a) shows a rectangular object, with its outline 101 represented by a dashed line. The outline 101 of the rectangular object can be considered to be composed of multiple vertices, and the vertices can be offset in the two-dimensional plane along their normal directions. After offsetting all vertices by the same distance, the offset outer outline 102 can be obtained from the original outline 101. The outer outline 102 added to the rectangular object is represented, for example, by a solid line. Similarly, in... Figure 10 The same rectangular object is shown in (b), labeled as outline 103 for easy distinction, and the outer stroke 101 added to the rectangular object is also represented by a solid line. Here, the distance between the vertex and the outer stroke in the corresponding normal direction is, for example... Figure 10 The distances d1 shown in (a) and d2 shown in (b) can be determined by transferring the two-dimensional image to the three-dimensional model, which is the offset described above.

[0249] Here, through the analysis of Figure 10 As the explanation shows, the effect of the added outer stroke line varies depending on the offset setting. For example, for... Figure 10 The rectangular object shown in (a) has a smaller offset, so the added outer stroke is closer to the outline of the rectangular object, resulting in a style closer to the refined style obtained when rendering characters with many details. However, for... Figure 10 The rectangular object shown in (b) has a large offset, so the added outer stroke is far from the outline of the rectangular object. The style is closer to the exaggerated, comic-style cartoon style obtained when rendering a simple cartoon character.

[0250] Therefore, when obtaining the offset for positional offset processing, the corresponding offset can be determined based on the desired rendering style. The unit of the offset can be, for example, the pixels corresponding to the rendered 2D image; for instance, the offset can be set to 2 pixels or 5 pixels to obtain different style types.

[0251] In addition, the offset is used to offset the position of the vertices in the 3D model according to the corresponding vertex normal direction. This principle is the same as the principle of offsetting the position of the contour line on the 2D image described in the above embodiment, and will not be repeated here.

[0252] If the intermediate rendering model is obtained by using the position offset processing method described above, the intermediate 3D model can also be rendered using preset colors to obtain the second rendering model.

[0253] In specific implementations, for example, the following method can be used: obtain the rendering range when rendering the vertex using the preset color; and based on the rendering range, perform preset color rendering on the vertex in the 3D model.

[0254] Specifically, the preset color includes the color of the displayed outer outline, which can be determined in response to a color selection operation. See also Figure 11 The diagram shown is a schematic representation of an operation interface provided in an embodiment of this disclosure. The operation interface includes a color chart and a color picker button at the "Select Color" location. In response to clicking the color picker button, a rendering color can be selected for vertex rendering, and the currently selected rendering color is displayed using the color chart.

[0255] The rendering range can be specifically reflected in the thickness of the outer stroke outline, for example, in Figure 10 The rendering area corresponding to (a) is smaller, so the displayed outer outline is thinner; while Figure 10 The rendering range corresponding to (b) is larger, therefore the displayed outer outline is thicker. When determining the rendering range for vertex rendering, in Figure 11 The interface shown also includes an adjustment knob at the "Selection Range" location. Controlling this knob determines the size of the selected rendering range, and the result is displayed numerically on the right. Here, the selected rendering range can be represented in pixels, specifically indicating the number of pixels occupied in the direction of the normal to the vertex when rendering the outlining.

[0256] Given a preset color and rendering range, the vertices can be rendered using the preset color according to the rendering range to obtain a second rendered model. Here, the resulting second rendered model has the same shape as the 3D model, but is larger. If the second rendered model is overlaid on the 3D model, the 3D model can be wrapped around it. Furthermore, the vertices of the second rendered model are not visible from the current display viewpoint.

[0257] (b): First, the 3D model is rendered using preset colors. Then, the target vertex to be offset is determined from multiple vertices in the 3D model so as to continue the position offset processing of the corresponding vertex normal direction.

[0258] In specific implementation, for example, the following method can be adopted: use a preset color to render the three-dimensional model to obtain an intermediate rendering model; based on the current display view of the intermediate rendering model, determine the target vertex from the multiple vertices included in the intermediate rendering model, and perform position offset processing on the target vertex in the corresponding vertex normal direction to obtain the second rendering model.

[0259] The method for determining the preset color can be found in the explanation in (a) above, and will not be repeated here. After rendering the 3D model using the preset color, the resulting intermediate rendered model is, for example, a 3D model expressed entirely in the preset color.

[0260] After obtaining the intermediate rendering model, the target vertex can be determined from multiple vertices using the current display viewpoint, and the target vertex can be offset along its corresponding vertex normal direction. The method for determining the current display viewpoint and the method for determining the target vertex using the determined current display viewpoint can be referred to the explanation in (a) above, and will not be repeated here. When offsetting the target vertex with the preset color along its corresponding normal direction, the principle is similar to that used in (a) above to determine the second rendering model, and the resulting second rendering model is the same as the second rendering model determined in (a) above.

[0261] Furthermore, there is no restriction on the order in which steps 51 and 52 are performed.

[0262] Step 53: Display and overlay the first rendering model and the second rendering model to obtain the outer edge rendering image of the target object.

[0263] In a specific implementation, the target rendering model can be determined in the following way: based on the current display view of the three-dimensional model, the first rendering model is rendered to obtain a first rendering layer, and the second rendering model is rendered to obtain a second rendering layer; the first rendering layer is superimposed on the front end of the second rendering layer to generate the outer edge rendering image.

[0264] Specifically, the second rendering model uses preset colors for vertex rendering and is larger than the first rendering model. Therefore, the second rendering layer obtained after rendering the second rendering model will be slightly larger than the first rendering layer obtained after rendering the first rendering model. If the first rendering layer is superimposed on the second rendering layer, the first rendering layer cannot completely occlude the second rendering layer; instead, it will display the unoccluded edges of the second rendering layer, i.e., the rendered portion with the preset color and rendering range. Furthermore, the vertices of the visible portion of the second rendering model have been removed from the current viewing angle and will not affect the display of the first rendering model. Since the first rendering model, through color mapping, can display the artistic details of the target object, superimposing the first rendering layer on the second rendering layer results in a target rendering model that not only fully displays the target object but also shows the outer outline rendered by the second rendering model, adding more stylistic effects to the target object.

[0265] For example, see Figure 12 The image shown is a schematic diagram of a rendered image with an outer outline effect provided in an embodiment of this disclosure. Wherein, Figure 12 The target object shown in (a) is, for example, the rendered image corresponding to the first rendering layer. Figure 12 Image (b) shows the rendered image obtained after overlaying the second rendering layer. Compared to... Figure 12 The rendered image shown in (a) shows that... Figure 12 The target object in the rendered image shown in (b) has an outer outline, which can further enhance the comic book style effect.

[0266] Step 54: Based on the shadow color map, the specular rendering map, the rim light rendering map, the color map, and the outer edge rendering image, render the 3D model to generate the target rendering model of the target object.

[0267] In another embodiment of this disclosure, the original lighting map further includes: a self-illuminating mask map; the grayscale value of each first pixel in the self-illuminating mask map is used to characterize the luminous intensity of a second pixel corresponding to the first pixel; wherein the second pixel is located in the original color map, and its position in the original color map is consistent with the position of the corresponding first pixel in the self-illuminating mask map.

[0268] By using self-illuminating mask textures, when rendering two-dimensional objects, the self-illuminating two-dimensional objects can usually be rendered with a glowing effect, such as rendering glowing effects for lanterns, gems, etc., to improve the realism of the rendered two-dimensional objects.

[0269] Specifically, this rendering method includes, for example, the following steps 61 to 62:

[0270] Step 61: Based on the self-illuminating mask texture, perform self-illuminating processing on the color texture to obtain a target color texture with luminous effect.

[0271] In specific implementations, for example, the color texture can be processed to produce a target color texture with an luminous effect based on the self-illuminating mask texture, as follows:

[0272] Based on the target luminescence configuration information and the pixel values ​​of the first pixels corresponding to each second pixel in the color map, the luminescence attribute information of each second pixel is determined.

[0273] Based on the light emission attribute information corresponding to each of the second pixels and the pixel value corresponding to each of the second pixels, the target pixel value corresponding to each of the second pixels is determined.

[0274] The target color map is generated based on the target pixel values ​​corresponding to each of the second pixel points.

[0275] In practical implementation, for each of the multiple first pixels in the self-illuminating mask texture, the luminous intensity of that first pixel during rendering of the self-illuminating effect can be determined using its corresponding grayscale value. For example, the smaller the grayscale value of the first pixel, the darker the color reflected in the self-illuminating mask texture, and the lower the luminous intensity during rendering; conversely, the larger the grayscale value of the first pixel, the lighter the color reflected in the self-illuminating mask texture, and the higher the luminous intensity during rendering.

[0276] For example, taking a grayscale value range of 0-255, if the grayscale value of a first pixel is 0, it will appear black in the self-illuminating mask map, with the lowest luminous intensity during rendering, and can be considered as not emitting light. If the grayscale value of a first pixel is 255, it will appear white in the self-illuminating mask map, with the highest luminous intensity during rendering, and can be considered as a fully bright display without occlusion. For first pixels with grayscale values ​​between 0-255, such as a first pixel with a grayscale value of 200, it will appear gray in the self-illuminating mask map, emitting light during rendering, but not displaying the maximum luminous intensity brightness, but rather a slightly dimmer luminous effect.

[0277] Therefore, by using a self-illuminating mask map, the luminescence intensity of each second pixel on the color map can be determined when rendering the self-illumination effect. By processing the color map using the self-illuminating mask map, the luminescence color and other attribute information of the self-illumination effect can also be further determined based on the colors of each second pixel in the color map.

[0278] The target luminescence configuration information includes at least one of the following: target luminescence color and target luminescence intensity threshold. Specifically, before determining the luminescence attribute information of each second pixel in the color map using the target luminescence configuration information, the target luminescence configuration information can also be determined in response to an adjustment operation on the luminescence configuration information.

[0279] For example, see Figure 13 The diagram shown illustrates an operation interface for adjusting light emission configuration information according to an embodiment of this disclosure. Specifically, the operation interface includes a color picker 131 for determining the target light emission color, a color card 132 for displaying the currently selected color, a color wheel 133 for directly selecting colors, a color selection card 134 for further color selection from the selected color wheel color, a color band 135 supporting color channel selection, and a display frame 136 for displaying the currently selected value. These different types of color picking tools can all be used to determine the target light emission color.

[0280] In addition, the user interface also includes buttons for adjusting the target luminous intensity threshold. The slider 137 is used to determine the maximum selectable range of the target luminous intensity threshold; adjustments to the threshold must not exceed this maximum range. Within this maximum selectable range, the target luminous intensity can be adjusted using the slider box 138.

[0281] Here, the luminous intensity of each first pixel in the self-illuminating mask texture can be determined using grayscale values, specifically reflecting the differences in luminous intensity among the first pixels in the self-illuminating mask texture during self-illumination processing. The target luminous intensity threshold described here specifically affects the maximum luminous intensity corresponding to each first pixel.

[0282] After adjusting the luminescence configuration information, the luminescence attribute information of each second pixel can be determined using the determined target luminescence configuration information and the pixel values ​​of the first pixels corresponding to each second pixel in the color map. Specifically, the luminescence attribute information of each second pixel is related to self-illumination processing, including attribute information reflecting the luminescence color and intensity of the second pixel. Using the luminescence attribute information and pixel values ​​corresponding to each second pixel, the target pixel values ​​corresponding to each second pixel are obtained, specifically including the relevant attribute information when rendering the self-illumination effect at each second pixel. Therefore, using the target pixel values ​​corresponding to each second pixel, a target color map for self-illumination rendering can be generated.

[0283] Step 62: Based on the shadow color map, the specular rendering map, the rim light rendering map, and the target color map, render the 3D model to generate the target rendering model of the target object.

[0284] Here, after obtaining the target color map based on step 61 above, the three-dimensional model is rendered based on the shadow color map, the specular rendering map, the rim light rendering map, and the target color map to generate the target rendering model of the target object.

[0285] In the aforementioned self-illuminating rendering, the grayscale value of each first pixel in the self-illuminating mask texture of the target object is used to determine the luminescence intensity of the corresponding second pixel in the color texture. This allows the self-illuminating mask texture to be used to perform self-illumination processing on the color texture. Since the self-illuminating mask texture can accurately determine the area of ​​the target object to be rendered with a luminescence effect, and the grayscale value can also determine the corresponding luminescence intensity, this method can directly determine the area on the target object to be illuminated. Then, the self-illuminating mask texture and color texture are used to perform self-illumination processing, resulting in a target color texture with a luminescence effect. This allows the target object to be rendered with a luminescence effect directly using the target color texture, resulting in a more realistic rendering.

[0286] like Figure 14 As shown in the embodiments of this disclosure, a specific example is provided for obtaining a target rendering model after rendering the target object using the above-described method. Specifically, after rendering the 3D model using the original textures of the 3D model, the resulting rendering effect is as follows: Figure 14 As shown in (a); after rendering the 3D model using the rendering method of this embodiment, the rendering effect of the target 3D model is as follows. Figure 14 As shown in (b), it can be seen that rendering the target object using the rendering method provided in this embodiment of the present disclosure can achieve better rendering results.

[0287] Those skilled in the art will understand that, in the above-described method of the specific implementation, the order in which each step is written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be determined by its function and possible internal logic.

[0288] Based on the same inventive concept, this disclosure also provides a rendering device corresponding to the rendering method. Since the principle of the device in this disclosure for solving the problem is similar to the rendering method described above, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be described again.

[0289] Reference Figure 15 The diagram shown is a schematic representation of a rendering apparatus provided in an embodiment of this disclosure. The apparatus includes: an acquisition module 151, a first rendering module 152, a second rendering module 153, a third rendering module 154, and a processing module 155; wherein,

[0290] The acquisition module 151 is used to acquire the three-dimensional model of the target object and the original texture of the three-dimensional model; the original texture includes: original color texture, original shadow tendency texture, and original lighting texture;

[0291] The first rendering module 152 is used to generate a shadow color map of the three-dimensional model based on the original light map, the original shadow tendency map, and the lighting direction corresponding to the three-dimensional model; the shadow color map is used to describe the shadow rendering of the three-dimensional model.

[0292] The second rendering module 153 is used to generate a specular rendering map corresponding to the three-dimensional model based on the original lighting map and the lighting direction; the specular rendering map is used to describe the specular rendering of the three-dimensional model.

[0293] The third rendering module 154 is used to determine the edge light rendering map corresponding to the three-dimensional model based on the virtual camera direction corresponding to the three-dimensional model and the lighting direction; the edge light rendering map is used to describe the edge light rendering situation of the three-dimensional model.

[0294] The processing module 155 is used to render the three-dimensional model based on the shadow color map, the specular rendering map, the rim light rendering map, and the color map to generate a target rendering model of the target object.

[0295] In one possible implementation, the original light map includes: an original shadow map; the pixel value of each pixel in the original shadow map is used to characterize the original shadow degree information of the vertex corresponding to that pixel in the three-dimensional model.

[0296] The first rendering module 152, when generating the shadow color map of the 3D model based on the original light map and the lighting direction corresponding to the 3D model, is used for:

[0297] Based on the three-dimensional model and the lighting direction corresponding to the three-dimensional model, a lighting model corresponding to the three-dimensional model is determined; the lighting model is used to characterize the shadow intensity information corresponding to multiple vertices of the three-dimensional model.

[0298] The original shadow map is corrected for lighting direction using the lighting model to obtain the target shadow map of the three-dimensional model;

[0299] The original shadow tendency map is used to perform light and shadow mapping on the target shadow map to obtain the shadow color map corresponding to the three-dimensional model.

[0300] In one possible implementation, the first rendering module 152, when correcting the lighting direction of the original shadow map using the lighting model to obtain the target shadow map of the 3D model, is used to:

[0301] Using the shadow intensity information corresponding to multiple vertices included in the lighting model, the original shadow intensity information corresponding to each vertex in the three-dimensional model is remapped to obtain the intermediate shadow map of the three-dimensional model.

[0302] Use the intermediate shadow map as the target shadow map, or

[0303] The intermediate shadow map is subjected to at least one of the following processes: shadow range adjustment, shadow depth correction, and shadow color correction, to obtain the target shadow map.

[0304] In one possible implementation, the first rendering module 152, when correcting the lighting direction of the original shadow map using the lighting model to obtain the target shadow map of the 3D model, is used to:

[0305] The original shadow tendency map is remapped onto the intermediate shadow map to obtain the shadow color map of the 3D model.

[0306] In one possible implementation, the original lightmap further includes: a specular material map and a specular shape map; the specular shape map is used to describe the specular shape of the target object during specular rendering, and the specular material map is used to describe whether the constituent materials of various parts of the target object are reflective.

[0307] The second rendering module 153, when generating the specular rendering map of the 3D model from the original light map, the original shadow tendency map, and the lighting direction corresponding to the 3D model, is used for:

[0308] Based on the lighting direction corresponding to the 3D model and the virtual camera direction corresponding to the 3D model, the initial specular rendering information corresponding to the 3D model is determined;

[0309] The specular rendering map is generated based on the specular material map, the specular shape map, and the initial specular rendering information.

[0310] In one possible implementation, the second rendering module 153, when determining the initial specular rendering information corresponding to the 3D model based on the lighting direction corresponding to the 3D model and the virtual camera direction corresponding to the 3D model, is used to:

[0311] Determine the normal direction corresponding to each vertex in the three-dimensional model;

[0312] For any vertex, based on the virtual camera direction, lighting direction, and normal direction corresponding to the vertex in the 3D model, the initial specular rendering information corresponding to the vertex is determined; wherein, the initial specular rendering information is used to describe the lighting intensity of the vertex under the virtual camera direction and the lighting direction.

[0313] In one possible implementation, the second rendering module 153, when generating the specular rendering map based on the specular material map, the specular shape map, and the initial specular rendering map, is used to:

[0314] Based on the specular material map and the initial specular rendering map, an intermediate rendering map is determined; wherein, the intermediate rendering map is used to characterize whether specular highlights need to be added to various parts of the 3D model;

[0315] The target specular rendering map is determined based on the specular shape map and the intermediate rendering map.

[0316] In one possible implementation, the third rendering module 154, when determining the edge light rendering texture corresponding to the 3D model based on the virtual camera direction corresponding to the 3D model and the lighting direction, is used to:

[0317] Based on the virtual camera orientation corresponding to the 3D model, the edge rendering information of the target object under the virtual camera orientation is determined; the edge rendering information is used to characterize the probability that each vertex of the 3D model is an edge; based on the edge rendering information, an edge region texture is determined to characterize the edge light rendering area corresponding to the target object;

[0318] And based on the three-dimensional model and the lighting direction corresponding to the three-dimensional model, determine the backlight rendering information of the target object, wherein the backlight rendering information is used to characterize the probability that each vertex of the three-dimensional model is located on the backlight surface under the lighting direction;

[0319] The edge light rendering map is generated based on the edge region texture and the backlight surface rendering information.

[0320] In one possible implementation, the third rendering module 154, when determining the edge rendering information corresponding to the target object, includes: edge rendering information corresponding to multiple vertices of the 3D model; and when determining the edge rendering information of the target object under the virtual camera direction based on the virtual camera direction corresponding to the 3D model, it is used to:

[0321] Determine the normal direction corresponding to each vertex in the three-dimensional model;

[0322] For any given vertex, the edge rendering information corresponding to that vertex is determined based on the virtual camera orientation corresponding to the 3D model and the normal orientation corresponding to that vertex.

[0323] In one possible implementation, the third rendering module 154, when determining the edge rendering information corresponding to any vertex based on the virtual camera direction corresponding to the 3D model and the normal direction corresponding to the vertex, is used to:

[0324] For any of the aforementioned vertices, the edge rendering information corresponding to the vertex is subjected to an exponentiation operation based on a preset second target parameter to obtain the edge rendering information corresponding to the vertex; wherein, the second target parameter is used to characterize the exponent size when performing the exponentiation operation.

[0325] In one possible implementation, the third rendering module 154, when determining the backlight rendering information of the target object based on the 3D model and the corresponding lighting direction, is used to:

[0326] Determine the normal direction corresponding to each vertex in the three-dimensional model;

[0327] For any given vertex, the lighting surface rendering information corresponding to that vertex is determined based on the lighting direction and the normal direction corresponding to that vertex; the lighting surface rendering information is used to characterize the size of the lighting surface range of the target object;

[0328] Based on the rendering information of the lit surface corresponding to each vertex, the rendering information of the backlit surface corresponding to each vertex is determined.

[0329] In one possible implementation, the processing module 155, when rendering the 3D model based on the shadow color map, the specular rendering map, the rim light rendering map, and the color map to generate the target rendering model of the target object, is used to:

[0330] The three-dimensional model is pre-processed with shading to obtain a first rendered model; and

[0331] The vertices of the three-dimensional model are subjected to position offset processing of the corresponding vertex normal direction and rendering processing of preset colors to obtain a second rendering model;

[0332] The first rendering model and the second rendering model are overlaid to obtain the outer edge rendering image of the target object;

[0333] Based on the shadow color map, the specular rendering map, the rim light rendering map, the color map, and the outer edge rendering image, the 3D model is rendered to generate the target rendering model of the target object.

[0334] In one possible implementation, the processing module 155, when performing position offset processing on vertices in the 3D model according to their corresponding vertex normal directions, is used to:

[0335] Obtain the offset amount from the position offset processing; the offset amount is used to characterize the distance between the target vertex's position after the offset and its position before the offset.

[0336] Using the offset, the vertices in the 3D model are offset in the direction of their corresponding vertex normals.

[0337] In one possible implementation, the processing module 155, when performing preset color rendering processing on the vertices in the 3D model, is used to:

[0338] Obtain the rendering range when rendering the vertex using the preset color;

[0339] Based on the rendering range, the vertices in the 3D model are rendered with preset colors.

[0340] In one possible implementation, the original lighting map further includes: a self-illuminating mask map; the pixel value of each first pixel in the self-illuminating mask map is used to characterize the luminous intensity of a second pixel corresponding to the first pixel; wherein the second pixel is located in the original color map, and its position in the original color map is consistent with the position of the corresponding first pixel in the self-illuminating mask map;

[0341] The processing module 155, when rendering the 3D model based on the shadow color map, the specular rendering map, the rim light rendering map, and the original color map to generate the target rendering model of the target object, is used to:

[0342] Based on the self-illuminating mask texture, the color texture is subjected to self-illuminating processing to obtain a target color texture with an illuminating effect;

[0343] Based on the shadow color map, the specular rendering map, the rim light rendering map, and the target color map, the 3D model is rendered to generate the target rendering model of the target object.

[0344] In one possible implementation, the processing module 155, when performing self-illumination processing on the color map based on the self-illuminating mask map to obtain a target color map with an illuminating effect, is used to:

[0345] Based on the target luminescence configuration information and the pixel values ​​of the first pixels corresponding to each second pixel in the color map, the luminescence attribute information of each second pixel is determined.

[0346] Based on the light emission attribute information corresponding to each of the second pixels and the pixel value corresponding to each of the second pixels, the target pixel value corresponding to each of the second pixels is determined.

[0347] The target color map is generated based on the target pixel values ​​corresponding to each of the second pixel points.

[0348] The processing flow of each module in the device and the interaction flow between each module can be referred to the relevant descriptions in the above method embodiments, and will not be detailed here.

[0349] This disclosure also provides a computer device, such as... Figure 16 The diagram shown is a schematic representation of a computer device structure provided in an embodiment of this disclosure, including:

[0350] Processor 10 and memory 20; the memory 20 stores machine-readable instructions executable by processor 10, and processor 10 executes the machine-readable instructions stored in memory 20. When the machine-readable instructions are executed by processor 10, processor 10 performs the following steps:

[0351] Obtain the 3D model of the target object and the original textures of the 3D model; the original textures include: original color textures, original shadow tendency textures, and original lighting textures;

[0352] Based on the original light map, the original shadow tendency map, and the lighting direction corresponding to the 3D model, a shadow color map of the 3D model is generated; the shadow color map is used to describe the shadow rendering of the 3D model.

[0353] Based on the original light map and the lighting direction, a specular rendering map corresponding to the 3D model is generated; the specular rendering map is used to describe the specular rendering of the 3D model.

[0354] Furthermore, based on the virtual camera orientation corresponding to the 3D model and the lighting direction, an edge light rendering texture corresponding to the 3D model is determined; the edge light rendering texture is used to describe the edge light rendering of the 3D model.

[0355] Based on the shadow color map, the specular rendering map, the rim light rendering map, and the color map, the 3D model is rendered to generate the target rendering model of the target object.

[0356] The aforementioned memory 20 includes a main memory 21 and an external memory 22; the main memory 21, also known as internal memory, is used to temporarily store the computational data in the processor 10, as well as the data exchanged with external memory 22 such as a hard disk. The processor 10 exchanges data with the external memory 22 through the main memory 21.

[0357] The specific execution process of the above instructions can be referred to the steps of the rendering method described in the embodiments of this disclosure, and will not be repeated here.

[0358] This disclosure also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of the rendering method described in the above method embodiments. The storage medium may be a volatile or non-volatile computer-readable storage medium.

[0359] This disclosure also provides a computer program product carrying program code. The program code includes instructions that can be used to execute the steps of the rendering method described in the above method embodiments. For details, please refer to the above method embodiments, which will not be repeated here.

[0360] The aforementioned computer program product can be implemented through hardware, software, or a combination thereof. In one optional embodiment, the computer program product is specifically embodied in a computer storage medium; in another optional embodiment, the computer program product is specifically embodied in a software product, such as a software development kit (SDK), etc.

[0361] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems and devices described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. In the several embodiments provided in this disclosure, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division; in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Another point is that the displayed or discussed mutual coupling or direct coupling or communication connection may be through some communication interfaces; the indirect coupling or communication connection of devices or units may be electrical, mechanical, or other forms.

[0362] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0363] In addition, the functional units in the various embodiments of this disclosure can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0364] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0365] Finally, it should be noted that the above-described embodiments are merely specific implementations of this disclosure, used to illustrate the technical solutions of this disclosure, and not to limit it. The protection scope of this disclosure is not limited thereto. Although this disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this disclosure. Such modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this disclosure, and should all be covered within the protection scope of this disclosure. Therefore, the protection scope of this disclosure should be determined by the protection scope of the claims.

Claims

1. A rendering method, characterized in that, include: Obtain the 3D model of the target object and the original texture of the 3D model; The original textures include: original color textures, original shadow tendency textures, and original lighting textures; Based on the original light map, the original shadow tendency map, and the lighting direction corresponding to the 3D model, a shadow color map of the 3D model is generated; the shadow color map is used to describe the shadow rendering of the 3D model. Based on the original light map and the lighting direction, a specular rendering map corresponding to the 3D model is generated; the specular rendering map is used to describe the specular rendering of the 3D model. Furthermore, based on the virtual camera orientation corresponding to the 3D model and the lighting direction, an edge light rendering texture corresponding to the 3D model is determined; the edge light rendering texture is used to describe the edge light rendering of the 3D model. Based on the shadow color map, the specular rendering map, the rim light rendering map, and the original color map, the 3D model is rendered to generate the target rendering model of the target object.

2. The method according to claim 1, characterized in that, The original lighting map includes: an original shadow map; the pixel value of each pixel in the original shadow map is used to characterize the original shadow degree information of the vertex corresponding to that pixel in the three-dimensional model; The step of generating a shadow color map for the 3D model based on the original light map, the original shadow tendency map, and the lighting direction corresponding to the 3D model includes: Based on the three-dimensional model and the lighting direction corresponding to the three-dimensional model, a lighting model corresponding to the three-dimensional model is determined; the lighting model is used to characterize the shadow intensity information corresponding to multiple vertices of the three-dimensional model. The original shadow map is corrected for lighting direction using the lighting model to obtain the target shadow map of the three-dimensional model; The original shadow tendency map is used to perform light and shadow mapping on the target shadow map to obtain the shadow color map corresponding to the three-dimensional model.

3. The method according to claim 2, characterized in that, The step of correcting the lighting direction of the original shadow map using the lighting model to obtain the target shadow map of the 3D model includes: Using the shadow intensity information corresponding to multiple vertices included in the lighting model, the original shadow intensity information corresponding to each vertex in the three-dimensional model is remapped to obtain the intermediate shadow map of the three-dimensional model. Use the intermediate shadow map as the target shadow map, or The intermediate shadow map is subjected to at least one of the following processes: shadow range adjustment, shadow depth correction, and shadow color correction, to obtain the target shadow map. The process of correcting the shadow depth of the intermediate shadow map includes: In response to receiving a shadow range adjustment command, the shadow range of the intermediate shadow map is adjusted; wherein, the shadow range adjustment command carries the grayscale threshold of the target shadow partition.

4. The method according to claim 3, characterized in that, The step of performing light and shadow mapping processing on the target shadow map using the original shadow tendency map to obtain the shadow color map corresponding to the 3D model includes: The original shadow tendency map is remapped onto the intermediate shadow map to obtain the shadow color map of the 3D model.

5. The method according to any one of claims 1-4, characterized in that, The original lighting map further includes: a specular material map and a specular shape map; the specular shape map is used to describe the specular shape of the target object when performing specular rendering, and the specular material map is used to describe whether the constituent materials of each part of the target object are reflective; Based on the original light map and the lighting direction, a specular rendering map corresponding to the 3D model is generated, including: Based on the lighting direction corresponding to the 3D model and the virtual camera direction corresponding to the 3D model, the initial specular rendering information corresponding to the 3D model is determined; wherein, the initial specular rendering information is used to describe the lighting intensity of the vertices of the 3D model under the virtual camera direction and the lighting direction; The specular rendering map is generated based on the specular material map, the specular shape map, and the initial specular rendering information.

6. The method according to claim 5, characterized in that, The process of determining the initial specular rendering information of the 3D model based on the lighting direction corresponding to the 3D model and the virtual camera direction corresponding to the 3D model includes: Determine the normal direction corresponding to each vertex in the three-dimensional model; For any vertex, based on the virtual camera direction, lighting direction, and normal direction corresponding to the vertex in the 3D model, the initial specular rendering information corresponding to the vertex is determined; wherein, the initial specular rendering information is used to describe the lighting intensity of the vertex under the virtual camera direction and the lighting direction.

7. The method according to claim 5, characterized in that, The process of generating the specular rendering map based on the specular material map, the specular shape map, and the initial specular rendering information includes: Based on the specular texture map and the initial specular rendering information, an intermediate rendering texture map is determined; wherein, the intermediate rendering texture map is used to characterize whether specular highlights need to be added to various parts of the 3D model; The specular rendering map is determined based on the specular shape map and the intermediate rendering map.

8. The method according to any one of claims 1-4, characterized in that, The step of determining the edge light rendering texture corresponding to the 3D model based on the virtual camera orientation and the lighting direction of the 3D model includes: Based on the virtual camera orientation corresponding to the 3D model, the edge rendering information of the target object under the virtual camera orientation is determined; the edge rendering information is used to characterize the probability that each vertex of the 3D model is an edge; based on the edge rendering information, an edge region texture is determined to characterize the edge light rendering area corresponding to the target object; And based on the three-dimensional model and the lighting direction corresponding to the three-dimensional model, determine the backlight rendering information of the target object, wherein the backlight rendering information is used to characterize the probability that each vertex of the three-dimensional model is located on the backlight surface under the lighting direction; The edge light rendering map is generated based on the edge region texture and the backlight surface rendering information; The step of generating the edge light rendering map based on the edge region texture and the backlight surface rendering information includes: The backlight rendering information and the edge region texture are overlaid to obtain the edge light rendering texture.

9. The method according to claim 8, characterized in that, The edge rendering information corresponding to the target object includes: edge rendering information corresponding to multiple vertices of the 3D model; determining the edge rendering information of the target object under the virtual camera direction based on the virtual camera direction corresponding to the 3D model includes: Determine the normal direction corresponding to each vertex in the three-dimensional model; For any given vertex, the edge rendering information corresponding to that vertex is determined based on the virtual camera orientation corresponding to the 3D model and the normal orientation corresponding to that vertex.

10. The method according to claim 9, characterized in that, For any given vertex, determining the edge rendering information corresponding to that vertex based on the virtual camera orientation of the 3D model and the normal orientation of that vertex includes: For any of the aforementioned vertices, the edge rendering information corresponding to the vertex is subjected to an exponentiation operation based on a preset second target parameter to obtain the edge rendering information corresponding to the vertex; wherein, the second target parameter is used to characterize the exponent size when performing the exponentiation operation.

11. The method according to claim 8, characterized in that, The step of determining the backlight rendering information of the target object based on the 3D model and the corresponding lighting direction includes: Determine the normal direction corresponding to each vertex in the three-dimensional model; For any given vertex, the lighting surface rendering information corresponding to that vertex is determined based on the lighting direction and the normal direction corresponding to that vertex; the lighting surface rendering information is used to characterize the size of the lighting surface range of the target object; Based on the rendering information of the lit surface corresponding to each vertex, the rendering information of the backlit surface corresponding to each vertex is determined.

12. The method according to any one of claims 1-4, characterized in that, The process of rendering the 3D model based on the shadow color map, the specular rendering map, the rim light rendering map, and the original color map to generate the target rendering model of the target object includes: The three-dimensional model is pre-processed with shading to obtain a first rendered model; and The vertices of the three-dimensional model are subjected to position offset processing of the corresponding vertex normal direction and rendering processing of preset colors to obtain a second rendering model; The first rendering model and the second rendering model are overlaid to obtain the outer edge rendering image of the target object; Based on the shadow color map, the specular rendering map, the rim light rendering map, the original color map, and the outer edge rendering image, the 3D model is rendered to generate the target rendering model of the target object.

13. The method according to claim 12, characterized in that, The step of offsetting the position of the vertices in the 3D model according to their corresponding vertex normal directions includes: Obtain the offset amount of the position offset processing; the offset amount is used to characterize the distance between the vertex's position after the offset and its position before the offset. Using the offset, the vertices in the 3D model are offset in the direction of their corresponding vertex normals.

14. The method according to claim 12, characterized in that, Rendering the vertices in the 3D model using preset colors includes: Obtain the rendering range when rendering the vertex using the preset color; Based on the rendering range, the vertices in the 3D model are rendered with preset colors.

15. The method according to any one of claims 1-4, characterized in that, The original lighting map also includes: a self-illuminating mask map; the pixel value of each first pixel in the self-illuminating mask map is used to characterize the luminous intensity of the second pixel corresponding to the first pixel; wherein, the second pixel is located in the original color map, and its position in the original color map is consistent with the position of the corresponding first pixel in the self-illuminating mask map; The process of rendering the 3D model based on the shadow color map, the specular rendering map, the rim light rendering map, and the original color map to generate the target rendering model of the target object includes: Based on the self-illuminating mask texture, the original color texture is processed to produce a target color texture with an illuminating effect. Based on the shadow color map, the specular rendering map, the rim light rendering map, and the target color map, the 3D model is rendered to generate the target rendering model of the target object.

16. The method according to claim 15, wherein the step of performing self-illuminating processing on the original color map based on the self-illuminating mask map to obtain a target color map with an illuminating effect includes: Based on the target luminescence configuration information and the pixel values ​​of the first pixels corresponding to each second pixel in the original color map, the luminescence attribute information of each second pixel is determined. Based on the light emission attribute information corresponding to each of the second pixels and the pixel value corresponding to each of the second pixels, the target pixel value corresponding to each of the second pixels is determined. The target color map is generated based on the target pixel values ​​corresponding to each of the second pixel points.

17. A rendering apparatus, characterized in that, include: The acquisition module is used to acquire the 3D model of the target object and the original texture of the 3D model; The original textures include: original color textures, original shadow tendency textures, and original lighting textures; The first rendering module is used to generate a shadow color map of the three-dimensional model based on the original light map, the original shadow tendency map, and the lighting direction corresponding to the three-dimensional model; the shadow color map is used to describe the shadow rendering of the three-dimensional model. The second rendering module is used to generate a specular rendering map corresponding to the 3D model based on the original lighting map and the lighting direction; the specular rendering map is used to describe the specular rendering of the 3D model. The third rendering module is used to determine the edge light rendering map corresponding to the 3D model based on the virtual camera direction corresponding to the 3D model and the lighting direction; the edge light rendering map is used to describe the edge light rendering of the 3D model; The processing module is used to render the 3D model based on the shadow color map, the specular rendering map, the rim light rendering map, and the original color map to generate the target rendering model of the target object.

18. A computer device, characterized in that, include: A processor and a memory, the memory storing machine-readable instructions executable by the processor, the processor executing the machine-readable instructions stored in the memory, wherein when the machine-readable instructions are executed by the processor, the processor performs the steps of the rendering method as described in any one of claims 1 to 16.

19. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, which, when executed by a computer device, performs the steps of the rendering method as described in any one of claims 1 to 16.

Citation Information

Patent Citations

  • Direct3D 11-based 3D graphics rendering engine

    CN106056661A

  • method for generating a 3D material map through a picture with multi-angle lighting

    CN109523619A