A method of enhancing virtual reality scenario illumination and reflection validity
Technical field
The present invention relates to a kind of methods of enhancing virtual reality scenario illumination and reflection validity, and it is real-time to belong to three-dimensional scenic
Rendering field.
Background technique
In three-dimensional scenic real-time rendering, enhance virtual reality experience, improve scene validity, for attracting user's enhancing
Man-machine interaction experience is more and more important.In real-time rendering, light luminance attenuation ratio is more, in order to simulate more true environment
Light needs us according to some light compensating lamps of environment generation, while generating Reflction by auxiliary, promotes effect of shadow.
Existing illumination render algorithm be mainly based upon ambient lighting, diffused light shine with specular light according to etc..Illumination impinges upon object
It on body surface face, is coloured on pixel by tinter, to simulate realistic material effect, such as semi-transparent obvious results
Fruit, reflecting effect and jade effect.The surface color of physics is usually by three primary colours vector description, real-time rendering in three-dimensional space
Rendering method there are three types of general, multiple light courcess once renders, multiple light courcess repeatedly renders and postpones coloring.The above two are due to largely calculating
Each object renders waste of resource to hidden object;And postpone coloring, last pixel is all based on due to colouring every time
Attribute, therefore time complexity is relatively much smaller.But in real life, having in the room of light, body surface will not
Be it is completely unglazed, some total light quantum is in body surface.
So we it is necessary to the environment light that some light compensating lamps of addition of intelligence simulate this partial loss, while for anti-
Material is penetrated, Reflction real-time rendering is generated and effectively raises rendering efficiency by both approach, greatly improve
Interactive experience.
Summary of the invention
Goal of the invention: in order to overcome the deficiencies in the prior art, the present invention provides a kind of enhancing virtual reality scenario
The method of illumination and reflection validity, the automation that can be realized light compensating lamp and Reflction generate, by both approach, have
Effect improves rendering efficiency, greatly promotes interactive experience.
Technical solution: to achieve the above object, the technical solution adopted by the present invention are as follows:
A method of enhancing virtual reality scenario illumination and reflection validity, comprising the following steps:
1) the house type region drawn according to user, logging data structure simultaneously are completed to pre-process;
2) according to modular character, functional module, such as bedroom parlor etc. in house type are divided, the environment letter of light compensating lamp for after
Breath provides foundation, while can effectively improve calculating concurrency, enhances real-time experience;
3) it is based on modular character, including window size, position, depth, calculates the light compensating lamp information for generating each module, including
Size, position, the quantity of light compensating lamp;
4) it is based on environmental parameter, adjusts the intensity and color of light compensating lamp, further promotes the sense of reality of light compensating lamp;
5) the reflection material in extraction environment, different types is divided according to opacity and reflection coefficient;
6) environmental parameter and surrounding objects are based on, superposition renders for several times, and superposition reflective to setting number generates corresponding complete
Scape Reflction;
7) textures, real-time rendering light compensating lamp are sticked.
Further, the preprocessing process includes: to realize point face information trigonometric ratio, and calculate dough sheet normal vector.
Further, the generating process of each module light compensating lamp information includes: to set height as h, width w, then
Light compensating lamp dough sheet height is k1H, width k2W, light compensating lamp is apart from window length L=k3* min (h, w), range of exposures area are
S, and the light intensity of light compensating lamp and irradiated area S are positively correlated;Wherein, k1、k2For multiple coefficient, if entire scene illumination intensity be N then
k1∝ N, k2∝ N, and k3For multiple coefficient,
Further, the environmental parameter includes window depth, indoor illumination intensity and color.
Further, the generating process of the panorama Reflction includes acquiring the inscribed spherical surface of maximum of scene, and generate
General steady spherical panoramic image based on OpenCV is cut out according to scene viewpoint position by splicing technology of panorama drawing
Panorama sketch is attached in reflection material by the panorama sketch textures of the material plane sizes in visual angle.The synthesis flow of panorama sketch includes:
Feature Points Matching, picture mode matching, panorama sketch amendment, the fusion of image irradiation tone balance, image frequency range.
The utility model has the advantages that a kind of method of enhancing virtual reality scenario illumination and reflection validity provided by the invention, relatively
It in the prior art, has the advantage that 1, combine model partition with region light compensating lamp computational algorithm, it is parallel to increase algorithm
Property;2, parallel computation region light compensating lamp relevant information and Reflction greatly improve the experience of real-time rendering effect;3, in model
Partitioning pretreatment is added in division, so that model partition is more rapidly and efficiently;4, in conjunction with the height fitting of specific environment Mature growing
Reflction is spent, real-time validity is efficiently improved.
Detailed description of the invention
Fig. 1 is a kind of flow chart of enhancing virtual reality scenario illumination and the method for reflecting validity of the present invention;
Fig. 2 is the schematic diagram that light compensating lamp dough sheet information is generated in the present invention.
Specific embodiment
The present invention will be further explained with reference to the accompanying drawings and embodiments.
It is as shown in Figure 1 a kind of method of enhancing virtual reality scenario illumination and reflection validity, comprising the following steps:
1) the house type region drawn according to user, logging data structure simultaneously are completed to pre-process, that is, realize point face information triangle
Change, and calculates dough sheet normal vector;
2) according to modular character, functional module in house type is divided;
3) it is based on modular character, including window size, position, depth, calculates the light compensating lamp information for generating each module, including
Size, position, the quantity of light compensating lamp;
4) based on parameters such as window depth, indoor illumination intensity and colors, the intensity and color of light compensating lamp are adjusted;
5) the reflection material in extraction environment, different types is divided according to opacity and reflection coefficient;
6) environmental parameter and surrounding objects are based on, superposition renders for several times, and superposition reflective to setting number generates corresponding complete
Scape Reflction;
7) textures, real-time rendering light compensating lamp are sticked.
Existing light compensating lamp generates, and the usually fixed light compensating lamp position of program setting or offer increases light compensating lamp manually and arrive
Entrance in scene, process CIMS are complicated, and adjustment lighting programmers are also more troublesome, often expend designer it is considerable when
Between.The present invention provides a kind of scheme reliably compromised, the generating process of each module light compensating lamp information include: as shown in Fig. 2,
If height is h, width w, then light compensating lamp dough sheet height is k1H, width k2W, light compensating lamp is apart from window length L=k3*
Min (h, w), range of exposures area is S, and the light intensity of light compensating lamp and irradiated area S are positively correlated;Wherein, k1、k2For multiple coefficient,
If entire scene illumination intensity is N then k1∝ N, k2∝ N, and k3For multiple coefficient,
In the present embodiment, the generating process of the panorama Reflction includes acquiring the inscribed spherical surface of maximum of scene, and give birth to
At the general steady spherical panoramic image based on OpenCV, cut according to scene viewpoint position by splicing technology of panorama drawing
Panorama sketch is attached in reflection material by the panorama sketch textures of the material plane sizes in visual angle out.
Since textures are more in scene, the light compensating lamp quantity needed is also relatively more, and this programme is based on calculating process
The speeding scheme of OpenMP.
The above is only a preferred embodiment of the present invention, it should be pointed out that: for the ordinary skill people of the art
For member, various improvements and modifications may be made without departing from the principle of the present invention, these improvements and modifications are also answered
It is considered as protection scope of the present invention.