The content of the invention
In order to solve the deficiency of prior art presence, influence empty based on panorama it is an object of the invention to provide one kindIntend the method for object effect of shadow, virtual objects can be allowed to be influenceed by real world shadow, and the shadow in real worldIt can produce interactive.
To achieve the above object, what the present invention was provided influences the method for virtual objects effect of shadow, bag based on panoramaInclude following steps:
(1)Obtain the panorama of current scene;(2)The surrounding environment generated with panorama, is carried out on virtual objects surfaceMirror-reflection;(3)Diffusing reflection environment map is generated according to panorama;(4)It is that virtual objects generation is unrestrained by diffusing reflection environment mapReflected light is shone;(5)It is virtual objects generation final effect figure according to mirror-reflection and diffusing reflection effect.
The step(1)Further comprise:(11)By photographing device, the shooting of different angles is carried out to surrounding environment;(12)Panorama is generated by all photographic intelligences of shooting.
The step(2)Further comprise:(21)Direction of visual lines v and virtual objects surface arbitrfary point P according to the observationNormal direction n, calculate incident light direction r;(22)Obtain the illumination letter that incident beam is reflexed at point P in observer's eyeBreath.
The step(22)Further comprise:According to the smooth degree g at point P, the minute surface environment for corresponding resolution of samplingReflectogram, obtains the reflective information of correspondence readability.
Further, the step(3)For:All pixels in read group total panorama, for the void that normal direction is nIntend the arbitrfary point P of subject surface illumination result.
Further, step(3)Described in diffusing reflection environment map, for being stored in panorama each arbitrfary point P,The intensity and color of the photograph that diffuses for the surrounding environment transmitting that all directions can be received.
Further, step(3)Described in diffusing reflection environment map, with cube or ball it is humorous preserve.
Further, the step(4)For:According to virtual objects surface arbitrfary point P normal direction n, from diffusing reflection ringNormal direction n Lighting information is obtained in the figure of border.
The present invention's influences the method for virtual objects effect of shadow based on panorama, according to the prompting taken pictures, to specifyingDirection is taken pictures, based on the multiple pictures of photographing device multi-angled shooting, is generated panorama, is extracted from panoramaShadow information, removes to influence the shadow expression effect in virtual picture, allows virtual picture to be influenceed by the shadow in real world,So as to obtain truer, more rich Product Experience.
Other features and advantages of the present invention will be illustrated in the following description, also, partly becomes from specificationObtain it is clear that or being understood by implementing the present invention.
Brief description of the drawings
Accompanying drawing is used for providing a further understanding of the present invention, and constitutes a part for specification, and with the present invention'sEmbodiment together, for explaining the present invention, is not construed as limiting the invention.In the accompanying drawings:
Fig. 1 is that the method flow diagram of virtual objects effect of shadow is influenceed based on panorama according to the present invention;
Fig. 2 is a photo in the multiple pictures according to the shooting of the present invention;
Fig. 3 is the cube of the panorama according to the present invention;
Fig. 4 is the schematic diagram for calculating the incident light direction r in virtual objects surface according to the present invention;
Fig. 5 is the schematic diagram of the calculating virtual objects surface specular reflections light according to the present invention;
Fig. 6 is the mirror-reflection comparison diagram of the different degree of roughness according to the present invention;
Fig. 7 is the schematic diagram of the directive illumination sum received according to the calculating virtual objects surface of the present invention;
Fig. 8 is the diffusing reflection environment cube of the generation according to the present invention;
Fig. 9 is to be diffused to shine design sketch according to the virtual objects of the present invention;
Figure 10 is the flow chart of the lighting effect of the influence virtual objects statue model according to the present invention.
Embodiment
The preferred embodiments of the present invention are illustrated below in conjunction with accompanying drawing, it will be appreciated that preferred reality described hereinApply example to be merely to illustrate and explain the present invention, be not intended to limit the present invention.
Fig. 1 is that the method flow diagram of virtual objects effect of shadow is influenceed based on panorama according to the present invention, below willWith reference to Fig. 1, the method for virtual objects effect of shadow is influenceed to be described in detail based on panorama the present invention.
In step 101, provide and take pictures into after system, in system(Manually or automatically take pictures)Function, enters to surrounding environmentThe different angles of row(The all angles of current scene are covered as far as possible)Shooting;Or uploading pictures function is provided, worked asOne group of photo of preceding scene.Fig. 2 is a photo in the multiple pictures according to the shooting of the present invention.
In step 102, panorama is generated according to all photographic intelligences of shooting;
Fig. 3 is the cube of the panorama according to the present invention(CubeMap).As shown in figure 3, according to multiple photographs of shootingPiece, generates panorama textures.
In step 103, the surrounding environment generated with panorama carries out mirror-reflection on virtual objects surface(specular reflection).
The concrete scheme of mirror-reflection is:
(1)Direction of visual lines v and virtual objects surface arbitrfary point P normal direction n according to the observation, calculate incident light sideTo r;Fig. 4 is the schematic diagram for calculating the incident light direction r in virtual objects surface according to the present invention.
Incident light direction r calculation formula is:R=v-2*n*dot (v, n)
Wherein, * represents the multiplication of scalar sum vector, and dot (v, n) represents direction of visual lines vector v and normal line vector n dot product.
(2)Obtain the Lighting information that incident beam is reflexed at point P in observer's eye.
Fig. 5 is the schematic diagram of the calculating virtual objects surface specular reflections light according to the present invention.Point P smooth degree g determinesThe thickness of irradiating light beam is incorporated into, the incident beam of more smooth surface is thinner, and reflective information is more clear.According to the smooth degree at point PG, corresponding resolution of sampling(Precision)Minute surface Ambient figure, obtain correspondence readability reflective information.
The smooth surface of sampling, obtains high-resolution minute surface Ambient figure, obtains apparent reflective information.
Fig. 6 is the mirror-reflection comparison diagram of the different degree of roughness according to the present invention.As shown in fig. 6, the model of the leftmost sideMaterial it is most smooth(G is maximum), the material for the model turned right is more and more coarse(G is less and less), from fig. 6 it can be seen that moreSmooth material mirror-reflection is more clear.
In step 104, diffusing reflection environment map is generated according to panorama;
Generation diffusing reflection environment map concrete scheme be:All pixels in read group total panorama, are n's for normal directionThe arbitrfary point P on virtual objects surface illumination result.Fig. 7 is according to owning that the calculating virtual objects surface of the present invention is receivedThe schematic diagram of the illumination sum in direction.
Specifically, to arbitrfary point P of the normal direction for n virtual objects surface, all directions are calculated(That is any directiond)Incident light it is as follows in the formula of point P Lighting information sum:
E=∑Ed* max (0, dot (d, n))
Wherein, E is Lighting information and EdIt is any direction d incident light, max is the function for seeking two number maximums, dot (d,N) it is the result of asking incident light vector d and normal line vector n dot products.
Diffusing reflection environment map, for being stored in panorama each arbitrfary point P, the week that can be received in all directionsThe intensity and color of the photograph that diffuses of collarette border transmitting.
Diffusing reflection environment map can use cube(CubeMap)Or ball is humorous(Spherical harmonics)Preserve,Fig. 8 is the diffusing reflection environment cube of the generation according to the present invention.
In the step, when obtaining diffusing reflection environment map, only a kind of resolution ratio, it is not necessary to according to smooth degree g samplings notWith the textures of resolution ratio.
It is that virtual objects generate the photograph that diffuses by diffusing reflection environment map in step 105;
The diffuse concrete scheme of photograph of generation is:According to virtual objects surface arbitrfary point P normal direction n, from diffusing reflection ringNormal direction n Lighting information is obtained in the figure of border.Fig. 9 is to be diffused to shine design sketch according to the virtual objects of the present invention.
It is virtual objects generation final effect figure according to mirror-reflection and diffusing reflection effect in step 106.
The present invention's influences the method for virtual objects effect of shadow based on panorama, and ambient light is obtained by capture apparatusThe truth of shadow, so as to influence the shadow in virtual system to show.
Figure 10 is the flow chart of the lighting effect of the influence virtual objects statue model according to the present invention, with reference to figure10, the operation principle of the present invention is expanded on further.
First, obtaining includes Figure 10(a)One group of photo of current scene inside;
Secondly, by one group of photo of current scene, generation such as Figure 10(b)Shown panorama;
Again, panorama Figure 10 is passed through(b), the lighting effect of virtual objects statue model is handled, generation such as Figure 10(c)Shown mirror reflection effect figure;In the step, panorama is directly used as minute surface Ambient figure.
Again, by panorama Figure 10(b), generation such as Figure 10(d)Shown diffusing reflection Environment, and pass through diffusing reflectionEnvironment Figure 10(d), the lighting effect of virtual objects statue model is handled, generation such as Figure 10(e)Shown is unrestrained anti-Penetrate design sketch;
Finally, mirror reflection effect figure Figure 10 is passed through(c)And diffusing reflection design sketch Figure 10(c), generation such as Figure 10(f)It is shown mostWhole design sketch.
The present invention's influences the method for virtual objects effect of shadow based on panorama, according to the prompting taken pictures, to specifyingDirection is taken pictures, based on the multiple pictures of photographing device multi-angled shooting, is generated panorama, is extracted from panoramaShadow information, removes to influence the shadow expression effect in virtual picture, allows virtual picture to be influenceed by the shadow in real world,So as to obtain truer, more rich Product Experience.
One of ordinary skill in the art will appreciate that:It the foregoing is only the preferred embodiments of the present invention, and withoutIn the limitation present invention, although the present invention is described in detail with reference to the foregoing embodiments, for those skilled in the artFor, it can still be modified to the technical scheme that foregoing embodiments are recorded, or which part technical characteristic is enteredRow equivalent substitution.Within the spirit and principles of the invention, any modification, equivalent substitution and improvements made etc., all should be includedWithin protection scope of the present invention.