Highlight rendering method, device, computer equipment and storage medium
By obtaining the material and highlight shape map of the three-dimensional model, combining lighting and camera directions, a highlight rendering model that meets the natural reflection laws and personalized needs is solved, and a more realistic and personalized rendering effect is achieved.
Patent Information
- Application Number
- CN202210158152.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-21
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2042-02-21
AI Technical Summary
The prior art can only render highlight effects within a fixed range when rendering highlights, and cannot meet the personalized rendering needs of virtual objects such as two-dimensional objects.
By obtaining the three-dimensional model of the target object, its material map and highlight shape map, combining lighting and camera direction, the initial highlight rendering model is determined, and through the remapping of the material and shape map, a target highlight rendering model that meets the natural reflection laws and personalized needs is generated.
It realizes a more realistic highlight rendering effect, conforms to the reflection laws of natural objects, and meets users' personalized rendering needs for two-dimensional objects.
Smart Images

Figure CN114581592B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing technology, and in particular to a highlight rendering method, apparatus, computer equipment, and storage medium. Background Art
[0002] When light hits an object, it is reflected into the human eye. The brightest part of the object is called the highlight. When rendering two-dimensional objects such as cartoon characters, highlight rendering is added to improve the rendering effect of the two-dimensional objects after rendering and display.
[0003] In related technologies, when performing highlight rendering, highlight rendering is often only performed based on the current lighting direction. Although this can achieve a more realistic highlight rendering effect, the highlight effect can only be rendered within a fixed range, and the highlight rendering effect of virtual objects such as two-dimensional objects needs to be improved. Summary of the Invention
[0004] The embodiments of the present disclosure at least provide a highlight rendering method, apparatus, computer equipment, and storage medium.
[0005] In a first aspect, an embodiment of the present disclosure provides a highlight rendering method, comprising:
[0006] Obtaining a three-dimensional model of a target object, and a material map and a highlight shape map corresponding to the three-dimensional model; wherein the highlight shape map is used to describe the highlight shape of the target object when highlight rendering is performed, and the material map is used to describe whether the constituent materials of various parts of the target object are reflective;
[0007] Determining an initial highlight rendering model corresponding to the three-dimensional model based on a lighting direction corresponding to the three-dimensional model and a camera direction corresponding to the three-dimensional model;
[0008] A target highlight rendering model is determined based on the material map, the highlight shape map, and the initial highlight rendering model, and highlight rendering is performed based on the target highlight rendering model.
[0009] In this way, in the process of highlight rendering, by adding the material map corresponding to the three-dimensional model of the target object, the final highlight rendering effect is made more realistic, ensuring that the final highlight effect conforms to the reflection law of natural objects; on the other hand, by adding the highlight shape map corresponding to the three-dimensional model of the target object for highlight rendering, the final generated highlight range meets the personalized rendering needs. Compared with highlight rendering only based on the light direction, the final rendering effect can better meet the user's personalized rendering needs for virtual objects such as two-dimensional objects.
[0010] In a possible implementation, determining an initial highlight rendering model corresponding to the three-dimensional model based on a lighting direction corresponding to the three-dimensional model and a camera direction corresponding to the three-dimensional model includes:
[0011] Determining the normal direction corresponding to each vertex in the three-dimensional model;
[0012] For any of the vertices, determining initial highlight rendering information corresponding to the vertex based on the camera direction and the illumination direction corresponding to the three-dimensional model and the normal direction corresponding to the vertex; wherein the initial highlight rendering information is used to describe the illumination intensity of the vertex under the camera direction and the illumination direction;
[0013] The initial highlight rendering information corresponding to each vertex constitutes the initial highlight rendering model.
[0014] In a possible implementation, determining a target highlight rendering model based on the material map, the highlight shape map, and the initial highlight rendering model includes:
[0015] Determining an intermediate rendering model based on the material map and the initial highlight rendering model; wherein the intermediate rendering model is used to indicate whether highlights need to be added to each part of the three-dimensional model;
[0016] The target highlight rendering model is determined based on the highlight shape map and the intermediate rendering model.
[0017] In a possible implementation, the material map is used to store reflection property information of the three-dimensional model;
[0018] The determining of the intermediate rendering model based on the material map and the initial highlight rendering model includes:
[0019] remapping the initial highlight rendering information corresponding to each vertex in the initial highlight rendering model according to the reflection information stored in the material map to obtain intermediate highlight rendering information corresponding to each vertex;
[0020] The intermediate highlight rendering information corresponding to each vertex constitutes the intermediate highlight rendering model.
[0021] In this way, remapping the initial highlight rendering model according to the material map can make the final highlight rendering effect more realistic and ensure that the final highlight effect complies with the reflection law of natural objects.
[0022] In a possible implementation, the highlight shape map is used to store highlight shape information of the three-dimensional model;
[0023] The determining the target highlight rendering model based on the highlight shape map and the intermediate rendering model includes:
[0024] remapping the intermediate highlight rendering information corresponding to each vertex in the intermediate rendering model according to the highlight shape information stored in the highlight shape map to obtain target highlight rendering information corresponding to each vertex;
[0025] The target highlight rendering information corresponding to each vertex constitutes the target highlight rendering model.
[0026] In this way, by adding a highlight shape map corresponding to the three-dimensional model of the target object for highlight rendering, the final generated highlight range meets the personalized rendering needs. Compared with highlight rendering only based on the light direction, the final rendering effect can better meet the user's personalized rendering needs for virtual objects such as two-dimensional objects.
[0027] In a possible implementation manner, the method further includes:
[0028] receiving highlight rendering parameter information corresponding to the three-dimensional model;
[0029] The performing highlight rendering based on the target highlight rendering model includes:
[0030] Based on the target highlight rendering model and the highlight rendering parameter information, highlight rendering is performed on the target object.
[0031] In this way, the highlight rendering effect can be adjusted more flexibly by adjusting the highlight rendering parameter information to obtain the desired highlight rendering effect.
[0032] In a possible implementation, the highlight rendering parameter information includes at least one of the following:
[0033] Highlight intensity information, highlight range information, highlight color information.
[0034] In a second aspect, an embodiment of the present disclosure further provides a highlight rendering device, comprising:
[0035] An acquisition module, configured to acquire a three-dimensional model of a target object, and a material map and a highlight shape map corresponding to the three-dimensional model; wherein the highlight shape map is used to describe the highlight shape of the target object when highlight rendering is performed, and the material map is used to describe whether the constituent materials of various parts of the target object are reflective;
[0036] a determination module, configured to determine an initial highlight rendering model corresponding to the three-dimensional model based on a lighting direction corresponding to the three-dimensional model and a camera direction corresponding to the three-dimensional model;
[0037] A rendering module is used to determine a target highlight rendering model based on the material map, the highlight shape map and the initial highlight rendering model, and perform highlight rendering based on the target highlight rendering model.
[0038] In one possible implementation, the determining module, when determining the initial highlight rendering model corresponding to the three-dimensional model based on the illumination direction corresponding to the three-dimensional model and the camera direction corresponding to the three-dimensional model, is configured to:
[0039] Determining the normal direction corresponding to each vertex in the three-dimensional model;
[0040] For any of the vertices, determining initial highlight rendering information corresponding to the vertex based on the camera direction and the illumination direction corresponding to the three-dimensional model and the normal direction corresponding to the vertex; wherein the initial highlight rendering information is used to describe the illumination intensity of the vertex under the camera direction and the illumination direction;
[0041] The initial highlight rendering information corresponding to each vertex constitutes the initial highlight rendering model.
[0042] In one possible implementation, the rendering module, when determining the target highlight rendering model based on the material map, the highlight shape map, and the initial highlight rendering model, is configured to:
[0043] Determining an intermediate rendering model based on the material map and the initial highlight rendering model; wherein the intermediate rendering model is used to indicate whether highlights need to be added to each part of the three-dimensional model;
[0044] The target highlight rendering model is determined based on the highlight shape map and the intermediate rendering model.
[0045] In a possible implementation, the material map is used to store reflection property information of the three-dimensional model;
[0046] The rendering module, when determining the intermediate rendering model based on the material map and the initial highlight rendering model, is used to:
[0047] remapping the initial highlight rendering information corresponding to each vertex in the initial highlight rendering model according to the reflection information stored in the material map to obtain intermediate highlight rendering information corresponding to each vertex;
[0048] The intermediate highlight rendering information corresponding to each vertex constitutes the intermediate highlight rendering model.
[0049] In a possible implementation, the highlight shape map is used to store highlight shape information of the three-dimensional model;
[0050] The rendering module, when determining the target highlight rendering model based on the highlight shape map and the intermediate rendering model, is configured to:
[0051] remapping the intermediate highlight rendering information corresponding to each vertex in the intermediate rendering model according to the highlight shape information stored in the highlight shape map to obtain target highlight rendering information corresponding to each vertex;
[0052] The target highlight rendering information corresponding to each vertex constitutes the target highlight rendering model.
[0053] In a possible implementation, the rendering module is further configured to:
[0054] receiving highlight rendering parameter information corresponding to the three-dimensional model;
[0055] The rendering module, when performing highlight rendering based on the target highlight rendering model, is used to:
[0056] Based on the target highlight rendering model and the highlight rendering parameter information, highlight rendering is performed on the target object.
[0057] In a possible implementation, the highlight rendering parameter information includes at least one of the following:
[0058] Highlight intensity information, highlight range information, highlight color information.
[0059] In a third aspect, an embodiment of the present disclosure further provides a computer device comprising: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the computer device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the steps of the above-mentioned first aspect or any possible implementation of the first aspect are performed.
[0060] In a fourth aspect, an embodiment of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned first aspect or any possible implementation of the first aspect are executed.
[0061] For a description of the effects of the above-mentioned highlight rendering device, computer equipment, and computer-readable storage medium, please refer to the description of the above-mentioned highlight rendering method, which will not be repeated here.
[0062] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following briefly introduces the drawings required for use in the embodiments.
[0064] Figure 1 A flowchart of a highlight rendering method provided by an embodiment of the present disclosure is shown;
[0065] Figure 2a A schematic diagram of a three-dimensional model of a target object in the highlight rendering method provided by an embodiment of the present disclosure is shown;
[0066] Figure 2b A schematic diagram of a highlight shape map in the highlight rendering method provided by an embodiment of the present disclosure is shown;
[0067] Figure 2c A schematic diagram of a material map in the highlight rendering method provided by an embodiment of the present disclosure is shown;
[0068] Figure 3 A flowchart showing a specific method for determining an initial highlight rendering model in the highlight rendering method provided by an embodiment of the present disclosure is shown;
[0069] Figure 4 A flowchart showing a specific method for determining a target highlight rendering model in the highlight rendering method provided by an embodiment of the present disclosure is shown;
[0070] Figure 5 Shows a setting page for highlight rendering parameter information in the highlight rendering method provided by an embodiment of the present disclosure;
[0071] Figure 6 A schematic diagram of the architecture of a highlight rendering device provided by an embodiment of the present disclosure is shown;
[0072] Figure 7 A schematic structural diagram of a computer device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0073] In order to make the purpose, technical solutions and advantages of the embodiments of the present disclosure more clear, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure.
[0074] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, it does not need to be further defined or explained in subsequent drawings.
[0075] The term "and / or" herein simply describes an association relationship, indicating that three relationships can exist. For example, A and / or B can represent the existence of A alone, the simultaneous existence of A and B, and the existence of B alone. In addition, the term "at least one" herein refers to any combination of at least two of any one or more of a plurality of items. For example, "at least one of A, B, and C" can represent any one or more elements selected from the set consisting of A, B, and C.
[0076] Research has found that when performing highlight rendering, highlight rendering is often only performed based on the current lighting direction. Although this can achieve a more realistic highlight rendering effect, the highlight effect can only be rendered within a fixed range. The highlight rendering effect of virtual objects such as two-dimensional objects needs to be improved.
[0077] Based on the above research, the present disclosure provides a highlight rendering method, device, computer equipment and storage medium. During the highlight rendering process, by adding a material map corresponding to the three-dimensional model of the target object, the final highlight rendering effect is made more realistic, ensuring that the final highlight effect conforms to the reflection law of natural objects; on the other hand, by adding a highlight shape map corresponding to the three-dimensional model of the target object for highlight rendering, the final generated highlight range meets the personalized rendering requirements. Compared with highlight rendering only based on the light direction, the final rendering effect can better meet the user's personalized rendering needs for virtual objects such as two-dimensional objects.
[0078] To facilitate understanding of this embodiment, a highlight rendering method disclosed in an embodiment of the present disclosure is first described in detail. The execution subject of the highlight rendering method provided in the embodiment of the present disclosure is generally a computer device with certain computing capabilities. The computer device includes, for example, a terminal device, a server, or other processing device. The terminal device can be a user equipment (UE), a mobile device, a user terminal, a terminal, etc. In some possible implementations, the highlight rendering method can be implemented by a processor calling computer-readable instructions stored in a memory.
[0079] See also Figure 1 FIG. 1 is a flowchart of a highlight rendering method provided by an embodiment of the present disclosure, wherein the method includes S101 to S103, wherein:
[0080] S101: Obtain a three-dimensional model of a target object, as well as a material map and a highlight shape map corresponding to the three-dimensional model; wherein the highlight shape map is used to describe the highlight shape of the target object when highlight rendering is performed, and the material map is used to describe whether the constituent materials of various parts of the target object are reflective.
[0081] S102: Determine an initial highlight rendering model corresponding to the three-dimensional model based on a lighting direction corresponding to the three-dimensional model and a camera direction corresponding to the three-dimensional model.
[0082] S103: Determine a target highlight rendering model based on the material map, the highlight shape map, and the initial highlight rendering model, and perform highlight rendering based on the target highlight rendering model.
[0083] The following is a detailed description of the above steps.
[0084] For S101, the target object may specifically include a two-dimensional object. Since the two-dimensional object is a virtual object and does not actually exist, the height, fatness and other body characteristics of the two-dimensional object can be determined by constructing a three-dimensional model corresponding to the two-dimensional object, and the determined three-dimensional model can be used to simulate the image that the two-dimensional object wants to present in the real world; the highlight shape map specifically includes a grayscale map, which is composed of pixel points at different grayscale values, and can reflect whether each vertex in the three-dimensional model needs to be highlighted; the material map specifically includes a grayscale map, which is composed of pixel points at different grayscale values, and can reflect whether the constituent material of each vertex in the three-dimensional model is reflective.
[0085] For example, Figure 2a The figure is a schematic diagram of a three-dimensional model of a target object provided by an embodiment of the present disclosure. The three-dimensional model is an artificially constructed virtual model; the three-dimensional model can refine the facial features and clothing features of a person. Figure 2a Different three-dimensional models can be determined for different two-dimensional objects. The three-dimensional models generally include: a plurality of vertices located on the surface of the three-dimensional model, and a mesh formed by interconnected relationships between the vertices.
[0086] For example, Figure 2b , which is a schematic diagram of a highlight shape map provided by an embodiment of the present disclosure. Figure 2b In the figure, the black area is the area that does not need highlight rendering, and the gray area is the area that needs highlight rendering. The highlight shape map can be drawn by the developer, so that the final highlight effect can better meet the personalized rendering needs.
[0087] For example, Figure 2c , which is a schematic diagram of a material map provided by an embodiment of the present disclosure. Figure 2c In the figure, different grayscale values represent different materials of the area. The higher the grayscale value, the higher the reflectivity of the material in the area. The lower the grayscale value, the lower the reflectivity of the material in the area.
[0088] S102: Determine an initial highlight rendering model corresponding to the three-dimensional model based on a lighting direction corresponding to the three-dimensional model and a camera direction corresponding to the three-dimensional model.
[0089] In one possible implementation, Figure 3 As shown, the initial highlight rendering model can be determined by the following steps:
[0090] S301: Determine the normal direction corresponding to each vertex in the three-dimensional model.
[0091] Here, the normal direction of the vertex can be as follows Figure 2a As shown in , for any of the vertices, based on the position information of the vertex in the three-dimensional model, the vertex normal direction corresponding to the vertex can be determined. The normal direction of the vertex can be represented by the vector coordinates in the plane rectangular coordinate system corresponding to the three-dimensional model, for example, the normal direction is (1, 1, 1).
[0092] S302: For any of the vertices, based on the camera direction and lighting direction corresponding to the three-dimensional model and the normal direction corresponding to the vertex, determine the initial highlight rendering information corresponding to the vertex; wherein the initial highlight rendering information is used to describe the illumination intensity of the vertex under the camera direction and the lighting direction, and the initial highlight rendering information corresponding to each vertex constitutes the initial highlight rendering model.
[0093] Here, the camera direction corresponding to the three-dimensional model can be represented by the vector coordinates in the plane rectangular coordinate system corresponding to the three-dimensional model, such as the camera direction a is (0, 0, 1); the lighting direction can be represented by the vector coordinates in the plane rectangular coordinate system corresponding to the three-dimensional model, such as the lighting direction b is (1, 1, 0).
[0094] Specifically, when determining the initial highlight rendering information corresponding to the vertex based on the camera direction, lighting direction and normal direction corresponding to the vertex corresponding to the three-dimensional model, the camera direction and the lighting direction can be superimposed to obtain the target tangent; the target tangent is normalized, and the dot product operation is performed on the normalized target tangent and the normal direction corresponding to the vertex to obtain the initial highlight rendering information corresponding to the vertex.
[0095] For example, taking the 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 camera direction and the lighting direction are superimposed to obtain a target tangent of (1, 1, 1), and the target tangent after normalization is (1 / 3, 1 / 3, 1 / 3). The normalized target tangent is then click-operated with the normal direction of vertex A to obtain the initial highlight rendering information corresponding to vertex A as 1 / 3×1+1 / 3×1+1 / 3×1=1.
[0096] S103: Determine a target highlight rendering model based on the material map, the highlight shape map, and the initial highlight rendering model, and perform highlight rendering based on the target highlight rendering model.
[0097] In one possible implementation, Figure 4 As shown, the target highlight rendering model can be determined by the following steps:
[0098] S401: Determine an intermediate rendering model based on the material map and the initial highlight rendering model; wherein the intermediate rendering model is used to indicate whether highlights need to be added to various parts of the three-dimensional model.
[0099] In one possible implementation, when determining the intermediate rendering model, the initial highlight rendering information corresponding to each vertex in the initial highlight rendering model can be remapped according to the reflection information stored in the material map to obtain the intermediate highlight rendering information corresponding to each vertex. The intermediate highlight rendering information corresponding to each vertex constitutes the intermediate highlight rendering model.
[0100] Here, when remapping the initial highlight rendering information corresponding to each vertex in the initial highlight rendering model according to the reflection information stored in the material map, an algorithm such as a linear interpolation algorithm can be used to remap the initial highlight rendering information within the range corresponding to the reflection information stored in the material map (that is, the grayscale value range corresponding to the material map) to obtain the intermediate highlight rendering information corresponding to each vertex.
[0101] In this way, remapping the initial highlight rendering model according to the material map can make the final highlight rendering effect more realistic and ensure that the final highlight effect complies with the reflection law of natural objects.
[0102] S402: Determine the target highlight rendering model based on the highlight shape map and the intermediate rendering model.
[0103] In one possible implementation, when determining the target highlight rendering model, the intermediate highlight rendering information corresponding to each vertex in the intermediate rendering model can be remapped according to the highlight shape information stored in the highlight shape map to obtain the target highlight rendering information corresponding to each vertex; the target highlight rendering information corresponding to each vertex constitutes the target highlight rendering model.
[0104] Here, when remapping the intermediate highlight rendering information corresponding to each vertex in the intermediate rendering model according to the highlight shape information stored in the highlight shape map, an algorithm such as a linear interpolation algorithm can be used to remap the initial highlight rendering information within the range corresponding to the highlight shape information stored in the highlight shape map (that is, the grayscale value range corresponding to the highlight shape map) to obtain the target highlight rendering information corresponding to each vertex.
[0105] In this way, by adding a highlight shape map corresponding to the three-dimensional model of the target object for highlight rendering, the final generated highlight range meets the personalized rendering needs. Compared with highlight rendering only based on the light direction, the final rendering effect can better meet the user's personalized rendering needs for virtual objects such as two-dimensional objects.
[0106] In actual applications, the highlight rendering effect often cannot immediately meet the rendering needs of developers. Therefore, after performing highlight rendering based on the target highlight rendering model, a highlight rendering effect adjustment instruction can be received, and highlight rendering can be performed based on the highlight rendering parameter information in the highlight rendering effect adjustment instruction.
[0107] In a possible implementation, highlight rendering parameter information corresponding to the three-dimensional model may be received, and highlight rendering may be performed on the target object based on the target highlight rendering model and the highlight rendering parameter information.
[0108] Here, the highlight rendering parameter information may include at least one of highlight intensity information, highlight range information, and highlight color information.
[0109] Specifically, when adjusting the highlight intensity of the highlight rendering effect, the target highlight rendering information in the target highlight rendering model can be updated based on the highlight intensity parameters carried in the highlight intensity information; when adjusting the highlight range of the highlight rendering effect, the target highlight rendering information in the target highlight rendering model can be updated based on the highlight range parameters carried in the highlight range information; when adjusting the highlight color of the highlight rendering effect, highlight rendering can be performed based on the highlight color corresponding to the highlight color information and the target highlight rendering information in the target highlight rendering model to obtain the highlight rendering effect after adjusting the highlight color.
[0110] For example, the setting page of the highlight rendering parameter information can be as follows: Figure 5 As shown, Figure 5 The adjustment areas for the highlight intensity parameter, highlight range parameter, and highlight color parameter are respectively set, 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".
[0111] In this way, the highlight rendering effect can be adjusted more flexibly by adjusting the highlight rendering parameter information to obtain the desired highlight rendering effect.
[0112] The highlight rendering method provided by the embodiment of the present disclosure makes the final highlight rendering effect more realistic by adding a material map corresponding to the three-dimensional model of the target object during the highlight rendering process, ensuring that the final highlight effect complies with the reflection law of natural objects; on the other hand, by adding a highlight shape map corresponding to the three-dimensional model of the target object for highlight rendering, the final generated highlight range meets the personalized rendering requirements. Compared with highlight rendering based only on the light direction, the final rendering effect can better meet the user's personalized rendering requirements for virtual objects such as two-dimensional objects.
[0113] Those skilled in the art will understand that in the above-mentioned method of the specific implementation method, the writing order of each step does not mean 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.
[0114] Based on the same inventive concept, the embodiment of the present disclosure also provides a highlight rendering device corresponding to the highlight rendering method. Since the principle of solving the problem by the device in the embodiment of the present disclosure is similar to that of the above-mentioned highlight rendering method in the embodiment of the present disclosure, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0115] Reference Figure 6 FIG. 6 is a schematic diagram of the architecture of a highlight rendering device provided by an embodiment of the present disclosure, wherein the device includes: an acquisition module 601, a determination module 602, and a rendering module 603; wherein,
[0116] Acquisition module 601 is used to acquire a three-dimensional model of a target object, and a material map and a highlight shape map corresponding to the three-dimensional model; wherein the highlight shape map is used to describe the highlight shape of the target object when highlight rendering is performed, and the material map is used to describe whether the constituent materials of various parts of the target object are reflective;
[0117] A determination module 602 is configured to determine an initial highlight rendering model corresponding to the three-dimensional model based on a lighting direction corresponding to the three-dimensional model and a camera direction corresponding to the three-dimensional model;
[0118] The rendering module 603 is configured to determine a target highlight rendering model based on the material map, the highlight shape map, and the initial highlight rendering model, and perform highlight rendering based on the target highlight rendering model.
[0119] In one possible implementation, the determining module 602, when determining the initial highlight rendering model corresponding to the three-dimensional model based on the illumination direction corresponding to the three-dimensional model and the camera direction corresponding to the three-dimensional model, is configured to:
[0120] Determining the normal direction corresponding to each vertex in the three-dimensional model;
[0121] For any of the vertices, determining initial highlight rendering information corresponding to the vertex based on the camera direction and the illumination direction corresponding to the three-dimensional model and the normal direction corresponding to the vertex; wherein the initial highlight rendering information is used to describe the illumination intensity of the vertex under the camera direction and the illumination direction;
[0122] The initial highlight rendering information corresponding to each vertex constitutes the initial highlight rendering model.
[0123] In one possible implementation, the rendering module 603, when determining the target highlight rendering model based on the material map, the highlight shape map, and the initial highlight rendering model, is configured to:
[0124] Determining an intermediate rendering model based on the material map and the initial highlight rendering model; wherein the intermediate rendering model is used to indicate whether highlights need to be added to each part of the three-dimensional model;
[0125] The target highlight rendering model is determined based on the highlight shape map and the intermediate rendering model.
[0126] In a possible implementation, the material map is used to store reflection property information of the three-dimensional model;
[0127] The rendering module 603, when determining the intermediate rendering model based on the material map and the initial highlight rendering model, is used to:
[0128] remapping the initial highlight rendering information corresponding to each vertex in the initial highlight rendering model according to the reflection information stored in the material map to obtain intermediate highlight rendering information corresponding to each vertex;
[0129] The intermediate highlight rendering information corresponding to each vertex constitutes the intermediate highlight rendering model.
[0130] In a possible implementation, the highlight shape map is used to store highlight shape information of the three-dimensional model;
[0131] The rendering module 603, when determining the target highlight rendering model based on the highlight shape map and the intermediate rendering model, is configured to:
[0132] remapping the intermediate highlight rendering information corresponding to each vertex in the intermediate rendering model according to the highlight shape information stored in the highlight shape map to obtain target highlight rendering information corresponding to each vertex;
[0133] The target highlight rendering information corresponding to each vertex constitutes the target highlight rendering model.
[0134] In a possible implementation, the rendering module 603 is further configured to:
[0135] receiving highlight rendering parameter information corresponding to the three-dimensional model;
[0136] The rendering module 603, when performing highlight rendering based on the target highlight rendering model, is used to:
[0137] Based on the target highlight rendering model and the highlight rendering parameter information, highlight rendering is performed on the target object.
[0138] In a possible implementation, the highlight rendering parameter information includes at least one of the following:
[0139] Highlight intensity information, highlight range information, highlight color information.
[0140] The highlight rendering device provided by the embodiment of the present disclosure makes the final highlight rendering effect more realistic by adding a material map corresponding to the three-dimensional model of the target object during the highlight rendering process, ensuring that the final highlight effect complies with the reflection law of natural objects; on the other hand, by adding a highlight shape map corresponding to the three-dimensional model of the target object for highlight rendering, the final generated highlight range meets the personalized rendering requirements. Compared with highlight rendering based only on the light direction, the final rendering effect can better meet the user's personalized rendering requirements for virtual objects such as two-dimensional objects.
[0141] For descriptions of the processing flow of each module in the device and the interaction flow between each module, reference can be made to the relevant descriptions in the above method embodiment, which will not be described in detail here.
[0142] Based on the same technical concept, the embodiment of the present disclosure also provides a computer device. Figure 7 , which is a schematic diagram of the structure of a computer device 700 provided in an embodiment of the present disclosure, including a processor 701, a memory 702, and a bus 703. The memory 702 is used to store execution instructions and includes a memory 7021 and an external memory 7022. The memory 7021 is also referred to as internal memory and is used to temporarily store operation data in the processor 701 and data exchanged with an external memory 7022 such as a hard disk. The processor 701 exchanges data with the external memory 7022 via the memory 7021. When the computer device 700 is running, the processor 701 communicates with the memory 702 via the bus 703, so that the processor 701 executes the following instructions:
[0143] Obtaining a three-dimensional model of a target object, and a material map and a highlight shape map corresponding to the three-dimensional model; wherein the highlight shape map is used to describe the highlight shape of the target object when highlight rendering is performed, and the material map is used to describe whether the constituent materials of various parts of the target object are reflective;
[0144] Determining an initial highlight rendering model corresponding to the three-dimensional model based on a lighting direction corresponding to the three-dimensional model and a camera direction corresponding to the three-dimensional model;
[0145] A target highlight rendering model is determined based on the material map, the highlight shape map, and the initial highlight rendering model, and highlight rendering is performed based on the target highlight rendering model.
[0146] The present disclosure also provides a computer-readable storage medium having a computer program stored thereon. When executed by a processor, the computer program executes the steps of the highlight rendering method described in the above method embodiment. The storage medium may be a volatile or non-volatile computer-readable storage medium.
[0147] The embodiments of the present disclosure also provide a computer program product, which carries program code. The instructions included in the program code can be used to execute the steps of the highlight rendering method described in the above method embodiment. For details, please refer to the above method embodiment and will not be repeated here.
[0148] The computer program product may be implemented in hardware, software, or a combination thereof. In one embodiment, the computer program product is implemented as a computer storage medium. In another embodiment, the computer program product is implemented as a software product, such as a software development kit (SDK).
[0149] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems and devices described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. In the several embodiments provided in the present 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 schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0150] The units described as separate components may or may not be physically separate, and 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 these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0151] In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0152] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0153] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The scope of protection of the present disclosure is not limited thereto. Although the present disclosure has been described in detail with reference to the above-described embodiments, those skilled in the art should understand that any person skilled in the art can modify or easily conceive of changes to the technical solutions described in the above-described embodiments within the technical scope disclosed in the present disclosure, or replace some of the technical features therein with equivalents. Such modifications, changes, or replacements do not deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the scope of protection of the present disclosure. Therefore, the scope of protection of the present disclosure shall be subject to the scope of protection of the claims.
Claims
1. A highlight rendering method, characterized in that: include: Obtaining a three-dimensional model of a target object, and a material map and a highlight shape map corresponding to the three-dimensional model; wherein the highlight shape map is used to describe the highlight shape of the target object when highlight rendering is performed, and the material map is used to describe whether the constituent materials of various parts of the target object are reflective; Determining an initial highlight rendering model corresponding to the three-dimensional model based on a lighting direction corresponding to the three-dimensional model and a camera direction corresponding to the three-dimensional model; Determining an intermediate rendering model based on the material map and the initial highlight rendering model; wherein the intermediate rendering model is used to indicate whether highlights need to be added to each part of the three-dimensional model; Determining a target highlight rendering model based on the highlight shape map and the intermediate rendering model, and performing highlight rendering based on the target highlight rendering model; The step of determining an initial highlight rendering model corresponding to the three-dimensional model based on a lighting direction corresponding to the three-dimensional model and a camera direction corresponding to the three-dimensional model includes: Determining the normal direction corresponding to each vertex in the three-dimensional model; For any of the vertices, determining initial highlight rendering information corresponding to the vertex based on the camera direction and the illumination direction corresponding to the three-dimensional model and the normal direction corresponding to the vertex; wherein the initial highlight rendering information is used to describe the illumination intensity of the vertex under the camera direction and the illumination direction; The initial highlight rendering information corresponding to each vertex constitutes the initial highlight rendering model.
2. The method according to claim 1, characterized in that The material map is used to store the reflection property information of the three-dimensional model; The determining of the intermediate rendering model based on the material map and the initial highlight rendering model includes: remapping the initial highlight rendering information corresponding to each vertex in the initial highlight rendering model according to the reflection information stored in the material map to obtain intermediate highlight rendering information corresponding to each vertex; The intermediate highlight rendering information corresponding to each vertex constitutes the intermediate rendering model.
3. The method according to claim 1 or 2, characterized in that The highlight shape map is used to store highlight shape information of the three-dimensional model; The determining the target highlight rendering model based on the highlight shape map and the intermediate rendering model includes: remapping the intermediate highlight rendering information corresponding to each vertex in the intermediate rendering model according to the highlight shape information stored in the highlight shape map to obtain target highlight rendering information corresponding to each vertex; The target highlight rendering information corresponding to each vertex constitutes the target highlight rendering model.
4. The method according to claim 1, wherein The method further comprises: receiving highlight rendering parameter information corresponding to the three-dimensional model; The performing highlight rendering based on the target highlight rendering model includes: Based on the target highlight rendering model and the highlight rendering parameter information, highlight rendering is performed on the target object.
5. The method according to claim 4, characterized in that The highlight rendering parameter information includes at least one of the following: Highlight intensity information, highlight range information, highlight color information.
6. A highlight rendering device, characterized in that: include: An acquisition module, configured to acquire a three-dimensional model of a target object, and a material map and a highlight shape map corresponding to the three-dimensional model; wherein the highlight shape map is used to describe the highlight shape of the target object when highlight rendering is performed, and the material map is used to describe whether the constituent materials of various parts of the target object are reflective; a determination module, configured to determine an initial highlight rendering model corresponding to the three-dimensional model based on a lighting direction corresponding to the three-dimensional model and a camera direction corresponding to the three-dimensional model; a rendering module configured to determine an intermediate rendering model based on the material map and the initial highlight rendering model; wherein the intermediate rendering model is used to indicate whether highlights are required for various parts of the three-dimensional model; determine a target highlight rendering model based on the highlight shape map and the intermediate rendering model, and perform highlight rendering based on the target highlight rendering model; The determining module is specifically configured to: Determining the normal direction corresponding to each vertex in the three-dimensional model; For any of the vertices, determining initial highlight rendering information corresponding to the vertex based on the camera direction and the illumination direction corresponding to the three-dimensional model and the normal direction corresponding to the vertex; wherein the initial highlight rendering information is used to describe the illumination intensity of the vertex under the camera direction and the illumination direction; The initial highlight rendering information corresponding to each vertex constitutes the initial highlight rendering model.
7. A computer device, characterized in that: include: A processor, a memory, and a bus, wherein the memory stores machine-readable instructions executable by the processor. When the computer device is running, the processor and the memory communicate via the bus. When the machine-readable instructions are executed by the processor, the steps of the highlight rendering method according to any one of claims 1 to 5 are performed.
8. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, executes the steps of the highlight rendering method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Model rendering method, device and equipment and storage medium
CN112316420A
Hair highlight rendering method, device and equipment and storage medium
CN113763525A