Method for enhancing illumination and reflection reality degree of virtual reality scene
Technical Field
The invention relates to a method for enhancing illumination and reflection reality degree of a virtual reality scene, and belongs to the technical field of real-time rendering of three-dimensional scenes.
Background
In the real-time rendering of the three-dimensional scene, the virtual reality experience is enhanced, the scene reality degree is improved, and the method is more and more important for attracting users to enhance the human-computer interaction experience. In the real-time rendering, the light luminance decay is more, in order to simulate more real ambient light, needs us to generate some light filling lamps according to the environment, and through supplementary formation reflection mapping, promote the shadow effect simultaneously.
The existing illumination rendering algorithm is mainly based on ambient illumination, diffuse illumination, mirror illumination and the like. The light shines on the object surface, and is painted on the pixel point through the coloring device to simulate the material effect with the sense of reality, such as a semitransparent effect, a reflection effect and a jade effect. The physical surface color in the three-dimensional space is usually described by three primary color vectors, and real-time rendering generally comprises three rendering methods, namely multi-light-source one-time rendering, multi-light-source multiple rendering and delayed coloring. The former two wastes resources because of calculating each object in large quantity, and rendering the hidden object; and the delayed coloring is based on the attribute of the last pixel point, so the time complexity is much smaller. However, in real life, in a light room, the surface of an object is not completely dark, and a part of light quantum always exists on the surface of the object.
Therefore, the light supplementing lamps are added to simulate the lost ambient light, the reflection map is generated to render in real time according to the reflection material, the rendering efficiency is effectively improved through the two ways, and the interaction experience is greatly improved.
Disclosure of Invention
The purpose of the invention is as follows: in order to overcome the defects in the prior art, the invention provides a method for enhancing the illumination and reflection reality degree of a virtual reality scene, which can realize the automatic generation of a light supplement lamp and a reflection map.
The technical scheme is as follows: in order to achieve the purpose, the invention adopts the technical scheme that:
a method for enhancing illumination and reflection reality degree of a virtual reality scene comprises the following steps:
1) According to the house type area drawn by the user, inputting a data structure and finishing preprocessing;
2) According to the module characteristics, the indoor functional modules, such as bedroom living rooms and the like, are divided, a basis is provided for the environment information of the light supplement lamp, meanwhile, the calculation parallelism can be effectively improved, and the real-time experience is enhanced;
3) Calculating and generating light supplement lamp information of each module based on the module characteristics including the size, the position and the depth of the window, wherein the light supplement lamp information includes the size, the position and the number of light supplement lamps;
4) Based on the environmental parameters, the intensity and the color of the light supplement lamp are adjusted, and the sense of reality of the light supplement lamp is further improved;
5) Extracting reflection materials in the environment, and dividing different types according to the opacity and the reflection coefficient;
6) Based on the environmental parameters and surrounding objects, rendering for a plurality of times in a superposition mode, reflecting for a set number of times in a superposition mode, and generating a corresponding panoramic reflection map;
7) And pasting a paste picture, and rendering the light supplement lamp in real time.
Further, the pretreatment process comprises: and realizing the triangularization of point-surface information, and calculating a normal vector of a surface patch.
Further, the generating process of the light supplement lamp information of each module includes: if the height of the window is h and the width is w, the height of the light-compensating lamp patch is k
1 h, width k
2 w, length L = k of light supplement lamp from window
3 * min (h, w), wherein the area of an irradiation range is S, and the light intensity of the light supplement lamp is positively correlated with the irradiation area S; wherein k is
1 、k
2 Is a multiple coefficient, and k is the illumination intensity of the whole scene is set as N
1 ∝N,k
2 Is alpha to N, and k
3 Is a coefficient of the multiple of the number,
further, the environmental parameters include window depth, indoor illumination intensity and color.
Furthermore, the generation process of the panoramic reflection map comprises the steps of obtaining the maximum inscribed sphere of the scene, generating a general and stable spherical panoramic map based on OpenCV, cutting out the panoramic map of the material plane size in the view angle according to the viewpoint position of the scene through a panoramic map splicing technology, and pasting the panoramic map on the reflection material. The panoramic image synthesis flow comprises the following steps: feature point matching, picture mode matching, panorama correction, image illumination tone balance and image frequency band fusion.
Has the beneficial effects that: compared with the prior art, the method for enhancing the illumination and reflection reality degree of the virtual reality scene has the following advantages: 1. model division is combined with a regional fill light calculation algorithm, and algorithm parallelism is increased; 2. the related information of the light supplement lamp and the reflection map in the area are calculated in parallel, so that the real-time rendering effect experience is greatly improved; 3. the partitioning pretreatment is added in the model partitioning, so that the model partitioning is faster and more efficient; 4. and the high-fitting-degree reflection mapping generated by combining the specific environment material effectively improves the real-time reality degree.
Drawings
FIG. 1 is a flow chart of a method of enhancing the illumination and reflection realism of a virtual reality scene according to the present invention;
fig. 2 is a schematic diagram of generating information of a light filling lamp patch in the present invention.
Detailed Description
The present invention will be further described with reference to the accompanying drawings and examples.
Fig. 1 shows a method for enhancing the illumination and reflection reality of a virtual reality scene, comprising the following steps:
1) Inputting a data structure and finishing preprocessing according to a house type area drawn by a user, namely realizing the triangularization of point-surface information and calculating a surface patch normal vector;
2) Dividing the function modules in the house type according to the module characteristics;
3) Based on the module characteristics including the size, position and depth of the window, calculating and generating light supplement lamp information of each module including the size, position and number of light supplement lamps;
4) Adjusting the intensity and color of the light supplement lamp based on parameters such as the depth of the window, the indoor illumination intensity and color and the like;
5) Extracting reflection materials in the environment, and dividing different types according to the opacity and the reflection coefficient;
6) Based on the environmental parameters and surrounding objects, rendering for a plurality of times in a superposition mode, reflecting for a set number of times in a superposition mode, and generating a corresponding panoramic reflection map;
7) And pasting a paste map, and rendering the light supplement lamp in real time.
The conventional light supplement lamp is usually generated by setting the position of the light supplement lamp or providing the light supplement lamp by a programThe manual increase light filling lamp is to the scene in the entry, and the flow is more complicated, and it is also more troublesome to adjust light parameter, often can consume the designer considerable time. The invention provides a reliable compromise scheme, and the generation process of the light supplement lamp information of each module comprises the following steps: as shown in fig. 2, if the height of the window is h and the width is w, the height of the light-compensating lamp patch is k
1 h, width k
2 w, the length L = k of the light supplement lamp from the window
3 * min (h, w), the area of the irradiation range is S, and the light intensity of the light supplement lamp is positively correlated with the irradiation area S; wherein k is
1 、k
2 Is a multiple coefficient, and k is the illumination intensity of the whole scene is set as N
1 ∝N,k
2 Is alpha to N, and k
3 Is the coefficient of the multiple of the number,
in this embodiment, the generating process of the panoramic reflection map includes obtaining a maximum inscribed sphere of the scene, generating a general robust spherical panorama based on OpenCV, cutting out a panoramic map of the material plane size in the view angle according to the scene viewpoint position through a panorama splicing technology, and attaching the panoramic map to the reflection material.
Because the number of the maps in the scene is large, the number of the required light supplement lamps is large, and the scheme is an OpenMP-based acceleration scheme for the calculation process.
The above description is only of the preferred embodiments of the present invention, and it should be noted that: it will be apparent to those skilled in the art that various modifications and adaptations can be made without departing from the principles of the invention and these are intended to be within the scope of the invention.