











技术领域technical field
本公开涉及计算机技术领域,尤其涉及一种虚拟物体显示方法、装置、电子设备及存储介质。The present disclosure relates to the field of computer technologies, and in particular, to a method, apparatus, electronic device and storage medium for displaying virtual objects.
背景技术Background technique
随着计算机技术的发展,在电子游戏或虚拟现实等领域通常会显示虚拟物体,为了使虚拟物体的显示效果更加自然,需要在虚拟物体表面添加贴图,以模拟虚拟物体表面被虚拟光源照射的效果。With the development of computer technology, virtual objects are usually displayed in the fields of video games or virtual reality. In order to make the display effect of virtual objects more natural, it is necessary to add textures to the surface of virtual objects to simulate the effect of virtual objects being illuminated by virtual light sources. .
在显示虚拟物体时,会先获取虚拟物体的漫反射参数,该漫反射参数可以反映虚拟物体表面的亮暗程度,确定与该漫反射参数匹配的目标贴图,将目标贴图添加到虚拟物体表面,从而显示添加目标贴图后的虚拟物体。When displaying a virtual object, the diffuse reflection parameter of the virtual object will be obtained first. The diffuse reflection parameter can reflect the brightness and darkness of the surface of the virtual object, determine the target texture that matches the diffuse reflection parameter, and add the target texture to the surface of the virtual object. Thus, the virtual object after adding the target map is displayed.
但是,上述方案仅考虑了虚拟物体的漫反射参数,漫反射参数的数据量较少,导致确定的目标贴图不够准确,进而导致虚拟物体的显示效果不佳。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 small, resulting in inaccurate target maps determined, which in turn leads to poor display effects of the virtual objects.
发明内容SUMMARY OF THE INVENTION
本公开提供了一种虚拟物体显示方法、装置、电子设备及存储介质,提高了虚拟物体的显示效果。The present disclosure provides a method, device, electronic device and storage medium for displaying virtual objects, which improve the display effect of virtual objects.
根据本公开实施例的一方面,提供一种虚拟物体显示方法,所述方法包括:According to an aspect of the embodiments of the present disclosure, there is provided a method for displaying a virtual object, the method comprising:
获取虚拟物体的物体参数,所述物体参数至少包括虚拟物体表面上的多个位置点的法线向量及光照向量,所述位置点的光照向量为所述位置点的光线照射方向上的向量;Obtaining object parameters of the virtual object, the object parameters at least include normal vectors and illumination vectors of a plurality of position points on the surface of the virtual object, and the illumination vectors of the position points are vectors in the light irradiation direction of the position points;
根据所述多个位置点的法线向量及光照向量,获取所述虚拟物体的漫反射参数及反光参数,所述漫反射参数与所述反光参数呈负相关关系;According to the normal vector and the illumination vector of the plurality of position points, the diffuse reflection parameter and the reflection parameter of the virtual object are obtained, and the diffuse reflection parameter is negatively correlated with the reflection parameter;
确定与所述漫反射参数及所述反光参数匹配的目标贴图;determining a target map matching the diffuse 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.
在一种可能实现方式中,所述虚拟物体的漫反射参数包括所述多个位置点的漫反射子参数,所述虚拟物体的反光参数包括所述多个位置点的反光子参数;In a possible implementation manner, the diffuse reflection parameters of the virtual object include diffuse reflection sub-parameters of the plurality of position points, and the reflection parameters of the virtual object include reflection sub-parameters of the plurality of position points;
所述根据所述多个位置点的法线向量及光照向量,获取所述虚拟物体的漫反射参数及反光参数,包括:The obtaining of the diffuse reflection parameter and the reflective parameter of the virtual object according to the normal vector and the illumination vector of the multiple position points, including:
对于每个位置点,根据所述位置点的法线向量及光照向量,获取所述位置点的漫反射子参数;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;
对所述漫反射子参数进行取反处理,得到所述位置点的第一反光子参数;Perform inversion processing on the diffuse reflection sub-parameter to obtain the first reflection sub-parameter of the position point;
根据预先设置的第一调整参数,调整所述第一反光子参数,得到所述位置点的第二反光子参数;Adjust the first reflection photon parameter according to the preset first adjustment parameter to obtain the second reflection 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 reflection photon parameters of the multiple position points are combined to obtain the reflection parameters.
在另一种可能实现方式中,所述根据所述位置点的法线向量及光照向量,获取所述位置点的漫反射子参数,包括:In another possible implementation manner, obtaining the diffuse reflection sub-parameter of the position point according to the normal vector and the illumination vector of the position point, including:
将所述法线向量与所述光照向量的点积,作为第一数值;Taking the dot product of the normal vector and the illumination vector as the first value;
将所述第一数值和0中较大的数值,确定为所述位置点的漫反射子参数。The larger value among the first value and 0 is determined as the diffuse reflection sub-parameter of the position point.
在另一种可能实现方式中,所述虚拟物体的漫反射参数包括所述多个位置点的漫反射子参数,所述虚拟物体的反光参数包括所述多个位置点的反光子参数;所述确定与所述漫反射参数及所述反光参数匹配的目标贴图,包括:In another possible implementation manner, the diffuse reflection parameters of the virtual object include diffuse reflection sub-parameters of the plurality of position points, and the reflection parameters of the virtual object include reflection sub-parameters of the plurality of position points; The determining of the target map matching the diffuse reflection parameter and the reflective parameter includes:
根据每个位置点的漫反射子参数及反光子参数,分别获取所述每个位置点的亮度子参数;According to the diffuse reflection sub-parameter and the reflection sub-parameter of each position point, respectively obtain the brightness sub-parameter of each position point;
根据所述每个位置点的亮度子参数和多个备选贴图的序号,分别获取所述多个备选贴图的权重,所述备选贴图的序号为所述多个备选贴图按照亮度从大到小依次排列之后确定的,所述备选贴图的序号表征所述备选贴图的亮度,不同备选贴图的序号不同;According to the brightness sub-parameter of each position point and the serial number of the multiple candidate textures, the weights of the multiple candidate textures are respectively obtained, and the serial number of the candidate textures is that the multiple candidate textures change from brightness to Determined after arranging from largest to smallest, the sequence number of the candidate texture represents the brightness of the candidate texture, and the sequence numbers of different candidate textures are different;
按照所述每个位置点对应的多个备选贴图的权重,确定所述目标贴图。The target map is determined according to the weight of the multiple candidate maps corresponding to each position point.
在另一种可能实现方式中,所述根据每个位置点的漫反射子参数及反光子参数,分别获取所述每个位置点的亮度子参数,包括:In another possible implementation manner, according to the diffuse reflection sub-parameter and the reflection sub-parameter of each position point, the brightness sub-parameter of each position point is obtained respectively, including:
对于每个位置点,将所述位置点的漫反射子参数与反光子参数相加,得到所述位置点的第一亮度子参数;For each position point, add the diffuse reflection sub-parameter and the reflection sub-parameter of the position point to obtain the first brightness sub-parameter of the position point;
将所述第一亮度子参数与所述备选贴图的数量相乘,得到所述位置点的第二亮度子参数。The first luminance sub-parameter is multiplied by the number of candidate maps to obtain the second luminance sub-parameter of the position point.
在另一种可能实现方式中,所述根据所述每个位置点的亮度子参数和多个备选贴图的序号,分别获取所述多个备选贴图的权重,包括:In another possible implementation manner, according to the luminance sub-parameter of each position point and the serial number of the multiple candidate textures, the weights of the multiple candidate textures are respectively obtained, including:
对于每个位置点,根据所述位置点的亮度子参数与每个备选贴图的序号之间的差值,确定所述每个备选贴图的匹配参数,所述匹配参数表征所述备选贴图的亮度与所述位置点的亮度之间的匹配程度;For each position point, according to the difference between the brightness sub-parameter of the position point and the serial number of each candidate map, determine the matching parameter of each candidate map, and the matching parameter represents the candidate map the degree of matching between the brightness of the map and the brightness of the location point;
将相邻的任两个备选贴图的匹配参数之间的差值,作为所述任两个备选贴图中的第一个备选贴图的权重,且将最后一个备选贴图的匹配参数,作为所述最后一个备选贴图的权重,所述相邻的任两个备选贴图是指按照亮度从大到小依次排列的多个备选贴图中相邻的两个备选贴图。The difference between the matching parameters of any two adjacent candidate textures is used as the weight of the first candidate texture in the any two candidate textures, and the matching parameters of the last candidate texture, As the weight of the last candidate texture, any two adjacent candidate textures refer to two adjacent candidate textures among the multiple candidate textures arranged in descending order of brightness.
在另一种可能实现方式中,所述方法还包括:In another possible implementation, the method further includes:
按照所述多个备选贴图的序号,依次将序号相邻的备选贴图进行融合,得到至少一个融合贴图,所述融合贴图的红色通道、绿色通道或蓝色通道中的至少一个通道对应一个备选贴图;According to the serial numbers of the plurality of candidate maps, the candidate maps with adjacent serial numbers are fused in sequence to obtain at least one fusion map, wherein at least one channel of the red channel, the green channel or the blue channel of the fusion map corresponds to one Alternative textures;
所述根据所述位置点的亮度子参数与每个备选贴图的序号之间的差值,确定所述每个备选贴图的匹配参数,包括:Determining the matching parameters of each candidate map according to the difference between the luminance sub-parameter of the position point and the serial number of each candidate map, including:
获取每个融合贴图的序号矩阵,所述融合贴图的序号矩阵包括所述融合贴图中每个备选贴图的序号;Obtain the sequence number matrix of each fusion map, where the sequence number matrix of the fusion map includes the sequence number of each candidate map in the fusion map;
获取亮度子参数矩阵,所述亮度子参数矩阵包括多个所述亮度子参数,且多个所述亮度子参数的数量等于所述融合贴图中包含的备选贴图的数量;obtaining a luminance sub-parameter matrix, where the luminance sub-parameter matrix includes a plurality of the luminance sub-parameters, and the number of the plurality of luminance sub-parameters is equal to the number of candidate maps included in the fusion map;
获取所述亮度子参数矩阵与所述每个融合贴图的序号矩阵之间的差值,确定匹配参数矩阵,所述匹配参数矩阵包括所述每个备选贴图的匹配参数。The difference between the luminance sub-parameter matrix and the sequence number matrix of each fusion map is acquired, and a matching parameter matrix is determined, and the matching parameter matrix includes the matching parameters of each candidate map.
在另一种可能实现方式中,所述根据所述位置点的亮度子参数与所述备选贴图的序号的差值,确定所述备选贴图的匹配参数,包括:In another possible implementation manner, determining the matching parameter of the candidate texture according to the difference between the luminance sub-parameter of the position point and the sequence number of the candidate texture includes:
响应于所述差值大于第一参考数值,将所述第一参考数值作为所述备选贴图的匹配参数;或者,In response to the difference value being greater than the first reference value, the first reference value is used as the matching parameter of the candidate map; or,
响应于所述差值小于第二参考数值,将所述第二参考数值作为所述备选贴图的匹配参数;或者,In response to the difference being less than a second reference value, the second reference value is used as a matching parameter of the candidate map; or,
响应于所述差值不大于所述第一参考数值,且不小于所述第二参考数值,将所述差值作为所述备选贴图的匹配参数。In response to the difference value being not greater than the first reference value and not less than the second reference value, the difference value is used as a matching parameter of the candidate map.
在另一种可能实现方式中,所述按照所述每个备选贴图对应的权重,确定所述目标贴图,包括:In another possible implementation manner, the determining the target texture according to the weight corresponding to each candidate texture includes:
将最大的权重对应的备选贴图作为所述目标贴图;或者,Use the candidate map corresponding to the largest weight as the target map; or,
按照所述每个备选贴图的权重,对所述多个备选贴图进行加权融合,将融合后的贴图作为所述目标贴图。According to the weight of each candidate texture, weighted fusion is performed on the multiple candidate textures, and the fused texture is used as the target texture.
在另一种可能实现方式中,所述物体参数还包括所述多个位置点的视角向量,所述位置点的视角向量为虚拟摄像机相对于所述位置点的方向上的向量;In another possible implementation manner, the object parameter further includes a viewing angle vector of the plurality of position points, and the viewing angle vector of the position point is a vector in the direction of the virtual camera relative to the position point;
所述在所述虚拟物体表面添加所述目标贴图,显示添加所述目标贴图后的所述虚拟物体之前,所述方法还包括:Before adding the target texture to the surface of the virtual object and displaying the virtual object after adding the target texture, the method further includes:
根据所述多个位置点的法线向量、光照向量及视角向量,获取所述虚拟物体的高光参数,所述高光参数表征所述虚拟物体表面上最亮的位置点;Acquire a highlight parameter of the virtual object according to the normal vector, the illumination vector and the viewing angle vector of the multiple position points, where the highlight parameter represents the brightest position point on the surface of the virtual object;
所述在所述虚拟物体表面添加所述目标贴图,显示添加所述目标贴图后的所述虚拟物体,包括:The adding the target texture on the surface of the virtual object, and displaying the virtual object after adding the target texture, includes:
在所述虚拟物体表面添加所述目标贴图,根据所述高光参数显示添加所述目标贴图后的所述虚拟物体。The target texture is added on the surface of the virtual object, and the virtual object after adding the target texture is displayed according to the specular parameter.
在另一种可能实现方式中,所述根据所述多个位置点的法线向量、光照向量及视角向量,获取所述虚拟物体的高光参数,包括:In another possible implementation manner, the acquiring the specular parameter of the virtual object according to the normal vector, the illumination vector and the viewing angle vector of the multiple position points includes:
对于每个位置点,将所述位置点的视角向量与光照向量的和向量与所述位置点的法线向量的点积,作为第二数值;For each position point, the dot product of the sum vector of the angle vector of the position point and the illumination vector and the normal vector of the position point is taken as the second value;
将所述第二数值和0中较大的数值与所述光照向量的乘积,作为第一高光子参数;The product of the second numerical value and the larger numerical value of 0 and the illumination vector is used as the first hyperphoton parameter;
根据预先设置的第二调整参数,调整所述第一高光子参数,得到第二高光子参数。According to the preset second adjustment parameter, the first hyperphoton parameter is adjusted to obtain the second hyperphoton parameter.
在另一种可能实现方式中,所述确定与所述漫反射参数及所述反光参数匹配的目标贴图之后,所述方法还包括:In another possible implementation manner, after the determining a target map matching the diffuse reflection parameter and the reflective parameter, the method further includes:
将每个位置点沿着对应的法线方向延伸预设距离,在所述虚拟物体的表面外侧形成延伸区域,将参考颜色填充至所述延伸区域;extending each position point along the corresponding normal direction by a preset distance, forming an extension area outside the surface of the virtual object, and filling the extension area with a reference color;
所述在所述虚拟物体表面添加所述目标贴图,显示添加所述目标贴图后的所述虚拟物体,包括:The adding the target texture on the surface of the virtual object, and displaying the virtual object after adding the target texture, includes:
在所述虚拟物体表面添加所述目标贴图,显示添加所述目标贴图后的所述虚拟物体及所述虚拟物体的表面外侧的延伸区域。The target texture is added on the surface of the virtual object, and the virtual object after adding the target texture and an extension area outside the surface of the virtual object are displayed.
根据本公开实施例的再一方面,提供一种虚拟物体显示装置,所述装置包括:According to yet another aspect of the embodiments of the present disclosure, there is provided a virtual object display device, the device comprising:
第一参数获取单元,被配置为执行获取虚拟物体的物体参数,所述物体参数至少包括虚拟物体表面上的多个位置点的法线向量及光照向量,所述位置点的光照向量为所述位置点的光线照射方向上的向量;The first parameter acquisition unit is configured to perform acquisition of object parameters of the virtual object, the object parameters at least include normal vectors and illumination vectors of multiple position points on the surface of the virtual object, and the illumination vectors of the position points are the The vector in the direction of the ray at the location point;
第二参数获取单元,被配置为执行根据所述多个位置点的法线向量及光照向量,获取所述虚拟物体的漫反射参数及反光参数,所述漫反射参数与所述反光参数呈负相关关系;The second parameter obtaining unit is configured to obtain the diffuse reflection parameter and the reflection parameter of the virtual object according to the normal vector and the illumination vector of the plurality of position points, and the diffuse reflection parameter and the reflection parameter are negative. relationship;
目标贴图确定单元,被配置为执行确定与所述漫反射参数及所述反光参数匹配的目标贴图;a target map determining unit configured to perform determining a target map matching the diffuse reflection parameter and the reflective parameter;
虚拟物体显示单元,被配置为执行在所述虚拟物体表面添加所述目标贴图,显示添加所述目标贴图后的所述虚拟物体。The virtual object display unit is configured to execute adding the target texture on the surface of the virtual object, and display the virtual object after adding the target texture.
在一种可能实现方式中,所述虚拟物体的漫反射参数包括所述多个位置点的漫反射子参数,所述虚拟物体的反光参数包括所述多个位置点的反光子参数;In a possible implementation manner, the diffuse reflection parameters of the virtual object include diffuse reflection sub-parameters of the plurality of position points, and the reflection parameters of the virtual object include reflection sub-parameters of the plurality of position points;
所述第二参数获取单元,被配置为执行:The second parameter obtaining unit is configured to execute:
对于每个位置点,根据所述位置点的法线向量及光照向量,获取所述位置点的漫反射子参数;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;
对所述漫反射子参数进行取反处理,得到所述位置点的第一反光子参数;Perform inversion processing on the diffuse reflection sub-parameter to obtain the first reflection sub-parameter of the position point;
根据预先设置的第一调整参数,调整所述第一反光子参数,得到所述位置点的第二反光子参数;Adjust the first reflection photon parameter according to the preset first adjustment parameter to obtain the second reflection 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 reflection photon parameters of the multiple position points are combined to obtain the reflection parameters.
在另一种可能实现方式中,所述第二参数获取单元,被配置为执行:In another possible implementation manner, the second parameter obtaining unit is configured to execute:
将所述法线向量与所述光照向量的点积,作为第一数值;Taking the dot product of the normal vector and the illumination vector as the first value;
将所述第一数值和0中较大的数值,确定为所述位置点的漫反射子参数。The larger value among the first value and 0 is determined as the diffuse reflection sub-parameter of the position point.
在另一种可能实现方式中,所述虚拟物体的漫反射参数包括所述多个位置点的漫反射子参数,所述虚拟物体的反光参数包括所述多个位置点的反光子参数;所述目标贴图确定单元,包括:In another possible implementation manner, the diffuse reflection parameters of the virtual object include diffuse reflection sub-parameters of the plurality of position points, and the reflection parameters of the virtual object include reflection sub-parameters of the plurality of position points; Describe the target map determination unit, including:
亮度子参数获取子单元,被配置为执行根据每个位置点的漫反射子参数及反光子参数,分别获取所述每个位置点的亮度子参数;a brightness sub-parameter obtaining subunit, configured to obtain the brightness sub-parameter of each position point according to the diffuse reflection sub-parameter and the reflection sub-parameter of each position point;
权重获取子单元,被配置为执行根据所述每个位置点的亮度子参数和多个备选贴图的序号,分别获取所述多个备选贴图的权重,所述备选贴图的序号为所述多个备选贴图按照亮度从大到小依次排列之后确定的,所述备选贴图的序号表征所述备选贴图的亮度,不同备选贴图的序号不同;The weight acquisition subunit is configured to obtain the weight of the multiple candidate textures according to the brightness sub-parameter of each position point and the serial number of the multiple candidate textures, and the serial number of the candidate texture is the Determined after the plurality of candidate textures are arranged in descending order of brightness, the sequence number of the candidate texture represents the brightness of the candidate texture, and the sequence numbers of different candidate textures are different;
贴图确定子单元,被配置为执行按照所述每个位置点对应的多个备选贴图的权重,确定所述目标贴图。The texture determination subunit is configured to determine the target texture according to the weight of the multiple candidate textures corresponding to each position point.
在另一种可能实现方式中,所述亮度子参数获取子单元,被配置为执行:In another possible implementation manner, the luminance sub-parameter acquiring subunit is configured to execute:
对于每个位置点,将所述位置点的漫反射子参数与反光子参数相加,得到所述位置点的第一亮度子参数;For each position point, add the diffuse reflection sub-parameter and the reflection sub-parameter of the position point to obtain the first brightness sub-parameter of the position point;
将所述第一亮度子参数与所述备选贴图的数量相乘,得到所述位置点的第二亮度子参数。The first luminance sub-parameter is multiplied by the number of candidate maps to obtain the second luminance sub-parameter of the position point.
在另一种可能实现方式中,所述权重获取子单元,被配置为执行:In another possible implementation manner, the weight obtaining subunit is configured to execute:
对于每个位置点,根据所述位置点的亮度子参数与每个备选贴图的序号之间的差值,确定所述每个备选贴图的匹配参数,所述匹配参数表征所述备选贴图的亮度与所述位置点的亮度之间的匹配程度;For each position point, according to the difference between the brightness sub-parameter of the position point and the serial number of each candidate map, determine the matching parameter of each candidate map, and the matching parameter represents the candidate map the degree of matching between the brightness of the map and the brightness of the location point;
将相邻的任两个备选贴图的匹配参数之间的差值,作为所述任两个备选贴图中的第一个备选贴图的权重,且将最后一个备选贴图的匹配参数,作为所述最后一个备选贴图的权重,所述相邻的任两个备选贴图是指按照亮度从大到小依次排列的多个备选贴图中相邻的两个备选贴图。The difference between the matching parameters of any two adjacent candidate textures is used as the weight of the first candidate texture in the any two candidate textures, and the matching parameters of the last candidate texture, As the weight of the last candidate texture, any two adjacent candidate textures refer to two adjacent candidate textures among the multiple candidate textures arranged in descending order of brightness.
在另一种可能实现方式中,所述装置还包括:In another possible implementation, the apparatus further includes:
贴图融合单元,被配置为执行按照所述多个备选贴图的序号,依次将序号相邻的备选贴图进行融合,得到至少一个融合贴图,所述融合贴图的红色通道、绿色通道或蓝色通道中的至少一个通道对应一个备选贴图;The texture fusion unit is configured to perform fusion of candidate textures with adjacent serial numbers in sequence according to the sequence numbers of the multiple candidate textures to obtain at least one fusion texture, the red channel, green channel or blue of the fusion texture. At least one of the channels corresponds to an alternative map;
所述权重获取子单元,被配置为执行:The weight acquisition subunit is configured to execute:
获取每个融合贴图的序号矩阵,所述融合贴图的序号矩阵包括所述融合贴图中每个备选贴图的序号;Obtain the sequence number matrix of each fusion map, where the sequence number matrix of the fusion map includes the sequence number of each candidate map in the fusion map;
获取亮度子参数矩阵,所述亮度子参数矩阵包括多个所述亮度子参数,且多个所述亮度子参数的数量等于所述融合贴图中包含的备选贴图的数量;obtaining a luminance sub-parameter matrix, where the luminance sub-parameter matrix includes a plurality of the luminance sub-parameters, and the number of the plurality of luminance sub-parameters is equal to the number of candidate maps included in the fusion map;
获取所述亮度子参数矩阵与所述每个融合贴图的序号矩阵之间的差值,确定匹配参数矩阵,所述匹配参数矩阵包括所述每个备选贴图的匹配参数。The difference between the luminance sub-parameter matrix and the sequence number matrix of each fusion map is acquired, and a matching parameter matrix is determined, and the matching parameter matrix includes the matching parameters of each candidate map.
在另一种可能实现方式中,所述权重获取子单元,被配置为执行:In another possible implementation manner, the weight obtaining subunit is configured to execute:
响应于所述差值大于第一参考数值,将所述第一参考数值作为所述备选贴图的匹配参数;或者,In response to the difference value being greater than the first reference value, the first reference value is used as the matching parameter of the candidate map; or,
响应于所述差值小于第二参考数值,将所述第二参考数值作为所述备选贴图的匹配参数;或者,In response to the difference being less than a second reference value, the second reference value is used as a matching parameter of the candidate map; or,
响应于所述差值不大于所述第一参考数值,且不小于所述第二参考数值,将所述差值作为所述备选贴图的匹配参数。In response to the difference value being not greater than the first reference value and not less than the second reference value, the difference value is used as a matching parameter of the candidate map.
在另一种可能实现方式中,所述贴图确定子单元,被配置为执行:In another possible implementation, the map determination subunit is configured to perform:
将最大的权重对应的备选贴图作为所述目标贴图;或者,Use the candidate map corresponding to the largest weight as the target map; or,
按照所述每个备选贴图的权重,对所述多个备选贴图进行加权融合,将融合后的贴图作为所述目标贴图。According to the weight of each candidate texture, weighted fusion is performed on the multiple candidate textures, and the fused texture is used as the target texture.
在另一种可能实现方式中,所述物体参数还包括所述多个位置点的视角向量,所述位置点的视角向量为虚拟摄像机相对于所述位置点的方向上的向量;In another possible implementation manner, the object parameter further includes a viewing angle vector of the plurality of position points, and the viewing angle vector of the position point is a vector in the direction of the virtual camera relative to the position point;
所述装置还包括:The device also includes:
第三参数获取单元,被配置为执行根据所述多个位置点的法线向量、光照向量及视角向量,获取所述虚拟物体的高光参数,所述高光参数表征所述虚拟物体表面上最亮的位置点;A third parameter obtaining unit, configured to obtain a highlight parameter of the virtual object according to the normal vector, the illumination vector and the viewing angle vector of the plurality of position points, where the highlight parameter represents the brightest on the surface of the virtual object the location point;
所述虚拟物体显示单元,被配置为执行在所述虚拟物体表面添加所述目标贴图,根据所述高光参数显示添加所述目标贴图后的所述虚拟物体。The virtual object display unit is configured to execute adding the target texture on the surface of the virtual object, and display the virtual object after adding the target texture according to the specular parameter.
在另一种可能实现方式中,所述第三参数获取单元,被配置为执行:In another possible implementation manner, the third parameter obtaining unit is configured to execute:
对于每个位置点,将所述位置点的视角向量与光照向量的和向量与所述位置点的法线向量的点积,作为第二数值;For each position point, the dot product of the sum vector of the angle vector of the position point and the illumination vector and the normal vector of the position point is taken as the second value;
将所述第二数值和0中较大的数值与所述光照向量的乘积,作为第一高光子参数;The product of the second numerical value and the larger numerical value of 0 and the illumination vector is used as the first hyperphoton parameter;
根据预先设置的第二调整参数,调整所述第一高光子参数,得到第二高光子参数。According to the preset second adjustment parameter, the first hyperphoton parameter is adjusted to obtain the second hyperphoton parameter.
在另一种可能实现方式中,所述装置还包括:In another possible implementation, the apparatus further includes:
延伸区域获取单元,被配置为执行将每个位置点沿着对应的法线方向延伸预设距离,在所述虚拟物体的表面外侧形成延伸区域,将参考颜色填充至所述延伸区域;an extension area acquisition unit, configured to extend each position point along the corresponding normal direction by a preset distance, form an extension area outside the surface of the virtual object, and fill the extension area with a reference color;
所述虚拟物体显示单元,被配置为执行在所述虚拟物体表面添加所述目标贴图,显示添加所述目标贴图后的所述虚拟物体及所述虚拟物体的表面外侧的延伸区域。The virtual object display unit is configured to perform adding the target texture on the surface of the virtual object, and display the virtual object after adding the target texture and an extension area outside the surface of the virtual object.
根据本公开实施例的再一方面,提供了一种电子设备,所述电子设备包括:According to yet another aspect of the embodiments of the present disclosure, there is provided an electronic device, the electronic device comprising:
一个或多个处理器;one or more processors;
用于存储所述一个或多个处理器可执行命令的易失性或非易失性存储器;volatile or non-volatile memory for storing the one or more processor-executable commands;
其中,所述一个或多个处理器被配置为执行上述方面所述的虚拟物体显示方法。Wherein, the one or more processors are configured to execute the virtual object display method described in the above aspects.
根据本公开实施例的再一方面,提供一种非临时性计算机可读存储介质,当所述存储介质中的指令由电子设备的处理器执行时,使得电子设备能够执行上述方面所述的虚拟物体显示方法。According to yet another aspect of the embodiments of the present disclosure, a non-transitory 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.
根据本公开实施例的再一方面,提供一种计算机程序产品,当所述计算机程序产品中的指令由电子设备的处理器执行时,使得电子设备能够执行上述方面所述的虚拟物体显示方法。According to yet another aspect of the embodiments of the present disclosure, a computer program product is provided, when the 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 aspect.
本公开实施例提供的虚拟物体显示方法、装置、电子设备及存储介质,能够获取虚拟物体的漫反射参数及反光参数,由于漫反射参数及反光参数均能够反映虚拟物体的亮度,因此与仅根据漫反射参数确定匹配的贴图相比,根据漫反射参数及反光参数确定匹配的目标贴图时,还考虑了反光现象对虚拟物体显示效果的影响,增加了信息量,使确定的目标贴图能够更加准确地反映该虚拟物体的亮度,从而显示添加目标贴图后的虚拟物体时,该虚拟物体更加逼真,提高了虚拟物体的显示效果。The virtual object display method, device, electronic device, and storage medium provided by the embodiments of the present disclosure can obtain the diffuse reflection parameters and reflective parameters of the virtual object. Compared with the matching texture determined by the diffuse reflection parameters, when determining the matching target texture according to the diffuse reflection parameters and the reflective parameters, the influence of the reflection phenomenon on the display effect of the virtual object is also considered, which increases the amount of information and makes the determined target texture more accurate. The brightness of the virtual object is accurately reflected, so that when the virtual object after adding the target texture is displayed, the virtual object is more realistic and the display effect of the virtual object is improved.
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制本公开。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.
附图说明Description of drawings
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本公开的实施例,并与说明书一起用于解释本公开的原理。The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description serve to explain the principles of the disclosure.
图1是根据一示例性实施例示出的一种虚拟物体显示方法的流程图。Fig. 1 is a flowchart of a method for displaying a virtual object according to an exemplary embodiment.
图2是根据一示例性实施例示出的另一种虚拟物体显示方法的流程图。Fig. 2 is a flow chart of another method for displaying virtual objects according to an exemplary embodiment.
图3是根据一示例性实施例示出的一种位置点的物体参数的示意图。Fig. 3 is a schematic diagram showing object parameters of a position point according to an exemplary embodiment.
图4是根据一示例性实施例示出的一种虚拟物体的示意图。Fig. 4 is a schematic diagram of a virtual object according to an exemplary embodiment.
图5是根据一示例性实施例示出的一种备选贴图的示意图。Fig. 5 is a schematic diagram showing an alternative map according to an exemplary embodiment.
图6是根据一示例性实施例示出的一种融合贴图的示意图。Fig. 6 is a schematic diagram of a fusion map according to an exemplary embodiment.
图7是根据一示例性实施例示出的一种高光现象的示意图。FIG. 7 is a schematic diagram illustrating a highlight phenomenon according to an exemplary embodiment.
图8是根据一示例性实施例示出的一种素描图像的示意图。Fig. 8 is a schematic diagram showing a sketch image according to an exemplary embodiment.
图9是根据一示例性实施例示出的一种虚拟物体的示意图。Fig. 9 is a schematic diagram of a virtual object according to an exemplary embodiment.
图10是根据一示例性实施例示出的一种虚拟物体显示装置的框图。Fig. 10 is a block diagram of a device for displaying virtual objects according to an exemplary embodiment.
图11是根据一示例性实施例示出的另一种虚拟物体显示装置的框图。Fig. 11 is a block diagram of another apparatus for displaying virtual objects according to an exemplary embodiment.
图12是根据一示例性实施例示出的一种终端的框图。Fig. 12 is a block diagram of a terminal according to an exemplary embodiment.
具体实施方式Detailed ways
为了使本领域普通人员更好地理解本公开的技术方案,下面将结合附图,对本公开实施例中的技术方案进行清楚、完整地描述。In order to make those skilled in the art 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 with reference to the accompanying drawings.
需要说明的是,本公开的说明书和权利要求书及上述附图说明中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本公开的实施例能够以除了在这里图示或描述的那些以外的顺序实施。以下示例性实施例中所描述的实施方式并不代表与本公开相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本公开的一些方面相一致的装置和方法的例子。It should be noted that the terms "first", "second", etc. in the description and claims of the present disclosure and the above description of the drawings are used to distinguish similar objects, and are not necessarily used to describe a specific sequence or sequence. . It is to be understood that the data so used may be interchanged under appropriate circumstances such that the embodiments of the disclosure described herein can be practiced in sequences other than those illustrated or described herein. The implementations described in the illustrative examples below are not intended to represent all implementations consistent with this disclosure. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present disclosure as recited in the appended claims.
需要说明的是,本公开所涉及的用户信息(包括但不限于用户设备信息、用户个人信息等),均为经用户授权或者经过各方充分授权的信息。It should be noted that the user information (including but not limited to user equipment information, user personal information, etc.) involved in this disclosure is information authorized by the user or fully authorized by all parties.
为了便于理解本公开实施例的技术过程,下面对本公开实施例所涉及的名词进行解释:In order to facilitate the 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:
实时渲染(Ealtime Rendering):是一种根据图形学算法将三维数据绘制到二维图像之中,并对二维图像进行实时显示的模型渲染技术,应用于虚拟现实、游戏应用中的虚拟场景中等。Ealtime Rendering: It is a model rendering technology that draws three-dimensional data into two-dimensional images according to graphics algorithms, and displays the two-dimensional images in real time. It is used in virtual reality, virtual scenes in game applications, etc. .
光照模型(Illumination Model):光照模型也称为明暗模型,用于描述虚拟物体位置点处在光线与视角等影响下呈现的颜色值,光照模型包括基于物理的理论模型和基于经验的经验模型。例如光照模型包括Phong(镜面反射)模型、Blinn-Phong(修正镜面反射)模型和Cook-Torrance(微表面)模型等。其中,Blinn-Phong模型是一种高光计算模型,可进行快速实时的渲染。Illumination Model: The illumination model, also known as the light and shade model, is used to describe the color value presented by the position point of a virtual object under the influence of light and viewing angle. The illumination model includes a physics-based theoretical model and an experience-based empirical model. For example, the lighting models include the Phong (specular reflection) model, the Blinn-Phong (corrected specular reflection) model, and the Cook-Torrance (microsurface) model. Among them, the Blinn-Phong model is a specular calculation model that can perform fast and real-time rendering.
渲染通路(Pass):一个渲染通路表示一次渲染操作,在显示虚拟物体时,通过多个渲染通路对虚拟物体进行渲染显示。Rendering pass (Pass): A rendering pass represents a rendering operation. When displaying a virtual object, the virtual object is rendered and displayed through multiple rendering passes.
虚拟场景:虚拟场景是应用程序在终端上运行时显示(或提供)的虚拟场景。虚拟场景用于模拟一个三维虚拟空间,该三维虚拟空间是一个开放空间,或者该虚拟场景是对现实中真实环境进行仿真的虚拟场景,或者该虚拟场景是半仿真半虚构的虚拟场景,或者该虚拟场景是完全虚构的虚拟场景,虚拟场景是二维虚拟场景、2.5维虚拟场景和三维虚拟场景中的任意一种。例如,该虚拟场景中包括河流、草丛、陆地、建筑物等。Virtual scene: A virtual scene is a virtual scene that is displayed (or provided) when the application is running on the terminal. The virtual scene is used to simulate a three-dimensional virtual space, and the three-dimensional virtual space is an open space, or the virtual scene is a virtual scene that simulates the real environment in reality, or the virtual scene is a semi-simulated semi-fictional virtual scene, or the The virtual scene is a completely fictitious virtual scene, and 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, and the like.
图1是根据一示例性实施例示出的一种虚拟物体显示方法的流程图,参见图1,该方法应用于终端中,包括以下步骤:FIG. 1 is a flowchart of a method for displaying virtual objects according to an exemplary embodiment. Referring to FIG. 1 , the method is applied to a terminal and includes the following steps:
在步骤101中,获取虚拟物体的物体参数,物体参数至少包括虚拟物体表面上的多个位置点的法线向量及光照向量,位置点的光照向量为位置点的光线照射方向上的向量。In
在步骤102中,根据多个位置点的法线向量及光照向量,获取虚拟物体的漫反射参数及反光参数,漫反射参数与反光参数呈负相关关系。In
在步骤103中,确定与漫反射参数及反光参数匹配的目标贴图。In
在步骤104中,在虚拟物体表面添加目标贴图,显示添加目标贴图后的虚拟物体。In
本公开实施例提供的方法,能够获取虚拟物体的漫反射参数及反光参数,由于漫反射参数及反光参数均能够反映虚拟物体的亮度,因此与仅根据漫反射参数确定匹配的贴图相比,根据漫反射参数及反光参数确定匹配的目标贴图时,还考虑了反光现象对虚拟物体显示效果的影响,增加了信息量,使确定的目标贴图能够更加准确地反映该虚拟物体的亮度,从而显示添加目标贴图后的虚拟物体时,该虚拟物体更加逼真,提高了虚拟物体的显示效果。The method provided by the embodiment of the present disclosure can obtain the diffuse reflection parameter and the reflective parameter of the virtual object. Since both the diffuse reflection parameter and the reflective parameter can reflect the brightness of the virtual object, compared with determining the matching map based only on the diffuse reflection parameter, according to When the diffuse reflection parameter and the reflective parameter determine the matching target map, the influence of the reflection phenomenon on the display effect of the virtual object is also considered, and the amount of information is increased, so that the determined target map can more accurately reflect the brightness of the virtual object, so that the display added When the virtual object after the target map is used, the virtual object is more realistic, and the display effect of the virtual object is improved.
在一种可能实现方式中,虚拟物体的漫反射参数包括多个位置点的漫反射子参数,虚拟物体的反光参数包括多个位置点的反光子参数;In a possible implementation manner, the diffuse reflection parameters of the virtual object include diffuse reflection sub-parameters of multiple position points, and the reflection parameters of the virtual object include reflection photon parameters of multiple position points;
根据多个位置点的法线向量及光照向量,获取虚拟物体的漫反射参数及反光参数,包括:According to the normal vector and illumination vector of multiple position points, the diffuse reflection parameters and reflection parameters of the virtual object are obtained, including:
对于每个位置点,根据位置点的法线向量及光照向量,获取位置点的漫反射子参数;For each position point, obtain the diffuse reflection sub-parameter of the position point according to the normal vector and illumination vector of the position point;
对漫反射子参数进行取反处理,得到位置点的第一反光子参数;Negate the diffuse reflection sub-parameters to obtain the first reflection sub-parameters of the position point;
根据预先设置的第一调整参数,调整第一反光子参数,得到位置点的第二反光子参数;According to the preset first adjustment parameter, adjust the first reflection photon parameter to obtain the second reflection photon parameter of the position point;
将多个位置点的漫反射子参数进行组合,得到漫反射参数;Combine the diffuse reflection sub-parameters of multiple position points to obtain diffuse reflection parameters;
将多个位置点的第二反光子参数进行组合,得到反光参数。Combining the second reflective photon parameters of multiple position points to obtain reflective parameters.
在另一种可能实现方式中,根据位置点的法线向量及光照向量,获取位置点的漫反射子参数,包括:In another possible implementation manner, the diffuse reflection sub-parameters of the position point are obtained according to the normal vector and the illumination vector of the position point, including:
将法线向量与光照向量的点积,作为第一数值;Take the dot product of the normal vector and the light vector as the first value;
将第一数值和0中较大的数值,确定为位置点的漫反射子参数。The larger value among the first value and 0 is determined as the diffuse reflection sub-parameter of the position point.
在另一种可能实现方式中,虚拟物体的漫反射参数包括多个位置点的漫反射子参数,虚拟物体的反光参数包括多个位置点的反光子参数;确定与漫反射参数及反光参数匹配的目标贴图,包括:In another possible implementation manner, the diffuse reflection parameters of the virtual object include diffuse reflection sub-parameters of multiple position points, and the reflection parameters of the virtual object include reflection photon parameters of multiple position points; it is determined to match the diffuse reflection parameters and the reflection parameters. target maps, including:
根据每个位置点的漫反射子参数及反光子参数,分别获取每个位置点的亮度子参数;According to the diffuse reflection sub-parameter and the reflection photon parameter of each position point, the brightness sub-parameter of each position point is obtained respectively;
根据每个位置点的亮度子参数和多个备选贴图的序号,分别获取多个备选贴图的权重,备选贴图的序号为多个备选贴图按照亮度从大到小依次排列之后确定的,备选贴图的序号表征备选贴图的亮度,不同备选贴图的序号不同;According to the brightness sub-parameter of each position point and the serial number of the multiple candidate textures, the weights of the multiple candidate textures are obtained respectively. The serial number of the candidate textures is determined after the multiple candidate textures are arranged in descending order of brightness. , the serial number of the alternative texture represents the brightness of the alternative texture, and the serial number of different alternative textures is different;
按照每个位置点对应的多个备选贴图的权重,确定目标贴图。The target texture is determined according to the weight of the multiple candidate textures corresponding to each position point.
在另一种可能实现方式中,根据每个位置点的漫反射子参数及反光子参数,分别获取每个位置点的亮度子参数,包括:In another possible implementation manner, according to the diffuse reflection sub-parameter and the reflection sub-parameter of each position point, the brightness sub-parameters of each position point are obtained respectively, including:
对于每个位置点,将位置点的漫反射子参数与反光子参数相加,得到位置点的第一亮度子参数;For each position point, add the diffuse reflection sub-parameter of the position point and the reflection sub-parameter to obtain the first brightness sub-parameter of the position point;
将第一亮度子参数与备选贴图的数量相乘,得到位置点的第二亮度子参数。Multiply the first luminance sub-parameter by the number of candidate maps to obtain the second luminance sub-parameter of the position point.
在另一种可能实现方式中,根据每个位置点的亮度子参数和多个备选贴图的序号,分别获取多个备选贴图的权重,包括:In another possible implementation manner, according to the luminance sub-parameter of each position point and the serial numbers of the multiple candidate textures, the weights of the multiple candidate textures are respectively obtained, including:
对于每个位置点,根据位置点的亮度子参数与每个备选贴图的序号之间的差值,确定每个备选贴图的匹配参数,匹配参数表征备选贴图的亮度与位置点的亮度之间的匹配程度;For each position point, the matching parameter of each candidate texture is determined according to the difference between the brightness sub-parameter of the position point and the serial number of each candidate texture, and the matching parameter represents the brightness of the candidate texture and the brightness of the position point the degree of matching between;
将相邻的任两个备选贴图的匹配参数之间的差值,作为任两个备选贴图中的第一个备选贴图的权重,且将最后一个备选贴图的匹配参数,作为最后一个备选贴图的权重,相邻的任两个备选贴图是指按照亮度从大到小依次排列的多个备选贴图中相邻的两个备选贴图。The difference between the matching parameters of any two adjacent candidate textures is used as the weight of the first candidate texture in any two candidate textures, and the matching parameters of the last candidate texture are used as the final value. The weight of an alternative texture. Any two adjacent alternative textures refer to two adjacent alternative textures in multiple alternative textures arranged in descending order of brightness.
在另一种可能实现方式中,方法还包括:In another possible implementation, the method further includes:
按照多个备选贴图的序号,依次将序号相邻的备选贴图进行融合,得到至少一个融合贴图,融合贴图的红色通道、绿色通道或蓝色通道中的至少一个通道对应一个备选贴图;According to the serial numbers of the multiple candidate textures, the candidate textures with adjacent serial numbers are fused in sequence to obtain at least one fusion texture, and at least one channel of the red channel, green channel or blue channel of the fusion texture corresponds to one candidate texture;
根据位置点的亮度子参数与每个备选贴图的序号之间的差值,确定每个备选贴图的匹配参数,包括:According to the difference between the brightness sub-parameter of the position point and the serial number of each candidate texture, the matching parameters of each candidate texture are determined, including:
获取每个融合贴图的序号矩阵,融合贴图的序号矩阵包括融合贴图中每个备选贴图的序号;Obtain the serial number matrix of each fusion map, and the serial number matrix of the fusion map includes the serial number of each candidate map in the fusion map;
获取亮度子参数矩阵,亮度子参数矩阵包括多个亮度子参数,且多个亮度子参数的数量等于融合贴图中包含的备选贴图的数量;Obtain a brightness sub-parameter matrix, where 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 fusion map;
获取亮度子参数矩阵与每个融合贴图的序号矩阵之间的差值,确定匹配参数矩阵,匹配参数矩阵包括每个备选贴图的匹配参数。The difference between the luminance sub-parameter matrix and the sequence number matrix of each fusion texture is obtained, and the matching parameter matrix is determined, and the matching parameter matrix includes the matching parameters of each candidate texture.
在另一种可能实现方式中,根据位置点的亮度子参数与备选贴图的序号的差值,确定备选贴图的匹配参数,包括:In another possible implementation manner, the matching parameters of the candidate texture are determined according to the difference between the luminance sub-parameter of the position point and the sequence number of the candidate texture, including:
响应于差值大于第一参考数值,将第一参考数值作为备选贴图的匹配参数;或者,In response to the difference being greater than the first reference value, the first reference value is used as the matching parameter of the candidate map; or,
响应于差值小于第二参考数值,将第二参考数值作为备选贴图的匹配参数;或者,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; or,
响应于差值不大于第一参考数值,且不小于第二参考数值,将差值作为备选贴图的匹配参数。In response to the difference value being not greater than the first reference value and not less than the second reference value, the difference value is used as a matching parameter of the candidate map.
在另一种可能实现方式中,按照每个备选贴图对应的权重,确定目标贴图,包括:In another possible implementation manner, the target texture is determined according to the weight corresponding to each candidate texture, including:
将最大的权重对应的备选贴图作为目标贴图;或者,Use the candidate texture corresponding to the largest weight as the target texture; or,
按照每个备选贴图的权重,对多个备选贴图进行加权融合,将融合后的贴图作为目标贴图。According to the weight of each candidate texture, weighted fusion is performed on multiple candidate textures, and the fused texture is used as the target texture.
在另一种可能实现方式中,物体参数还包括多个位置点的视角向量,位置点的视角向量为虚拟摄像机相对于位置点的方向上的向量;In another possible implementation manner, the object parameter further includes the viewing angle vectors of the plurality of position points, and the viewing angle vectors of the position points are vectors in the direction of the virtual camera relative to the position points;
在虚拟物体表面添加目标贴图,显示添加目标贴图后的虚拟物体之前,方法还包括:Adding a target map on the surface of the virtual object, and before displaying the virtual object after adding the target map, the method further includes:
根据多个位置点的法线向量、光照向量及视角向量,获取虚拟物体的高光参数,高光参数表征虚拟物体表面上最亮的位置点;Obtain the highlight parameters of the virtual object according to the normal vector, illumination vector and viewing angle vector of multiple position points, and the highlight parameter represents the brightest position point on the surface of the virtual object;
在虚拟物体表面添加目标贴图,显示添加目标贴图后的虚拟物体,包括:Add a target map to the surface of the virtual object, and display the virtual object after adding the target map, including:
在虚拟物体表面添加目标贴图,根据高光参数显示添加目标贴图后的虚拟物体。Add a target map to the surface of the virtual object, and display the virtual object after adding the target map according to the specular parameters.
在另一种可能实现方式中,根据多个位置点的法线向量、光照向量及视角向量,获取虚拟物体的高光参数,包括:In another possible implementation, the specular parameters of the virtual object are obtained according to the normal vector, the illumination vector and the viewing angle vector of the multiple position points, including:
对于每个位置点,将位置点的视角向量与光照向量的和向量与位置点的法线向量的点积,作为第二数值;For each position point, the dot product of the sum vector of the position point's viewing angle vector and the illumination vector and the normal vector of the position point is used as the second value;
将第二数值和0中较大的数值与光照向量的乘积,作为第一高光子参数;The product of the second value and the larger value of 0 and the light vector is used as the first hyperphoton parameter;
根据预先设置的第二调整参数,调整第一高光子参数,得到第二高光子参数。According to the preset second adjustment parameter, the first hyperphoton parameter is adjusted to obtain the second hyperphoton parameter.
在另一种可能实现方式中,确定与漫反射参数及反光参数匹配的目标贴图之后,方法还包括:In another possible implementation manner, after determining the target map matching the diffuse reflection parameter and the reflective parameter, the method further includes:
将每个位置点沿着对应的法线方向延伸预设距离,在虚拟物体的表面外侧形成延伸区域,将参考颜色填充至延伸区域;Extend each position point along the corresponding normal direction by a preset distance, form an extension area outside the surface of the virtual object, and fill the reference color to the extension area;
在虚拟物体表面添加目标贴图,显示添加目标贴图后的虚拟物体,包括:Add a target map to the surface of the virtual object, and display the virtual object after adding the target map, including:
在虚拟物体表面添加目标贴图,显示添加目标贴图后的虚拟物体及虚拟物体的表面外侧的延伸区域。Add a target map on the surface of the virtual object, and display the virtual object after adding the target map and the extension area outside the surface of the virtual object.
本公开实施例提供的虚拟物体显示方法能够应用于多种场景下。The virtual object display method provided by the embodiments of the present disclosure can be applied to various scenarios.
例如,应用于游戏场景下。For example, in game scenarios.
在游戏应用中会创建虚拟场景,虚拟场景中设置有虚拟光源,在虚拟场景中显示虚拟物体时,需要考虑在虚拟光源的照射对虚拟物体的影响,采用本申请实施例提供的方法显示虚拟物体,能够考虑在虚拟光源照射下虚拟物体表面产生的漫反射效果和反光效果,使得显示的虚拟物体更加真实,从而提高了虚拟物体的显示效果。A virtual scene is created in a game application, and a virtual light source is set in the virtual scene. When displaying a virtual object in the virtual scene, it is necessary to consider the influence of the illumination of the virtual light source on the virtual object, and the method provided by the embodiment of the present application is used to display the virtual object. , the diffuse reflection effect and reflective effect generated by the surface of the virtual object under the illumination of the virtual light source can be considered, so that the displayed virtual object is more realistic, thereby improving the display effect of the virtual object.
又例如,应用于虚拟现实场景下。For another example, it is applied to a virtual reality scene.
用户能够使用终端的摄像头拍摄实际场景的画面,并在该画面中添加虚拟物体,在添加虚拟物体时,需要考虑虚拟光源的照射对虚拟物体的影响,采用本申请实施例提供的方法显示虚拟物体,能够考虑在光源照射下虚拟物体表面产生的漫反射效果和反光效果,从而提高了虚拟物体的显示效果。The user can use the camera of the terminal to take a picture of the actual scene, and add a virtual object to the picture. When adding a virtual object, it is necessary to consider the influence of the illumination of the virtual light source on the virtual object, and the method provided by the embodiment of the present application is used to display the virtual object , the diffuse reflection effect and reflective effect generated by 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.
图2是根据一示例性实施例示出的另一种虚拟物体显示方法的流程图,参见图2,该方法应用于终端中,该终端为便携式、袖珍式、手持式等多种类型的终端,如手机、计算机、平板电脑等,该方法包括以下步骤:Fig. 2 is a flow chart showing another method for displaying virtual objects according to an exemplary embodiment. Referring to Fig. 2, the method is applied to a terminal, and the terminal is a portable, pocket, hand-held and other various types of terminals, Such as mobile phones, computers, tablet computers, etc., the method includes the following steps:
201、终端获取虚拟物体的物体参数。201. The terminal acquires object parameters of the virtual object.
本公开实施例中,为了使虚拟物体的显示效果更加自然,在虚拟物体表面添加贴图,在选择贴图时,考虑虚拟物体在光源照射下虚拟物体表面的亮度,以选择亮度与虚拟物体表面的亮度匹配的贴图,将贴图添加至虚拟物体表面上,以模拟出虚拟物体表面在光源照射下的效果,提高虚拟物体的显示效果。In the embodiment of the present disclosure, 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 a texture, the brightness of the surface of the virtual object under the illumination of the light source is considered to select the brightness and the brightness of the surface of the virtual object. Match the texture, add the texture to the surface of the virtual object to simulate the effect of the surface of the virtual object under the illumination of the light source, and improve the display effect of the virtual object.
虚拟物体是指虚拟场景中设置的物体,可选地,该虚拟物体为人物、动物、植物等动态物体,或者为桌、椅等静态物体。虚拟物体的物体参数为在虚拟场景中显示虚拟物体时所需的参数,根据虚拟物体的物体参数,能够确定虚拟物体在虚拟光源照射下的产生的各项参数,该各项参数用于描述虚拟物体在虚拟光源照射下显示效果应该满足的条件。后续即可根据各项参数选择对应的贴图,以使选择的贴图添加至虚拟物体表面时达到的显示效果满足条件。The virtual object refers to an object set in a virtual scene. Optionally, the virtual object is a dynamic object such as a character, an animal, or a plant, or a static object such as a table or chair. The object parameters of the virtual object are the parameters required to display the virtual object in the virtual scene. According to the object parameters of the virtual object, various parameters generated by the virtual object under the illumination of the virtual light source can be determined. These parameters are used to describe the virtual object. The conditions that the object should meet under the illumination of the virtual light source. Subsequently, the corresponding texture can be selected according to various parameters, so that the display effect achieved when the selected texture is added to the surface of the virtual object meets the conditions.
在一种可能实现方式中,由于虚拟物体表面包括多个位置点,每个位置点有对应的物体参数,则虚拟物体的物体参数包括多个位置点处的法线向量及光照向量。其中,任一位置点处的法线向量为该位置点的法线方向上的向量,即与该位置点所在的虚拟物体表面垂直的方向上的向量,任一位置点处的光照向量为该位置点的光线照射方向上的向量。In a possible implementation manner, since the surface of the virtual object includes multiple position points, and 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. Among them, the normal vector at any position point is the vector in the normal direction of the position point, that is, the vector in the direction perpendicular to the surface of the virtual object where the position point is located, and the illumination vector at any position point is the The vector in the direction in which the ray hits the location point.
例如,参见图3所示的位置点示意图,位置点A为球体表面上的一个位置点,向量N为该位置点A处的法线向量,向量L为该位置点A处的光照向量。For example, referring to the schematic diagram of the position point shown in FIG. 3 , 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.
202、终端根据多个位置点的法线向量及光照向量,获取虚拟物体的漫反射参数及反光参数。202. The terminal acquires the diffuse reflection parameter and the reflection parameter of the virtual object according to the normal vector and the illumination vector of the multiple position points.
本公开实施例中,由于在光源的照射下,物体表面会产生漫反射现象以及反光现象,因此为了使虚拟物体的显示效果更加逼真,获取虚拟物体表面的漫反射参数及反光参数,漫反射参数用于描述虚拟物体在虚拟光源照射下应该满足的漫反射条件,反光参数用于描述虚拟物体在虚拟光源照射下应该满足的反光条件,以根据该漫反射参数及反光参数显示虚拟物体。In the embodiment of the present disclosure, under the illumination of the light source, the surface of the object will produce diffuse reflection and reflection. Therefore, in order to make the display effect of the virtual object more realistic, the diffuse reflection parameters and reflection parameters of the surface of the virtual object are obtained. It is used to describe the diffuse reflection condition that the virtual object should meet under the illumination of the virtual light source, and the reflection parameter is used to describe the reflection condition 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 parameter and the reflection parameter.
由于虚拟物体在虚拟场景中除了受到虚拟光源的照射之外,还会受到虚拟场景中其他虚拟物体的反射光的照射,其他虚拟物体的反射光的照射会对虚拟物体表面上较暗的部位产生影响,即虚拟物体表面上较暗的部位在受到其他虚拟物体的反射光的照射时,亮度会提高一些。即虚拟物体受到虚拟光源照射时产生的漫反射参数越小,虚拟物体表面越暗,此时再受到其他虚拟物体的反射光的照射时,该反射光对虚拟物体表面上的亮度的影响较大,产生的反光参数越大,因此,虚拟物体的漫反射参数与反光参数呈负相关关系。In the virtual scene, in addition to being illuminated by the virtual light source, the virtual object will also be illuminated by the reflected light of other virtual objects in the virtual scene. Influence, that is, the brightness of the darker part on the surface of the virtual object will increase when it is 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, and when it is illuminated by the reflected light of other virtual objects, the reflected light will have a greater impact on the brightness on the surface of the virtual object. , the larger the reflection parameter is, the more the diffuse reflection parameter of the virtual object is negatively correlated with the reflection parameter.
也就是说,虚拟物体的漫反射参数与反光参数受到光照强度的影响,光照强度越大,虚拟物体表面越亮,漫反射参数越大,受到反射光的影响越小,反光参数越小;光照强度越小,虚拟物体表面越暗,漫反射参数越小,受到反射光的影响越大,反光参数越大。That is to say, the diffuse reflection parameters and reflective parameters of virtual objects are affected by the light intensity. The greater the light intensity, the brighter the surface of the virtual object. The smaller the 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 greater the reflection parameter.
虚拟物体的漫反射参数包括虚拟物体表面上多个位置点的漫反射子参数,虚拟物体的反光参数包括虚拟物体表面上多个位置点的反光子参数。由于虚拟物体表面上包括多个位置点,获取虚拟物体的漫反射参数及反光参数时,需要分别获取每个位置点的漫反射子参数及反光子参数,将多个位置点的漫反射子参数进行组合,得到虚拟物体的漫反射参数,将多个位置点的反光子参数进行组合,得到虚拟物体的反光参数。例如,虚拟物体的漫反射参数为矩阵,则每个位置点的漫反射子参数为矩阵中的每个元素。The diffuse reflection parameters of the virtual object include diffuse reflection sub-parameters of multiple positions on the surface of the virtual object, and the reflection parameters of the virtual object include reflection sub-parameters of multiple positions on the surface of the virtual object. Since the surface of the virtual object 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 the reflection photon parameters of each position point respectively. Combination is performed to obtain the diffuse reflection parameters of the virtual object, and the reflection photon parameters of multiple position points are combined to obtain the reflection parameters of the virtual object. For example, if the diffuse reflection parameter of a virtual object is a matrix, the diffuse reflection sub-parameter of each position point is each element in the matrix.
本公开实施例以获取任一位置点的漫反射子参数及反光子参数为例进行说明。The embodiment of the present disclosure is described by taking the acquisition of the diffuse reflection sub-parameter and the reflection sub-parameter of any position point as an example.
在一种可能实现方式中,由于漫反射现象是指光线照射到粗糙的物体表面,物体表面每个位置点处的法线方向不一致,导致光线向不同的方向反射的现象,因此终端根据位置点的法线向量及光照向量,获取该位置点的漫反射子参数。In a possible implementation, since the diffuse reflection phenomenon refers to the phenomenon that the light irradiates the rough object surface, the normal direction of each position point on the object surface is inconsistent, resulting in the phenomenon that the light is reflected in different directions, so the terminal according to the position point The normal vector and light vector of , and the diffuse sub-parameters of the position point are obtained.
可选地,终端采用(0,1)表示虚拟物体表面上位置点的亮度,0表示最亮,1表示最暗。由于两个向量的点积存在小于0的情况,因此终端将法线向量与光照向量的点积,作为第一数值,将该第一数值和0中较大的数值,确定为该位置点的漫反射子参数。即如果点积小于0,将0作为漫反射子参数,如果点积不小于0,将第一数值作为漫反射子参数。Optionally, the terminal uses (0, 1) to represent the brightness of the position point on the surface of the virtual object, 0 represents the brightest, and 1 represents the darkest. Since the dot product of the two vectors is less than 0, the terminal takes 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 value of the position point. Diffuse subparameter. That is, if the dot product is less than 0, 0 is used as the diffuse sub-parameter, and if the dot product is not less than 0, the first value is used as the diffuse sub-parameter.
例如,采用下述公式,获取位置点的漫反射子参数:For example, use the following formula to obtain the diffuse subparameter of the location point:
D=max(0,dot(N,L));D=max(0, dot(N, L));
其中,D表示位置点的漫反射子参数,N表示位置点的法线向量,L表示位置点的光照向量,dot(N,L)表示求取N与L的点积。Among them, D represents the diffuse reflection sub-parameter of the location point, N represents the normal vector of the location point, L represents the illumination vector of the location point, and dot(N, L) represents the dot product of N and L.
由于虚拟物体表面的亮度不仅受到虚拟光源的影响,还受到其他虚拟物体的反射光的影响,因此,终端还需要获取每个位置点的反光子参数。Since the brightness of the surface of the 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 reflection photon parameters of each position point.
在一种可能实现方式中,终端对漫反射子参数进行取反处理,得到该位置点的第一反光子参数,根据预先设置的第一调整参数,调整第一反光子参数,得到该位置点的第二反光子参数,该第二反光子参数表示该位置点受到其他虚拟物体的反射光照射时的亮度。In a possible implementation manner, the terminal performs inversion processing on the diffuse reflection sub-parameter to obtain the first reflection photon parameter of the position point, and adjusts the first reflection photon parameter according to the preset first adjustment parameter to obtain the position point The second reflection photon parameter of , the second reflection photon parameter indicates the brightness when the position point is illuminated by the reflected light of other virtual objects.
其中,对漫反射子参数进行取反处理是为了确定位置点处受到其他虚拟物体的反射光的照射时,对该位置点的亮度的影响。可选地,1表示最亮,0表示最暗,取反处理是将1与漫反射子参数相减。例如,位置点的漫反射子参数为0,则该位置点的亮度最低,即最暗,那么对0进行取反处理,得到第一反光子参数1,1表示该位置点受到其他虚拟物体的反射光照射时亮度会提高较多。The inversion processing of the diffuse reflection sub-parameter is to determine the influence on the brightness of the position point when the position point is irradiated by the reflected light of other virtual objects. Optionally, 1 means the brightest, 0 means the darkest, and the negation process is to subtract 1 from the diffuse subparameter. 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. 1 means that the position point is affected by other virtual objects. Brightness will increase more when illuminated by reflected light.
如果将取反处理得到的第一反光子参数作为位置点的反光子参数,那么对漫反射子参数和反光子参数相加之后,得到的值为0,位置点对光线没有反射效果,因此根据第一调整参数对第一反光子参数进行调整,得到调整后的第二反光子参数,以便采用漫反射子参数和调整后的第二反光子参数相加之后的参数来准确反映位置点的亮度。其中,第一调整参数用于表示反射光对虚拟物体的影响程度,根据其他虚拟物体的反射光的强度进行设置,如果其他虚拟物体的反射光较强,即其他虚拟物体的反射光对该虚拟物体的影响较大,则第一调整参数为一个较大的参数,如果其他虚拟物体的反射光较弱,即其他虚拟物体的反射光对该虚拟物体的影响较小,则第一调整参数为一个较小的参数,该第一调整参数大于0小于1。If the first reflection photon parameter obtained by the negation process is used as the reflection photon parameter of the position point, then after adding the diffuse reflection sub-parameter and the reflection photon parameter, the obtained value is 0, and the position point has no reflection effect on light, so according to The first adjustment parameter adjusts the first reflection sub-parameter to obtain the adjusted second reflection sub-parameter, so that the parameter after the diffuse reflection sub-parameter and the adjusted second reflection sub-parameter are added 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 influence of the object is greater, 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 less influence on the virtual object, then the first adjustment parameter is A smaller parameter, the first adjustment parameter is greater than 0 and less than 1.
例如,参见图4所示的虚拟物体,在虚拟光源位于右上方的情况下,图4中左图的虚拟物体在虚拟光源照射下,右侧较亮,左下角较暗,但是其他虚拟物体的反射光线的照射在虚拟物体中产生的亮度与虚拟光源的照射产生的亮度相反,如图4中右图的虚拟物体,右侧较暗,左下角较亮。For example, referring to the virtual object shown in Figure 4, when the virtual light source is located at the upper right, the virtual object on the left in Figure 4 is illuminated by the virtual light source, the right side is brighter, and the lower left corner is darker, but other virtual objects have The brightness generated by the irradiation of the reflected light in the virtual object is opposite to the brightness generated by the irradiation of the virtual light source. For the virtual object on the right in Figure 4, the right side is darker and the lower left corner is brighter.
203、终端确定与漫反射参数及反光参数匹配的目标贴图。203. The terminal determines a target map matching the diffuse reflection parameter and the reflection parameter.
本公开实施例中,由于终端在显示虚拟物体时,需要在虚拟物体表面上添加贴图,用户看到的虚拟物体是添加贴图后的虚拟物体。但是贴图的选择对虚拟物体显示的效果有较大的影响,例如,虚拟物体的某一位置点没有光线照射,那么,该位置点较暗,需要的贴图应该是较暗的贴图,如果采用较亮的贴图会导致该位置点的显示效果与实际情况不相符,显示效果会较差。由于漫反射参数及反光参数均是用于表示虚拟物体表面的亮度,因此,根据漫反射参数及反光参数确定匹配的目标贴图,以使将目标贴图添加至虚拟物体表面后呈现出较好的显示效果。In the embodiment of the present disclosure, 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 selection of the texture has a great impact 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 dark, and the required texture should be a darker texture. A bright map will cause the display effect of the position point to be inconsistent with the actual situation, and the display effect will be poor. Since both the diffuse reflection parameter and the reflective parameter are used to represent the brightness of the surface of the virtual object, the matching target map is determined according to the diffuse reflection parameter and the reflective parameter, so that the target map can be added to the surface of the virtual object to show a better display Effect.
在一种可能实现方式中,终端在确定与漫反射参数及反光参数匹配的目标贴图之前,需要先获取多个备选贴图,由于虚拟物体在显示时,在虚拟光源照射下,虚拟物体的不同部分的亮度不同,因此该多个备选贴图的亮度也不同,以使该多个备选贴图能够满足虚拟物体显示的不同亮度的要求。In a possible implementation manner, before determining the target texture matching the diffuse reflection parameters and the reflective parameters, the terminal needs to obtain multiple candidate textures. Since the virtual object is displayed under the illumination of the virtual light source, the difference between the virtual objects is different. The brightness of the parts is different, so the brightness of the multiple candidate textures is also different, so that the multiple candidate textures can meet the requirements of different brightness displayed by the virtual object.
将该多个备选贴图按照亮度从大到小依次排序之后,确定每个备选贴图的序号,其中,备选贴图的序号表征备选贴图的亮度,不同备选贴图的序号不同,即不同备选贴图的亮度不同,序号越小表示备选贴图的亮度越亮,序号越大表示备选贴图的亮度越暗。其中,目标贴图为该多个备选贴图中的任一备选贴图,或者为多个备选贴图融合之后的贴图。After sorting the multiple candidate textures in descending order of brightness, determine the serial number of each candidate texture, wherein the serial number of the candidate texture represents the brightness of the candidate texture, and the serial numbers of different candidate textures are different, that is, different The brightness of the candidate textures is different. The smaller the number, the brighter the brightness of the candidate texture, and the higher the number, the darker the brightness of the candidate texture. The target texture is any candidate texture among the multiple candidate textures, or a texture after fusion of the multiple candidate textures.
本公开实施例是为了根据虚拟物体表面上位置点的亮度,获取能够反映该位置点的亮度的贴图,以使将贴图添加至虚拟物体后,虚拟物体的显示效果与实际的显示效果相符合。The embodiment of the present disclosure is to obtain a map that can reflect the brightness of a position point on the surface of a virtual object according to the brightness of the position 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.
在一种可能实现方式中,素描图像由线条构成,若要在虚拟物体的图像中显示出素描效果,则获取的备选贴图为线条图,备选贴图中线条的分布越稀疏,则备选贴图越亮,备选贴图中线条的分布越紧密,则备选贴图越暗。例如,参见图5所示的备选贴图,从左至右,这6个备选贴图的亮度依次降低,第一个备选贴图的序号为0,第二个备选贴图的序号为1,直至最后一个贴图的序号为5。In a possible implementation manner, the sketch image is composed of lines. To display the sketch effect in the image of the virtual object, the obtained alternative map is a line map. The sparser the distribution of lines in the alternative map, the alternative map The brighter the map and the tighter the distribution of lines in the alternative map, the darker the alternative map. For example, referring to the candidate textures shown in Figure 5, from left to right, the brightness of these 6 candidate textures decreases in turn, the sequence number of the first candidate texture is 0, and the sequence number of the second candidate texture is 1. The sequence number until the last texture is 5.
另外,备选贴图的数量越多,对亮度的划分越精细,终端能够选择的备选贴图越多,显示效果越好。In addition, the greater the number of candidate textures, the finer the division of brightness, the more candidate textures the terminal can select, and the better the display effect.
在另一种可能实现方式中,如果虚拟物体显示的是除素描效果以外的其他效果,那么根据其他效果获取相应类型的贴图。例如,为了模拟点阵的效果,则备选贴图为由多个点构成。In another possible implementation manner, if the virtual object displays other effects than the sketch effect, a corresponding type of texture is obtained according to the other effects. For example, in order to simulate the effect of a dot matrix, the alternative map is composed of multiple points.
在一种可能实现方式中,终端确定与漫反射参数及反光参数匹配的目标贴图,包括:终端根据每个位置点的漫反射子参数及反光子参数,分别获取每个位置点的亮度子参数;根据每个位置点的亮度子参数和多个备选贴图的序号,分别获取多个备选贴图的权重;按照每个位置点对应的多个备选贴图的权重,确定目标贴图。In a possible implementation manner, the terminal determines the target texture matching the diffuse reflection parameter and the reflection parameter, including: the terminal obtains the brightness sub-parameter of each position point according to the diffuse reflection sub-parameter and the reflection photon parameter of each position point respectively ;According to the brightness sub-parameter of each position point and the serial number of the multiple candidate textures, the weights of the multiple candidate textures are obtained respectively; the target texture is determined according to the weights of the multiple candidate textures corresponding to each position point.
在确定虚拟物体的目标贴图时,由于虚拟物体中包括多个位置点,且每个位置点受到的光照不同,即每个位置点的亮度不同,因此,为了使虚拟物体的目标贴图更加符合实际的光照,需要分别确定每个位置点对应的目标贴图,将每个位置点对应的目标贴图组合在一起,得到虚拟物体的目标贴图。When determining the target map of the virtual object, since the virtual object includes multiple position points, and each position point receives different lighting, that is, the brightness of each position point is different, therefore, in order to make the target map of the virtual object more realistic It is necessary to determine the target map corresponding to each position point separately, and combine the target maps corresponding to each position point to obtain the target map of the virtual object.
其中,漫反射子参数及反光子参数均用于反映位置点对应的亮度,如果仅根据漫反射子参数获取亮度子参数,那么显示的虚拟物体中体现不出虚拟物体的反光效果,导致显示的虚拟物体与实际情况不相符,显示效果较差,因此根据漫反射子参数及反光子参数,获取该位置点的亮度子参数,以使得到的亮度子参数能够更加准确地反映该位置点的亮度。Among them, the diffuse reflection sub-parameter and the reflection sub-parameter are both used to reflect the brightness corresponding to the position point. If the brightness sub-parameter is only obtained according to the diffuse reflection sub-parameter, the displayed virtual object will not reflect the reflection effect of the virtual object, resulting in the display of the brightness sub-parameter. The virtual object does not match the actual situation, and the display effect is poor. Therefore, the brightness sub-parameter of the position point is obtained according to the diffuse reflection sub-parameter and the reflection sub-parameter, so that the obtained brightness sub-parameter can more accurately reflect the brightness of the position point. .
在一种可能实现方式中,终端根据每个位置点的漫反射子参数及反光子参数,分别获取每个位置点的亮度子参数,包括:终端对于每个位置点,将该位置点的漫反射子参数与反光子参数相加,得到位置点的第一亮度子参数;将第一亮度子参数与备选贴图的数量相乘,得到该位置点的第二亮度子参数,将该第二亮度子参数作为该位置点的亮度子参数。In a possible implementation manner, the terminal obtains the brightness sub-parameter of each position point according to the diffuse reflection sub-parameter and the reflection sub-parameter of each position point, including: for each position point, the terminal obtains the diffuse reflection sub-parameter of the position point The reflection sub-parameter and the reflection sub-parameter are added to obtain the first brightness sub-parameter of the position point; the first brightness sub-parameter is multiplied by the number of alternative maps to obtain the second brightness sub-parameter of the position point, and the second brightness sub-parameter of the position point is obtained. The brightness sub-parameter is used as the brightness sub-parameter of the position point.
在一种可能实现方式中,终端根据每个位置点的亮度子参数和多个备选贴图的序号,分别获取多个备选贴图的权重,包括:终端对于每个位置点,根据该位置点的亮度子参数与每个备选贴图的序号之间的差值,确定每个备选贴图的匹配参数;将相邻的任两个备选贴图的匹配参数之间的差值,作为该任两个备选贴图中的第一个备选贴图的权重,且将最后一个备选贴图的匹配参数,作为最后一个备选贴图的权重。其中,匹配参数表征备选贴图的亮度与位置点的亮度之间的匹配程度,相邻的任两个备选贴图是指按照亮度依次排列的多个备选贴图中相邻的两个备选贴图。In a possible implementation manner, the terminal obtains the weights of the multiple candidate textures respectively according to the luminance sub-parameter of each position point and the serial numbers of the multiple candidate textures, including: The difference between the brightness sub-parameter of the sub-parameter and the serial number of each candidate texture determines the matching parameter of each candidate texture; the difference between the matching parameters of any two adjacent candidate textures is used as the matching parameter of each candidate texture. The weight of the first candidate texture among the two candidate textures, and the matching parameters of the last candidate texture are used as the weight of the last candidate texture. The matching parameter represents the degree of matching between the brightness of the candidate texture and the brightness of the position point, and any two adjacent candidate textures refer to two adjacent candidates in the multiple candidate textures arranged in order of brightness map.
如果备选贴图的序号较小,该亮度子参数与备选贴图的序号之间的差值较大,如果备选贴图的序号较小,该亮度子参数与备选贴图的序号之间的差值较小,而匹配参数的取值范围是固定的,因此,响应于差值大于第一参考数据,将第一参考数值作为备选贴图的匹配参数;响应于差值小于第二参考数值,将第二参考数值作为备选贴图的匹配参数;响应于差值不大于第一参考数值,且不小于第二参考数值,将差值作为备选贴图的匹配参数。其中,第一参考数值大于第二参考数值。If the sequence number of the candidate map is small, the difference between the luminance sub-parameter and the sequence number of the candidate map is larger. If the sequence number of the candidate map is small, the difference between the luminance sub-parameter and the sequence number of the candidate map is larger. The value is smaller, and 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 smaller than the second reference value, The second reference value is used as the matching parameter of the candidate texture; 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 texture. Wherein, the first reference value is greater than the second reference value.
例如,有6个备选贴图,这六个备选贴图从亮到暗的序号依次为0、1、2、3、4和5,漫反射子参数与反光子参数相加为0.75,亮度子参数为4.5,则亮度子参数与六个备选贴图的序号之间的差值依次为4.5、3.5、2.5、1.5、0.5和-0.5,第一参考数值为1,第二参考数值为0,则得到六个备选贴图的匹配参数依次为1、1、1、1、0.5和0,从而得到六个备选贴图的权重依次为0、0、0、0.5、0.5和0。For example, there are 6 alternative maps, the sequence numbers of these six alternative maps from light to dark are 0, 1, 2, 3, 4 and 5, the sum of the diffuse sub-parameter and the reflection sub-parameter is 0.75, and the luminance sub-parameter is added to 0.75. If the parameter is 4.5, the difference between the luminance sub-parameter and the serial numbers of the six candidate maps is 4.5, 3.5, 2.5, 1.5, 0.5 and -0.5, the first reference value is 1, the second reference value is 0, Then, the matching parameters of the six candidate textures are 1, 1, 1, 1, 0.5, and 0, and the weights of the six candidate textures are 0, 0, 0, 0.5, 0.5, and 0 in sequence.
在另一种可能实现方式中,如果对每个备选图像单独进行存储,则每个备选图像占用一个存储空间,总共需要占用加大的存储空间,则对多个备选图像进行融合,以减少需要存储的图像的数量,节省存储空间。因此,终端按照多个备选贴图的序号,依次将序号相邻的备选贴图进行融合,得到至少一个融合贴图。其中,融合贴图的红色通道、绿色通道或蓝色通道中的至少一个通道对应一个备选贴图,序号相邻的备选贴图是指序号相邻的两个或三个备选贴图。In another possible implementation manner, if each candidate image is stored separately, each candidate image occupies one storage space, which needs to occupy an increased storage space in total, and then multiple candidate images are fused, To reduce the number of images that need to be stored, save storage space. Therefore, the terminal sequentially fuses candidate textures with adjacent serial numbers according to the sequence numbers of the multiple candidate textures to obtain at least one fused texture. Wherein, at least one of the red channel, green channel or blue channel of the fusion map corresponds to one candidate map, and the candidate maps with adjacent serial numbers refer to two or three candidate maps with adjacent serial numbers.
例如,参见图5,有六个备选贴图,这六个备选贴图的序号依次为0、1、2、3、4和5,将序号相邻的三个备选贴图进行融合,参见图6,将序号为0、1和2的备选贴图进行融合,得到图6左边的融合贴图,该融合贴图的红色通道对应序号为0的备选贴图,绿色通道对应序号为1的备选贴图,蓝色通道对应序号为2的备选贴图,将序号为3、4和5的备选贴图进行融合,得到图6右边的融合贴图,该融合贴图的红色通道对应序号为3的备选贴图,绿色通道对应序号为4的贴图,蓝色通道对应序号为5的备选贴图。For example, referring to Figure 5, there are six candidate textures, and the serial numbers of these six candidate textures are 0, 1, 2, 3, 4, and 5 in sequence, and the three candidate textures with adjacent serial numbers are fused, see Figure 6. Fusion of the alternative textures with serial numbers 0, 1 and 2 to obtain the fusion texture on the left of Figure 6. The red channel of the fusion texture corresponds to the alternative texture with serial number 0, and the green channel corresponds to the alternative texture with serial number 1. , the blue channel corresponds to the alternative texture with serial number 2, and the alternative textures with serial numbers 3, 4 and 5 are fused to obtain the fusion texture on the right side of Figure 6. The red channel of the fusion texture corresponds to the alternative texture with serial number 3 , the green channel corresponds to the texture number 4, and the blue channel corresponds to the alternative texture number 5.
那么,终端根据位置点的亮度子参数与每个备选贴图的序号之间的差值,确定每个备选贴图的匹配参数,包括:终端获取每个融合贴图的序号矩阵;获取亮度子参数矩阵;获取亮度子参数矩阵与每个融合贴图的序号矩阵之间的差值,确定匹配参数矩阵。其中,融合贴图的序号矩阵包括融合贴图中每个备选贴图的序号。Then, the terminal determines the matching parameters of each candidate texture according to the difference between the brightness sub-parameter of the position point and the sequence number of each candidate texture, including: the terminal obtains the sequence number matrix of each fusion texture; obtains the brightness sub-parameter Matrix; obtains the difference between the luminance sub-parameter matrix and the sequence number matrix of each fusion map, and determines the matching parameter matrix. The sequence number matrix of the fusion map includes the sequence number of each candidate map in the fusion map.
例如,融合贴图中包括三个备选贴图,每个备选贴图的序号依次为0、1和2,则序号矩阵为(0,1,2);亮度子参数矩阵包括多个亮度子参数,且多个亮度子参数的数量等于融合贴图中包含的备选贴图的数量,例如,亮度子参数为4.5,融合贴图中包括三个备选贴图,则亮度子参数矩阵为(4.5,4.5,4.5);匹配参数矩阵包括每个备选贴图的匹配参数,例如,亮度子参数矩阵为(4.5,4.5,4.5)与序号矩阵为(0,1,2)的差值为(4.5,3.5,2.5),则匹配参数矩阵为(1,1,1)。For example, if the fusion map includes three candidate maps, and the serial numbers of each candidate map are 0, 1, and 2, the serial number matrix is (0, 1, 2); the luminance sub-parameter matrix includes multiple luminance sub-parameters, And the number of multiple luminance sub-parameters is equal to the number of candidate textures included in the fusion texture. For example, if the luminance sub-parameter is 4.5, and the fusion texture includes three candidate textures, the luminance sub-parameter matrix is (4.5, 4.5, 4.5 ); the matching parameter matrix includes the matching parameters of each candidate texture. For example, the difference between the luminance sub-parameter matrix (4.5, 4.5, 4.5) and the sequence number matrix (0, 1, 2) is (4.5, 3.5, 2.5) ), the matching parameter matrix is (1, 1, 1).
终端得到每个融合贴图对应的匹配参数矩阵之后,将相邻的任两个备选贴图的匹配参数之间的差值,作为该任两个备选贴图中的第一个备选贴图的权重,且将最后一个备选贴图的匹配参数,作为最后一个备选贴图的权重。After the terminal obtains the matching parameter matrix corresponding to each fusion texture, the difference between the matching parameters of any two adjacent candidate textures is used as the weight of the first candidate texture in the any two candidate textures , and the matching parameter of the last candidate texture is used as the weight of the last candidate texture.
例如,采用下述公式,获取每个备选贴图的权重:For example, use the following formula to get the weight of each candidate texture:
weights=saturate((intensity*m)-(a1,a2,a3));weights=saturate((intensity*m)-(a1,a2,a3));
其中,weights表示融合贴图的匹配参数矩阵,intensity表示位置点的亮度子参数,m表示备选贴图的数量,a表示备选贴图的序号,saturate(·)表示将得到的每个匹配参数限制在0和1之间,即如果intensity*m-a1大于1,则intensity*m-a1的结果为1,如果intensity*m-a1小于0,则intensity*m-a1的结果为0。Among them, weights represents the matching parameter matrix of the fusion 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 maps, and saturate( ) represents that each matching parameter obtained is limited to Between 0 and 1, that is, if intensity*m-a1 is greater than 1, the result of intensity*m-a1 is 1, and if intensity*m-a1 is less than 0, the result of intensity*m-a1 is 0.
上述采用亮度子参数矩阵和序号矩阵确定匹配参数矩阵的过程中,进行一次计算即可得到两个或三个备选贴图的匹配参数,与分别计算每个备选贴图的匹配参数相比较,减小了计算量,提高了获取权重的速度。In the above process of determining the matching parameter matrix by using the brightness sub-parameter matrix and the sequence number matrix, the matching parameters of two or three alternative textures can be obtained by performing one calculation. The amount of calculation is reduced, and the speed of obtaining weights is improved.
另外,在对多个备选贴图进行融合时,如果备选贴图的数量为3的倍数,则将相邻的三个备选贴图融合为一个融合贴图;如果备选贴图的数量不是3的倍数,且剩余一个备选贴图时,直接将剩余的一个备选贴图作为一个融合贴图;如果备选贴图的数量不是3的倍数,且剩余两个备选贴图时,将剩余的两个备选贴图进行融合。In addition, when merging multiple candidate textures, if the number of candidate textures is a multiple of 3, the adjacent three candidate textures are fused into one fusion texture; if the number of candidate textures is not a multiple of 3 , and when there is one candidate texture left, the remaining candidate texture is directly used as a fusion texture; if the number of candidate textures is not a multiple of 3, and there are two remaining candidate textures, the remaining two candidate textures will be used as a fusion texture. Fusion.
在一种可能实现方式中,终端按照每个备选贴图对应的权重,确定目标贴图,包括:终端将最大的权重对应的备选贴图作为目标贴图;或者,终端按照每个备选贴图的权重,对多个备选贴图进行加权融合,将融合后的贴图作为目标贴图。In a possible implementation manner, 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 determines the target texture according to the weight of each candidate texture. , perform weighted fusion of multiple candidate textures, and use the fused texture as the target texture.
204、终端根据多个位置点的法线向量、光照向量及视角向量,获取虚拟物体的高光参数。204. The terminal acquires the highlight parameter of the virtual object according to the normal vector, the illumination vector, and the viewing angle vector of the multiple position points.
可选地,物体参数还包括视角向量,位置点的视角向量为虚拟摄像机相对于位置点的方向上的向量。在虚拟场景中设置虚拟摄像机,虚拟摄像机对虚拟物体所在的场景进行拍摄得到的画面,即为终端显示的包括虚拟物体的画面。虚拟光源照射到虚拟物体表面的位置点后,如果该位置点直接将光线反射至虚拟摄像机所处的位置,既虚拟摄像机直接拍摄该位置点,那么此时该位置点即为最亮的位置点。Optionally, the object parameter further includes 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 illuminates the position point on the surface of the virtual object, if the position point directly reflects the light to the position where the virtual camera is located, that is, the virtual camera directly shoots the position point, then the position point is the brightest position point at this time. .
例如,参见图3所示的位置点的示意图,向量H为位置点A处的视角向量。For example, referring to the schematic diagram of the position point shown in FIG. 3 , the vector H is the viewing angle vector at the position point A.
本公开实施例以获取一个位置点的高光子参数为例进行说明。高光参数表征虚拟物体表面上最亮的位置点。因此,根据位置点的法线向量、光照向量及视角向量,获取虚拟物体的高光参数。The embodiment of the present disclosure is described by taking the acquisition of the hyperphoton parameter of a position point as an example. The specular parameter represents the brightest point on the surface of the virtual object. Therefore, the specular parameters of the virtual object are obtained according to the normal vector, the illumination vector and the viewing angle vector of the position point.
在一种可能实现方式中,终端将位置点的视角向量与光照向量的和向量与位置点的法线向量的点积,作为第二数值;将第二数值和0中较大的数值与光照向量的乘积,作为第一高光子参数;根据预先设置的第二调整参数,调整第一高光子参数,得到第二高光子参数,将第二高光子参数作为位置点的高光子参数。其中,和向量为视角向量与光照向量相加得到的半角向量。In a possible implementation manner, the terminal takes the dot product of the view vector of the position point, the sum vector of the illumination vector, and the normal vector of the position point, as the second value; The product of the vectors is used as the first hyperphoton parameter; according to the preset second adjustment parameter, the first hyperphoton parameter is adjusted to obtain the second hyperphoton parameter, and the second hyperphoton parameter is used as the hyperphoton parameter of the position point. Among them, the sum vector is the half-width vector obtained by adding the viewing angle vector and the light vector.
当高光子参数大于某一参考数值时,表示该高光子参数对应的位置点是最亮的位置点,后续现在虚拟物体时,该位置点最亮;当高光子参数小于某一预设参数时,表示该高光子参数对应的位置点不是最亮的位置点,后续在显示虚拟物体时,按照该位置点的目标贴图进行显示即可。例如,参见图7所示的虚拟物体,该虚拟物体的左上角的白色区域,该白色区域为虚拟物体中最亮的区域,该白色区域中包括高光参数指示的多个位置点。When the hyperphoton parameter is greater than a certain reference value, it indicates that the position point corresponding to the hyperphoton parameter is the brightest position point, and when the virtual object is present, the position point is the brightest; when the hyperphoton parameter is less than a preset parameter , indicating that the position point corresponding to the high photon parameter is not the brightest position point. When displaying the virtual object later, it can be displayed according to the target map of the position point. For example, referring to the virtual object shown in FIG. 7 , the white area in the upper left corner of the virtual object is the brightest area in the virtual object, and the white area includes multiple position points indicated by the highlight parameter.
其中,第二调整参数为任一大于0小于1的数值,例如,为0.1、0.2等数值。该第二调整参数越小,得到的高光子参数越小,相应的,虚拟物体中显示的高光范围越小;该第二调节参数越大,得到的高光子参数越大,相应的,虚拟物体中显示的高光范围越大。The second adjustment parameter is any value greater than 0 and less than 1, for example, a value such as 0.1 and 0.2. The smaller the second adjustment parameter, the smaller the obtained hyperphoton parameter, correspondingly, the smaller the highlight range displayed in the virtual object; the larger the second adjustment parameter, the larger the obtained hyperphoton parameter, and correspondingly, the virtual object The larger the range of highlights displayed in .
例如,参见下述公式,获取位置点的高光子参数:For example, see the following formula to obtain the hyperphoton parameters of the location point:
G=I*max(0,dot(N,H));G=I*max(0, dot(N, H));
其中,G表示高光参数,I表示视角向量,N表示法线向量,H表示光照向量,dot(N,H)表示求取N与H的点积。Among them, G represents the highlight parameter, I represents the viewing angle vector, N represents the normal vector, H represents the illumination vector, and dot(N, H) represents the dot product of N and H.
205、终端在虚拟物体表面添加目标贴图,根据高光参数显示添加目标贴图后的虚拟物体。205. The terminal adds a target texture on the surface of the virtual object, and displays the virtual object after adding the target texture according to the specular parameter.
本公开实施例中,终端确定每个位置点的目标贴图之后,在虚拟物体表面的每个位置点添加对应的目标贴图,显示添加目标贴图后的虚拟物体,该目标贴图反映了虚拟物体表面上每个位置点的亮度,用户看到的虚拟物体更加符合现实中的物体。可选地,任两个位置点的目标贴图相同或者不同。In the embodiment of the present disclosure, after the terminal determines the target texture of each position point, a corresponding target texture is added to each position point on the surface of the virtual object, and the virtual object after adding the target texture is displayed, and the target texture reflects the surface of the virtual object. The brightness of each position point, the virtual object seen by the user is more in line with the real object. Optionally, the target maps of any two position points are the same or different.
终端获取虚拟物体的高光参数之后,在显示的虚拟物体中添加高光效果,使虚拟物体的高光参数指示的位置点最亮,使用户能够看出虚拟物体中的高光部分。After acquiring the highlight parameter of the virtual object, the terminal adds a highlight effect to the displayed virtual object, so that the position indicated by the highlight parameter of the virtual object is the brightest, so that the user can see the highlight part in the virtual object.
以素描图像为例,参见图8所示的手绘的素描图像,素描图像中绘制的物体有反光和高光,本公开实施例就是为了使虚拟物体模拟出素描图像的显示效果。参见图9中左图所示的虚拟物体,该虚拟物体表面添加的贴图仅是根据漫反射参数确定的,该虚拟物体虽然在一定程度上模拟了素描图像的显示效果,但是,能够明显看出该虚拟物体中没有反光和高光。参见图9中右图所示的虚拟物体,该虚拟物体表面添加的贴图是根据漫反射参数及反光参数确定的,与左图的虚拟物体相比较,左图的虚拟物体的左下角,能够明显看出存在反光,且该右侧的虚拟物体的右上角有明显的高光,该右侧的虚拟物体模拟出了素描图像的显示效果。Taking a sketch image as an example, referring to the hand-drawn sketch image shown in FIG. 8 , the objects drawn in the sketch image have reflections and highlights. The embodiment of the present disclosure is to simulate the display effect of the sketch image for the virtual object. Referring to the virtual object shown on the left in Figure 9, the texture added to the surface of the virtual object is only determined according to 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 are no reflections and highlights in this dummy. Referring to the virtual object shown in the right picture in Figure 9, the texture added to the surface of the virtual object is determined according to the diffuse reflection parameters and reflective parameters. Compared with the virtual object in the left picture, the lower left corner of the virtual object in the left picture can be obviously It can be seen that there is reflection, and the upper right corner of the virtual object on the right has obvious highlights, and the virtual object on the right simulates the display effect of the sketch image.
另外,在一种可能实现方式中,对虚拟物体进行描边处理,即将每个位置点沿着对应的法线方向延伸预设距离,在虚拟物体的表面外侧形成延伸区域,该延伸区域即为虚拟物体的表面外侧显示的边缘,将参考颜色填充至延伸区域,填充的参考颜色即为虚拟物体显示时表面外侧的颜色。终端显示虚拟物体时,在虚拟物体表面添加目标贴图,显示添加目标贴图后的虚拟物体及虚拟物体的表面外侧的延伸区域,从而实现了将虚拟物体向外延伸的显示效果。In addition, in a possible implementation manner, the virtual object is stroked, that is, each position point is extended along the corresponding normal direction by a preset distance, and an extended area is formed outside the surface of the virtual object, and the extended area is For the edge displayed on the outside of the surface of the virtual object, fill the reference color to the extended area, and the filled reference color is the color on the outside of the surface when the virtual object is displayed. When the terminal displays the virtual object, a target texture is added on the surface of the virtual object, and the virtual object after adding the target texture and the extension area outside the surface of the virtual object are displayed, thereby realizing the display effect of extending the virtual object outward.
在一种可能实现方式中,终端获取虚拟物体的高光参数及延伸区域后,在虚拟物体表面添加目标贴图,显示虚拟物体的表面外侧的延伸区域,按照高光参数显示添加目标贴图后的虚拟物体及虚拟物体的表面外侧的延伸区域。In a possible implementation manner, after acquiring the highlight parameters and extension area of the virtual object, the terminal adds a target texture to the surface of the virtual object, displays the extension area outside the surface of the virtual object, and displays the virtual object and the virtual object after adding the target texture according to the highlight parameters. The extended area outside the surface of the virtual object.
另外,对于呈现出素描效果的虚拟物体来说,为了使虚拟场景中的三维虚拟物体能够显示出二维的素描效果,在三维虚拟物体的表面上添加不同亮度的贴图,以使添加贴图后的三维虚拟物体显示出二维的素描效果,用户能够旋转三维虚拟物体,从多个角度查看虚拟物体,避免了从多个角度绘制二维虚拟物体。In addition, for a virtual object showing a sketch effect, in order to enable the three-dimensional virtual object in the virtual scene to display a two-dimensional sketch effect, textures with different brightness are added on the surface of the three-dimensional virtual object, so that the added texture The three-dimensional virtual object displays a two-dimensional sketch effect, and the user can rotate the three-dimensional virtual object to view the virtual object from multiple angles, avoiding drawing the two-dimensional virtual object from multiple angles.
需要说明的是,本公开实施例仅是以分别根据每个位置点的物体参数,获取该位置点对应的目标贴图,分别将多个位置点的目标贴图添加至虚拟物体表面为例进行说明,在另一实施例中,将多个位置点的物体参数作为一个整体,根据该多个位置点的物体参数,获取虚拟物体对应的目标贴图,将该目标贴图添加至虚拟物体表面。It should be noted that, the embodiment of the present disclosure is only described by taking the example of acquiring the target texture corresponding to each position point according to the object parameters of the position point, and adding the target textures of multiple position points to the surface of the virtual object as an example. In another embodiment, the object parameters of multiple position points are taken as a whole, and according to the object parameters of the multiple position points, a target texture corresponding to the virtual object is obtained, and the target texture is added to the surface of the virtual object.
本公开实施例提供的方法,能够获取虚拟物体的漫反射参数及反光参数,由于漫反射参数及反光参数均能够反映虚拟物体的亮度,因此与仅根据漫反射参数确定匹配的贴图相比,根据漫反射参数及反光参数确定匹配的目标贴图时,还考虑了反光现象对虚拟物体显示效果的影响,增加了信息量,使确定的目标贴图能够更加准确地反映该虚拟物体的亮度,从而显示添加目标贴图后的虚拟物体时,该虚拟物体更加逼真,提高了虚拟物体的显示效果。The method provided by the embodiment of the present disclosure can obtain the diffuse reflection parameter and the reflective parameter of the virtual object. Since both the diffuse reflection parameter and the reflective parameter can reflect the brightness of the virtual object, compared with determining the matching map based only on the diffuse reflection parameter, according to When the diffuse reflection parameter and the reflective parameter determine the matching target map, the influence of the reflection phenomenon on the display effect of the virtual object is also considered, and the amount of information is increased, so that the determined target map can more accurately reflect the brightness of the virtual object, so that the display added When the virtual object after the target map is used, the virtual object is more realistic, and the display effect of the virtual object is improved.
并且,本公开实施例中,还会获取虚拟物体表面上多个位置点的视角向量,然后根据该多个位置点的法线向量、光照向量及视角向量,获取虚拟物体的高光参数,由于高光参数能够指示虚拟物体中最亮的位置点,在显示添加目标贴图后的虚拟物体时,考虑高光对虚拟物体显示效果的影响,使虚拟物体更加逼真,进一步提高了虚拟物体的显示效果。In addition, in the embodiment of the present disclosure, the viewing angle vectors of multiple position points on the surface of the virtual object are also obtained, and then the highlight parameters of the virtual object are obtained according to the normal vector, the illumination vector and the viewing angle vector of the multiple position points. The parameter can indicate the brightest point in the virtual object. When displaying the virtual object after adding the target texture, the influence of the highlight on the display effect of the virtual object is considered, which makes the virtual object more realistic and further improves the display effect of the virtual object.
并且,本公开实施例中,设置有第一调整参数,以调整每个位置点的反光子参数,设置有第二调整参数,以调整每个位置点的高光子参数,由于第一调整参数和第二调整参数是由技术人员设置的,该第一调整参数和第二调整参数的大小能够调整,因此,灵活调整反光子参数和高光子参数,提高了灵活性,从而能够更加方便地调整虚拟物体的亮度,对显示效果进行调整。Moreover, in the embodiment of the present disclosure, a first adjustment parameter is set to adjust the reflective photon parameter of each position point, and a second adjustment parameter is set to adjust the high photon parameter of each position point. Since the first adjustment parameter and the The second adjustment parameter is set by technicians, and the size of the first adjustment parameter and the second adjustment parameter can be adjusted. Therefore, the flexibility to adjust the reflective photon parameter and the high photon parameter is improved, so that the virtual photon can be adjusted more conveniently. The brightness of the object, adjust the display effect.
并且,本公开实施例中,对序号相邻的备选贴图进行融合,得到融合贴图,不需要分别对每个备选贴图单独进行存储,直接存储融合贴图即可,减少了需要存储的备选贴图的数量,节省了存储空间,提高了设备的运行效率。Moreover, in the embodiment of the present disclosure, the candidate textures with adjacent serial numbers are fused to obtain the fusion texture, and each candidate texture does not need to be stored separately, and the fusion texture can be directly stored, which reduces the number of candidates that need to be stored. The number of textures saves storage space and improves the operating efficiency of the device.
并且,采用亮度子参数矩阵和序号矩阵确定匹配参数矩阵的过程中,进行一次计算即可得到两个或三个备选贴图的匹配参数,与分别计算每个备选贴图的匹配参数相比较,减小了计算量,提高了获取权重的速度。Moreover, in the process of determining the matching parameter matrix by using the brightness sub-parameter matrix and the sequence number matrix, the matching parameters of two or three alternative textures can be obtained by one calculation, and compared with the matching parameters of each alternative texture calculated separately, The amount of calculation is reduced and the speed of obtaining weights is improved.
图10是根据一示例性实施例示出的一种虚拟物体显示装置的框图。参见图10,该装置包括:Fig. 10 is a block diagram of a device for displaying virtual objects according to an exemplary embodiment. Referring to Figure 10, the device includes:
第一参数获取单元1001,被配置为执行获取虚拟物体的物体参数,物体参数至少包括虚拟物体表面上的多个位置点的法线向量及光照向量,位置点的光照向量为位置点的光线照射方向上的向量;The first
第二参数获取单元1002,被配置为执行根据多个位置点的法线向量及光照向量,获取虚拟物体的漫反射参数及反光参数,漫反射参数与反光参数呈负相关关系;The second
目标贴图确定单元1003,被配置为执行确定与漫反射参数及反光参数匹配的目标贴图;The target
虚拟物体显示单元1004,被配置为执行在虚拟物体表面添加目标贴图,显示添加目标贴图后的虚拟物体。The virtual
本公开实施例提供的装置,能够获取虚拟物体的漫反射参数及反光参数,由于漫反射参数及反光参数均能够反映虚拟物体的亮度,因此与仅根据漫反射参数确定匹配的贴图相比,根据漫反射参数及反光参数确定匹配的目标贴图时,还考虑了反光现象对虚拟物体显示效果的影响,增加了信息量,使确定的目标贴图能够更加准确地反映该虚拟物体的亮度,从而显示添加目标贴图后的虚拟物体时,该虚拟物体更加逼真,提高了虚拟物体的显示效果。The device provided by the embodiment of the present disclosure can obtain the diffuse reflection parameter and the reflective parameter of the virtual object. Since both the diffuse reflection parameter and the reflective parameter can reflect the brightness of the virtual object, compared with determining the matching map only based on the diffuse reflection parameter, according to When the diffuse reflection parameter and the reflection parameter determine the matching target map, the influence of the reflection phenomenon on the display effect of the virtual object is also considered, and the amount of information is increased, so that the determined target map can more accurately reflect the brightness of the virtual object, so as to display the added When the virtual object after the target map is used, the virtual object is more realistic, and the display effect of the virtual object is improved.
在一种可能实现方式中,虚拟物体的漫反射参数包括多个位置点的漫反射子参数,虚拟物体的反光参数包括多个位置点的反光子参数;第二参数获取单元1002,被配置为执行:In a possible implementation manner, the diffuse reflection parameter of the virtual object includes diffuse reflection sub-parameters of multiple position points, and the reflection parameter of the virtual object includes reflection sub-parameters of multiple position points; the second
对于每个位置点,根据位置点的法线向量及光照向量,获取位置点的漫反射子参数;For each position point, obtain the diffuse reflection sub-parameter of the position point according to the normal vector and illumination vector of the position point;
对漫反射子参数进行取反处理,得到位置点的第一反光子参数;Negate the diffuse reflection sub-parameters to obtain the first reflection sub-parameters of the position point;
根据预先设置的第一调整参数,调整第一反光子参数,得到位置点的第二反光子参数;According to the preset first adjustment parameter, adjust the first reflection photon parameter to obtain the second reflection photon parameter of the position point;
将多个位置点的漫反射子参数进行组合,得到漫反射参数;Combine the diffuse reflection sub-parameters of multiple position points to obtain diffuse reflection parameters;
将多个位置点的第二反光子参数进行组合,得到反光参数。Combining the second reflective photon parameters of multiple position points to obtain reflective parameters.
在另一种可能实现方式中,第二参数获取单元1002,被配置为执行:In another possible implementation manner, the second
将法线向量与光照向量的点积,作为第一数值;Take the dot product of the normal vector and the light vector as the first value;
将第一数值和0中较大的数值,确定为位置点的漫反射子参数。The larger value among the first value and 0 is determined as the diffuse reflection sub-parameter of the position point.
在另一种可能实现方式中,虚拟物体的漫反射参数包括多个位置点的漫反射子参数,虚拟物体的反光参数包括多个位置点的反光子参数;参见图11,目标贴图确定单元1003,包括:In another possible implementation manner, the diffuse reflection parameters of the virtual object include diffuse reflection sub-parameters of multiple position points, and the reflection parameters of the virtual object include reflection photon parameters of multiple position points; see FIG. 11 , the target
亮度子参数获取子单元1013,被配置为执行根据每个位置点的漫反射子参数及反光子参数,分别获取每个位置点的亮度子参数;The brightness
权重获取子单元1023,被配置为执行根据每个位置点的亮度子参数和多个备选贴图的序号,分别获取多个备选贴图的权重,备选贴图的序号为多个备选贴图按照亮度从大到小依次排列之后确定的,备选贴图的序号表征备选贴图的亮度,不同备选贴图的序号不同;The
贴图确定子单元1033,被配置为执行按照每个位置点对应的多个备选贴图的权重,确定目标贴图。The
在另一种可能实现方式中,参加图11,亮度子参数获取子单元1013,被配置为执行:In another possible implementation, referring to FIG. 11 , the luminance
对于每个位置点,将位置点的漫反射子参数与反光子参数相加,得到位置点的第一亮度子参数;For each position point, add the diffuse reflection sub-parameter of the position point and the reflection sub-parameter to obtain the first brightness sub-parameter of the position point;
将第一亮度子参数与备选贴图的数量相乘,得到位置点的第二亮度子参数。Multiply the first luminance sub-parameter by the number of candidate maps to obtain the second luminance sub-parameter of the position point.
在另一种可能实现方式中,参见图11,权重获取子单元1023,被配置为执行:In another possible implementation, referring to FIG. 11 , the
对于每个位置点,根据位置点的亮度子参数与每个备选贴图的序号之间的差值,确定每个备选贴图的匹配参数,匹配参数表征备选贴图的亮度与位置点的亮度之间的匹配程度;For each position point, the matching parameter of each candidate texture is determined according to the difference between the brightness sub-parameter of the position point and the serial number of each candidate texture, and the matching parameter represents the brightness of the candidate texture and the brightness of the position point the degree of matching between;
将相邻的任两个备选贴图的匹配参数之间的差值,作为任两个备选贴图中的第一个备选贴图的权重,且将最后一个备选贴图的匹配参数,作为最后一个备选贴图的权重,相邻的任两个备选贴图是指按照亮度从大到小依次排列的多个备选贴图中相邻的两个备选贴图。The difference between the matching parameters of any two adjacent candidate textures is used as the weight of the first candidate texture in any two candidate textures, and the matching parameters of the last candidate texture are used as the final value. The weight of an alternative texture. Any two adjacent alternative textures refer to two adjacent alternative textures in multiple alternative textures arranged in descending order of brightness.
在另一种可能实现方式中,参见图11,该装置还包括:In another possible implementation, referring to FIG. 11 , the apparatus further includes:
贴图融合单元1005,被配置为执行按照多个备选贴图的序号,依次将序号相邻的备选贴图进行融合,得到至少一个融合贴图,融合贴图的红色通道、绿色通道或蓝色通道中的至少一个通道对应一个备选贴图;The
权重获取子单元1023,被配置为执行:The
获取每个融合贴图的序号矩阵,融合贴图的序号矩阵包括融合贴图中每个备选贴图的序号;Obtain the serial number matrix of each fusion map, and the serial number matrix of the fusion map includes the serial number of each candidate map in the fusion map;
获取亮度子参数矩阵,亮度子参数矩阵包括多个亮度子参数,且多个亮度子参数的数量等于融合贴图中包含的备选贴图的数量;Obtain a brightness sub-parameter matrix, where 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 fusion map;
获取亮度子参数矩阵与每个融合贴图的序号矩阵之间的差值,确定匹配参数矩阵,匹配参数矩阵包括每个备选贴图的匹配参数。The difference between the luminance sub-parameter matrix and the sequence number matrix of each fusion texture is obtained, and the matching parameter matrix is determined, and the matching parameter matrix includes the matching parameters of each candidate texture.
在另一种可能实现方式中,权重获取子单元1023,被配置为执行:In another possible implementation manner, the
响应于差值大于第一参考数值,将第一参考数值作为备选贴图的匹配参数;或者,In response to the difference being greater than the first reference value, the first reference value is used as the matching parameter of the candidate map; or,
响应于差值小于第二参考数值,将第二参考数值作为备选贴图的匹配参数;或者,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; or,
响应于差值不大于第一参考数值,且不小于第二参考数值,将差值作为备选贴图的匹配参数。In response to the difference value being not greater than the first reference value and not less than the second reference value, the difference value is used as a matching parameter of the candidate map.
在另一种可能实现方式中,贴图确定子单元1033,被配置为执行:In another possible implementation, the
将最大的权重对应的备选贴图作为目标贴图;或者,Use the candidate texture corresponding to the largest weight as the target texture; or,
按照每个备选贴图的权重,对多个备选贴图进行加权融合,将融合后的贴图作为目标贴图。According to the weight of each candidate texture, weighted fusion is performed on multiple candidate textures, and the fused texture is used as the target texture.
在另一种可能实现方式中,物体参数还包括多个位置点的视角向量,位置点的视角向量为虚拟摄像机相对于位置点的方向上的向量;参见图11,该装置还包括:In another possible implementation manner, the object parameters further include viewing angle vectors of multiple position points, and the viewing angle vectors of the position points are vectors in the direction of the virtual camera relative to the position points; referring to FIG. 11 , the apparatus further includes:
第三参数获取单元1006,被配置为执行根据多个位置点的法线向量、光照向量及视角向量,获取虚拟物体的高光参数,高光参数表征虚拟物体表面上最亮的位置点;The third
虚拟物体显示单元1004,被配置为执行在虚拟物体表面添加目标贴图,根据高光参数显示添加目标贴图后的虚拟物体。The virtual
在另一种可能实现方式中,第三参数获取单元1006,被配置为执行:In another possible implementation manner, the third
对于每个位置点,将位置点的视角向量与光照向量的和向量与位置点的法线向量的点积,作为第二数值;For each position point, the dot product of the sum vector of the position point's viewing angle vector and the illumination vector and the normal vector of the position point is used as the second value;
将第二数值和0中较大的数值与光照向量的乘积,作为第一高光子参数;The product of the second value and the larger value of 0 and the light vector is used as the first hyperphoton parameter;
根据预先设置的第二调整参数,调整第一高光子参数,得到第二高光子参数。According to the preset second adjustment parameter, the first hyperphoton parameter is adjusted to obtain the second hyperphoton parameter.
在另一种可能实现方式中,参见图11,该装置还包括:In another possible implementation, referring to FIG. 11 , the apparatus further includes:
延伸区域获取单元1007,被配置为执行将每个位置点沿着对应的法线方向延伸预设距离,在虚拟物体的表面外侧形成延伸区域,将参考颜色填充至延伸区域;The extension
虚拟物体显示单元1004,被配置为执行在虚拟物体表面添加目标贴图,显示添加目标贴图后的虚拟物体及虚拟物体的表面外侧的延伸区域。The virtual
关于上述实施例中的装置,其中各个单元执行操作的具体方式已经在有关该方法的实施例中进行了详细描述,此处将不做详细阐述说明。Regarding the apparatus in the above-mentioned 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 described in detail here.
图12示出了本申请一个示例性实施例提供的终端1200的结构框图。该终端1200可以是便携式移动终端,比如:智能手机、平板电脑、MP3播放器(Moving Picture ExpertsGroup Audio Layer III,动态影像专家压缩标准音频层面3)、MP4(Moving PictureExperts Group Audio Layer IV,动态影像专家压缩标准音频层面4)播放器、笔记本电脑或台式电脑。终端1200还可能被称为用户设备、便携式终端、膝上型终端、台式终端等其他名称。FIG. 12 shows a structural block diagram of a terminal 1200 provided by an exemplary embodiment of the present application. 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, the standard audio layer 3 of the moving picture experts compression), MP4 (Moving Picture Experts Group Audio Layer IV, the moving picture expert) Compression Standard Audio Layer 4) Player, Laptop or Desktop. Terminal 1200 may also be called user equipment, portable terminal, laptop terminal, desktop terminal, and the like by other names.
通常,终端1200包括有:处理器1201和存储器1202。Generally, the terminal 1200 includes: a
处理器1201可以包括一个或多个处理核心,比如4核心处理器、8核心处理器等。处理器1201可以采用DSP(Digital Signal Processing,数字信号处理)、FPGA(Field-Programmable Gate Array,现场可编程门阵列)、PLA(Programmable Logic Array,可编程逻辑阵列)中的至少一种硬件形式来实现。处理器1201也可以包括主处理器和协处理器,主处理器是用于对在唤醒状态下的数据进行处理的处理器,也称CPU(Central ProcessingUnit,中央处理器);协处理器是用于对在待机状态下的数据进行处理的低功耗处理器。在一些实施例中,处理器1201可以集成有GPU(Graphics Processing Unit,图像处理器),GPU用于负责显示屏所需要显示的内容的渲染和绘制。一些实施例中,处理器1201还可以包括AI(Artificial Intelligence,人工智能)处理器,该AI处理器用于处理有关机器学习的计算操作。The
存储器1202可以包括一个或多个计算机可读存储介质,该计算机可读存储介质可以是非暂态的。存储器1202还可包括高速随机存取存储器,以及非易失性存储器,比如一个或多个磁盘存储设备、闪存存储设备。在一些实施例中,存储器1202中的非暂态的计算机可读存储介质用于存储至少一个指令,该至少一个指令用于被处理器1201所执行以实现本申请中方法实施例提供的虚拟物体显示方法。
在一些实施例中,终端1200还可选包括有:外围设备接口1203和至少一个外围设备。处理器1201、存储器1202和外围设备接口1203之间可以通过总线或信号线相连。各个外围设备可以通过总线、信号线或电路板与外围设备接口1203相连。具体地,外围设备包括:射频电路1204、显示屏1205、摄像头组件1206、音频电路1207、定位组件1208和电源1209中的至少一种。In some embodiments, the terminal 1200 may optionally further include: a
外围设备接口1203可被用于将I/O(Input/Output,输入/输出)相关的至少一个外围设备连接到处理器1201和存储器1202。在一些实施例中,处理器1201、存储器1202和外围设备接口1203被集成在同一芯片或电路板上;在一些其他实施例中,处理器1201、存储器1202和外围设备接口1203中的任意一个或两个可以在单独的芯片或电路板上实现,本实施例对此不加以限定。The
射频电路1204用于接收和发射RF(Radio Frequency,射频)信号,也称电磁信号。射频电路1204通过电磁信号与通信网络以及其他通信设备进行通信。射频电路1204将电信号转换为电磁信号进行发送,或者,将接收到的电磁信号转换为电信号。可选地,射频电路1204包括:天线系统、RF收发器、一个或多个放大器、调谐器、振荡器、数字信号处理器、编解码芯片组、用户身份模块卡等等。射频电路1204可以通过至少一种无线通信协议来与其它终端进行通信。该无线通信协议包括但不限于:万维网、城域网、内联网、各代移动通信网络(2G、3G、4G及5G)、无线局域网和/或WiFi(Wireless Fidelity,无线保真)网络。在一些实施例中,射频电路1204还可以包括NFC(Near Field Communication,近距离无线通信)有关的电路,本申请对此不加以限定。The
显示屏1205用于显示UI(User Interface,用户界面)。该UI可以包括图形、文本、图标、视频及其它们的任意组合。当显示屏1205是触摸显示屏时,显示屏1205还具有采集在显示屏1205的表面或表面上方的触摸信号的能力。该触摸信号可以作为控制信号输入至处理器1201进行处理。此时,显示屏1205还可以用于提供虚拟按钮和/或虚拟键盘,也称软按钮和/或软键盘。在一些实施例中,显示屏1205可以为一个,设置在终端1200的前面板;在另一些实施例中,显示屏1205可以为至少两个,分别设置在终端1200的不同表面或呈折叠设计;在另一些实施例中,显示屏1205可以是柔性显示屏,设置在终端1200的弯曲表面上或折叠面上。甚至,显示屏1205还可以设置成非矩形的不规则图形,也即异形屏。显示屏1205可以采用LCD(Liquid Crystal Display,液晶显示屏)、OLED(Organic Light-EmittingDiode,有机发光二极管)等材质制备。The
摄像头组件1206用于采集图像或视频。可选地,摄像头组件1206包括前置摄像头和后置摄像头。通常,前置摄像头设置在终端的前面板,后置摄像头设置在终端的背面。在一些实施例中,后置摄像头为至少两个,分别为主摄像头、景深摄像头、广角摄像头、长焦摄像头中的任意一种,以实现主摄像头和景深摄像头融合实现背景虚化功能、主摄像头和广角摄像头融合实现全景拍摄以及VR(Virtual Reality,虚拟现实)拍摄功能或者其它融合拍摄功能。在一些实施例中,摄像头组件1206还可以包括闪光灯。闪光灯可以是单色温闪光灯,也可以是双色温闪光灯。双色温闪光灯是指暖光闪光灯和冷光闪光灯的组合,可以用于不同色温下的光线补偿。The
音频电路1207可以包括麦克风和扬声器。麦克风用于采集用户及环境的声波,并将声波转换为电信号输入至处理器1201进行处理,或者输入至射频电路1204以实现语音通信。出于立体声采集或降噪的目的,麦克风可以为多个,分别设置在终端1200的不同部位。麦克风还可以是阵列麦克风或全向采集型麦克风。扬声器则用于将来自处理器1201或射频电路1204的电信号转换为声波。扬声器可以是传统的薄膜扬声器,也可以是压电陶瓷扬声器。当扬声器是压电陶瓷扬声器时,不仅可以将电信号转换为人类可听见的声波,也可以将电信号转换为人类听不见的声波以进行测距等用途。在一些实施例中,音频电路1207还可以包括耳机插孔。
定位组件1208用于定位终端1200的当前地理位置,以实现导航或LBS(LocationBased Service,基于位置的服务)。定位组件1208可以是基于美国的GPS(GlobalPositioning System,全球定位系统)、中国的北斗系统或俄罗斯的伽利略系统的定位组件。The
电源1209用于为终端1200中的各个组件进行供电。电源1209可以是交流电、直流电、一次性电池或可充电电池。当电源1209包括可充电电池时,该可充电电池可以是有线充电电池或无线充电电池。有线充电电池是通过有线线路充电的电池,无线充电电池是通过无线线圈充电的电池。该可充电电池还可以用于支持快充技术。The
在一些实施例中,终端1200还包括有一个或多个传感器1210。该一个或多个传感器1210包括但不限于:加速度传感器1211、陀螺仪传感器1212、压力传感器1213、指纹传感器1214、光学传感器1215以及接近传感器1216。In some embodiments, the terminal 1200 also includes one or more sensors 1210 . The one or more sensors 1210 include, but are not limited to, an acceleration sensor 1211 , a gyro sensor 1212 , a pressure sensor 1213 , a fingerprint sensor 1214 , an
加速度传感器1211可以检测以终端1200建立的坐标系的三个坐标轴上的加速度大小。比如,加速度传感器1211可以用于检测重力加速度在三个坐标轴上的分量。处理器1201可以根据加速度传感器1211采集的重力加速度信号,控制显示屏1205以横向视图或纵向视图进行用户界面的显示。加速度传感器1211还可以用于游戏或者用户的运动数据的采集。The acceleration sensor 1211 can detect the magnitude of acceleration on the three coordinate axes of the coordinate system established by the
陀螺仪传感器1212可以检测终端1200的机体方向及转动角度,陀螺仪传感器1212可以与加速度传感器1211协同采集用户对终端1200的3D动作。处理器1201根据陀螺仪传感器1212采集的数据,可以实现如下功能:动作感应(比如根据用户的倾斜操作来改变UI)、拍摄时的图像稳定、游戏控制以及惯性导航。The gyroscope sensor 1212 can detect the body direction and rotation angle of the terminal 1200 , and the gyroscope sensor 1212 can cooperate with the acceleration sensor 1211 to collect 3D actions of the user on the
压力传感器1213可以设置在终端1200的侧边框和/或显示屏1205的下层。当压力传感器1213设置在终端1200的侧边框时,可以检测用户对终端1200的握持信号,由处理器1201根据压力传感器1213采集的握持信号进行左右手识别或快捷操作。当压力传感器1213设置在显示屏1205的下层时,由处理器1201根据用户对显示屏1205的压力操作,实现对UI界面上的可操作性控件进行控制。可操作性控件包括按钮控件、滚动条控件、图标控件、菜单控件中的至少一种。The pressure sensor 1213 may be disposed on the side frame of the terminal 1200 and/or the lower layer of the
指纹传感器1214用于采集用户的指纹,由处理器1201根据指纹传感器1214采集到的指纹识别用户的身份,或者,由指纹传感器1214根据采集到的指纹识别用户的身份。在识别出用户的身份为可信身份时,由处理器1201授权该用户执行相关的敏感操作,该敏感操作包括解锁屏幕、查看加密信息、下载软件、支付及更改设置等。指纹传感器1214可以被设置在终端1200的正面、背面或侧面。当终端1200上设置有物理按键或厂商Logo时,指纹传感器1214可以与物理按键或厂商Logo集成在一起。The fingerprint sensor 1214 is used to collect the user's fingerprint, and the
光学传感器1215用于采集环境光强度。在一个实施例中,处理器1201可以根据光学传感器1215采集的环境光强度,控制显示屏1205的显示亮度。具体地,当环境光强度较高时,调高显示屏1205的显示亮度;当环境光强度较低时,调低显示屏1205的显示亮度。在另一个实施例中,处理器1201还可以根据光学传感器1215采集的环境光强度,动态调整摄像头组件1206的拍摄参数。
接近传感器1216,也称距离传感器,通常设置在终端1200的前面板。接近传感器1216用于采集用户与终端1200的正面之间的距离。在一个实施例中,当接近传感器1216检测到用户与终端1200的正面之间的距离逐渐变小时,由处理器1201控制显示屏1205从亮屏状态切换为息屏状态;当接近传感器1216检测到用户与终端1200的正面之间的距离逐渐变大时,由处理器1201控制显示屏1205从息屏状态切换为亮屏状态。A
本领域技术人员可以理解,图12中示出的结构并不构成对终端1200的限定,可以包括比图示更多或更少的组件,或者组合某些组件,或者采用不同的组件布置。Those skilled in the art can understand that the structure shown in FIG. 12 does not constitute a limitation on the terminal 1200, and may include more or less components than the one shown, or combine some components, or adopt different component arrangements.
在示例性实施例中,还提供了一种非临时性计算机可读存储介质,当存储介质中的指令由电子设备的处理器执行时,使得电子设备能够执行上述虚拟物体显示方法中终端所执行的步骤。In an exemplary embodiment, a non-transitory computer-readable storage medium is also provided. When the instructions in the storage medium are executed by the processor of the electronic device, the electronic device can execute the execution of the terminal in the above-mentioned virtual object display method. A step of.
在示例性实施例中,还提供了一种计算机程序产品,当计算机程序产品中的指令由电子设备的处理器执行时,使得电子设备能够执行上述虚拟物体显示方法中终端所执行的步骤。In an exemplary embodiment, a computer program product is also provided, when the instructions in the computer program product are executed by the processor of the electronic device, the electronic device can execute the steps performed by the terminal in the above-mentioned virtual object display method.
本领域技术人员在考虑说明书及实践这里的公开后,将容易想到本公开的其它实施方案。本申请旨在涵盖本公开的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本公开的一般性原理并包括本公开未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本公开的真正范围和精神由下面的权利要求指出。Other embodiments of the present disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the disclosure herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or techniques in the technical field not disclosed by the present disclosure . The specification and examples are to be regarded as exemplary only, with the true scope and spirit of the disclosure being indicated by the following claims.
应当理解的是,本公开并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本公开的范围仅由所附的权利要求来限制。It is to be understood that the present disclosure is not limited to the precise structures described above and illustrated in the accompanying 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.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010833390.6ACN114155336B (en) | 2020-08-18 | 2020-08-18 | Virtual object display method, device, electronic device and storage medium |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010833390.6ACN114155336B (en) | 2020-08-18 | 2020-08-18 | Virtual object display method, device, electronic device and storage medium |
| Publication Number | Publication Date |
|---|---|
| CN114155336Atrue CN114155336A (en) | 2022-03-08 |
| CN114155336B CN114155336B (en) | 2024-11-22 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202010833390.6AActiveCN114155336B (en) | 2020-08-18 | 2020-08-18 | Virtual object display method, device, electronic device and storage medium |
| Country | Link |
|---|---|
| CN (1) | CN114155336B (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2024021557A1 (en)* | 2022-07-25 | 2024-02-01 | 网易(杭州)网络有限公司 | Reflected illumination determination method and apparatus, global illumination determination method and apparatus, medium, and device |
| WO2024239622A1 (en)* | 2023-05-23 | 2024-11-28 | 华为技术有限公司 | Image rendering method and electronic device |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20030011596A1 (en)* | 2001-06-03 | 2003-01-16 | Zhengyou Zhang | View-dependent image synthesis |
| CN108109194A (en)* | 2017-12-29 | 2018-06-01 | 广东工业大学 | The realization method and system of laser paper effect in virtual reality scenario |
| CN108447112A (en)* | 2018-01-24 | 2018-08-24 | 重庆爱奇艺智能科技有限公司 | Analogy method, device and the VR equipment of role's light environment |
| CN111009026A (en)* | 2019-12-24 | 2020-04-14 | 腾讯科技(深圳)有限公司 | Object rendering method and device, storage medium and electronic device |
| CN111179396A (en)* | 2019-12-12 | 2020-05-19 | 腾讯科技(深圳)有限公司 | Image generation method, image generation device, storage medium, and electronic device |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20030011596A1 (en)* | 2001-06-03 | 2003-01-16 | Zhengyou Zhang | View-dependent image synthesis |
| CN108109194A (en)* | 2017-12-29 | 2018-06-01 | 广东工业大学 | The realization method and system of laser paper effect in virtual reality scenario |
| CN108447112A (en)* | 2018-01-24 | 2018-08-24 | 重庆爱奇艺智能科技有限公司 | Analogy method, device and the VR equipment of role's light environment |
| CN111179396A (en)* | 2019-12-12 | 2020-05-19 | 腾讯科技(深圳)有限公司 | Image generation method, image generation device, storage medium, and electronic device |
| CN111009026A (en)* | 2019-12-24 | 2020-04-14 | 腾讯科技(深圳)有限公司 | Object rendering method and device, storage medium and electronic device |
| Title |
|---|
| CJ24: "Difffuse, Specular and Normal Maps", Retrieved from the Internet <URL:https://www.modding-forum.com/guide/17-diffuse-specular-and-normal-maps/>* |
| 朱国仲;张玉华;: "基于二维纹理映射的镜面反射加速绘制", 计算机工程与设计, no. 07, 16 July 2011 (2011-07-16)* |
| 王薇婕等: "基于三维立体标志物的增强现实实时渲染", 纺织高校基础科学学报, 30 June 2012 (2012-06-30)* |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2024021557A1 (en)* | 2022-07-25 | 2024-02-01 | 网易(杭州)网络有限公司 | Reflected illumination determination method and apparatus, global illumination determination method and apparatus, medium, and device |
| WO2024239622A1 (en)* | 2023-05-23 | 2024-11-28 | 华为技术有限公司 | Image rendering method and electronic device |
| Publication number | Publication date |
|---|---|
| CN114155336B (en) | 2024-11-22 |
| Publication | Publication Date | Title |
|---|---|---|
| US11393154B2 (en) | Hair rendering method, device, electronic apparatus, and storage medium | |
| US12056813B2 (en) | Shadow rendering method and apparatus, computer device, and storage medium | |
| CN112870707B (en) | Virtual object display method in virtual scene, computer device and storage medium | |
| CN109712224B (en) | Virtual scene rendering method and device and intelligent device | |
| US20210153629A1 (en) | Method for processing images, electronic device, and storage medium | |
| WO2022052620A1 (en) | Image generation method and electronic device | |
| WO2020233403A1 (en) | Personalized face display method and apparatus for three-dimensional character, and device and storage medium | |
| CN111541907A (en) | Item display method, device, equipment and storage medium | |
| CN109886208B (en) | Object detection method and device, computer equipment and storage medium | |
| CN112308103B (en) | Method and device for generating training samples | |
| WO2022134632A1 (en) | Work processing method and apparatus | |
| CN113384880A (en) | Virtual scene display method, device, computer equipment and storage medium | |
| CN110853128B (en) | Virtual object display method and device, computer equipment and storage medium | |
| CN111857793A (en) | Network model training method, device, equipment and storage medium | |
| CN111932604A (en) | Method and device for measuring human ear characteristic distance | |
| CN112135191A (en) | Video editing method, device, terminal and storage medium | |
| WO2021027890A1 (en) | License plate image generation method and device, and computer storage medium | |
| CN114494073A (en) | Image processing method, device, device and storage medium | |
| CN113209610A (en) | Virtual scene picture display method and device, computer equipment and storage medium | |
| CN111105474B (en) | Font drawing method, font drawing device, computer device and computer readable storage medium | |
| CN114155336B (en) | Virtual object display method, device, electronic device and storage medium | |
| CN112907716A (en) | Cloud rendering method, device, equipment and storage medium in virtual environment | |
| CN112967261B (en) | Image fusion method, device, equipment and storage medium | |
| CN109472855B (en) | Volume rendering method and device and intelligent device | |
| CN109388732B (en) | Music map generating and displaying method, device and storage medium |
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |