Disclosure of Invention
The present invention is directed to solving at least one of the problems of the prior art or the related art.
To this end, an aspect of the present invention is to provide a highlight information extraction method.
Another aspect of the present invention is to provide a highlight information extraction system.
Yet another aspect of the invention is directed to a computer device.
Yet another aspect of the present invention is to provide a computer-readable storage medium.
In view of the above, according to an aspect of the present invention, a highlight information extraction method is provided, including: acquiring an environment map; carrying out parameterization processing on the environment map, and converting the environment map into a view-point-independent environment map; determining the incident light quantity in any direction according to the view-independent environment map; obtaining the reflected light quantity according to the incident light quantity statistics; and determining the reflection intensity of the light according to the quantity of the reflected light, and outputting the reflection intensity of the light as highlight information of the environment map.
According to the highlight information extraction method, the environment Map is parameterized by acquiring the environment Map, so that the environment Map is converted into an environment Map (View-Independent-Map) Independent of a View point from a Longitude and Latitude Map (Latitude-Longitude-Map), and the influence of an observation direction during calculation of highlight information is eliminated; and determining the incident light quantity in any direction according to the independent viewpoint environment map, calculating the incident light quantity to obtain the reflected light quantity, collecting the reflected light quantity in all directions to obtain the light reflection intensity, outputting the light reflection intensity as the highlight information of the environment map, and in the process, determining the reflected light quantity in any direction by converting the reflected light quantity into the independent viewpoint environment map, which greatly reduces the calculation quantity required by the statistical calculation of the traditional method and can achieve the same effect. The highlight information extraction method of the present invention may further have the following technical features:
in the foregoing technical solution, preferably, determining the incident light amount in any direction according to the view-independent environment map specifically includes: processing the map independent of the viewpoint environment by using a Mipmap technology to generate an image pyramid; determining a sampling direction according to the independent viewpoint environment map; determining a layer number corresponding to any sampling direction in the image pyramid according to any sampling direction and the image pyramid; and searching a corresponding color value according to the layer number, and taking the color value as the incident light quantity in the sampling direction.
In the technical scheme, a Mipmap technology is used for processing the map independent of the viewpoint environment to generate an image pyramid. The Mipmap (parameter in a small space) is a computer graphic image technology, in particular to a texture mapping technology, namely a pixel value in an l-1 layer image is an average value of 4 pixels at corresponding positions, in the traditional highlight extraction sampling process, the number of invalid sampling points is too many, the sampling efficiency is low, the influence of invalid sampling points on a final result in the sampling process can be reduced by using the Mipmap technology, the invalid sampling points can be sampled at a higher position of an image pyramid level particularly when the requirement on the image details is low, and the sampling at a lower position of the image pyramid level when the requirement on the image details is high, so that the effectiveness of the sampling points is ensured, and the sampling efficiency is improved; the sampling direction is determined according to the view-independent environment map, the layer number of the color value corresponding to the sampling direction in the image pyramid is determined according to any sampling direction, the corresponding color value is searched through the layer number of the image pyramid, the color value is used as the incident light quantity in the sampling direction, in the process, the incident light quantity in the sampling direction is directly determined through the layer number of the image pyramid, the calculation is simple, the problem of large calculation quantity of a traditional calculation mode is solved, the effect of real-time rendering can be achieved on the basis of one fourth of the number of original sampling points through the scheme, and therefore rendering real-time is facilitated.
In the foregoing technical solution, preferably, the determining a sampling direction according to the view-independent environment map specifically includes: determining a hemisphere which is unfolded by taking any direction as a normal line according to the view-independent environment map; multiple directions are arbitrarily selected as sampling directions within the hemisphere.
In the technical scheme, the hemisphere which is unfolded by taking any direction as the normal direction is determined, so that a plurality of directions in the hemisphere are selected as sampling directions at will, and the corresponding incident light quantity is determined for the sampling directions.
In the foregoing technical solution, preferably, determining a layer number corresponding to any sampling direction in the image pyramid according to any sampling direction and the image pyramid specifically includes: acquiring the number of sampling directions, attributes independent of the viewpoint environment maps and mapping distortion factors of the environment maps, wherein the attributes comprise: the physical size and probability density function of the viewpoint environment map are not depended on; and calculating the layer number according to the physical size of the independent viewpoint environment map, the mapping distortion factor of the environment map, the probability density function and the number of sampling directions.
In the technical scheme, the sampling layer number can be accurately calculated by acquiring the number of sampling directions in a hemisphere, the physical size of the environment map independent of a viewpoint, the mapping distortion factor and the probability density function of the environment map, and different sampling quantities can be selected according to the requirements of image details to calculate the accurate sampling layer number, so that highlight information of a real scene can be more accurately represented.
In the above technical solution, preferably, the sampling layer number is calculated by the following formula:
wherein l is the layer number, w is the width of the view-independent environment map, h is the height of the view-independent environment map, N is the number of sampling directions within the hemisphere, pdf is the sum of frsNormalized as a probability density function, d is the mapped distortion factor of the environment map.
In the technical scheme, the sampling layer number l is respectively related to the width w of the non-dependent view environment map, the length h of the non-dependent view environment map, the number N of sampling directions in a hemisphere, the probability density function pdf and the mapping distortion factor d of the environment map, the sampling layer number l is directly obtained by calculation through the formula, and the formula is simple and clear in calculation and easy to realize digitization.
In the above technical solution, preferably, the reflected light amount obtained from the statistics of the incident light amount is calculated by the following formula:
wherein L is
oIs the amount of reflected light in a certain direction, N is the number of sampling directions within the hemisphere, L
isIs a certain sampling direction in the hemisphere
Amount of incident light, f
rsIs a bidirectional reflectance distribution function,
Is the direction of sampling
Cosine value of (1), pdf is
rsNormalized as a function of probability density.
In this embodiment, the amount of reflected light L in a certain direction
oThe number N of sampling directions in the hemisphere, and a certain sampling direction in the hemisphere
Amount of incident light L
isBidirectional reflectance distribution function f
rsSampling direction
Cosine value of
And from f
rsThe light quantity L of the reflected light in a certain direction is directly obtained by performing accumulation calculation through the formula after being related as a probability density function pdf through standardization
oThe formula is simple and clear to calculate, and digitization is easy to realize.
Another aspect of the present invention is to provide a highlight information extraction system.
Wherein highlight information extraction system includes: the acquisition unit is used for acquiring the environment map; the conversion unit is used for carrying out parameterization processing on the environment map and converting the environment map into a view-point-independent environment map; a determination unit for determining an incident light amount in any one direction from the viewpoint-independent environment map; a counting unit for counting the amount of reflected light according to the amount of incident light; and the output unit is used for determining the reflection intensity of the light according to the reflection light quantity, and outputting the reflection intensity of the light as highlight information of the environment map.
The highlight information extraction system provided by the invention obtains the environment Map through the obtaining unit, and parameterizes the environment Map by using the conversion unit, so that the environment Map is converted into an environment Map (View-Independent-Map) Independent of a View point from a Longitude and Latitude Map (Latitude-Long-Map), and the influence of an observation direction when highlight information is calculated is eliminated. The determination unit determines the incident light quantity in any direction according to the independent viewpoint environment map, the reflected light quantity is obtained through calculation of the incident light quantity, the output unit is used for collecting the reflected light quantity in all directions to obtain the light reflection intensity, and the light reflection intensity is output as highlight information of the environment map.
The highlight information extraction system according to the present invention may further have the following technical features:
in the foregoing technical solution, preferably, the determining unit specifically includes: the generating unit is used for processing the map independent of the viewpoint environment by using a Mipmap technology to generate an image pyramid; the sampling direction determining unit is used for determining the sampling direction according to the independent viewpoint environment map; the computing unit is used for determining a layer number corresponding to any sampling direction in the image pyramid according to any sampling direction and the image pyramid; and the searching unit is used for searching the corresponding color value according to the layer number and taking the color value as the incident light quantity in the sampling direction.
In the technical scheme, the generating unit uses a Mipmap technology to process the map independent of the viewpoint environment, and generates an image pyramid. The Mipmap (parameter in a small space) is a computer graphic image technology, in particular to a texture mapping technology, namely a pixel value in an l-layer picture is an average value of 4 pixels at a corresponding position in an l-1-layer picture, in the traditional highlight extraction sampling process, the number of invalid sampling points is too many, the sampling efficiency is low, the influence of the invalid sampling points on a result can be reduced by using the Mipmap technology, particularly, the invalid sampling points can be sampled at a higher position of an image pyramid level when the requirement on the details of the image is not high, and the image details can be sampled at a lower position of the image pyramid level when the requirement on the details of the image is high, so that the effectiveness of the sampling points is ensured, and the sampling efficiency is improved; the sampling direction determining unit determines the sampling direction according to the view-independent environment mapping, the layer number of the color value corresponding to the sampling direction in the image pyramid is determined according to any sampling direction through the calculating unit, the corresponding color value is searched through the layer number of the image pyramid, the color value is used as the incident light quantity in the sampling direction, in the process, the incident light quantity in the sampling direction is directly determined through the layer number of the image pyramid, the calculation is simple, the problem of large calculation quantity of a traditional calculation mode is solved, the same effect can be achieved on the basis of one fourth of the original sampling times through the scheme, the real-time rendering effect is completed, and the rendering real-time is facilitated.
In the foregoing technical solution, preferably, the sampling direction determining unit includes: the unfolding unit is used for determining a hemisphere which is unfolded by taking any direction as a normal line according to the view-independent environment map; and the selection unit is used for randomly selecting a plurality of directions in the hemisphere as sampling directions.
In the technical scheme, the hemisphere which is unfolded in any direction serving as a normal direction is determined through the unfolding unit, so that the selection unit selects multiple directions in the hemisphere to serve as sampling directions, and corresponding incident light quantities are determined for the sampling directions.
In the above technical solution, preferably, the calculation unit includes: a first obtaining unit, configured to obtain the number of sampling directions, an attribute independent of a viewpoint environment map, and a mapping distortion factor of the environment map, where the attribute includes: the physical size and probability density function of the viewpoint environment map are not depended on; and the first calculation unit is used for calculating the layer number according to the physical size of the independent viewpoint environment map, the mapping distortion factor of the environment map, the probability density function and the number of sampling directions.
In the technical scheme, the sampling layer number can be accurately calculated by acquiring the number of sampling directions in a hemisphere, the physical size of the environment map independent of a viewpoint, the mapping distortion factor and the probability density function of the environment map, and different numbers of sampling times can be selected according to the requirements of image details to calculate the accurate sampling layer number, so that highlight information of a real scene can be more accurately represented.
In the above technical solution, preferably, the layer number is calculated by the following formula:
wherein l is the layer number, w is the width of the view-independent environment map, h is the height of the view-independent environment map, N is the number of sampling directions within the hemisphere, pdf is the sum of frsNormalized as a probability density function, d is the mapped distortion factor of the environment map.
In the technical scheme, the sampling layer number l is respectively related to the width w of the non-dependent view environment map, the height h of the non-dependent view environment map, the number N of sampling directions in a hemisphere, the probability density function pdf and the mapping distortion factor d of the environment map, the sampling layer number l is directly obtained by calculation through the formula, and the formula is simple and clear in calculation and easy to realize digitization.
In the above technical solution, preferably, the reflected light amount obtained from the statistics of the incident light amount is calculated by the following formula:
wherein L is
oIs the amount of reflected light in a certain direction, N is the number of said sampling directions within said hemisphere, L
isIs a certain sampling direction within said hemisphere
Amount of incident light, f
rsIs a bidirectional reflectance distribution function,
Is the direction of sampling
Cosine value of (1), pdf is
rsNormalized as a function of probability density.
In this embodiment, the amount of reflected light L in a certain direction
oThe number N of sampling directions in the hemisphere, and a certain sampling direction in the hemisphere
Amount of incident light L
isBidirectional reflectance distribution function f
rsSampling direction
Cosine value of
And from f
rsThe light quantity L of the reflected light in a certain direction is directly obtained by calculation through the formula after being related as a probability density function pdf through standardization processing
oThe formula is simple and clear to calculate, and digitization is easy to realize.
According to yet another aspect of the present invention, a computer device is proposed, which comprises a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the highlight information extraction method according to any one of the above when executing the computer program.
According to the computer equipment provided by the invention, when a processor executes a computer program, the environment Map is parameterized by acquiring the environment Map, so that the environment Map is converted into an environment Map (View-Independent-Map) Independent of a View point from a Longitude and Latitude Map (Latitude-Long-Map), and the influence of an observation direction is eliminated when highlight information is calculated; and determining the incident light quantity in any direction according to the independent viewpoint environment map, calculating the incident light quantity to obtain the reflected light quantity, collecting the reflected light quantity in all directions to obtain the light reflection intensity, outputting the light reflection intensity as the highlight information of the environment map, and in the process, determining the reflected light quantity in any direction by converting the reflected light quantity into the independent viewpoint environment map, which greatly reduces the calculation quantity required by the statistical calculation of the traditional method and can achieve the same effect.
According to yet another aspect of the present invention, a computer-readable storage medium is proposed, on which a computer program is stored, which computer program, when being executed by a processor, realizes the steps of the highlight information extraction method according to any one of the above.
The computer program realizes parameterization of the environment Map by acquiring the environment Map when being executed by a processor, so that the environment Map is converted from a Longitude and Latitude Map (Latitude-Long-Map) into an environment Map (View-Independent-Map) Independent of a View point, and the influence of an observation direction is eliminated when highlight information is calculated; and determining the incident light quantity in any direction according to the independent viewpoint environment map, calculating the incident light quantity to obtain the reflected light quantity, collecting the reflected light quantity in all directions to obtain the light reflection intensity, outputting the light reflection intensity as the highlight information of the environment map, and in the process, determining the reflected light quantity in any direction by converting the reflected light quantity into the independent viewpoint environment map, which greatly reduces the calculation quantity required by the statistical calculation of the traditional method and can achieve the same effect.
Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention.
Detailed Description
In order that the above objects, features and advantages of the present invention can be more clearly understood, a more particular description of the invention will be rendered by reference to the appended drawings. It should be noted that the embodiments and features of the embodiments of the present application may be combined with each other without conflict.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention, however, the present invention may be practiced in other ways than those specifically described herein, and therefore the scope of the present invention is not limited to the specific embodiments disclosed below.
An embodiment of the first aspect of the present invention provides a highlight information extraction method, and fig. 1 illustrates a flow diagram of the highlight information extraction method in the embodiment of the present invention. Wherein, the method comprises the following steps:
s102, obtaining an environment map;
s104, carrying out parameterization processing on the environment map, and converting the environment map into a view-independent environment map;
s106, determining the incident light quantity in any direction according to the view-independent environment map;
s108, obtaining the reflected light quantity according to the incident light quantity statistics;
s110, determining the reflection intensity of the light according to the reflection light quantity, and outputting the reflection intensity of the light as highlight information of the environment map.
In the embodiment, the environment Map is obtained and parameterized, so that the environment Map is converted from a Longitude and Latitude Map (Latitude-Longitude-Map) into an environment Map (View-Independent-Map) Independent of a viewpoint, and the influence of an observation direction on calculation of highlight information is eliminated; and determining the incident light quantity in any direction according to the independent viewpoint environment map, calculating the incident light quantity to obtain the reflected light quantity, collecting the reflected light quantity in all directions to obtain the light reflection intensity, outputting the light reflection intensity as the highlight information of the environment map, and in the process, determining the reflected light quantity in any direction by converting the reflected light quantity into the independent viewpoint environment map, which greatly reduces the calculation quantity required by the statistical calculation of the traditional method and can achieve the same effect.
Fig. 2 shows a flow chart of a highlight information extraction method in an embodiment of the present invention.
In one embodiment of the present invention, preferably, the highlight information extraction method includes:
s202, obtaining an environment map;
s204, carrying out parameterization processing on the environment map, and converting the environment map into a view-independent environment map;
s206, processing the map independent of the viewpoint environment by using a Mipmap technology to generate an image pyramid;
s208, determining a sampling direction according to the view-independent environment map;
s210, determining a layer number corresponding to any sampling direction in the image pyramid according to any sampling direction and the image pyramid;
s212, searching a corresponding color value according to the layer number, and taking the color value as the incident light quantity in the sampling direction;
s214, obtaining the reflected light quantity according to the incident light quantity statistics;
s216, determining the reflection intensity of the light according to the reflection light quantity, and outputting the reflection intensity of the light as highlight information of the environment map.
In this embodiment, the view-independent environment map is processed using a Mipmap technique to generate an image pyramid. The Mipmap (parameter in a small space) is a computer graphic image technology, in particular to a texture mapping technology, namely a pixel value in an l-layer picture is an average value of 4 pixels at a corresponding position in an l-1-layer picture, in the traditional highlight extraction and sampling process, the number of invalid sampling points is too many, the sampling efficiency is low, the influence of the invalid sampling points on a result can be reduced by using the Mipmap technology, the sampling can be carried out at a higher position of an image pyramid level when the requirement on the image detail is low, and the sampling can be carried out at a lower position of the image pyramid level when the requirement on the image detail is high, so that the effectiveness of the sampling points is ensured, and the sampling efficiency is improved; the sampling direction is determined according to the view-independent environment map, the layer number of the sampling direction in the image pyramid is determined according to any sampling direction, the corresponding color value is searched for through the layer number of the image pyramid, the color value is used as the incident light quantity in the sampling direction, in the process, the incident light quantity in the sampling direction is directly determined through the layer number of the image pyramid, the calculation is simple, the problem that the calculation quantity of a traditional calculation mode is large is solved, the same effect can be achieved on the basis of one fourth of the original sampling times through the scheme, and real-time rendering can be completed, so that real-time rendering is facilitated.
Such as: in the traditional highlight information extraction method, 1000 points are averagely collected in an environment map depending on a viewpoint, wherein 200 invalid sampling points can appear, highlight information is obtained through complicated calculation, the same rendering effect as the traditional mode can be achieved by only collecting 200 to 300 points through the technical scheme, highlight information corresponding to the sampling direction is determined by using an image pyramid, the calculation amount of highlight information is reduced, and the calculation basis of real-time rendering is realized.
Fig. 3 shows a flowchart of a highlight information extraction method in an embodiment of the present invention.
In one embodiment of the present invention, preferably, the highlight information extraction method includes:
s302, obtaining an environment map;
s304, carrying out parameterization processing on the environment map, and converting the environment map into a view-independent environment map;
s306, processing the map independent of the viewpoint environment by using a Mipmap technology to generate an image pyramid;
s308, determining a hemisphere which is unfolded by taking any direction as a normal line according to the view-independent environment map;
s310, randomly selecting a plurality of directions in a hemisphere as sampling directions;
s312, determining a layer number corresponding to any sampling direction in the image pyramid according to any sampling direction and the image pyramid;
s314, searching a corresponding color value according to the layer number, and taking the color value as the incident light quantity in the sampling direction;
s316, obtaining the reflected light quantity according to the incident light quantity statistics;
s318, determining the reflection intensity of the light according to the reflection light quantity, and outputting the reflection intensity of the light as highlight information of the environment map.
In this embodiment, in determining a hemisphere which is expanded with an arbitrary direction as a normal direction, so that a plurality of directions are selected as sampling directions in the hemisphere, and determining a corresponding amount of incident light for the sampling directions, the original integration in the hemisphere is converted into an accumulation of projections in the normal direction in the plurality of directions in the hemisphere, thereby reducing the amount of calculation required.
Fig. 4 shows a flowchart of a highlight information extraction method in an embodiment of the present invention.
In one embodiment of the present invention, preferably, the highlight information extraction method includes:
s402, obtaining an environment map;
s404, parameterizing the environment map, and converting the environment map into a view-independent environment map;
s406, processing the map independent of the viewpoint environment by using a Mipmap technology to generate an image pyramid;
s408, determining a hemisphere which is unfolded by taking any direction as a normal line according to the view-independent environment map;
s410, randomly selecting a plurality of directions in a hemisphere as sampling directions;
s412, acquiring the number of sampling directions, the attribute independent of the viewpoint environment map and the mapping distortion factor of the environment map, wherein the attribute comprises: the physical size and probability density function of the viewpoint environment map are not depended on;
s414, calculating layer numbers according to the physical size of the environment map independent of the viewpoint, the mapping distortion factor of the environment map, the probability density function and the number of sampling directions;
s416, searching a corresponding color value according to the layer number, and taking the color value as the incident light quantity in the sampling direction;
s418, obtaining the reflected light quantity according to the incident light quantity statistics;
and S420, determining the reflection intensity of the light according to the reflection light quantity, and outputting the reflection intensity of the light as highlight information of the environment map.
In the embodiment, the sampling layer number can be accurately calculated by obtaining the number of sampling points independent of the view environment map, the physical size independent of the view environment map, the mapping distortion factor of the environment map and the probability density function, and different numbers of sampling numbers can be selected according to the required image detail requirements, so that the accurate sampling layer number can be calculated, highlight information of a real scene can be more accurately represented, in addition, the required calculated amount is far less than that of the traditional highlight information, so that the data required to be calculated is reduced, and the time support is provided for real-time rendering.
In one embodiment of the present invention, the layer number is preferably calculated by the following formula:
wherein l is the layer number, w is the width of the view-independent environment map, h is the height of the view-independent environment map, N is the number of sampling directions within the hemisphere, pdf is the sum of frsNormalized as a probability density function, d is the mapped distortion factor of the environment map.
In the embodiment, the layer number l is respectively related to the width w of the view-independent environment map, the height h of the view-independent environment map, the number N of sampling directions in a hemisphere, the probability density function pdf and the mapping distortion factor d of the environment map, and the layer number l is directly obtained by calculation through the formula.
In one embodiment of the present invention, it is preferable that the reflected light amount statistically obtained from the incident light amount is calculated by the following formula:
wherein L is
oIs the amount of reflected light in a certain direction, N is the number of sampling directions within the hemisphere, L
isIs a certain sampling direction in the hemisphere
Amount of incident light, f
rsIs a bidirectional reflectance distribution function,
Is the direction of sampling
Cosine value of (1), pdf is
rsIs subject to standardizationThe processing is as a function of probability density.
In this embodiment, the amount of reflected light L in a certain direction
oThe number N of sampling directions in the hemisphere, and a certain sampling direction in the hemisphere
Amount of incident light L
isBidirectional reflectance distribution function f
rsSampling direction
Cosine value of
And from f
rsThe light quantity L of the reflected light in a certain direction is directly obtained by calculation through the formula after being related as a probability density function pdf through standardization processing
oThe formula is simple and clear to calculate, and digitization is easy to realize.
In a second aspect of the present invention, a highlight information extraction system is provided. FIG. 5 shows a schematic block diagram of a highlight information extraction system in an embodiment of the present invention. The highlight information extraction system 500 includes: an obtaining unit 502, configured to obtain an environment map; a conversion unit 504, configured to perform parameterization on the environment map and convert the environment map into a view-independent environment map; a determination unit 506 for determining the incident light amount in any direction from the viewpoint-independent environment map; a counting unit 508 for counting the amount of reflected light according to the amount of incident light; and an output unit 510 for determining the light reflection intensity according to the reflection light quantity, and outputting the light reflection intensity as highlight information of the environment map.
In this embodiment, the environment Map is obtained by the obtaining unit 502, the environment Map is parameterized by the converting unit 504, so that the environment Map is converted from a Longitude and Latitude Map (Latitude-Long-Map) into a View-Independent environment Map (View-Independent-Map) to be free from the influence of the observation direction in the calculation of highlight information, the incident light quantity in any direction is determined by the determining unit according to the View-Independent environment Map, the reflected light quantity is statistically obtained by the statistical unit 508 according to the incident light quantity, the reflected light quantity in all directions is collected by the output unit 510 to obtain the light reflection intensity, the light reflection intensity is output as highlight information of the environment Map, in the process, the reflected light quantity in any direction is determined by converting into the View-Independent environment Map and is greatly reduced compared with the calculation quantity required by the statistical calculation in the conventional manner, the method can achieve the same effect, can meet the requirement of real-time rendering, and solves the problems that a large number of sampling points are needed in the calculation process of highlight information in the traditional mode, and huge calculation amount is needed.
In an embodiment of the present invention, preferably, the determining unit 506 specifically includes: a generating unit 512, configured to process the view-independent environment map by using a Mipmap technique, and generate an image pyramid; a sampling direction determining unit 514 for determining a sampling direction from the view-independent environment map; a calculating unit 516, configured to determine, according to any sampling direction and the image pyramid, a layer number corresponding to the image pyramid in any sampling direction; and a searching unit 518, configured to search for a corresponding color value according to the layer number, and use the color value as an incident light amount in the sampling direction.
In this embodiment, the generating unit 512 uses Mipmap technology to process the view-independent environment map, and generates an image pyramid. The Mipmap (parameter in a small space) is a computer graphic image technology, in particular to a texture mapping technology, namely a pixel value in an l-layer picture is an average value of 4 pixels at a corresponding position in an l-1-layer picture, in the traditional highlight extraction and sampling process, the number of invalid sampling points is too many, the sampling efficiency is low, the influence of the invalid sampling points on a result in the sampling process can be reduced by using the Mipmap technology, the sampling can be carried out at a higher position of an image pyramid level when the requirement on the image details is low, and the sampling can be carried out at a lower position of the image pyramid level when the requirement on the image details is high, so that the effectiveness of the sampling points is ensured, and the sampling efficiency is improved; the sampling direction determining unit 514 determines the sampling direction according to the view-independent environment map, and determines the layer number of the color value corresponding to the sampling direction in the image pyramid according to any sampling direction through the calculating unit 516, the searching unit 518 searches the corresponding color value through the layer number of the image pyramid, and takes the color value as the incident light quantity in the sampling direction, in the process, the incident light quantity in the sampling direction is directly determined through the layer number of the image pyramid, the calculation is simple, the problem of large calculation quantity of a traditional calculation mode is solved, the effect of real-time rendering can be completed on the basis of one fourth of the original sampling point quantity through the scheme, and the rendering real-time is facilitated.
Such as: in the traditional highlight information extraction method, 1000 points are averagely collected in the environment map depending on the viewpoint, 200 invalid sampling points may appear, highlight information is obtained through complicated calculation, and the same rendering effect as that of the traditional mode can be achieved only by collecting 200 to 300 points through the technical scheme. By using the image pyramid to determine highlight information corresponding to the sampling direction, the calculation amount of highlight information determination is reduced, and therefore the calculation basis of real-time rendering is achieved.
In one embodiment of the present invention, preferably, the sampling direction determining unit 514 includes: an unfolding unit 520, configured to determine a hemisphere that is unfolded with an arbitrary direction as a normal line according to the view-independent environment map; a selection unit 522 for arbitrarily selecting a plurality of directions within the hemisphere as sampling directions.
In this embodiment, the unfolding unit 520 determines the hemisphere which is unfolded with an arbitrary direction as the normal direction, so that the selection unit 522 selects a plurality of directions as sampling directions in the hemisphere, and determines the corresponding incident light amount for the sampling directions, in the process, the original integration in the hemisphere is converted into the accumulation of the projections of the reflected light amounts in the plurality of directions in the hemisphere in the normal direction, thereby reducing the required calculation amount.
In one embodiment of the present invention, preferably, the computing unit 516 includes: a first obtaining unit 524, configured to obtain the number of sampling directions, a property independent of the view environment map, and a mapping distortion factor of the environment map, where the property includes: a physical size probability density function independent of the viewpoint environment map; a first calculating unit 526 for calculating a layer number according to the physical size of the view-independent environment map, the mapping distortion factor of the environment map, the probability density function, and the number of sampling directions. In this embodiment, the first calculating unit 526 obtains the number of sampling directions in the hemisphere, the physical size independent of the viewpoint environment map, the mapping distortion factor of the environment map, and the probability density function through the first obtaining unit 524, so as to accurately calculate the sampling layer number, and may select different numbers of sampling times according to the required image details, so as to calculate the accurate sampling layer number, and more accurately represent highlight information of a real scene.
In one embodiment of the present invention, the layer number is preferably calculated by the following formula:
wherein l is the layer number, w is the width of the view-independent environment map, h is the height of the view-independent environment map, N is the number of sampling directions within the hemisphere, pdf is the sum of frsNormalized as a probability density function, d is the mapped distortion factor of the environment map.
In the embodiment, the layer number l is respectively related to the width w of the view-independent environment map, the height h of the view-independent environment map, the number N of sampling directions in a hemisphere, the probability density function pdf and the mapping distortion factor d of the environment map, and the layer number l is directly obtained by calculation through the formula.
In one embodiment of the present invention, it is preferable that the reflected light amount statistically obtained from the incident light amount is calculated by the following formula:
wherein L is
oIs the amount of reflected light in a certain direction, N is the number of sampling directions within the hemisphere, L
isIs a certain sampling direction within said hemisphere
Amount of incident light, f
rsIs a bidirectional reflectance distribution function,
Is the direction of sampling
Cosine value of (1), pdf is
rsNormalized as a function of probability density.
In this embodiment, the amount of reflected light L in a certain direction
oThe number N of sampling directions in the hemisphere, and a certain sampling direction in the hemisphere
Amount of incident light L
isBidirectional reflectance distribution function f
rsSampling direction
Cosine value of
And from f
rsThe light quantity L of the reflected light in a certain direction is directly obtained by calculation through the formula after being related as a probability density function pdf through standardization processing
oThe formula is simple and clear to calculate, and digitization is easy to realize.
In embodiments of the third aspect of the present invention, a computer device is provided, and fig. 6 shows a schematic block diagram of a computer device 600 according to an embodiment of the present invention. Wherein the computer device 600 comprises:
a memory 602, a processor 604 and a computer program stored on the memory 602 and executable on the processor 604, wherein the processor 604 implements the steps of any one of the highlight information extraction methods as described above when executing the computer program.
According to the computer device 600 provided by the invention, when the processor 604 executes the computer program, the environment Map is parameterized by acquiring the environment Map, so that the environment Map is converted from a Longitude and Latitude Map (Latitude-Long-Map) into an environment Map (View-Independent-Map) Independent of a View point, and the influence of an observation direction on highlight information during calculation is eliminated; and determining the incident light quantity in any direction according to the independent viewpoint environment map, calculating the incident light quantity to obtain the reflected light quantity, collecting the reflected light quantity in all directions to obtain the light reflection intensity, outputting the light reflection intensity as the highlight information of the environment map, and in the process, determining the reflected light quantity in any direction by converting the reflected light quantity into the independent viewpoint environment map, which greatly reduces the calculation quantity required by the statistical calculation of the traditional method and can achieve the same effect.
An embodiment of the fourth aspect of the present invention provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of any one of the highlight information extraction methods described above.
The computer program realizes parameterization of the environment Map by acquiring the environment Map when being executed by a processor, so that the environment Map is converted from a Longitude and Latitude Map (Latitude-Long-Map) into an environment Map (View-Independent-Map) Independent of a View point, and the influence of an observation direction is eliminated when highlight information is calculated; and determining the incident light quantity in any direction according to the independent viewpoint environment map, calculating the incident light quantity to obtain the reflected light quantity, collecting the reflected light quantity in all directions to obtain the light reflection intensity, outputting the light reflection intensity as the highlight information of the environment map, and in the process, determining the reflected light quantity in any direction by converting the reflected light quantity into the independent viewpoint environment map, which greatly reduces the calculation quantity required by the statistical calculation of the traditional method and can achieve the same effect.
In the description herein, the description of the terms "one embodiment," "some embodiments," "specific embodiments," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.