Virtual object display method, device, electronic device and storage medium
By calculating the normals and illumination vectors of multiple position points on the virtual object surface, obtaining diffuse reflection and reflection parameters, and matching the target map, the problem of inaccurate maps in the prior art is solved, and the display effect of virtual objects is improved.
Patent Information
- Application Number
- CN202010833390.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-18
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2040-08-18
AI Technical Summary
The prior art only considers diffuse parameters when displaying virtual objects, resulting in inaccurate target maps, which in turn affects the display effect of virtual objects.
Obtain the normal vector and illumination vector of multiple position points on the virtual object surface, calculate the diffuse reflection parameters and reflection parameters, and match the target map based on these two parameters to improve the accuracy of the map.
By considering the reflection phenomenon, the amount of information in the map is increased, making the display of virtual objects more realistic and improving the display effect.
Smart Images

Figure CN114155336B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a virtual object display method, device, electronic device and storage medium. Background Art
[0002] With the development of computer technology, virtual objects are often displayed in fields such as electronic games or virtual reality. In order to make the display effect of virtual objects more natural, it is necessary to add textures on the surface of virtual objects to simulate the effect of the virtual object surface being illuminated by virtual light sources.
[0003] When displaying a virtual object, the diffuse reflection parameter of the virtual object is first obtained. The diffuse reflection parameter can reflect the brightness of the virtual object surface. A target map matching the diffuse reflection parameter is determined, and the target map is added to the surface of the virtual object, thereby displaying the virtual object after adding the target map.
[0004] However, the above solution only considers the diffuse reflection parameters of the virtual object, and the amount of data of the diffuse reflection parameters is relatively small, resulting in inaccurate determination of the target map, which in turn leads to poor display effect of the virtual object. Summary of the invention
[0005] The present disclosure provides a virtual object display method, device, electronic device and storage medium, which improve the display effect of virtual objects.
[0006] According to an aspect of an embodiment of the present disclosure, a method for displaying a virtual object is provided, the method comprising:
[0007] Obtaining object parameters of the virtual object, wherein the object parameters at least include normal vectors and illumination vectors of a plurality of position points on the surface of the virtual object, wherein the illumination vector of the position point is a vector in a direction of light irradiation of the position point;
[0008] Acquire diffuse reflection parameters and reflective parameters of the virtual object according to the normal vectors and the illumination vectors of the multiple position points, wherein the diffuse reflection parameters are negatively correlated with the reflective parameters;
[0009] Determine a target map that matches the diffuse reflection parameter and the reflective parameter;
[0010] The target texture is added on the surface of the virtual object, and the virtual object after the target texture is added is displayed.
[0011] In a possible implementation, the diffuse reflection parameters of the virtual object include diffuse reflection sub-parameters of the multiple position points, and the reflective parameters of the virtual object include reflective sub-parameters of the multiple position points;
[0012] The obtaining of diffuse reflection parameters and reflective parameters of the virtual object according to the normal vectors and the illumination vectors of the plurality of position points includes:
[0013] For each position point, obtaining the diffuse reflection sub-parameter of the position point according to the normal vector and the illumination vector of the position point;
[0014] Performing an inversion process on the diffuse reflection sub-parameter to obtain a first reflected photon parameter of the position point;
[0015] According to a preset first adjustment parameter, adjusting the first anti-photon parameter to obtain a second anti-photon parameter of the position point;
[0016] Combining the diffuse reflection sub-parameters of the multiple position points to obtain the diffuse reflection parameter;
[0017] The second reflective photon parameters of the plurality of position points are combined to obtain the reflective parameters.
[0018] In another possible implementation, obtaining the diffuse reflection sub-parameter of the position point according to the normal vector and the illumination vector of the position point includes:
[0019] Taking the dot product of the normal vector and the illumination vector as a first value;
[0020] The larger value between the first value and 0 is determined as the diffuse reflection sub-parameter of the position point.
[0021] In another possible implementation, the diffuse reflection parameters of the virtual object include diffuse reflection sub-parameters of the multiple position points, and the reflective parameters of the virtual object include reflective sub-parameters of the multiple position points; and determining a target map matching the diffuse reflection parameters and the reflective parameters includes:
[0022] Obtaining brightness sub-parameters of each position point according to the diffuse reflection sub-parameters and the reflected light sub-parameters of each position point;
[0023] According to the brightness sub-parameter of each position point and the serial numbers of the multiple candidate maps, respectively obtaining the weights of the multiple candidate maps, wherein the serial numbers of the multiple candidate maps are determined after the multiple candidate maps are arranged in descending order according to brightness, and the serial numbers of the candidate maps represent the brightness of the candidate maps, and different candidate maps have different serial numbers;
[0024] The target map is determined according to the weights of the multiple candidate maps corresponding to each position point.
[0025] In another possible implementation, obtaining the brightness sub-parameter of each position point according to the diffuse reflection sub-parameter and the reflective sub-parameter of each position point includes:
[0026] For each position point, add the diffuse reflection sub-parameter and the anti-photon sub-parameter of the position point to obtain a first brightness sub-parameter of the position point;
[0027] The first brightness sub-parameter is multiplied by the number of the candidate textures to obtain a second brightness sub-parameter of the position point.
[0028] In another possible implementation, obtaining the weights of the multiple candidate textures respectively according to the brightness sub-parameter of each position point and the sequence numbers of the multiple candidate textures includes:
[0029] For each position point, determining a matching parameter of each candidate texture according to a difference between a brightness sub-parameter of the position point and a sequence number of each candidate texture, wherein the matching parameter represents a degree of matching between the brightness of the candidate texture and the brightness of the position point;
[0030] The difference between the matching parameters of any two adjacent candidate maps is used as the weight of the first candidate map among the any two candidate maps, and the matching parameter of the last candidate map is used as the weight of the last candidate map. The any two adjacent candidate maps refer to two adjacent candidate maps among a plurality of candidate maps arranged in descending order of brightness.
[0031] In another possible implementation, the method further includes:
[0032] According to the serial numbers of the multiple candidate maps, the candidate maps with adjacent serial numbers are merged in sequence to obtain at least one merged map, wherein at least one channel among the red channel, the green channel or the blue channel of the merged map corresponds to one candidate map;
[0033] The determining, according to the difference between the brightness sub-parameter of the position point and the sequence number of each candidate texture, the matching parameter of each candidate texture comprises:
[0034] Obtaining a sequence number matrix of each fused map, wherein the sequence number matrix of the fused map includes a sequence number of each candidate map in the fused map;
[0035] Acquire a brightness sub-parameter matrix, wherein the brightness sub-parameter matrix includes a plurality of brightness sub-parameters, and the number of the plurality of brightness sub-parameters is equal to the number of candidate textures included in the fused texture;
[0036] The difference between the brightness sub-parameter matrix and the sequence number matrix of each fused map is obtained to determine a matching parameter matrix, where the matching parameter matrix includes matching parameters of each candidate map.
[0037] In another possible implementation, determining the matching parameter of the candidate texture according to the difference between the brightness sub-parameter of the position point and the sequence number of the candidate texture includes:
[0038] In response to the difference being greater than a first reference value, using the first reference value as a matching parameter of the candidate map; or,
[0039] In response to the difference being smaller than a second reference value, taking the second reference value as a matching parameter of the candidate map; or,
[0040] In response to the difference being not greater than the first reference value and not less than the second reference value, the difference is used as a matching parameter of the candidate map.
[0041] In another possible implementation, determining the target texture according to the weight corresponding to each candidate texture includes:
[0042] The candidate map corresponding to the largest weight is used as the target map; or,
[0043] According to the weight of each candidate texture, the plurality of candidate textures are weightedly fused, and the fused texture is used as the target texture.
[0044] In another possible implementation, the object parameters further include viewing angle vectors of the multiple position points, where the viewing angle vectors of the position points are vectors of the virtual camera in directions relative to the position points;
[0045] Before adding the target map to the surface of the virtual object and displaying the virtual object after adding the target map, the method further includes:
[0046] Acquire a highlight parameter of the virtual object according to the normal vectors, the illumination vector, and the viewing angle vector of the plurality of position points, wherein the highlight parameter represents the brightest position point on the surface of the virtual object;
[0047] The adding the target map on the surface of the virtual object and displaying the virtual object after adding the target map comprises:
[0048] The target map is added to the surface of the virtual object, and the virtual object after the target map is added is displayed according to the highlight parameter.
[0049] In another possible implementation, acquiring the highlight parameter of the virtual object according to the normal vectors, the illumination vector, and the viewing angle vector of the multiple position points includes:
[0050] For each position point, taking the dot product of the sum vector of the view vector and the illumination vector of the position point and the normal vector of the position point as the second value;
[0051] The product of the larger value of the second value and 0 and the illumination vector is used as the first high photon parameter;
[0052] According to a preset second adjustment parameter, the first high photon parameter is adjusted to obtain a second high photon parameter.
[0053] In another possible implementation, after determining the target map that matches the diffuse reflection parameter and the reflective parameter, the method further includes:
[0054] Extending each position point by a preset distance along the corresponding normal direction to form an extension area outside the surface of the virtual object, and filling the extension area with a reference color;
[0055] The adding the target map on the surface of the virtual object and displaying the virtual object after adding the target map comprises:
[0056] The target map is added to the surface of the virtual object, and the virtual object after the target map is added and an extended area outside the surface of the virtual object are displayed.
[0057] According to another aspect of the embodiments of the present disclosure, a virtual object display device is provided, the device comprising:
[0058] A first parameter acquisition unit is configured to acquire object parameters of a virtual object, wherein the object parameters at least include normal vectors and illumination vectors of a plurality of position points on a surface of the virtual object, wherein the illumination vector of the position point is a vector in a direction of light irradiation of the position point;
[0059] A second parameter acquisition unit is configured to acquire a diffuse reflection parameter and a reflective parameter of the virtual object according to the normal vectors and the illumination vectors of the plurality of position points, wherein the diffuse reflection parameter is negatively correlated with the reflective parameter;
[0060] A target map determining unit, configured to determine a target map matching the diffuse reflection parameter and the reflective parameter;
[0061] The virtual object display unit is configured to add the target map to the surface of the virtual object and display the virtual object after the target map is added.
[0062] In a possible implementation, the diffuse reflection parameters of the virtual object include diffuse reflection sub-parameters of the multiple position points, and the reflective parameters of the virtual object include reflective sub-parameters of the multiple position points;
[0063] The second parameter acquisition unit is configured to execute:
[0064] For each position point, obtaining the diffuse reflection sub-parameter of the position point according to the normal vector and the illumination vector of the position point;
[0065] Performing an inversion process on the diffuse reflection sub-parameter to obtain a first reflected photon parameter of the position point;
[0066] According to a preset first adjustment parameter, adjusting the first anti-photon parameter to obtain a second anti-photon parameter of the position point;
[0067] Combining the diffuse reflection sub-parameters of the multiple position points to obtain the diffuse reflection parameter;
[0068] The second reflective photon parameters of the plurality of position points are combined to obtain the reflective parameters.
[0069] In another possible implementation, the second parameter obtaining unit is configured to execute:
[0070] Taking the dot product of the normal vector and the illumination vector as a first value;
[0071] The larger value between the first value and 0 is determined as the diffuse reflection sub-parameter of the position point.
[0072] In another possible implementation, the diffuse reflection parameters of the virtual object include diffuse reflection sub-parameters of the multiple position points, and the reflective parameters of the virtual object include reflective sub-parameters of the multiple position points; the target map determination unit includes:
[0073] A brightness sub-parameter acquisition sub-unit is configured to acquire the brightness sub-parameter of each position point according to the diffuse reflection sub-parameter and the reflective sub-parameter of each position point;
[0074] A weight acquisition subunit is configured to acquire weights of the multiple candidate maps respectively according to the brightness sub-parameter of each position point and the serial numbers of the multiple candidate maps, wherein the serial numbers of the candidate maps are determined after the multiple candidate maps are arranged in descending order according to brightness, and the serial numbers of the candidate maps represent the brightness of the candidate maps, and different candidate maps have different serial numbers;
[0075] The texture determination subunit is configured to determine the target texture according to the weights of the multiple candidate textures corresponding to each position point.
[0076] In another possible implementation, the brightness sub-parameter obtaining sub-unit is configured to execute:
[0077] For each position point, add the diffuse reflection sub-parameter and the anti-photon sub-parameter of the position point to obtain a first brightness sub-parameter of the position point;
[0078] The first brightness sub-parameter is multiplied by the number of the candidate textures to obtain a second brightness sub-parameter of the position point.
[0079] In another possible implementation, the weight acquisition subunit is configured to execute:
[0080] For each position point, determining a matching parameter of each candidate texture according to a difference between a brightness sub-parameter of the position point and a sequence number of each candidate texture, wherein the matching parameter represents a degree of matching between the brightness of the candidate texture and the brightness of the position point;
[0081] The difference between the matching parameters of any two adjacent candidate maps is used as the weight of the first candidate map among the any two candidate maps, and the matching parameter of the last candidate map is used as the weight of the last candidate map. The any two adjacent candidate maps refer to two adjacent candidate maps among a plurality of candidate maps arranged in descending order of brightness.
[0082] In another possible implementation, the device further includes:
[0083] a texture fusion unit configured to fuse candidate textures with adjacent sequence numbers in sequence according to the sequence numbers of the plurality of candidate textures to obtain at least one fused texture, wherein at least one of the red channel, the green channel or the blue channel of the fused texture corresponds to one candidate texture;
[0084] The weight acquisition subunit is configured to execute:
[0085] Obtaining a sequence number matrix of each fused map, wherein the sequence number matrix of the fused map includes a sequence number of each candidate map in the fused map;
[0086] Acquire a brightness sub-parameter matrix, wherein the brightness sub-parameter matrix includes a plurality of brightness sub-parameters, and the number of the plurality of brightness sub-parameters is equal to the number of candidate textures included in the fused texture;
[0087] The difference between the brightness sub-parameter matrix and the sequence number matrix of each fused map is obtained to determine a matching parameter matrix, where the matching parameter matrix includes matching parameters of each candidate map.
[0088] In another possible implementation, the weight acquisition subunit is configured to execute:
[0089] In response to the difference being greater than a first reference value, using the first reference value as a matching parameter of the candidate map; or,
[0090] In response to the difference being smaller than a second reference value, taking the second reference value as a matching parameter of the candidate map; or,
[0091] In response to the difference being not greater than the first reference value and not less than the second reference value, the difference is used as a matching parameter of the candidate map.
[0092] In another possible implementation, the texture determination subunit is configured to execute:
[0093] The candidate map corresponding to the largest weight is used as the target map; or,
[0094] According to the weight of each candidate texture, the plurality of candidate textures are weightedly fused, and the fused texture is used as the target texture.
[0095] In another possible implementation, the object parameters further include viewing angle vectors of the multiple position points, where the viewing angle vectors of the position points are vectors of the virtual camera in directions relative to the position points;
[0096] The device also includes:
[0097] A third parameter acquisition unit is configured to acquire a highlight parameter of the virtual object according to the normal vectors, the illumination vector and the viewing angle vector of the plurality of position points, wherein the highlight parameter represents the brightest position point on the surface of the virtual object;
[0098] The virtual object display unit is configured to add the target map to the surface of the virtual object, and display the virtual object after adding the target map according to the highlight parameter.
[0099] In another possible implementation, the third parameter obtaining unit is configured to execute:
[0100] For each position point, taking the dot product of the sum vector of the view vector and the illumination vector of the position point and the normal vector of the position point as the second value;
[0101] The product of the larger value of the second value and 0 and the illumination vector is used as the first high photon parameter;
[0102] According to a preset second adjustment parameter, the first high photon parameter is adjusted to obtain a second high photon parameter.
[0103] In another possible implementation, the device further includes:
[0104] an extended area acquisition unit, configured to extend each position point along a corresponding normal direction by a preset distance to form an extended area outside the surface of the virtual object, and fill the extended area with a reference color;
[0105] The virtual object display unit is configured to add the target map to the surface of the virtual object, and display the virtual object after the target map is added and an extended area outside the surface of the virtual object.
[0106] According to another aspect of the embodiments of the present disclosure, an electronic device is provided, the electronic device comprising:
[0107] one or more processors;
[0108] a volatile or non-volatile memory for storing the one or more processor-executable instructions;
[0109] Wherein, the one or more processors are configured to execute the virtual object display method described in the above aspects.
[0110] According to another aspect of the embodiments of the present disclosure, a non-temporary computer-readable storage medium is provided. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute the virtual object display method described in the above aspects.
[0111] According to another aspect of an embodiment of the present disclosure, a computer program product is provided. When instructions in the computer program product are executed by a processor of an electronic device, the electronic device can execute the virtual object display method described in the above aspects.
[0112] The virtual object display method, device, electronic device and storage medium provided by the embodiments of the present disclosure can obtain diffuse reflection parameters and reflection parameters of the virtual object. Since both the diffuse reflection parameters and the reflection parameters can reflect the brightness of the virtual object, compared with determining the matching map only based on the diffuse reflection parameters, when determining the matching target map based on the diffuse reflection parameters and the reflection parameters, the influence of the reflection phenomenon on the display effect of the virtual object is also considered, thereby increasing the amount of information and enabling the determined target map to more accurately reflect the brightness of the virtual object. Therefore, when displaying the virtual object after adding the target map, the virtual object is more realistic, thereby improving the display effect of the virtual object.
[0113] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0114] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0115] Figure 1 The figure is a flowchart of a method for displaying a virtual object according to an exemplary embodiment.
[0116] Figure 2 The figure is a flowchart of another method for displaying a virtual object according to an exemplary embodiment.
[0117] Figure 3 is a schematic diagram showing object parameters of a position point according to an exemplary embodiment.
[0118] Figure 4 is a schematic diagram of a virtual object according to an exemplary embodiment.
[0119] Figure 5 is a schematic diagram of an alternative map according to an exemplary embodiment.
[0120] Figure 6 is a schematic diagram showing a fused map according to an exemplary embodiment.
[0121] Figure 7 is a schematic diagram showing a highlight phenomenon according to an exemplary embodiment.
[0122] Figure 8 It is a schematic diagram of a sketch image according to an exemplary embodiment.
[0123] Fig. 9 is a schematic diagram of a virtual object according to an exemplary embodiment.
[0124] Fig.10 The present invention is a block diagram of a virtual object display device according to an exemplary embodiment.
[0125] Fig.11 The figure is a block diagram of another virtual object display device according to an exemplary embodiment.
[0126] Fig.12 It is a block diagram of a terminal according to an exemplary embodiment. DETAILED DESCRIPTION
[0127] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0128] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned figure descriptions are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0129] It should be noted that the user information involved in this disclosure (including but not limited to user device information, user personal information, etc.) is all information authorized by the user or fully authorized by all parties.
[0130] In order to facilitate understanding of the technical process of the embodiments of the present disclosure, the terms involved in the embodiments of the present disclosure are explained below:
[0131] Real-time rendering: It is a model rendering technology that draws three-dimensional data into two-dimensional images based on graphics algorithms and displays the two-dimensional images in real time. It is used in virtual reality, virtual scenes in game applications, etc.
[0132] Illumination Model: Illumination model is also called light and shade model, which is used to describe the color value of the virtual object under the influence of light and viewing angle. Illumination model includes theoretical model based on physics and empirical model based on experience. For example, illumination model includes Phong (specular reflection) model, Blinn-Phong (corrected specular reflection) model and Cook-Torrance (microsurface) model. Among them, Blinn-Phong model is a high light calculation model, which can perform fast real-time rendering.
[0133] Rendering Pass: A rendering pass represents a rendering operation. When displaying a virtual object, the virtual object is rendered and displayed through multiple rendering passes.
[0134] Virtual scene: A virtual scene is a virtual scene displayed (or provided) when an application is running on a terminal. A virtual scene is used to simulate a three-dimensional virtual space, which is an open space, or a virtual scene that simulates a real environment in reality, or a virtual scene that is semi-simulated and semi-fictitious, or a completely fictitious virtual scene. The virtual scene is any one of a two-dimensional virtual scene, a 2.5-dimensional virtual scene, and a three-dimensional virtual scene. For example, the virtual scene includes rivers, grass, land, buildings, etc.
[0135] Figure 1 is a flowchart of a method for displaying a virtual object according to an exemplary embodiment. Figure 1 The method is applied in a terminal and comprises the following steps:
[0136] In step 101, object parameters of the virtual object are obtained, and the object parameters at least include normal vectors and illumination vectors of multiple position points on the surface of the virtual object. The illumination vector of a position point is a vector in the direction of light irradiation of the position point.
[0137] In step 102, the diffuse reflection parameter and the reflection parameter of the virtual object are obtained according to the normal vectors and the illumination vectors of the plurality of position points. The diffuse reflection parameter and the reflection parameter are negatively correlated.
[0138] In step 103, a target map matching the diffuse reflection parameters and the reflective parameters is determined.
[0139] In step 104, a target texture is added to the surface of the virtual object, and the virtual object with the target texture added is displayed.
[0140] The method provided by the embodiment of the present disclosure can obtain diffuse reflection parameters and reflection parameters of a virtual object. Since both diffuse reflection parameters and reflection parameters can reflect the brightness of the virtual object, compared with determining a matching map based on diffuse reflection parameters alone, when determining a matching target map based on diffuse reflection parameters and reflection parameters, the influence of the reflection phenomenon on the display effect of the virtual object is also considered, thereby increasing the amount of information and enabling the determined target map to more accurately reflect the brightness of the virtual object. Therefore, when displaying the virtual object after adding the target map, the virtual object is more realistic, thereby improving the display effect of the virtual object.
[0141] In a possible implementation, the diffuse reflection parameters of the virtual object include diffuse reflection sub-parameters of multiple position points, and the reflective parameters of the virtual object include reflective sub-parameters of multiple position points;
[0142] According to the normal vectors and illumination vectors of multiple position points, the diffuse reflection parameters and reflection parameters of the virtual object are obtained, including:
[0143] For each position point, obtain the diffuse reflection sub-parameter of the position point according to the normal vector and the illumination vector of the position point;
[0144] The diffuse reflection sub-parameters are inverted to obtain the first reflection photon parameters of the position point;
[0145] According to the preset first adjustment parameter, the first anti-photon parameter is adjusted to obtain the second anti-photon parameter of the position point;
[0146] Combining diffuse reflection sub-parameters of multiple position points to obtain diffuse reflection parameters;
[0147] The second reflected photon parameters of multiple position points are combined to obtain the reflected light parameters.
[0148] In another possible implementation, the diffuse reflection sub-parameter of the position point is obtained according to the normal vector and the illumination vector of the position point, including:
[0149] Take the dot product of the normal vector and the light vector as the first value;
[0150] The larger value between the first value and 0 is determined as the diffuse reflection sub-parameter of the location point.
[0151] In another possible implementation, the diffuse reflection parameters of the virtual object include diffuse reflection sub-parameters of multiple position points, and the reflective parameters of the virtual object include reflective sub-parameters of multiple position points; determining a target map matching the diffuse reflection parameters and the reflective parameters includes:
[0152] According to the diffuse reflection sub-parameter and the reflected light sub-parameter of each position point, the brightness sub-parameter of each position point is obtained respectively;
[0153] According to the brightness sub-parameter of each position point and the serial numbers of the multiple candidate maps, the weights of the multiple candidate maps are respectively obtained, wherein the serial numbers of the candidate maps are determined after the multiple candidate maps are arranged in descending order according to brightness, and the serial numbers of the candidate maps represent the brightness of the candidate maps, and different candidate maps have different serial numbers;
[0154] The target map is determined according to the weights of multiple candidate maps corresponding to each position point.
[0155] In another possible implementation, the brightness sub-parameters of each position point are obtained according to the diffuse reflection sub-parameters and the reflected light sub-parameters of each position point, including:
[0156] For each position point, add the diffuse reflection sub-parameter and the anti-photon sub-parameter of the position point to obtain the first brightness sub-parameter of the position point;
[0157] The first brightness sub-parameter is multiplied by the number of candidate maps to obtain the second brightness sub-parameter of the position point.
[0158] In another possible implementation, the weights of the multiple candidate textures are obtained respectively according to the brightness sub-parameter of each position point and the sequence numbers of the multiple candidate textures, including:
[0159] For each position point, a matching parameter of each candidate texture is determined according to the difference between the brightness sub-parameter of the position point and the sequence number of each candidate texture, wherein the matching parameter represents the degree of matching between the brightness of the candidate texture and the brightness of the position point;
[0160] The difference between the matching parameters of any two adjacent candidate maps is used as the weight of the first candidate map among the two candidate maps, and the matching parameter of the last candidate map is used as the weight of the last candidate map. Any two adjacent candidate maps refer to two adjacent candidate maps among multiple candidate maps arranged in descending order of brightness.
[0161] In another possible implementation, the method further includes:
[0162] According to the serial numbers of the multiple candidate maps, the candidate maps with adjacent serial numbers are merged in sequence to obtain at least one merged map, and at least one channel of the red channel, the green channel or the blue channel of the merged map corresponds to one candidate map;
[0163] According to the difference between the brightness sub-parameter of the position point and the sequence number of each candidate texture, the matching parameters of each candidate texture are determined, including:
[0164] Obtaining a sequence number matrix of each fused map, wherein the sequence number matrix of the fused map includes the sequence number of each candidate map in the fused map;
[0165] Obtaining a brightness sub-parameter matrix, the brightness sub-parameter matrix including a plurality of brightness sub-parameters, and the number of the plurality of brightness sub-parameters is equal to the number of candidate maps included in the fused map;
[0166] The difference between the brightness sub-parameter matrix and the sequence number matrix of each fused map is obtained to determine a matching parameter matrix, where the matching parameter matrix includes matching parameters of each candidate map.
[0167] In another possible implementation, the matching parameter of the candidate texture is determined according to the difference between the brightness sub-parameter of the position point and the sequence number of the candidate texture, including:
[0168] In response to the difference being greater than a first reference value, taking the first reference value as a matching parameter of the candidate mapping; or,
[0169] In response to the difference being smaller than a second reference value, taking the second reference value as a matching parameter of the candidate mapping; or,
[0170] In response to the difference being not greater than the first reference value and not less than the second reference value, the difference is used as a matching parameter of the candidate map.
[0171] In another possible implementation, the target texture is determined according to the weight corresponding to each candidate texture, including:
[0172] Use the candidate map with the largest weight as the target map; or
[0173] According to the weight of each candidate texture, multiple candidate textures are weighted fused, and the fused texture is used as the target texture.
[0174] In another possible implementation, the object parameters further include view vectors of a plurality of position points, where the view vectors of the position points are vectors in directions of the virtual camera relative to the position points;
[0175] Before adding a target texture to the surface of the virtual object and displaying the virtual object after adding the target texture, the method further includes:
[0176] Obtaining highlight parameters of the virtual object according to normal vectors, illumination vectors, and viewing angle vectors of multiple position points, where the highlight parameters represent the brightest position points on the surface of the virtual object;
[0177] Add a target map on the surface of the virtual object and display the virtual object after adding the target map, including:
[0178] Add a target map on the surface of the virtual object, and display the virtual object after adding the target map according to the highlight parameters.
[0179] In another possible implementation, the highlight parameters of the virtual object are obtained according to the normal vectors, illumination vectors, and viewing angle vectors of multiple position points, including:
[0180] For each position point, the dot product of the sum vector of the view vector and the illumination vector of the position point and the normal vector of the position point is taken as the second value;
[0181] The product of the larger value between the second value and 0 and the illumination vector is used as the first high photon parameter;
[0182] According to the preset second adjustment parameter, the first high photon parameter is adjusted to obtain the second high photon parameter.
[0183] In another possible implementation, after determining the target map that matches the diffuse reflection parameters and the reflective parameters, the method further includes:
[0184] Extend each position point by a preset distance along the corresponding normal direction to form an extension area outside the surface of the virtual object, and fill the reference color into the extension area;
[0185] Add a target map on the surface of the virtual object and display the virtual object after adding the target map, including:
[0186] A target map is added to the surface of the virtual object, and the virtual object after the target map is added and an extended area outside the surface of the virtual object are displayed.
[0187] The virtual object display method provided by the embodiments of the present disclosure can be applied in a variety of scenarios.
[0188] For example, it is applied in game scenarios.
[0189] In a game application, a virtual scene is created, in which a virtual light source is provided. When displaying a virtual object in the virtual scene, it is necessary to consider the effect of the illumination of the virtual light source on the virtual object. By using the method provided in the embodiment of the present application to display the virtual object, it is possible to consider the diffuse reflection effect and the reflective effect generated on the surface of the virtual object under the illumination of the virtual light source, thereby making the displayed virtual object more realistic, thereby improving the display effect of the virtual object.
[0190] Another example is applied in virtual reality scenarios.
[0191] Users can use the terminal's camera to capture images of actual scenes and add virtual objects to the images. When adding virtual objects, it is necessary to consider the impact of the virtual light source on the virtual objects. The method provided in the embodiment of the present application is used to display virtual objects. The diffuse reflection effect and reflective effect generated on the surface of the virtual object under the illumination of the light source can be considered, thereby improving the display effect of the virtual object.
[0192] Figure 2 is a flowchart of another virtual object display method according to an exemplary embodiment. Figure 2 The method is applied to a terminal, which is a portable, pocket-sized, handheld or other type of terminal, such as a mobile phone, a computer, a tablet computer, etc. The method comprises the following steps:
[0193] 201. The terminal obtains object parameters of a virtual object.
[0194] In the disclosed embodiment, in order to make the display effect of the virtual object more natural, a texture is added to the surface of the virtual object. When selecting the texture, the brightness of the virtual object surface under the illumination of the light source is considered to select a texture whose brightness matches the brightness of the virtual object surface. The texture is added to the surface of the virtual object to simulate the effect of the virtual object surface under the illumination of the light source, thereby improving the display effect of the virtual object.
[0195] A virtual object refers to an object set in a virtual scene. Optionally, the virtual object is a dynamic object such as a person, an animal, or a plant, or a static object such as a table or a chair. The object parameters of a virtual object are the parameters required to display the virtual object in a virtual scene. According to the object parameters of the virtual object, various parameters generated by the virtual object under the illumination of a virtual light source can be determined. The various parameters are used to describe the conditions that the display effect of the virtual object under the illumination of a virtual light source should meet. Subsequently, the corresponding map can be selected according to the various parameters so that the display effect achieved when the selected map is added to the surface of the virtual object meets the conditions.
[0196] In a possible implementation, since the surface of the virtual object includes multiple position points, each position point has corresponding object parameters, the object parameters of the virtual object include normal vectors and illumination vectors at the multiple position points. The normal vector at any position point is a vector in the normal direction of the position point, that is, a vector in a direction perpendicular to the surface of the virtual object where the position point is located, and the illumination vector at any position point is a vector in the direction of light irradiation at the position point.
[0197] For example, see Figure 3 In the schematic diagram of the position points shown, the position point A is a position point on the surface of the sphere, the vector N is the normal vector at the position point A, and the vector L is the illumination vector at the position point A.
[0198] 202. The terminal obtains diffuse reflection parameters and reflective parameters of the virtual object according to the normal vectors and illumination vectors of the multiple position points.
[0199] In the disclosed embodiment, diffuse reflection and reflection phenomena will occur on the surface of an object under the illumination of a light source. Therefore, in order to make the display effect of the virtual object more realistic, diffuse reflection parameters and reflection parameters of the surface of the virtual object are obtained. The diffuse reflection parameters are used to describe the diffuse reflection conditions that the virtual object should meet under the illumination of the virtual light source, and the reflection parameters are used to describe the reflection conditions that the virtual object should meet under the illumination of the virtual light source, so as to display the virtual object according to the diffuse reflection parameters and reflection parameters.
[0200] In addition to being illuminated by the virtual light source, virtual objects in the virtual scene are also illuminated by the reflected light of other virtual objects in the virtual scene. The reflected light of other virtual objects will affect the darker parts on the surface of the virtual object, that is, the darker parts on the surface of the virtual object will have a higher brightness when illuminated by the reflected light of other virtual objects. That is, the smaller the diffuse reflection parameter generated when the virtual object is illuminated by the virtual light source, the darker the surface of the virtual object. At this time, when it is illuminated by the reflected light of other virtual objects, the reflected light has a greater impact on the brightness on the surface of the virtual object, and the greater the reflective parameter generated. Therefore, the diffuse reflection parameter and reflective parameter of the virtual object are negatively correlated.
[0201] That is to say, the diffuse reflection parameters and reflection parameters of the virtual object are affected by the light intensity. The greater the light intensity, the brighter the surface of the virtual object, the larger the diffuse reflection parameter, the smaller the influence of the reflected light, and the smaller the reflection parameter; the smaller the light intensity, the darker the surface of the virtual object, the smaller the diffuse reflection parameter, the greater the influence of the reflected light, and the larger the reflection parameter.
[0202] The diffuse reflection parameters of the virtual object include diffuse reflection sub-parameters of multiple position points on the surface of the virtual object, and the reflective parameters of the virtual object include reflective sub-parameters of multiple position points on the surface of the virtual object. Since the virtual object surface includes multiple position points, when obtaining the diffuse reflection parameters and reflective parameters of the virtual object, it is necessary to obtain the diffuse reflection sub-parameters and reflective sub-parameters of each position point respectively, combine the diffuse reflection sub-parameters of the multiple position points to obtain the diffuse reflection parameters of the virtual object, and combine the reflective sub-parameters of the multiple position points to obtain the reflective parameters of the virtual object. For example, if the diffuse reflection parameters of the virtual object are a matrix, the diffuse reflection sub-parameters of each position point are each element in the matrix.
[0203] The embodiment of the present disclosure is described by taking the acquisition of diffuse reflection sub-parameters and reflected photon parameters of any position point as an example.
[0204] In one possible implementation, the diffuse reflection phenomenon refers to the phenomenon that when light shines on the rough surface of an object, the normal direction at each position point on the surface of the object is inconsistent, causing the light to be reflected in different directions. Therefore, the terminal obtains the diffuse reflection sub-parameters of the position point based on the normal vector and the illumination vector of the position point.
[0205] Optionally, the terminal uses (0, 1) to represent the brightness of a position point on the surface of the virtual object, 0 represents the brightest, and 1 represents the darkest. Since the dot product of two vectors is less than 0, the terminal uses the dot product of the normal vector and the illumination vector as the first value, and determines the larger value between the first value and 0 as the diffuse reflection sub-parameter of the position point. That is, if the dot product is less than 0, 0 is used as the diffuse reflection sub-parameter, and if the dot product is not less than 0, the first value is used as the diffuse reflection sub-parameter.
[0206] For example, the following formula is used to obtain the diffuse reflection sub-parameters of the location point:
[0207] D = max(0, dot(N, L));
[0208] Wherein, D represents the diffuse reflection sub-parameter of the position point, N represents the normal vector of the position point, L represents the illumination vector of the position point, and dot(N, L) represents the dot product of N and L.
[0209] Since the brightness of the surface of a virtual object is not only affected by the virtual light source, but also by the reflected light of other virtual objects, the terminal also needs to obtain the reflected photon parameters of each position point.
[0210] In one possible implementation, the terminal inverts the diffuse reflection sub-parameter to obtain a first reflection sub-parameter of the position point, adjusts the first reflection sub-parameter according to a pre-set first adjustment parameter, and obtains a second reflection sub-parameter of the position point, wherein the second reflection sub-parameter represents the brightness of the position point when illuminated by reflected light from other virtual objects.
[0211] The purpose of negating the diffuse reflection sub-parameter is to determine the effect on the brightness of the position point when the position point is illuminated by the reflected light of other virtual objects. Optionally, 1 represents the brightest and 0 represents the darkest. The negation process is to subtract 1 from the diffuse reflection sub-parameter. For example, if the diffuse reflection sub-parameter of the position point is 0, the brightness of the position point is the lowest, that is, the darkest. Then, 0 is negated to obtain the first reflection sub-parameter 1, which means that the brightness of the position point will be greatly improved when it is illuminated by the reflected light of other virtual objects.
[0212] If the first anti-photon parameter obtained by the inversion process is used as the anti-photon parameter of the position point, then after adding the diffuse reflection sub-parameter and the anti-photon parameter, the value obtained is 0, and the position point has no reflection effect on the light. Therefore, the first anti-photon parameter is adjusted according to the first adjustment parameter to obtain the adjusted second anti-photon parameter, so that the parameter after adding the diffuse reflection sub-parameter and the adjusted second anti-photon parameter can be used to accurately reflect the brightness of the position point. Among them, the first adjustment parameter is used to indicate the degree of influence of the reflected light on the virtual object, and is set according to the intensity of the reflected light of other virtual objects. If the reflected light of other virtual objects is strong, that is, the reflected light of other virtual objects has a greater influence on the virtual object, then the first adjustment parameter is a larger parameter. If the reflected light of other virtual objects is weak, that is, the reflected light of other virtual objects has a smaller influence on the virtual object, then the first adjustment parameter is a smaller parameter, and the first adjustment parameter is greater than 0 and less than 1.
[0213] For example, see Figure 4 The virtual object shown, with the virtual light source located at the upper right, Figure 4 The virtual object in the middle left image is brighter on the right and darker on the lower left corner when illuminated by a virtual light source. However, the brightness of the virtual object caused by the reflected light from other virtual objects is opposite to that caused by the virtual light source. Figure 4 The virtual object in the middle-right image is darker on the right and brighter in the lower left corner.
[0214] 203. The terminal determines a target map that matches the diffuse reflection parameters and the reflective parameters.
[0215] In the disclosed embodiment, since the terminal needs to add a texture on the surface of the virtual object when displaying the virtual object, the virtual object seen by the user is the virtual object after the texture is added. However, the choice of texture has a great influence on the display effect of the virtual object. For example, if a certain position of the virtual object is not illuminated by light, then the position is darker and the required texture should be a darker texture. If a brighter texture is used, the display effect of the position will not match the actual situation and the display effect will be poor. Since the diffuse reflection parameter and the reflection parameter are both used to represent the brightness of the surface of the virtual object, the matching target texture is determined according to the diffuse reflection parameter and the reflection parameter so that a better display effect is presented after the target texture is added to the surface of the virtual object.
[0216] In one possible implementation, before determining the target map that matches the diffuse reflection parameters and the reflective parameters, the terminal needs to first obtain multiple candidate maps. Since different parts of the virtual object have different brightnesses when displayed under the illumination of a virtual light source, the brightnesses of the multiple candidate maps are also different, so that the multiple candidate maps can meet the different brightness requirements of the virtual object display.
[0217] After the multiple candidate maps are sorted in order from large to small according to brightness, the serial number of each candidate map is determined, wherein the serial number of the candidate map represents the brightness of the candidate map, and different candidate maps have different serial numbers, that is, different candidate maps have different brightness, and the smaller the serial number, the brighter the brightness of the candidate map, and the larger the serial number, the darker the brightness of the candidate map. The target map is any candidate map among the multiple candidate maps, or a map after the multiple candidate maps are merged.
[0218] The purpose of the disclosed embodiment is to obtain a map that can reflect the brightness of a point on the surface of a virtual object according to the brightness of the point, so that after the map is added to the virtual object, the display effect of the virtual object is consistent with the actual display effect.
[0219] In a possible implementation, the sketch image is composed of lines. If the sketch effect is to be displayed in the image of the virtual object, the candidate texture obtained is a line image. The sparser the distribution of the lines in the candidate texture, the brighter the candidate texture. The denser the distribution of the lines in the candidate texture, the darker the candidate texture. For example, see Figure 5 The alternative maps shown, from left to right, the brightness of these 6 alternative maps decreases successively, the first alternative map is numbered 0, the second alternative map is numbered 1, until the last map is numbered 5.
[0220] In addition, the more candidate stickers there are, the finer the division of brightness is, the more candidate stickers the terminal can select, and the better the display effect is.
[0221] In another possible implementation, if the virtual object displays other effects besides the sketch effect, then a corresponding type of map is obtained according to the other effect. For example, in order to simulate the effect of a dot matrix, the candidate map is composed of multiple dots.
[0222] In one possible implementation, the terminal determines a target map that matches the diffuse reflection parameters and the reflective parameters, including: the terminal obtains a brightness sub-parameter for each position point based on the diffuse reflection sub-parameter and the reflective sub-parameter for each position point; obtains weights of multiple candidate maps based on the brightness sub-parameter for each position point and the sequence numbers of the multiple candidate maps; and determines the target map according to the weights of the multiple candidate maps corresponding to each position point.
[0223] When determining the target map of a virtual object, since the virtual object includes multiple position points and each position point is exposed to different light, that is, the brightness of each position point is different, in order to make the target map of the virtual object more consistent with the actual lighting, it is necessary to separately determine the target map corresponding to each position point, and combine the target maps corresponding to each position point together to obtain the target map of the virtual object.
[0224] Among them, the diffuse reflection sub-parameter and the reflective sub-parameter are both used to reflect the brightness corresponding to the position point. If the brightness sub-parameter is obtained only based on the diffuse reflection sub-parameter, the reflective effect of the virtual object will not be reflected in the displayed virtual object, resulting in the displayed virtual object being inconsistent with the actual situation and the display effect being poor. Therefore, the brightness sub-parameter of the position point is obtained based on the diffuse reflection sub-parameter and the reflective sub-parameter, so that the obtained brightness sub-parameter can more accurately reflect the brightness of the position point.
[0225] In one possible implementation, the terminal obtains the brightness sub-parameter of each position point based on the diffuse reflection sub-parameter and the reflective sub-parameter of each position point, including: for each position point, the terminal adds the diffuse reflection sub-parameter and the reflective sub-parameter of the position point to obtain a first brightness sub-parameter of the position point; multiplies the first brightness sub-parameter by the number of alternative maps to obtain a second brightness sub-parameter of the position point, and uses the second brightness sub-parameter as the brightness sub-parameter of the position point.
[0226] In a possible implementation, the terminal obtains the weights of multiple candidate maps respectively according to the brightness sub-parameter of each position point and the serial numbers of multiple candidate maps, including: for each position point, the terminal determines the matching parameter of each candidate map according to the difference between the brightness sub-parameter of the position point and the serial number of each candidate map; the difference between the matching parameters of any two adjacent candidate maps is used as the weight of the first candidate map in the any two candidate maps, and the matching parameter of the last candidate map is used as the weight of the last candidate map. Among them, the matching parameter represents the degree of matching between the brightness of the candidate map and the brightness of the position point, and any two adjacent candidate maps refer to two adjacent candidate maps in multiple candidate maps arranged in sequence according to brightness.
[0227] If the sequence number of the candidate map is small, the difference between the brightness sub-parameter and the sequence number of the candidate map is large. If the sequence number of the candidate map is small, the difference between the brightness sub-parameter and the sequence number of the candidate map is small. The value range of the matching parameter is fixed. Therefore, in response to the difference being greater than the first reference data, the first reference value is used as the matching parameter of the candidate map; in response to the difference being less than the second reference value, the second reference value is used as the matching parameter of the candidate map; in response to the difference being not greater than the first reference value and not less than the second reference value, the difference is used as the matching parameter of the candidate map. Wherein, the first reference value is greater than the second reference value.
[0228] For example, there are 6 alternative maps, and the serial numbers of these six alternative maps from light to dark are 0, 1, 2, 3, 4 and 5, the sum of the diffuse reflection sub-parameter and the reflective sub-parameter is 0.75, and the brightness sub-parameter is 4.5. The difference between the brightness sub-parameter and the serial numbers of the six alternative maps are 4.5, 3.5, 2.5, 1.5, 0.5 and -0.5, respectively. The first reference value is 1, and the second reference value is 0. The matching parameters of the six alternative maps are 1, 1, 1, 1, 0.5 and 0, respectively, and the weights of the six alternative maps are 0, 0, 0, 0.5, 0.5 and 0, respectively.
[0229] In another possible implementation, if each candidate image is stored separately, each candidate image occupies a storage space, and a total of increased storage space is required, so multiple candidate images are fused to reduce the number of images that need to be stored and save storage space. Therefore, the terminal fuses the candidate maps with adjacent serial numbers in sequence according to the serial numbers of the multiple candidate maps to obtain at least one fused map. Among them, at least one channel of the red channel, green channel or blue channel of the fused map corresponds to an candidate map, and the candidate maps with adjacent serial numbers refer to two or three candidate maps with adjacent serial numbers.
[0230] For example, see Figure 5There are six candidate textures, the serial numbers of these six candidate textures are 0, 1, 2, 3, 4 and 5, and the three candidate textures with adjacent serial numbers are merged. Figure 6 , merge the candidate maps with serial numbers 0, 1 and 2 to get Figure 6 The fused map on the left has a red channel corresponding to the candidate map with sequence number 0, a green channel corresponding to the candidate map with sequence number 1, and a blue channel corresponding to the candidate map with sequence number 2. The candidate maps with sequence numbers 3, 4, and 5 are fused to obtain Figure 6 The fused map on the right, the red channel of the fused map corresponds to the alternative map numbered 3, the green channel corresponds to the map numbered 4, and the blue channel corresponds to the alternative map numbered 5.
[0231] Then, the terminal determines the matching parameter of each candidate tile according to the difference between the brightness sub-parameter of the position point and the sequence number of each candidate tile, including: the terminal obtains the sequence number matrix of each fused tile; obtains the brightness sub-parameter matrix; obtains the difference between the brightness sub-parameter matrix and the sequence number matrix of each fused tile, and determines the matching parameter matrix. The sequence number matrix of the fused tile includes the sequence number of each candidate tile in the fused tile.
[0232] For example, the merged map includes three candidate maps, and the serial number of each candidate map is 0, 1 and 2 respectively, then the serial number matrix is (0, 1, 2); the brightness sub-parameter matrix includes multiple brightness sub-parameters, and the number of the multiple brightness sub-parameters is equal to the number of candidate maps included in the merged map. For example, the brightness sub-parameter is 4.5, and the merged map includes three candidate maps, then the brightness sub-parameter matrix is (4.5, 4.5, 4.5); the matching parameter matrix includes the matching parameters of each candidate map. For example, the difference between the brightness sub-parameter matrix (4.5, 4.5, 4.5) and the serial number matrix (0, 1, 2) is (4.5, 3.5, 2.5), then the matching parameter matrix is (1, 1, 1).
[0233] After obtaining the matching parameter matrix corresponding to each fused map, the terminal uses the difference between the matching parameters of any two adjacent candidate maps as the weight of the first candidate map among the two candidate maps, and uses the matching parameter of the last candidate map as the weight of the last candidate map.
[0234] For example, the following formula is used to obtain the weight of each candidate map:
[0235] weights=saturate((intensity*m)-(a1, a2, a3));
[0236] Among them, weights represents the matching parameter matrix of the fused map, intensity represents the brightness sub-parameter of the position point, m represents the number of candidate maps, a represents the sequence number of the candidate map, and saturate(·) represents limiting each matching parameter obtained between 0 and 1, that is, if intensity*m-a1 is greater than 1, then the result of intensity*m-a1 is 1, and if intensity*m-a1 is less than 0, then the result of intensity*m-a1 is 0.
[0237] In the process of determining the matching parameter matrix using the brightness sub-parameter matrix and the sequence number matrix, the matching parameters of two or three candidate maps can be obtained by performing one calculation. Compared with calculating the matching parameters of each candidate map separately, the amount of calculation is reduced and the speed of obtaining the weight is increased.
[0238] In addition, when merging multiple candidate textures, if the number of candidate textures is a multiple of 3, the three adjacent candidate textures are merged into one merged texture; if the number of candidate textures is not a multiple of 3, and there is one candidate texture left, the remaining candidate texture is directly used as a merged texture; if the number of candidate textures is not a multiple of 3, and there are two candidate textures left, the remaining two candidate textures are merged.
[0239] In one possible implementation, the terminal determines the target texture according to the weight corresponding to each candidate texture, including: the terminal uses the candidate texture corresponding to the largest weight as the target texture; or the terminal performs weighted fusion on multiple candidate textures according to the weight of each candidate texture, and uses the fused texture as the target texture.
[0240] 204. The terminal obtains highlight parameters of the virtual object according to the normal vectors, illumination vectors, and viewing angle vectors of the multiple position points.
[0241] Optionally, the object parameters also include a viewing angle vector, and the viewing angle vector of the position point is a vector in the direction of the virtual camera relative to the position point. A virtual camera is set in the virtual scene, and the picture obtained by the virtual camera shooting the scene where the virtual object is located is the picture including the virtual object displayed by the terminal. After the virtual light source shines on the position point on the surface of the virtual object, if the position point directly reflects the light to the position of the virtual camera, that is, the virtual camera directly shoots the position point, then the position point is the brightest position point at this time.
[0242] For example, see Figure 3 The schematic diagram of the position point is shown, and vector H is the viewing angle vector at position point A.
[0243] The embodiment of the present disclosure is described by taking the acquisition of the highlight photon parameter of a position point as an example. The highlight parameter represents the brightest position point on the surface of the virtual object. Therefore, the highlight parameter of the virtual object is acquired according to the normal vector, illumination vector and viewing angle vector of the position point.
[0244] In a possible implementation, the terminal uses the dot product of the sum vector of the view vector and the illumination vector of the position point and the normal vector of the position point as the second value; uses the product of the larger value of the second value and 0 and the illumination vector as the first high photon parameter; adjusts the first high photon parameter according to the preset second adjustment parameter to obtain the second high photon parameter, and uses the second high photon parameter as the high photon parameter of the position point. The sum vector is the half-angle vector obtained by adding the view vector and the illumination vector.
[0245] When the high photon parameter is greater than a certain reference value, it means that the position point corresponding to the high photon parameter is the brightest position point. When the virtual object is displayed later, this position point is the brightest; when the high photon parameter is less than a certain preset parameter, it means that the position point corresponding to the high photon parameter is not the brightest position point. When the virtual object is displayed later, it can be displayed according to the target map of the position point. For example, see Figure 7 The virtual object shown has a white area in the upper left corner, which is the brightest area in the virtual object and includes multiple position points indicated by highlight parameters.
[0246] The second adjustment parameter is any value greater than 0 and less than 1, for example, 0.1, 0.2, etc. The smaller the second adjustment parameter is, the smaller the obtained highlight parameter is, and correspondingly, the smaller the highlight range displayed in the virtual object is; the larger the second adjustment parameter is, the larger the obtained highlight parameter is, and correspondingly, the larger the highlight range displayed in the virtual object is.
[0247] For example, refer to the following formula to obtain the high photon parameters of a position point:
[0248] G = I*max(0, dot(N, H));
[0249] Among them, G represents the highlight parameter, I represents the viewing vector, N represents the normal vector, H represents the illumination vector, and dot(N, H) represents the dot product of N and H.
[0250] 205. The terminal adds a target map on the surface of the virtual object, and displays the virtual object after adding the target map according to the highlight parameters.
[0251] In the disclosed embodiment, after the terminal determines the target map of each position point, it adds the corresponding target map to each position point on the surface of the virtual object, and displays the virtual object after adding the target map. The target map reflects the brightness of each position point on the surface of the virtual object, and the virtual object seen by the user is more consistent with the real object. Optionally, the target maps of any two position points are the same or different.
[0252] After obtaining the highlight parameters of the virtual object, the terminal adds a highlight effect to the displayed virtual object, so that the position indicated by the highlight parameters of the virtual object is the brightest, so that the user can see the highlight part of the virtual object.
[0253] Take the sketch image as an example, see Figure 8 The hand-drawn sketch image shown in the figure has reflections and highlights on the objects drawn in the sketch image. The embodiment of the present disclosure is to make the virtual object simulate the display effect of the sketch image. Fig. 9 The virtual object shown in the middle left image has a texture added to its surface that is determined only by the diffuse reflection parameters. Although the virtual object simulates the display effect of the sketch image to a certain extent, it can be clearly seen that there is no reflection or highlight in the virtual object. Fig. 9 The virtual object shown in the middle right picture has a texture added to its surface determined according to the diffuse reflection parameters and the reflection parameters. Compared with the virtual object in the left picture, the reflection is clearly visible in the lower left corner of the virtual object in the left picture, and there is an obvious highlight in the upper right corner of the virtual object on the right. The virtual object on the right simulates the display effect of a sketch image.
[0254] In addition, in a possible implementation, the virtual object is stroked, that is, each position point is extended by a preset distance along the corresponding normal direction, and an extension area is formed outside the surface of the virtual object. The extension area is the edge displayed outside the surface of the virtual object, and the reference color is filled into the extension area. The reference color filled is the color of the outside of the surface when the virtual object is displayed. When the terminal displays the virtual object, a target map is added to the surface of the virtual object, and the virtual object after the target map is added and the extension area outside the surface of the virtual object are displayed, thereby achieving the display effect of extending the virtual object outward.
[0255] In one possible implementation, after obtaining the highlight parameters and extended area of the virtual object, the terminal adds a target map to the surface of the virtual object, displays the extended area outside the surface of the virtual object, and displays the virtual object after adding the target map and the extended area outside the surface of the virtual object according to the highlight parameters.
[0256] In addition, for virtual objects that present a sketch effect, in order to make the three-dimensional virtual objects in the virtual scene display a two-dimensional sketch effect, maps with different brightness are added to the surface of the three-dimensional virtual objects so that the three-dimensional virtual objects after adding the maps display a two-dimensional sketch effect. Users can rotate the three-dimensional virtual objects and view the virtual objects from multiple angles, avoiding drawing two-dimensional virtual objects from multiple angles.
[0257] It should be noted that the embodiment of the present disclosure is only explained by taking the example of obtaining the target map corresponding to each position point according to the object parameters of the position point, and adding the target maps of multiple position points to the surface of the virtual object respectively. In another embodiment, the object parameters of the multiple position points are taken as a whole, and the target map corresponding to the virtual object is obtained according to the object parameters of the multiple position points, and the target map is added to the surface of the virtual object.
[0258] The method provided by the embodiment of the present disclosure can obtain diffuse reflection parameters and reflection parameters of a virtual object. Since both diffuse reflection parameters and reflection parameters can reflect the brightness of the virtual object, compared with determining a matching map based on diffuse reflection parameters alone, when determining a matching target map based on diffuse reflection parameters and reflection parameters, the influence of the reflection phenomenon on the display effect of the virtual object is also considered, thereby increasing the amount of information and enabling the determined target map to more accurately reflect the brightness of the virtual object. Therefore, when displaying the virtual object after adding the target map, the virtual object is more realistic, thereby improving the display effect of the virtual object.
[0259] Furthermore, in the disclosed embodiment, the viewing angle vectors of a plurality of position points on the surface of the virtual object are obtained, and then the highlight parameters of the virtual object are obtained based on the normal vectors, illumination vectors and viewing angle vectors of the plurality of position points. Since the highlight parameters can indicate the brightest position point in the virtual object, when displaying the virtual object after adding the target map, the influence of the highlight on the display effect of the virtual object is taken into consideration, thereby making the virtual object more realistic and further improving the display effect of the virtual object.
[0260] Furthermore, in the disclosed embodiment, a first adjustment parameter is provided to adjust the anti-photon parameter of each position point, and a second adjustment parameter is provided to adjust the high-photon parameter of each position point. Since the first adjustment parameter and the second adjustment parameter are set by technical personnel, the sizes of the first adjustment parameter and the second adjustment parameter can be adjusted. Therefore, the anti-photon parameter and the high-photon parameter can be flexibly adjusted, thereby improving flexibility, so that the brightness of the virtual object can be adjusted more conveniently and the display effect can be adjusted.
[0261] Furthermore, in the disclosed embodiment, candidate textures with adjacent serial numbers are merged to obtain a merged texture. It is not necessary to store each candidate texture separately, and the merged texture can be directly stored, thereby reducing the number of candidate textures that need to be stored, saving storage space, and improving the operating efficiency of the device.
[0262] Moreover, in the process of determining the matching parameter matrix using the brightness sub-parameter matrix and the sequence number matrix, the matching parameters of two or three candidate maps can be obtained by performing one calculation. Compared with calculating the matching parameters of each candidate map separately, the amount of calculation is reduced and the speed of obtaining the weight is increased.
[0263] Fig.10 is a block diagram of a virtual object display device according to an exemplary embodiment. Fig.10 , the device comprises:
[0264] The first parameter acquisition unit 1001 is configured to acquire object parameters of the virtual object, where the object parameters at least include normal vectors and illumination vectors of multiple position points on the surface of the virtual object, where the illumination vector of the position point is a vector in the direction of light irradiation of the position point;
[0265] The second parameter acquisition unit 1002 is configured to acquire the diffuse reflection parameter and the reflective parameter of the virtual object according to the normal vectors and the illumination vectors of the plurality of position points, wherein the diffuse reflection parameter and the reflective parameter are negatively correlated;
[0266] A target map determining unit 1003 is configured to determine a target map that matches the diffuse reflection parameter and the reflective parameter;
[0267] The virtual object display unit 1004 is configured to add a target texture to the surface of the virtual object and display the virtual object after the target texture is added.
[0268] The device provided by the embodiment of the present disclosure can obtain diffuse reflection parameters and reflection parameters of a virtual object. Since both the diffuse reflection parameters and the reflection parameters can reflect the brightness of the virtual object, compared with determining a matching map based on the diffuse reflection parameters alone, when determining a matching target map based on the diffuse reflection parameters and the reflection parameters, the influence of the reflection phenomenon on the display effect of the virtual object is also considered, thereby increasing the amount of information and enabling the determined target map to more accurately reflect the brightness of the virtual object. Therefore, when displaying the virtual object after adding the target map, the virtual object is more realistic, thereby improving the display effect of the virtual object.
[0269] In a possible implementation, the diffuse reflection parameters of the virtual object include diffuse reflection sub-parameters of multiple position points, and the reflective parameters of the virtual object include reflective sub-parameters of multiple position points; the second parameter acquisition unit 1002 is configured to execute:
[0270] For each position point, obtain the diffuse reflection sub-parameter of the position point according to the normal vector and the illumination vector of the position point;
[0271] The diffuse reflection sub-parameters are inverted to obtain the first reflection photon parameters of the position point;
[0272] According to the preset first adjustment parameter, the first anti-photon parameter is adjusted to obtain the second anti-photon parameter of the position point;
[0273] Combining diffuse reflection sub-parameters of multiple position points to obtain diffuse reflection parameters;
[0274] The second reflected photon parameters of multiple position points are combined to obtain the reflected light parameters.
[0275] In another possible implementation, the second parameter obtaining unit 1002 is configured to execute:
[0276] Take the dot product of the normal vector and the light vector as the first value;
[0277] The larger value between the first value and 0 is determined as the diffuse reflection sub-parameter of the location point.
[0278] In another possible implementation, the diffuse reflection parameters of the virtual object include diffuse reflection sub-parameters of multiple position points, and the reflective parameters of the virtual object include reflective sub-parameters of multiple position points; see Fig.11 , the target map determination unit 1003 includes:
[0279] The brightness sub-parameter acquisition sub-unit 1013 is configured to acquire the brightness sub-parameter of each position point according to the diffuse reflection sub-parameter and the reflective sub-parameter of each position point;
[0280] The weight acquisition subunit 1023 is configured to acquire the weights of the multiple candidate maps respectively according to the brightness sub-parameter of each position point and the serial numbers of the multiple candidate maps, wherein the serial numbers of the candidate maps are determined after the multiple candidate maps are arranged in descending order according to brightness, and the serial numbers of the candidate maps represent the brightness of the candidate maps, and different candidate maps have different serial numbers;
[0281] The texture determination subunit 1033 is configured to determine the target texture according to the weights of the multiple candidate textures corresponding to each position point.
[0282] In another possible implementation, participating Fig.11 , the brightness sub-parameter obtaining sub-unit 1013 is configured to execute:
[0283] For each position point, add the diffuse reflection sub-parameter and the anti-photon sub-parameter of the position point to obtain the first brightness sub-parameter of the position point;
[0284] The first brightness sub-parameter is multiplied by the number of candidate maps to obtain the second brightness sub-parameter of the position point.
[0285] In another possible implementation, see Fig.11 , the weight acquisition subunit 1023 is configured to execute:
[0286] For each position point, a matching parameter of each candidate texture is determined according to the difference between the brightness sub-parameter of the position point and the sequence number of each candidate texture, wherein the matching parameter represents the degree of matching between the brightness of the candidate texture and the brightness of the position point;
[0287] The difference between the matching parameters of any two adjacent candidate maps is used as the weight of the first candidate map among the two candidate maps, and the matching parameter of the last candidate map is used as the weight of the last candidate map. Any two adjacent candidate maps refer to two adjacent candidate maps among multiple candidate maps arranged in descending order of brightness.
[0288] In another possible implementation, see Fig.11 , the device further comprises:
[0289] The texture fusion unit 1005 is configured to fuse candidate textures with adjacent sequence numbers in order according to the sequence numbers of the candidate textures to obtain at least one fused texture, wherein at least one of the red channel, green channel or blue channel of the fused texture corresponds to one candidate texture;
[0290] The weight acquisition subunit 1023 is configured to execute:
[0291] Obtaining a sequence number matrix of each fused map, wherein the sequence number matrix of the fused map includes the sequence number of each candidate map in the fused map;
[0292] Obtaining a brightness sub-parameter matrix, the brightness sub-parameter matrix including a plurality of brightness sub-parameters, and the number of the plurality of brightness sub-parameters is equal to the number of candidate maps included in the fused map;
[0293] The difference between the brightness sub-parameter matrix and the sequence number matrix of each fused map is obtained to determine a matching parameter matrix, where the matching parameter matrix includes matching parameters of each candidate map.
[0294] In another possible implementation, the weight acquisition subunit 1023 is configured to execute:
[0295] In response to the difference being greater than a first reference value, taking the first reference value as a matching parameter of the candidate mapping; or,
[0296] In response to the difference being smaller than a second reference value, taking the second reference value as a matching parameter of the candidate mapping; or,
[0297] In response to the difference being not greater than the first reference value and not less than the second reference value, the difference is used as a matching parameter of the candidate map.
[0298] In another possible implementation, the texture determination subunit 1033 is configured to execute:
[0299] Use the candidate map with the largest weight as the target map; or
[0300] According to the weight of each candidate texture, multiple candidate textures are weighted fused, and the fused texture is used as the target texture.
[0301] In another possible implementation, the object parameters further include the viewing angle vectors of the plurality of position points, where the viewing angle vectors of the position points are vectors in the direction of the virtual camera relative to the position points; see Fig.11 , the device further comprises:
[0302] The third parameter acquisition unit 1006 is configured to acquire a highlight parameter of the virtual object according to the normal vectors, the illumination vectors and the viewing angle vectors of the plurality of position points, wherein the highlight parameter represents the brightest position point on the surface of the virtual object;
[0303] The virtual object display unit 1004 is configured to add a target texture to the surface of the virtual object, and display the virtual object after adding the target texture according to the highlight parameters.
[0304] In another possible implementation, the third parameter obtaining unit 1006 is configured to execute:
[0305] For each position point, the dot product of the sum vector of the view vector and the illumination vector of the position point and the normal vector of the position point is taken as the second value;
[0306] The product of the larger value between the second value and 0 and the illumination vector is used as the first high photon parameter;
[0307] According to the preset second adjustment parameter, the first high photon parameter is adjusted to obtain the second high photon parameter.
[0308] In another possible implementation, see Fig.11 , the device further comprises:
[0309] The extension area acquisition unit 1007 is configured to extend each position point along the corresponding normal direction by a preset distance to form an extension area outside the surface of the virtual object, and fill the reference color into the extension area;
[0310] The virtual object display unit 1004 is configured to add a target texture to the surface of the virtual object, and display the virtual object after the target texture is added and an extended area outside the surface of the virtual object.
[0311] Regarding the device in the above embodiment, the specific manner in which each unit performs the operation has been described in detail in the embodiment of the method, and will not be elaborated here.
[0312] Fig.12 The structure block diagram of a terminal 1200 provided by an exemplary embodiment of the present application is shown. The terminal 1200 may be a portable mobile terminal, such as a smart phone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III), an MP4 player (Moving Picture Experts Group Audio Layer IV), a laptop computer or a desktop computer. The terminal 1200 may also be called a user device, a portable terminal, a laptop terminal, a desktop terminal or other names.
[0313] Typically, the terminal 1200 includes: a processor 1201 and a memory 1202 .
[0314] The processor 1201 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 1201 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 1201 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 1201 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 1201 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0315] The memory 1202 may include one or more computer-readable storage media, which may be non-transitory. The memory 1202 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 1202 is used to store at least one instruction, which is used to be executed by the processor 1201 to implement the virtual object display method provided in the method embodiment of the present application.
[0316] In some embodiments, the terminal 1200 may also optionally include: a peripheral device interface 1203 and at least one peripheral device. The processor 1201, the memory 1202 and the peripheral device interface 1203 may be connected via a bus or a signal line. Each peripheral device may be connected to the peripheral device interface 1203 via a bus, a signal line or a circuit board. Specifically, the peripheral device includes: at least one of a radio frequency circuit 1204, a display screen 1205, a camera assembly 1206, an audio circuit 1207, a positioning assembly 1208 and a power supply 1209.
[0317] The peripheral device interface 1203 may be used to connect at least one peripheral device related to I / O (Input / Output) to the processor 1201 and the memory 1202. In some embodiments, the processor 1201, the memory 1202, and the peripheral device interface 1203 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 1201, the memory 1202, and the peripheral device interface 1203 may be implemented on a separate chip or circuit board, which is not limited in this embodiment.
[0318] The radio frequency circuit 1204 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 1204 communicates with the communication network and other communication devices through electromagnetic signals. The radio frequency circuit 1204 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals into electrical signals. Optionally, the radio frequency circuit 1204 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, and the like. The radio frequency circuit 1204 can communicate with other terminals through at least one wireless communication protocol. The wireless communication protocol includes, but is not limited to: the World Wide Web, a metropolitan area network, an intranet, various generations of mobile communication networks (2G, 3G, 4G and 5G), a wireless local area network and / or a WiFi (Wireless Fidelity) network. In some embodiments, the radio frequency circuit 1204 may also include circuits related to NFC (Near Field Communication), which is not limited in this application.
[0319] The display screen 1205 is used to display a UI (User Interface). The UI may include graphics, text, icons, videos, and any combination thereof. When the display screen 1205 is a touch display screen, the display screen 1205 also has the ability to collect touch signals on the surface or above the surface of the display screen 1205. The touch signal can be input to the processor 1201 as a control signal for processing. At this time, the display screen 1205 can also be used to provide virtual buttons and / or virtual keyboards, also known as soft buttons and / or soft keyboards. In some embodiments, the display screen 1205 can be one, set on the front panel of the terminal 1200; in other embodiments, the display screen 1205 can be at least two, respectively set on different surfaces of the terminal 1200 or in a folding design; in other embodiments, the display screen 1205 can be a flexible display screen, set on a curved surface or a folding surface of the terminal 1200. Even, the display screen 1205 can also be set to a non-rectangular irregular shape, that is, a special-shaped screen. The display screen 1205 can be made of materials such as LCD (Liquid Crystal Display) and OLED (Organic Light-Emitting Diode).
[0320] The camera assembly 1206 is used to capture images or videos. Optionally, the camera assembly 1206 includes a front camera and a rear camera. Typically, the front camera is arranged on the front panel of the terminal, and the rear camera is arranged on the back of the terminal. In some embodiments, there are at least two rear cameras, which are any one of a main camera, a depth of field camera, a wide-angle camera, and a telephoto camera, so as to realize the fusion of the main camera and the depth of field camera to realize the background blur function, the fusion of the main camera and the wide-angle camera to realize the panoramic shooting and VR (Virtual Reality) shooting function or other fusion shooting functions. In some embodiments, the camera assembly 1206 may also include a flash. The flash can be a monochrome temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm light flash and a cold light flash, which can be used for light compensation at different color temperatures.
[0321] The audio circuit 1207 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, and convert the sound waves into electrical signals and input them into the processor 1201 for processing, or input them into the radio frequency circuit 1204 to achieve voice communication. For the purpose of stereo acquisition or noise reduction, there may be multiple microphones, which are respectively arranged at different parts of the terminal 1200. The microphone may also be an array microphone or an omnidirectional acquisition microphone. The speaker is used to convert the electrical signal from the processor 1201 or the radio frequency circuit 1204 into sound waves. The speaker may be a traditional film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert the electrical signal into sound waves audible to humans, but also convert the electrical signal into sound waves inaudible to humans for purposes such as ranging. In some embodiments, the audio circuit 1207 may also include a headphone jack.
[0322] The positioning component 1208 is used to locate the current geographical location of the terminal 1200 to implement navigation or LBS (Location Based Service). The positioning component 1208 can be a positioning component based on the US GPS (Global Positioning System), China's Beidou system or Russia's Galileo system.
[0323] The power supply 1209 is used to power various components in the terminal 1200. The power supply 1209 can be an alternating current, a direct current, a disposable battery, or a rechargeable battery. When the power supply 1209 includes a rechargeable battery, the rechargeable battery can be a wired rechargeable battery or a wireless rechargeable battery. A wired rechargeable battery is a battery charged through a wired line, and a wireless rechargeable battery is a battery charged through a wireless coil. The rechargeable battery can also be used to support fast charging technology.
[0324] In some embodiments, the terminal 1200 further includes one or more sensors 1210 , including but not limited to: an acceleration sensor 1211 , a gyroscope sensor 1212 , a pressure sensor 1213 , a fingerprint sensor 1214 , an optical sensor 1215 , and a proximity sensor 1216 .
[0325] The acceleration sensor 1211 can detect the magnitude of acceleration on the three coordinate axes of the coordinate system established by the terminal 1200. For example, the acceleration sensor 1211 can be used to detect the components of gravity acceleration on the three coordinate axes. The processor 1201 can control the display screen 1205 to display the user interface in a horizontal view or a vertical view according to the gravity acceleration signal collected by the acceleration sensor 1211. The acceleration sensor 1211 can also be used to collect motion data of games or users.
[0326] The gyro sensor 1212 can detect the body direction and rotation angle of the terminal 1200, and the gyro sensor 1212 can cooperate with the acceleration sensor 1211 to collect the user's 3D actions on the terminal 1200. The processor 1201 can implement the following functions based on the data collected by the gyro sensor 1212: motion sensing (such as changing the UI according to the user's tilt operation), image stabilization during shooting, game control, and inertial navigation.
[0327] The pressure sensor 1213 can be set on the side frame of the terminal 1200 and / or the lower layer of the display screen 1205. When the pressure sensor 1213 is set on the side frame of the terminal 1200, the user's holding signal of the terminal 1200 can be detected, and the processor 1201 performs left and right hand recognition or shortcut operations according to the holding signal collected by the pressure sensor 1213. When the pressure sensor 1213 is set on the lower layer of the display screen 1205, the processor 1201 controls the operability controls on the UI interface according to the user's pressure operation on the display screen 1205. The operability controls include at least one of a button control, a scroll bar control, an icon control, and a menu control.
[0328] The fingerprint sensor 1214 is used to collect the user's fingerprint, and the processor 1201 identifies the user's identity based on the fingerprint collected by the fingerprint sensor 1214, or the fingerprint sensor 1214 identifies the user's identity based on the collected fingerprint. When the user's identity is identified as a trusted identity, the processor 1201 authorizes the user to perform relevant sensitive operations, including unlocking the screen, viewing encrypted information, downloading software, paying, and changing settings. The fingerprint sensor 1214 can be set on the front, back, or side of the terminal 1200. When a physical button or a manufacturer logo is set on the terminal 1200, the fingerprint sensor 1214 can be integrated with the physical button or the manufacturer logo.
[0329] The optical sensor 1215 is used to collect the ambient light intensity. In one embodiment, the processor 1201 can control the display brightness of the display screen 1205 according to the ambient light intensity collected by the optical sensor 1215. Specifically, when the ambient light intensity is high, the display brightness of the display screen 1205 is increased; when the ambient light intensity is low, the display brightness of the display screen 1205 is reduced. In another embodiment, the processor 1201 can also dynamically adjust the shooting parameters of the camera assembly 1206 according to the ambient light intensity collected by the optical sensor 1215.
[0330] The proximity sensor 1216, also called a distance sensor, is usually arranged on the front panel of the terminal 1200. The proximity sensor 1216 is used to collect the distance between the user and the front of the terminal 1200. In one embodiment, when the proximity sensor 1216 detects that the distance between the user and the front of the terminal 1200 is gradually decreasing, the processor 1201 controls the display screen 1205 to switch from the screen-on state to the screen-off state; when the proximity sensor 1216 detects that the distance between the user and the front of the terminal 1200 is gradually increasing, the processor 1201 controls the display screen 1205 to switch from the screen-off state to the screen-on state.
[0331] Those skilled in the art will understand that Fig.12 The structure shown in the figure does not constitute a limitation on the terminal 1200, and the terminal 1200 may include more or fewer components than those shown in the figure, or combine some components, or adopt a different component arrangement.
[0332] In an exemplary embodiment, a non-transitory computer-readable storage medium is also provided. When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute the steps executed by the terminal in the above-mentioned virtual object display method.
[0333] In an exemplary embodiment, a computer program product is further provided. When instructions in the computer program product are executed by a processor of an electronic device, the electronic device is enabled to execute the steps executed by the terminal in the above-mentioned virtual object display method.
[0334] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the disclosure herein. This application is intended to cover any variations, uses or adaptations of the present disclosure, which follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0335] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A virtual object display method, characterized in that: The method comprises: Obtaining object parameters of the virtual object, wherein the object parameters at least include normal vectors and illumination vectors of a plurality of position points on the surface of the virtual object, wherein the illumination vector of the position point is a vector in a direction of light irradiation of the position point; Acquire diffuse reflection parameters and reflective parameters of the virtual object according to the normal vectors and the illumination vectors of the multiple position points, wherein the diffuse reflection parameters are negatively correlated with the reflective parameters; Determine a target map that matches the diffuse reflection parameter and the reflective parameter; The target texture is added on the surface of the virtual object, and the virtual object after the target texture is added is displayed.
2. The method according to claim 1, characterized in that The diffuse reflection parameters of the virtual object include diffuse reflection sub-parameters of the multiple position points, and the reflective parameters of the virtual object include reflective sub-parameters of the multiple position points; The obtaining of diffuse reflection parameters and reflective parameters of the virtual object according to the normal vectors and the illumination vectors of the plurality of position points includes: For each position point, obtaining the diffuse reflection sub-parameter of the position point according to the normal vector and the illumination vector of the position point; Performing an inversion process on the diffuse reflection sub-parameter to obtain a first reflected photon parameter of the position point; According to a preset first adjustment parameter, adjusting the first anti-photon parameter to obtain a second anti-photon parameter of the position point; Combining the diffuse reflection sub-parameters of the multiple position points to obtain the diffuse reflection parameter; The second reflective photon parameters of the plurality of position points are combined to obtain the reflective parameters.
3. The method according to claim 2, characterized in that The obtaining the diffuse reflection sub-parameter of the position point according to the normal vector and the illumination vector of the position point comprises: Taking the dot product of the normal vector and the illumination vector as a first value; The larger value between the first value and 0 is determined as the diffuse reflection sub-parameter of the position point.
4. The method according to claim 1, characterized in that: The diffuse reflection parameters of the virtual object include diffuse reflection sub-parameters of the multiple position points, and the reflective parameters of the virtual object include reflective sub-parameters of the multiple position points; and determining a target map matching the diffuse reflection parameters and the reflective parameters includes: Obtaining brightness sub-parameters of each position point according to the diffuse reflection sub-parameters and the reflected light sub-parameters of each position point; According to the brightness sub-parameter of each position point and the serial numbers of the multiple candidate maps, respectively obtaining the weights of the multiple candidate maps, wherein the serial numbers of the multiple candidate maps are determined after the multiple candidate maps are arranged in descending order according to brightness, and the serial numbers of the candidate maps represent the brightness of the candidate maps, and different candidate maps have different serial numbers; The target map is determined according to the weights of the multiple candidate maps corresponding to each position point.
5. The method according to claim 4, characterized in that The step of obtaining the brightness sub-parameter of each position point according to the diffuse reflection sub-parameter and the reflective sub-parameter of each position point comprises: For each position point, add the diffuse reflection sub-parameter and the anti-photon sub-parameter of the position point to obtain a first brightness sub-parameter of the position point; The first brightness sub-parameter is multiplied by the number of the candidate textures to obtain a second brightness sub-parameter of the position point.
6. The method according to claim 4, characterized in that The obtaining weights of the plurality of candidate textures respectively according to the brightness sub-parameter of each position point and the sequence numbers of the plurality of candidate textures comprises: For each position point, determining a matching parameter of each candidate texture according to a difference between a brightness sub-parameter of the position point and a sequence number of each candidate texture, wherein the matching parameter represents a degree of matching between the brightness of the candidate texture and the brightness of the position point; The difference between the matching parameters of any two adjacent candidate maps is used as the weight of the first candidate map among the any two candidate maps, and the matching parameter of the last candidate map is used as the weight of the last candidate map. The any two adjacent candidate maps refer to two adjacent candidate maps among a plurality of candidate maps arranged in descending order of brightness.
7. The method according to claim 6, characterized in that The method further comprises: According to the serial numbers of the multiple candidate maps, the candidate maps with adjacent serial numbers are merged in sequence to obtain at least one merged map, wherein at least one channel among the red channel, the green channel or the blue channel of the merged map corresponds to one candidate map; The determining, according to the difference between the brightness sub-parameter of the position point and the sequence number of each candidate texture, the matching parameter of each candidate texture comprises: Obtaining a sequence number matrix of each fused map, wherein the sequence number matrix of the fused map includes a sequence number of each candidate map in the fused map; Acquire a brightness sub-parameter matrix, wherein the brightness sub-parameter matrix includes a plurality of brightness sub-parameters, and the number of the plurality of brightness sub-parameters is equal to the number of candidate textures included in the fused texture; The difference between the brightness sub-parameter matrix and the sequence number matrix of each fused map is obtained to determine a matching parameter matrix, where the matching parameter matrix includes matching parameters of each candidate map.
8. The method according to claim 6, characterized in that The determining the matching parameter of the candidate texture according to the difference between the brightness sub-parameter of the position point and the sequence number of the candidate texture comprises: In response to the difference being greater than a first reference value, using the first reference value as a matching parameter of the candidate map; or, In response to the difference being smaller than a second reference value, taking the second reference value as a matching parameter of the candidate map; or, In response to the difference being not greater than the first reference value and not less than the second reference value, the difference is used as a matching parameter of the candidate map.
9. The method according to claim 4, characterized in that The step of determining the target map according to the weights of the plurality of candidate maps corresponding to each position point includes: The candidate map corresponding to the largest weight is used as the target map; or, According to the weight of each candidate texture, the plurality of candidate textures are weightedly fused, and the fused texture is used as the target texture.
10. The method according to claim 1, characterized in that The object parameters also include viewing angle vectors of the multiple position points, where the viewing angle vectors of the position points are vectors in directions of the virtual camera relative to the position points; Before adding the target map to the surface of the virtual object and displaying the virtual object after adding the target map, the method further includes: Acquire a highlight parameter of the virtual object according to the normal vectors, the illumination vector, and the viewing angle vector of the plurality of position points, wherein the highlight parameter represents the brightest position point on the surface of the virtual object; The adding the target map on the surface of the virtual object and displaying the virtual object after adding the target map comprises: The target map is added to the surface of the virtual object, and the virtual object after the target map is added is displayed according to the highlight parameter.
11. The method according to claim 10, characterized in that The obtaining the highlight parameter of the virtual object according to the normal vectors, the illumination vector and the viewing angle vector of the plurality of position points includes: For each position point, taking the dot product of the sum vector of the view vector and the illumination vector of the position point and the normal vector of the position point as the second value; The product of the larger value of the second value and 0 and the illumination vector is used as the first high photon parameter; According to a preset second adjustment parameter, the first high photon parameter is adjusted to obtain a second high photon parameter.
12. The method according to claim 1, characterized in that After determining the target map matching the diffuse reflection parameter and the reflective parameter, the method further includes: Extending each position point by a preset distance along the corresponding normal direction to form an extension area outside the surface of the virtual object, and filling the extension area with a reference color; The adding the target map on the surface of the virtual object and displaying the virtual object after adding the target map comprises: The target map is added to the surface of the virtual object, and the virtual object after the target map is added and an extended area outside the surface of the virtual object are displayed.
13. A virtual object display device, characterized in that: The device comprises: A first parameter acquisition unit is configured to acquire object parameters of a virtual object, wherein the object parameters at least include normal vectors and illumination vectors of a plurality of position points on a surface of the virtual object, wherein the illumination vector of the position point is a vector in a direction of light irradiation of the position point; A second parameter acquisition unit is configured to acquire a diffuse reflection parameter and a reflective parameter of the virtual object according to the normal vectors and the illumination vectors of the plurality of position points, wherein the diffuse reflection parameter is negatively correlated with the reflective parameter; A target map determining unit is configured to determine a target map matching the diffuse reflection parameter and the reflective parameter; The virtual object display unit is configured to add the target map to the surface of the virtual object and display the virtual object after the target map is added.
14. The device according to claim 13, characterized in that The diffuse reflection parameters of the virtual object include diffuse reflection sub-parameters of the multiple position points, and the reflective parameters of the virtual object include reflective sub-parameters of the multiple position points; The second parameter acquisition unit is configured to execute: For each position point, obtaining the diffuse reflection sub-parameter of the position point according to the normal vector and the illumination vector of the position point; Performing an inversion process on the diffuse reflection sub-parameter to obtain a first reflected photon parameter of the position point; According to a preset first adjustment parameter, adjusting the first anti-photon parameter to obtain a second anti-photon parameter of the position point; Combining the diffuse reflection sub-parameters of the multiple position points to obtain the diffuse reflection parameter; The second reflective photon parameters of the plurality of position points are combined to obtain the reflective parameters.
15. The device according to claim 14, characterized in that The second parameter acquisition unit is configured to execute: Taking the dot product of the normal vector and the illumination vector as a first value; The larger value between the first value and 0 is determined as the diffuse reflection sub-parameter of the position point.
16. The device according to claim 13, characterized in that The diffuse reflection parameters of the virtual object include diffuse reflection sub-parameters of the multiple position points, and the reflective parameters of the virtual object include reflective sub-parameters of the multiple position points; The target map determination unit comprises: A brightness sub-parameter acquisition sub-unit is configured to acquire the brightness sub-parameter of each position point according to the diffuse reflection sub-parameter and the reflective sub-parameter of each position point; A weight acquisition subunit is configured to acquire weights of the multiple candidate maps respectively according to the brightness sub-parameter of each position point and the serial numbers of the multiple candidate maps, wherein the serial numbers of the candidate maps are determined after the multiple candidate maps are arranged in descending order according to brightness, and the serial numbers of the candidate maps represent the brightness of the candidate maps, and different candidate maps have different serial numbers; The texture determination subunit is configured to determine the target texture according to the weights of the multiple candidate textures corresponding to each position point.
17. The device according to claim 16, characterized in that The brightness sub-parameter acquisition sub-unit is configured to execute: For each position point, add the diffuse reflection sub-parameter and the anti-photon sub-parameter of the position point to obtain a first brightness sub-parameter of the position point; The first brightness sub-parameter is multiplied by the number of the candidate textures to obtain a second brightness sub-parameter of the position point.
18. The device according to claim 16, characterized in that The weight acquisition subunit is configured to execute: For each position point, determining a matching parameter of each candidate texture according to a difference between a brightness sub-parameter of the position point and a sequence number of each candidate texture, wherein the matching parameter represents a degree of matching between the brightness of the candidate texture and the brightness of the position point; The difference between the matching parameters of any two adjacent candidate maps is used as the weight of the first candidate map among the any two candidate maps, and the matching parameter of the last candidate map is used as the weight of the last candidate map. The any two adjacent candidate maps refer to two adjacent candidate maps among a plurality of candidate maps arranged in descending order of brightness.
19. The device according to claim 18, characterized in that The device also includes: a texture fusion unit configured to fuse candidate textures with adjacent sequence numbers in sequence according to the sequence numbers of the plurality of candidate textures to obtain at least one fused texture, wherein at least one of the red channel, the green channel or the blue channel of the fused texture corresponds to one candidate texture; The weight acquisition subunit is configured to execute: Obtaining a sequence number matrix of each fused map, wherein the sequence number matrix of the fused map includes a sequence number of each candidate map in the fused map; Acquire a brightness sub-parameter matrix, wherein the brightness sub-parameter matrix includes a plurality of brightness sub-parameters, and the number of the plurality of brightness sub-parameters is equal to the number of candidate textures included in the fused texture; The difference between the brightness sub-parameter matrix and the sequence number matrix of each fused map is obtained to determine a matching parameter matrix, where the matching parameter matrix includes matching parameters of each candidate map.
20. The device according to claim 18, characterized in that The weight acquisition subunit is configured to execute: In response to the difference being greater than a first reference value, using the first reference value as a matching parameter of the candidate texture; or, In response to the difference being less than a second reference value, using the second reference value as a matching parameter of the candidate map; or, In response to the difference being not greater than the first reference value and not less than the second reference value, the difference is used as a matching parameter of the candidate map.
21. The device according to claim 16, characterized in that The mapping determination subunit is configured to execute: The candidate map corresponding to the largest weight is used as the target map; or, According to the weight of each candidate texture, the plurality of candidate textures are weightedly fused, and the fused texture is used as the target texture.
22. The device according to claim 13, characterized in that The object parameters also include viewing angle vectors of the multiple position points, where the viewing angle vectors of the position points are vectors in directions of the virtual camera relative to the position points; The device also includes: A third parameter acquisition unit is configured to acquire a highlight parameter of the virtual object according to the normal vectors, the illumination vector and the viewing angle vector of the plurality of position points, wherein the highlight parameter represents the brightest position point on the surface of the virtual object; The virtual object display unit is configured to add the target map to the surface of the virtual object, and display the virtual object after adding the target map according to the highlight parameter.
23. The device according to claim 22, characterized in that The third parameter acquisition unit is configured to execute: For each position point, taking the dot product of the sum vector of the view vector and the illumination vector of the position point and the normal vector of the position point as the second value; The product of the larger value of the second value and 0 and the illumination vector is used as the first high photon parameter; According to a preset second adjustment parameter, the first high photon parameter is adjusted to obtain a second high photon parameter.
24. The device according to claim 13, characterized in that The device also includes: an extended area acquisition unit, configured to extend each position point along a corresponding normal direction by a preset distance to form an extended area outside the surface of the virtual object, and fill the extended area with a reference color; The virtual object display unit is configured to add the target map to the surface of the virtual object, and display the virtual object after the target map is added and an extended area outside the surface of the virtual object.
25. An electronic device, characterized in that: The electronic device comprises: one or more processors; a volatile or non-volatile memory for storing the one or more processor-executable instructions; The one or more processors are configured to execute the virtual object display method according to any one of claims 1 to 12.
26. A non-transitory computer-readable storage medium, characterized in that: When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the virtual object display method according to any one of claims 1 to 12.
27. A computer program product, characterized in that When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device is enabled to execute the virtual object display method according to any one of claims 1 to 12.
Citation Information
Patent Citations
Method and system for achieving laser paper effect in virtual reality scene
CN108109194A
Role light environment simulation method and device and VR equipment
CN108447112A
Object rendering method and device, storage medium and electronic device
CN111009026A
Image generation method and device, storage medium and electronic device
CN111179396A
View-dependent image synthesis
US20030011596A1
