CN106846454A - Lens Flare method for drafting and device - Google Patents
Lens Flare method for drafting and device Download PDFInfo
- Publication number
- CN106846454A CN106846454A CN201710032937.0A CN201710032937A CN106846454A CN 106846454 A CN106846454 A CN 106846454A CN 201710032937 A CN201710032937 A CN 201710032937A CN 106846454 A CN106846454 A CN 106846454A
- Authority
- CN
- China
- Prior art keywords
- lens flare
- lens
- flare
- halation
- parameter
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T15/00—3D [Three Dimensional] image rendering
- G06T15/50—Lighting effects
Landscapes
- Engineering & Computer Science (AREA)
- Computer Graphics (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Image Generation (AREA)
Abstract
A kind of Lens Flare method for drafting disclosed by the invention and device are merged into a large texture textures by by the texture mapping needed for some Lens Flares,It is committed to the caching of GPU,Then halation model is set up in three-dimensional scenic,The parameter and the attribute of each Lens Flare of current scene real-time adjustment of some Lens Flares according to input,According to the attribute of each Lens Flare,Call a quad patch,Read large texture textures caching,Each Lens Flare is drawn by tinter,This programme draws Lens Flare by the way of picture mapping,Multiple Lens Flares can be drawn in a batch by a quad patch and a large texture textures,Save the expense drawn,And the parameter of the Lens Flare can be set and be input into by designer,Pattern variation,Flexible configuration,Solve existing Lens Flare drafting expense big,The problem that can not be configured.
Description
Technical field
The present invention relates to area of computer graphics, more particularly to a kind of Lens Flare method for drafting and device.
Background technology
With the popularization of smart mobile phone and panel computer, the game of mobile terminal also grows up, with setting about industry of parading
Development, more and more senior drafting effects start the appearance on the user of mobile phone and panel computer.Image quality can particularly be represented
The camera lens glare effect of level, that is, Lens Flare effect, are gradually applied in mobile phone games.Lens Flare is inside camera lens
There is the optical phenomenas such as reflection, refraction, diffraction in light, so as to the glare effect formed in photo, the video for shooting.
There are based on the physics, sense of reality, Lens Flare rendering technique at present, but computing cost is very big, and
And need complicated pretreatment.And, ripe hand trip engine, such as unity, middle Lens Flare function is simple, but halation
Effect can not be configured, style sheet one, and drafting expense still has optimization space.
The content of the invention
The purpose of the embodiment of the present invention is to provide a kind of Lens Flare method for drafting and device, can Fast Drawing camera lens light
It is dizzy, solve the problems, such as that existing Lens Flare drafting expense is big, can not configure, diversification of forms, change is flexible.
To achieve the above object, a kind of Lens Flare method for drafting, including step be the embodiment of the invention provides:
The parameter of some Lens Flares of input is received, and successively in incoming tinter;
The texture mapping to be used of some Lens Flares is merged into a large texture textures, by large texture patch
Figure generates large texture textures caching in being committed to the caching of GPU;
Halation model is set up in three-dimensional scenic, according to the parameter and current scene real-time adjustment of some Lens Flares
The attribute of each Lens Flare in tinter;
According to the attribute of each Lens Flare, a quad patch is called, read the large texture textures caching, led to
Tinter is crossed to draw each Lens Flare.
Compared with prior art, if the dry system lens that is set according to designer of Lens Flare method for drafting disclosed by the invention
The parameter of halation, a large texture textures are merged into by the texture mapping needed for some Lens Flares, are committed to GPU
Caching, halation model is then set up in three-dimensional scenic, according to input some Lens Flares parameter and current scene reality
When adjust the attribute of each Lens Flare, according to the attribute of each Lens Flare, call a quad patch, read big line
Reason textures caching, is drawn by tinter to each Lens Flare, and this programme draws camera lens by the way of picture mapping
Halation, without complicated pretreatment, and during each Lens Flare is drawn, only need to use a quad patch, can subtract
Few vertex cache, amount of calculation is smaller;The large texture textures include the texture mapping to be used of some Lens Flares, can avoid
Drawing multiple Lens Flares will carry out the switching of texture cache;Using a large texture textures and a quad patch, can be by multiple
Lens Flare merges into a drafting batch, saves the expense drawn;And the parameter of the Lens Flare is set by designer
And be input into, pattern variation, flexible configuration, solve the problems, such as that existing Lens Flare drafting expense is big, can not configure.
As the improvement of such scheme, by below equation to being drawn to each Lens Flare:
Wherein, Iflare_resultIt is the halation image obtained after being drawn to each Lens Flare, IflareIt is described
Each pixel of Lens Flare, n is the number of the Lens Flare, and i is the index of the Lens Flare, and T (x, y, i) is described
Lens Flare carries out displacement according to attribute, the apex coordinate after scaling and being rotationally-varying, and c (i) is the Lens Flare according to category
Property obtain each pixel color value, a (i) is the transparence value of each pixel that the Lens Flare is obtained according to attribute, x
With the apex coordinate that y is the quad patch.The formula includes 5 basic elements of Lens Flare, be respectively color, thoroughly
Lightness, rotation, scaling and displacement.
As the improvement of such scheme, the parameter of the Lens Flare include texture index, color, size, offset, be/
One or more in no rotation, brightness, transparency, fuzziness.By setting multiple parameters, the multiple of Lens Flare can be presented
Visual effect, and the different patterns of Lens Flare are generated by configuration parameter, it is possible to reduce the number of texture mapping, optimization is slow
Deposit space.
As the improvement of such scheme, drafting is carried out to each Lens Flare by tinter and is specifically included:
The side-play amount of offset parameter values k and the current scene light source according to any Lens Flare to screen center
P, with the straight line where the current scene light source and the screen center on and to the screen center side-play amount be k*
The Lens Flare is drawn on the position of P.By this set, meet the effect of Lens Flare under truth, very
The center of real Lens Flare, light source and screen center are conllinear, and with movement of the light source on screen, Lens Flare also can be with
Movement and rotation.
Used as the improvement of such scheme, the halation result of Lens Flare includes fade in effect and effect of fading out;It is described to fade in
Effect is that under default scene, the transparency of the Lens Flare is within the predetermined time by 0 to 1 change;The effect of fading out
Fruit is that under default scene, the transparency of the Lens Flare is within the predetermined time by 1 to 0 change.This transparency
Transition can simulate the persistence of vision effect of human eye, the more sense of reality.
Used as the improvement of such scheme, the tinter includes vertex shader and fragment shader;
The vertex shader is generated respectively for the parameter that the skew according to the Lens Flare, scaling, Yes/No rotate
The offset effect of the Lens Flare, size effect, rotates effe;
The fragment shader generates institute respectively for the parameter of the color according to the Lens Flare, brightness, fuzziness
State color effects, chiaroscuro effect, the blur effect of Lens Flare.Various effects of Lens Flare can be presented by setting many kinds of parameters
Really, pattern enriches.
Used as the improvement of such scheme, carrying out drafting to each Lens Flare by tinter includes:
By the changing coordinates on each summit in the quad patch respectively with the zooming parameter value phase of the Lens Flare
The size effect of Lens Flare is obtained after multiplying;
Obtained after each summit in the quad patch is rotated according to the rotation angle value of the Lens Flare
The rotates effe of Lens Flare;The rotation angle value of the Lens Flare by the Yes/No rotation parameter of the Lens Flare and
The position generation of current scene light source;
Each fragment in the quad patch is multiplied with the color parameter of the Lens Flare and obtains the camera lens light
Dizzy color effects;
Each fragment in the quad patch is multiplied with the luminance parameter of the Lens Flare and obtains the camera lens light
Dizzy brightness effects;
The transparency that the transparency parameter of the Lens Flare is assigned to each fragment in the quad patch is obtained
The transparency interaction of the Lens Flare.
Used as the improvement of such scheme, carrying out drafting to each Lens Flare by tinter includes:
According to the fuzziness parameter of any Lens Flare, to described after being sampled in the different levels of mipmap textures
Lens Flare is drawn, and generates the blur effect of the Lens Flare;Wherein, the different levels of the mipmap textures pass through
Generated after the large texture textures are carried out into different Fuzzy processings.Large texture textures are carried out into Fuzzy processing in advance, can
The time-consuming of the Lens Flare is drawn to save.
As the improvement of such scheme, the large texture textures include halation texture mapping, starburst texture mapping and
Ring of light texture mapping;Wherein, the halation texture mapping includes octagon halation texture mapping, circular halation texture mapping, six
Side shape halation texture mapping, pentagon halation texture mapping.Starburst texture mapping can show the pearlescent effect of light source
Really, good simulation effect and visual effect is reached.
Used as the improvement of such scheme, methods described is carried out by instancing Renderings to the quad patch
Draw.By instancing Renderings, can acceleration drawing process, reach the effect for reducing and rendering batch.
Used as the improvement of such scheme, the quad patch is square dough sheet.
Used as the improvement of such scheme, the quad patch includes two triangle surfaces.
Accordingly, the embodiment of the present invention additionally provides a kind of Lens Flare drawing apparatus, including:
Parameter receiver module, the parameter of some Lens Flares for receiving input, and successively in incoming tinter;
Large texture textures cache module is big for the texture mapping to be used of some Lens Flares to be merged into one
Texture mapping, the large texture textures is committed to large texture textures caching is generated in the caching of GPU;
Attribute tuning module, sets up halation model in three-dimensional scenic, the ginseng of the described some Lens Flares according to input
The attribute of each Lens Flare in number and current scene real-time adjustment tinter;
Drafting module, for the attribute according to each Lens Flare, calls a quad patch, reads the big line
Reason textures caching, is drawn by tinter to each Lens Flare.
Used as the improvement of such scheme, the drafting module is painted by below equation to each Lens Flare
System:
Wherein, Iflare_resultIt is the halation image obtained after being drawn to each Lens Flare, IflareIt is camera lens
Each pixel of halation, n is the number of Lens Flare, and i is the index of Lens Flare, and T (x, y, i) is Lens Flare according to attribute
Displacement is carried out, the apex coordinate after scaling and being rotationally-varying, c (i) is each pixel that the Lens Flare is obtained according to attribute
Color value, a (i) is the transparence value of each pixel that the Lens Flare is obtained according to attribute, and x and y is the quadrangle
The apex coordinate of dough sheet.
As the improvement of such scheme, the parameter of the Lens Flare include texture index, color, size, offset, be/
One or more in no rotation, brightness, transparency, fuzziness.
Used as the improvement of such scheme, the drafting module is drawn to each Lens Flare in the following manner:
Offset parameter values k and current scene light source according to any Lens Flare to screen center side-play amount P,
With on the straight line where the scene light source and screen center and to screen center side-play amount for k*P position on to described
Lens Flare is drawn.
Used as the improvement of such scheme, the halation result of the Lens Flare includes fade in effect and effect of fading out;It is described
Effect of fading in is that under default scene, the transparency of the Lens Flare is within the predetermined time by 0 to 1 change;It is described light
It is that under default scene, the transparency of the Lens Flare is within the predetermined time by 1 to 0 change to go out effect.
Used as the improvement of such scheme, the tinter includes vertex shader and fragment shader;
The vertex shader is generated respectively for the parameter that the skew according to the Lens Flare, scaling, Yes/No rotate
The offset effect of the Lens Flare, size effect, rotates effe;
The fragment shader generates institute respectively for the parameter of the color according to the Lens Flare, brightness, fuzziness
State color effects, chiaroscuro effect, the blur effect of Lens Flare.
Used as the improvement of such scheme, the drafting module includes:
Scaling drawing unit, for by the changing coordinates on each summit in the quad patch respectively with the camera lens light
Dizzy zooming parameter value obtains the size effect of the Lens Flare after being multiplied;
Rotation drawing unit, for by the anglec of rotation of each summit according to the Lens Flare in the quad patch
Value obtains the rotates effe of the Lens Flare after being rotated;The rotation angle value of the Lens Flare passes through the camera lens light
The position generation of dizzy Yes/No rotation parameter and current scene light source;
Color drawing unit, for by the color parameter phase of each fragment in the quad patch and the Lens Flare
Multiply the color effects for obtaining the Lens Flare;
Brightness drawing unit, for by the luminance parameter phase of each fragment in the quad patch and the Lens Flare
Multiply the brightness effects for obtaining the Lens Flare;
Transparency drawing unit, it is every in the quad patch for the transparency parameter of the Lens Flare to be assigned
The transparency of one fragment obtains the transparency interaction of the Lens Flare.
Used as the improvement of such scheme, the drafting module includes fuzziness drawing unit, for according to any mirror
The fuzziness parameter of head halation, draws after being sampled in the different levels of mipmap textures to the Lens Flare, generates
The blur effect of Lens Flare;Wherein, the different levels of the mipmap textures carry out difference by by the large texture textures
Fuzzy processing after generate.
As the improvement of such scheme, the large texture textures include halation texture mapping, starburst texture mapping and
Ring of light texture mapping;Wherein, the halation texture mapping includes octagon halation texture mapping, circular halation texture mapping, six
Side shape halation texture mapping, pentagon halation texture mapping.
Used as the improvement of such scheme, described device is by instancing Renderings to each camera lens light
It is dizzy to be drawn.
Used as the improvement of such scheme, the quad patch is square dough sheet.
Used as the improvement of such scheme, the quad patch includes two triangle surfaces.
Present invention also offers another Lens Flare method for drafting, including step:
The position of parameter and current scene light source according to Lens Flare calculates the position of the Lens Flare on screen,
And the position of the Lens Flare on screen sets a quad patch;Wherein, the parameter of the Lens Flare is defeated in advance
Enter and in incoming tinter;
The parameter of attribute and the Lens Flare according to the current scene light source obtains the quad patch in real time
Attribute;
According to the attribute of the quad patch, corresponding texture mapping in a large texture textures is extracted in, and by institute
State and corresponding halation image is generated after tinter is drawn to the quad patch;Wherein, the large texture textures include
The texture mapping to be used of some Lens Flares.
Compared with prior art, Lens Flare method for drafting disclosed by the invention is by the parameter according to Lens Flare and works as
The attribute of preceding scene light source, a quad patch is set on the relevant position of screen and the category of the quad patch is obtained
Property, the attribute according to the quad patch extracts corresponding texture mapping in large texture textures and generates phase after being drawn
The halation image answered, this programme draws Lens Flare by the way of picture mapping, without complicated pretreatment and every drawing
During one Lens Flare, a quad patch only need to be used, without the switching of vertex cache and indexed cache, save storage
Expense and amount of calculation is smaller;The large texture textures include the texture mapping to be used of some Lens Flares, can avoid painting
The multiple Lens Flares of system will carry out the switching of texture cache;Using large texture textures and a quadrangle including some texture mapping
Multiple camera lens light sources can be merged into a batch and be rendered by dough sheet, optimize the efficiency for rendering;And the Lens Flare
Parameter is set and is input into by designer, pattern variation, flexible configuration, is solved existing Lens Flare and is drawn expense greatly, no
The problem that can be configured.
As the improvement of such scheme, the parameter of the Lens Flare include texture index, color, size, offset, be/
One or more in no rotation, brightness, transparency, fuzziness.
As the improvement of such scheme, the position of the Lens Flare is calculated in the following manner:
Offset parameter values k and current scene light source according to any Lens Flare are incited somebody to action to the side-play amount P of screen center
The Lens Flare be arranged at the current scene light source and the screen center where straight line on and to the screen center
Side-play amount for k*P position on.
Used as the improvement of such scheme, the halation result of the Lens Flare includes fade in effect and effect of fading out;It is described
Effect of fading in is that under default scene, the transparency of the Lens Flare is within the predetermined time by 0 to 1 change;It is described light
It is that under default scene, the transparency of the Lens Flare is within the predetermined time by 1 to 0 change to go out effect.
As the improvement of such scheme, the large texture textures include halation texture mapping, starburst texture mapping and
Ring of light texture mapping;Wherein, the halation texture mapping includes octagon halation texture mapping, circular halation texture mapping, six
Side shape halation texture mapping, pentagon halation texture mapping.
Used as the improvement of such scheme, methods described is carried out by instancing Renderings to the quad patch
Draw.
The present invention is also corresponded to and provides another Lens Flare drawing apparatus, including:
Dough sheet setup module, for the institute on the position calculating screen of the parameter according to Lens Flare and current scene light source
The position of Lens Flare is stated, and the position of the Lens Flare on screen sets a quad patch;Wherein described camera lens
The parameter of halation is pre-entered and in incoming tinter;
Dough sheet attribute acquisition module, the parameter for the attribute according to current scene light source and the Lens Flare is obtained in real time
Take the attribute of the quad patch;
Drafting module, for the attribute according to the quad patch, is extracted in corresponding texture in a large texture textures
Textures, and corresponding halation image is generated after being drawn to the quad patch by the tinter;Wherein, it is described big
Texture mapping includes the texture mapping to be used of some Lens Flares.
As the improvement of such scheme, the parameter of the Lens Flare include texture index, color, size, offset, be/
One or more in no rotation, brightness, transparency, fuzziness.
Used as the improvement of such scheme, the dough sheet setup module calculates the position of the Lens Flare in the following manner
Put:
Offset parameter values k and current scene light source according to any Lens Flare are incited somebody to action to the side-play amount P of screen center
The Lens Flare be arranged at the current scene light source and the screen center where straight line on and to the screen center
Side-play amount for k*P position on.
Used as the improvement of such scheme, the halation result of the Lens Flare includes fade in effect and effect of fading out;It is described
Effect of fading in is that under default scene, the transparency of the Lens Flare is within the predetermined time by 0 to 1 change;It is described light
It is that under default scene, the transparency of the Lens Flare is within the predetermined time by 1 to 0 change to go out effect.
As the improvement of such scheme, the large texture textures include halation texture mapping, starburst texture mapping and
Ring of light texture mapping;Wherein, the halation texture mapping includes octagon halation texture mapping, circular halation texture mapping, six
Side shape halation texture mapping, pentagon halation texture mapping.
Used as the improvement of such scheme, described device is carried out by instancing Renderings to the quad patch
Draw.
Brief description of the drawings
Fig. 1 is a kind of schematic flow sheet of Lens Flare method for drafting in the embodiment of the present invention 1.
Fig. 2 is the schematic diagram at Lens Flare setting interface in the embodiment of the present invention 1.
Fig. 3 is the schematic diagram of large texture textures in the embodiment of the present invention 1.
Fig. 4 a are the schematic diagrames of halation texture mapping in the embodiment of the present invention 1.
Fig. 4 b are the schematic diagrames of starburst texture mapping in the embodiment of the present invention 1.
Fig. 4 c are the schematic diagrames of ring of light texture mapping in the embodiment of the present invention 1.
Fig. 5 is the schematic diagram that is converted with the movement of light source of position of halation in the embodiment of the present invention 1.
Fig. 6 is the effect diagram after Lens Flare superposition in the embodiment of the present invention 1.
Fig. 7 is the schematic flow sheet drawn to each Lens Flare in step 4 in the embodiment of the present invention 1.
Fig. 8 is mipmap textures schematic diagrames in the embodiment of the present invention 1.
Fig. 9 is a kind of structural representation of Lens Flare drawing apparatus in the embodiment of the present invention 2.
Figure 10 is the structural representation of drafting module in the embodiment of the present invention 2.
Figure 11 is the schematic flow sheet of another Lens Flare method for drafting in the embodiment of the present invention 3.
Figure 12 is the structural representation of another Lens Flare drawing apparatus in the embodiment of the present invention 4.
Specific embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear, complete
Site preparation is described, it is clear that described embodiment is only a part of embodiment of the invention, rather than whole embodiments.It is based on
Embodiment in the present invention, it is every other that those of ordinary skill in the art are obtained under the premise of creative work is not made
Embodiment, belongs to the scope of protection of the invention.
It is a kind of schematic flow sheet of Lens Flare drafting that the embodiment of the present invention 1 is provided referring to Fig. 1.As shown in Figure 1
Lens Flare method for drafting, including step:
S1, the parameter for receiving some Lens Flares being input into, and successively in incoming tinter;
Wherein, the parameter of the Lens Flare can voluntarily be set and be input into by user, including texture index, color, size,
One or more in skew, Yes/No rotation, brightness, transparency, fuzziness.Texture index is corresponding with specific texture mapping,
Yes/No rotation is that, when light source is moved, whether the Lens Flare also rotates to simulate real field during moving
Scape.Therefore, as shown in Fig. 2 present solution provides user interface, so that designer is to the self-defined Lens Flare of Lens Flare
The parameter of quantity and each Lens Flare.
S2, the texture mapping to be used of some Lens Flares is merged into a large texture textures, by the big line
Reason textures generate large texture textures caching in being committed to the caching of GPU;
Preferably, as shown in figure 3, the large texture textures include halation texture mapping (such as Fig. 4 a), starburst (light
Awns four is penetrated) texture mapping (such as Fig. 4 b) and ring of light texture mapping (such as Fig. 4 c).As needed, need to represent radiance four near light source
The effect penetrated, it is therefore desirable to which starburst texture mapping is set.The shape of Lens Flare is relevant with lens aperture, therefore, it is described
Halation texture mapping includes octagon halation texture mapping, circular halation texture mapping, hexagon halation texture mapping, pentagon
Halation texture mapping.The large texture textures include the basic shape of various halation, by these basic configuration configuration parameters
Various patterns can be generated, the personalized and diversified demand of designer is met.
S3, halation model is set up in three-dimensional scenic, the parameter and current scene according to some Lens Flares are real-time
The attribute of each Lens Flare in adjustment tinter;
S4, the attribute according to each Lens Flare, call a quad patch, read the large texture textures and delay
Deposit, each Lens Flare is drawn by tinter;
In this step, indexed by the texture in the attribute of the Lens Flare, read in the large texture textures
Corresponding texture mapping.For example, in the large texture textures of Fig. 3 constructions, the line needed for being determined by the index value of 1-16
Reason textures.Wherein, the quad patch is preferably square dough sheet,
The method that this programme uses picture mapping carrys out simulating lens halation, with the camera lens of based on the physics, sense of reality
Halation rendering technique is compared, and the pretreatment without carrying out complexity, computing cost is few, can increase the atmosphere of scene of game.And, this
Scheme only needs a large texture textures and a quad patch, and when each Lens Flare is drawn, rendering state does not change,
Only different parameters need to be transmitted to tinter, without carrying out texture cache, indexed cache and the switching of vertex cache, can will be some
Individual Lens Flare is merged into one and renders batch, simplifies the flow of drafting, reduces the expense drawn.And, user circle is set
Face is used to configure the parameter of each Lens Flare, can generate the Lens Flare with multi-effect, and simple and flexible, pattern is richer
It is rich.
Preferably, the quad patch includes two triangle surfaces, so as to vertex cache can be reduced, reduces what is drawn
Amount of calculation, reduces the expense drawn.
, it is necessary to give each Lens Flare allocation position in specific implementation process.The position of real camera halation and
Light source, screen center be it is conllinear, and Lens Flare to the screen center of the distance and light source of screen center distance in solid
Fixed proportionate relationship.With movement of the light source on screen, Lens Flare can also be moved and rotated.Specifically, true
In real field scape, as shown in fig. 5, it is assumed that light source 2 is P1 for the offset vector of screen center 1 when starting, halation 3 is in screen
The offset vector of the heart 1 is P2, and P1 and P2 are conllinear.When the offset vector at the relative screen center 1 of light source 2 is changed into P3,
The offset vector of so new halation 3 is then changed into P3* (P2/P1).When light source 2 on screen offseting to for screen center 1
When amount changes, halation 3 also there occurs change for the offset vector of screen center 1, but between the two offset vectors
Proportionate relationship be constant.
Therefore, this programme configures the skew of the position according to any Lens Flare of Lens Flare in drawing process
Parameter value k and current scene light source to screen center side-play amount P, with the current scene light source and institute of the screen center
Straight line on and to the screen center side-play amount for k*P position on the Lens Flare is drawn.
It should be understood that each Lens Flare is by multiple halation element overlaids, it is preferable that can be by color, transparent
Degree, displacement, scaling, 5 basic elements of rotation are drawn to halation image, are drawn especially by below equation:
Wherein, Iflare_resultIt is the halation image obtained after being drawn to each Lens Flare, IflareIt is described
Each pixel of Lens Flare, n is the number of the Lens Flare, and i is the index of the Lens Flare, and T (x, y, i) is described
Lens Flare carries out displacement according to attribute, the apex coordinate after scaling and being rotationally-varying, and c (i) is the Lens Flare according to category
Property obtain each pixel color value, a (i) is the transparence value of each pixel that the Lens Flare is obtained according to attribute, x
With the apex coordinate that y is the quad patch.As shown in fig. 6, after carrying out the simulation of Lens Flare, n Lens Flare 3, field
On same straight line, n Lens Flare 3 is overlapped can simulate band Lens Flare effect for scape light source and screen center 1
Game picture, so as to set off game atmosphere by contrast, improve the experience sense of game.
As shown in fig. 7, being drawn to each Lens Flare by tinter in step S4 in embodiment 1
Including:
S41, by the changing coordinates on each summit in the quad patch respectively with the zooming parameter of the Lens Flare
Value obtains the size effect of Lens Flare after being multiplied;
S42, by after each summit is rotated according to the rotation angle value of the Lens Flare in the quad patch
Obtain the rotates effe of Lens Flare;The rotation angle value of the Lens Flare rotates ginseng by the Yes/No of the Lens Flare
The position of number and current scene light source generates;
S43, be multiplied each fragment in the quad patch with the color parameter of the Lens Flare acquisition mirror
The color effects of head halation;
S44, be multiplied each fragment in the quad patch with the luminance parameter of the Lens Flare acquisition mirror
The brightness effects of head halation;
S45, the transparency that the transparency parameter of the Lens Flare is assigned to each fragment in the quad patch
Obtain the transparency interaction of the Lens Flare;
S46, the fuzziness parameter according to the Lens Flare, to described after being sampled in the different levels of mipmap textures
Lens Flare is drawn, and generates the blur effect of the Lens Flare;Wherein, the different levels of the mipmap textures pass through
Generated after the large texture textures are carried out into different Fuzzy processings.
There is a conventional technology to be referred to as Mipmapping in the textures of three dimensional computer graphics are rendered.It typically is
Textures are processed into a series of file being made up of pictures for being pre-calculated and optimizing, and such textures are referred to as MIP
Map or mipmap." MIP " comes from the initial of Latin language multum in parvo, means and " places many things
Small space ".If the basic size of textures is 256x256 pixels, its mipmap just has 8 levels.Each level is
Last layer level a quarter size, successively level size be exactly:128x128;64x64;32x32;16x16;8x8;4x4;
2x2;1x1 (pixel).For example in one scenario, rendering textures needs if the space size that fills up is 40x40 pixels,
If without Trilinear Filtering, that 32x32 can be displayed magnified, or have Trilinear Filtering, can be between 64x64 and 32x32
Switching.The method of simplest generation textures is exactly to take turns doing averagely, naturally it is also possible to use more senior algorithm.In mipmap
The small figure of each level is the duplicate of the diminution details of a special ratios of master map.Although necessary being regarded at some
Angle, master map still can be rendered complete details by using.But when textures are reduced or only need to from remote viewing
When, mipmap will be transformed into appropriate level.In fact, being worked in Trilinear Filtering (trilinear filtering)
When, can switch between two close levels.
Because mipmap textures need the pixel being read far fewer than common textures, the speed for rendering is carried
Rise.And the time of operation reduces, because the picture of mipmap had done antialiasing treatment, so as to reduce in real time
The burden for rendering.Amplify and diminution also becomes more efficiently because of mipmap.
According to the different attribute of each incoming Lens Flare, the different-effect of Lens Flare is capable of achieving.In order to realize mirror
Different size of effect of the head halation on screen, apicad can transmit zooming parameter value by tinter, and the contracting is multiplied by each summit
Parameter value is put to zoom in and out, for example original coordinates be x and y, zooming parameter value be S, then by the coordinate after scale transformation be x ˊ
=Sx, y ˊ=Sy;In order to realize offset effect of the Lens Flare on screen, each summit is according to offset parameter values and current light
The side-play amount of each coordinate that the position in source is calculated enters line displacement, such as original coordinates are x and y, abscissa, ordinate
Side-play amount is respectively Tx, Ty, then the coordinate after offseting conversion is x ˊ=x+Tx, y ˊ=y+Ty;In order to realize Lens Flare
Rotates effe on screen, each summit is rotated according to the rotation angle value of the Lens Flare, for example original coordinates
For x and y, it is necessary to rotation angle value be θ, then by the coordinate after scale transformation be x ˊ=rcos (α+θ)=x cos θ-ysin
θ, y ˊ=rsin α+θ=ycos θ+xsin θ;In order to realize different brightness of the Lens Flare on screen, by fragment shader
Each fragment is multiplied by incoming brightness value, the brightness of final fragment is Fragment_Color=Fragment_Color*
luminance;In order to realize different colours of the Lens Flare on screen, each fragment is multiplied by incoming color value, final
The color of fragment is Fragment_Color=Fragment_Color*color;In order to realize that Lens Flare is saturating on screen
Lightness, by fragment shader to each fragment the incoming transparency parameter value of transparency assignment, the brightness of final fragment
It is Fragment_Color.a=alpha;In order to realize the different fuzzinesses of Lens Flare on screen, each fragment is according to fuzzy
Spend from the different levels of mipmap and sampled, wherein, as shown in figure 8, the different levels of the mipmap textures are by by institute
Stating large texture textures carries out generation after different Fuzzy processings.
Further, in order to simulate the persistence of vision effect of human eye, can fade in for Lens Flare increase, effect of fading out.When
When light source just appears in screen, using the effect faded in, i.e., value of increasing transparency frame by frame frames out or by object when light source
When blocking, using the effect faded out, transparence value is reduced frame by frame.Specifically, light source has just been appeared in when in camera lens, predetermined
In time, such as 0.5s, Lens Flare is from the transition that transparency is between 0 to 1, that is, the effect faded in;When light source leaves
Screen is blocked by object, within the predetermined time, such as 0.5s, Lens Flare from the transition that transparency is 1 to 0, that is,
The effect faded out.
Additionally, can also set the effect faded in, fade out according to the distance of Lens Flare and light source.Such as 30 meters inner light sources
Intensity just shows obvious Lens Flare on screen enough, and more portrait attachment halation is more obvious.Therefore, can be apart from light source 30
During moving closer to light source at rice, transparency carries out transition from 0 to 1.Further, the transparence value of Lens Flare is changed
Can also the effect that is produced with the change of the intensity of light source of simulating lens halation.
Preferably, the drafting of Lens Flare is carried out using instancing Renderings, is capable of achieving " once to submit to, repeatedly
Draw ", according to the parameter of plot order successively incoming tinter only before drawing every time, can acceleration drawing process, be applicable
The same large texture textures and same model proposed in this programme draw multiple Lens Flares, reach the effect for reducing and rendering batch
Really.
It should be understood that Vertex Constants Instancing (instantiation of summit constant) and Geometry
Two kinds of rendering intents of Instancing (solid instantiation) can reach the effect for reducing and rendering batch.When using vertex
Constants instancing methods, one value of each summit extra storage, for recording which this summit is belonging to
The index value index of individual instancing, and the parameter required for all instancing is stored in GPU all in the form of constant
In, each summit obtains required parameter when rendering according to corresponding index value index.When using geometry
Instancing, by suitable setting, each summit can obtain corresponding data when rendering according to instance_id.
Fig. 9 is a kind of structural representation of Lens Flare drawing apparatus that the embodiment of the present invention 2 is provided.As shown in figure 9, should
Lens Flare drawing apparatus 20 include:
Parameter receiver module 21, the parameter of some Lens Flares for receiving input, and successively in incoming tinter;
Large texture textures cache module 22, for the texture mapping to be used of some Lens Flares to be merged into one
Large texture textures, the large texture textures are committed to large texture textures caching are generated in the caching of GPU;
Attribute tuning module 23, sets up halation model in three-dimensional scenic, the parameter according to some Lens Flares and
The attribute of each Lens Flare in current scene real-time adjustment tinter;
Drafting module 24, for the attribute according to each Lens Flare, calls a quad patch, reads described big
Texture mapping is cached, and each Lens Flare is drawn by tinter.
Preferably, the quad patch is square dough sheet.
Wherein, the drafting module by below equation to being drawn to each Lens Flare:
Wherein, Iflare_resultIt is the halation image obtained after being drawn to each Lens Flare, IflareIt is camera lens
Each pixel of halation, n is the number of Lens Flare, and i is the index of Lens Flare, and T (x, y, i) is Lens Flare according to attribute
Displacement is carried out, the apex coordinate after scaling and being rotationally-varying, c (i) is each pixel that the Lens Flare is obtained according to attribute
Color value, a (i) is the transparence value of each pixel that the Lens Flare is obtained according to attribute, and x and y is the quadrangle
The apex coordinate of dough sheet.
Wherein, the parameter of the Lens Flare includes texture index, color, size, skew, Yes/No rotation, brightness, saturating
One or more in lightness, fuzziness.
Wherein, the large texture textures include halation texture mapping, starburst texture mapping and ring of light texture mapping;
Wherein, the halation texture mapping includes octagon halation texture mapping, circular halation texture mapping, hexagon halation texture patch
Figure, pentagon halation texture mapping.
Wherein, as shown in Figure 10, the drafting module 24 includes:
Scaling drawing unit 241, for by the changing coordinates on each summit in the quad patch respectively with the mirror
The zooming parameter value of head halation obtains the size effect of the Lens Flare after being multiplied;
Rotation drawing unit 242, for by rotation of each summit according to the Lens Flare in the quad patch
Angle value obtains the rotates effe of the Lens Flare after being rotated;The rotation angle value of the Lens Flare passes through the mirror
The position generation of the Yes/No rotation parameter and current scene light source of head halation;
Color drawing unit 243, for each fragment in the quad patch to be joined with the color of the Lens Flare
Number is multiplied and obtains the color effects of the Lens Flare;
Brightness drawing unit 244, for each fragment in the quad patch to be joined with the brightness of the Lens Flare
Number is multiplied and obtains the brightness effects of the Lens Flare;
Transparency drawing unit 245, for assigning the quad patch by the transparency parameter of the Lens Flare
In the transparency of each fragment obtain the transparency interaction of the Lens Flare;
Fuzziness drawing unit 246, for the fuzziness parameter according to any Lens Flare, in mipmap textures
The Lens Flare is drawn after being sampled in different levels, generates the blur effect of Lens Flare;Wherein, the mipmap
The different levels of textures are generated after the large texture textures are carried out into different Fuzzy processings.
In a preferred embodiment, the drafting module is drawn to each Lens Flare in the following manner:Root
According to any Lens Flare offset parameter values k and current scene light source to screen center side-play amount P, with the scene
On straight line where light source and screen center and to screen center side-play amount for k*P position on the Lens Flare is entered
Row is drawn.
In a preferred embodiment, the halation result of the Lens Flare includes fade in effect and effect of fading out;It is described
Effect of fading in is that under default scene, the transparency of the Lens Flare is within the predetermined time by 0 to 1 change;It is described light
It is that under default scene, the transparency of the Lens Flare is within the predetermined time by 1 to 0 change to go out effect.
In a preferred embodiment, described device passes through instancing Renderings to each camera lens light
It is dizzy to be drawn, can acceleration drawing process, reach the effect for reducing and rendering batch.
In a preferred embodiment, the quad patch includes two triangle surfaces, can reduce vertex cache, excellent
Change the amount of calculation drawn, reduce the expense drawn.
It should be understood that the tinter includes vertex shader and fragment shader;
The vertex shader is generated respectively for the parameter that the skew according to the Lens Flare, scaling, Yes/No rotate
The offset effect of the Lens Flare, size effect, rotates effe;
The fragment shader generates institute respectively for the parameter of the color according to the Lens Flare, brightness, fuzziness
State color effects, chiaroscuro effect, the blur effect of Lens Flare.
The Lens Flare that the detailed process of the Lens Flare drawing apparatus 20 of the present embodiment refers to above-described embodiment 1 is drawn
Method, will not be repeated here.
Figure 11 is the schematic flow sheet of another Lens Flare method for drafting that the embodiment of the present invention 3 is provided, including step:
The position of S31, the parameter according to Lens Flare and current scene light source calculates the Lens Flare on screen
Position, and the position of the Lens Flare on screen sets a quad patch;Wherein, the quad patch includes two
Individual triangle surface;The parameter of the Lens Flare is pre-entered and in incoming tinter;
Wherein, skews of the offset parameter values k and current scene light source according to any Lens Flare to screen center
Amount P, on the straight line where the Lens Flare is arranged at into the current scene light source and the screen center and to the screen
The side-play amount at curtain center is on the position of k*P;
It is additionally, the parameter of the Lens Flare is set by designer be input into including texture index, color, size, inclined
Shifting, Yes/No rotation, brightness, transparency, fuzziness etc., type are enriched, and can obtain the Lens Flare of various patterns, specific to use
Family interface can refer to Fig. 2;
The parameter of S32, the attribute according to the current scene light source and the Lens Flare obtains the quadrangle in real time
The attribute of dough sheet;
S33, the attribute according to the quad patch, are extracted in corresponding texture mapping in a large texture textures, and lead to
Cross and corresponding halation image is generated after the tinter is drawn to the quad patch;Wherein, the large texture textures
Including the texture mapping to be used of some Lens Flares.
During specific implementation, Lens Flare method for drafting disclosed by the invention is by the parameter and current field according to Lens Flare
The attribute of scape light source, a quad patch is set on the relevant position of screen and the attribute of the quad patch, root is obtained
Corresponding texture mapping is extracted in large texture textures according to the attribute of the quad patch and after being drawn generation it is corresponding
Halation image, this programme draws Lens Flare by the way of picture mapping, without complicated pretreatment, and is drawing each mirror
During head halation, a quad patch only need to be used, the quad patch is made up of two triangle surfaces, can reduce
Vertex cache, without the switching of vertex cache and indexed cache, saves the expense drawn, and the large texture textures include some mirrors
The head texture mapping to be used of halation, can avoid drawing multiple Lens Flares will carry out the switching of texture cache, using same
Individual quad patch and large texture textures, can merge and render batch, and amount of calculation is smaller, and the Lens Flare parameter by designing
Personnel set and are input into, pattern variation, flexible configuration, solve existing Lens Flare draw that expense is big, asking of can not configuring
Topic.
Preferably, the present embodiment can increase the effect of being fade-in fade-out of Lens Flare as a kind of Premium Features.It is described to fade in
Effect is that under default scene, the transparency of the Lens Flare is within the predetermined time by 0 to 1 change;The effect of fading out
Fruit is that under default scene, the transparency of the Lens Flare is within the predetermined time by 1 to 0 change.It is this to be fade-in fade-out
Effect can simulate the persistence of vision effect of human eye, make the Lens Flare more sense of reality, and its specific course of work refers to implement
Example 1 is illustrated.
Preferably, the present embodiment can accelerate render process using instancing Renderings, can reduce the expense of drafting,
Optimization drawing process.
Figure 12 is the structural representation of another Lens Flare drawing apparatus provided in an embodiment of the present invention.As shown in figure 12
Lens Flare drawing apparatus 40, including:
Dough sheet setup module 41, the position for the parameter according to Lens Flare and current scene light source is calculated on screen
The position of the Lens Flare, and the position of the Lens Flare on screen sets a quad patch;Wherein, described four
Side shape dough sheet includes two triangle surfaces;The parameter of the Lens Flare is pre-entered and in incoming tinter;
Wherein, the parameter of the Lens Flare includes texture index, color, size, skew, Yes/No rotation, brightness, saturating
One or more in lightness, fuzziness.
Preferably, the dough sheet setup module calculates the position of the Lens Flare in the following manner:
Offset parameter values k and current scene light source according to any Lens Flare are incited somebody to action to the side-play amount P of screen center
The Lens Flare be arranged at the current scene light source and the screen center where straight line on and to the screen center
Side-play amount for k*P position on;
Dough sheet attribute acquisition module 42, the parameter for the attribute according to current scene light source and the Lens Flare is real-time
Obtain the attribute of the quad patch;
Drafting module 43, for the attribute according to the quad patch, is extracted in corresponding line in a large texture textures
Reason textures, and corresponding halation image is generated after being drawn to the quad patch by the tinter;Wherein, it is described
Large texture textures include the texture mapping to be used of some Lens Flares;
The large texture textures include halation texture mapping, starburst texture mapping and ring of light texture mapping;Wherein,
The halation texture mapping includes octagon halation texture mapping, circular halation texture mapping, hexagon halation texture mapping, five
Side shape halation texture mapping.According to these basic texture mapping, different parameters are configured, abundant Lens Flare can be presented
Pattern.
Preferably, the halation result of the Lens Flare includes fade in effect and effect of fading out;The effect of fading in be
Under default scene, the transparency of the Lens Flare is within the predetermined time by 0 to 1 change;The effect of fading out is pre-
If scene under, the transparency of the Lens Flare is within the predetermined time by 1 to 0 change.
Preferably, the device can accelerate render process using instancing Renderings, can reduce the expense of drafting, excellent
Change drawing process.
The Lens Flare that the detailed process of the Lens Flare drawing apparatus 40 of the present embodiment refers to above-described embodiment 3 is drawn
Method, will not be repeated here.
It should be noted that, device embodiment described above is only schematical, wherein described as separating component
The unit of explanation can be or may not be physically separate, and the part shown as unit can be or can also
It is not physical location, you can with positioned at a place, or can also be distributed on multiple NEs.Can be according to reality
Selection some or all of module therein is needed to realize the purpose of this embodiment scheme.In addition, the device that the present invention is provided
In embodiment accompanying drawing, the annexation between module is represented has communication connection between them, specifically can be implemented as one or
A plurality of communication bus or holding wire.Those of ordinary skill in the art are without creative efforts, you can to understand
And implement.
Through the above description of the embodiments, it is apparent to those skilled in the art that the present invention can be borrowed
Software is helped to add the mode of required common hardware to realize, naturally it is also possible to include application specific integrated circuit, specially by specialized hardware
Realized with CPU, private memory, special components and parts etc..Generally, all functions of being completed by computer program can
Easily realized with corresponding hardware, and, the particular hardware structure for realizing same function can also be various many
Sample, such as analog circuit, digital circuit or special circuit etc..But, it is more for the purpose of the present invention in the case of software program reality
It is now more preferably implementation method.Based on such understanding, technical scheme is substantially made to prior art in other words
The part of contribution can be embodied in the form of software product, and the computer software product is stored in the storage medium that can read
In, such as the floppy disk of computer, USB flash disk, mobile hard disk, read-only storage (ROM, Read-Only Memory), random access memory
Device (RAM, Random Access Memory), magnetic disc or CD etc., including some instructions are used to so that a computer sets
Standby (can be personal computer, server, or network equipment etc.) performs the method described in each embodiment of the invention.
The above is the preferred embodiment of the present invention, it is noted that for those skilled in the art
For, under the premise without departing from the principles of the invention, some improvements and modifications can also be made, these improvements and modifications are also considered as
Protection scope of the present invention.
Claims (36)
1. a kind of Lens Flare method for drafting, it is characterised in that including step:
The parameter of some Lens Flares of input is received, and successively in incoming tinter;
The texture mapping to be used of some Lens Flares is merged into a large texture textures, the large texture textures are carried
Hand over and large texture textures caching is generated into the caching of GPU;
Halation model is set up in three-dimensional scenic, parameter and current scene the real-time adjustment coloring according to some Lens Flares
The attribute of each Lens Flare in device;
According to the attribute of each Lens Flare, a quad patch is called, read the large texture textures caching, passed through
Color device is drawn to each Lens Flare.
2. Lens Flare method for drafting as claimed in claim 1, it is characterised in that by below equation to each mirror
Head halation is drawn:
Wherein, Iflare_resultIt is the halation image obtained after being drawn to each Lens Flare, IflareIt is the camera lens
Each pixel of halation, n is the number of the Lens Flare, and i is the index of the Lens Flare, and T (x, y, i) is the camera lens
Halation according to attribute carry out displacement, scaling and it is rotationally-varying after apex coordinate, c (i) is that the Lens Flare is obtained according to attribute
The color value of each pixel for obtaining, a (i) is the transparence value of each pixel that the Lens Flare is obtained according to attribute, x and y
It is the apex coordinate of the quad patch.
3. Lens Flare method for drafting as claimed in claim 1, it is characterised in that the parameter of the Lens Flare includes texture
One or more in index, color, size, skew, Yes/No rotation, brightness, transparency, fuzziness.
4. Lens Flare method for drafting as claimed in claim 1, it is characterised in that by tinter to each camera lens light
It is dizzy to carry out drafting and specifically include:
Offset parameter values k and current scene light source according to any Lens Flare to screen center side-play amount P, with institute
On straight line where stating current scene light source and the screen center and to the screen center side-play amount for k*P position
On the Lens Flare is drawn.
5. Lens Flare method for drafting as claimed in claim 1, it is characterised in that the halation result of the Lens Flare includes
Effect of fading in and effect of fading out;The effect of fading in is that under default scene, the transparency of the Lens Flare is predetermined
By 0 to 1 change in time;The effect of fading out is that under default scene, the transparency of the Lens Flare is when predetermined
It is interior to be changed by 1 to 0.
6. Lens Flare method for drafting as claimed in claim 1, it is characterised in that the tinter include vertex shader and
Fragment shader;
The vertex shader is used for according to the parameter of the skew of the Lens Flare, scaling, Yes/No rotation is generated respectively
The offset effect of Lens Flare, size effect, rotates effe;
The fragment shader generates the mirror respectively for the parameter of the color according to the Lens Flare, brightness, fuzziness
Color effects, chiaroscuro effect, the blur effect of head halation.
7. Lens Flare method for drafting as claimed in claim 1, it is characterised in that by tinter to each mirror
Head halation carries out drafting to be included:
After the changing coordinates on each summit in the quad patch are multiplied with the zooming parameter value of the Lens Flare respectively
Obtain the size effect of the Lens Flare;
Described in being obtained after each summit in the quad patch is rotated according to the rotation angle value of the Lens Flare
The rotates effe of Lens Flare;The rotation angle value of the Lens Flare by the Yes/No rotation parameter of the Lens Flare and
The position generation of current scene light source;
Each fragment in the quad patch is multiplied with the color parameter of the Lens Flare and obtains the Lens Flare
Color effects;
Each fragment in the quad patch is multiplied with the luminance parameter of the Lens Flare and obtains the Lens Flare
Brightness effects;
The transparency that the transparency parameter of the Lens Flare is assigned to each fragment in the quad patch is obtained into the mirror
The transparency interaction of head halation.
8. Lens Flare method for drafting as claimed in claim 1, it is characterised in that by tinter to each camera lens light
It is dizzy to carry out drafting and include:
According to the fuzziness parameter of any Lens Flare, to the camera lens after being sampled in the different levels of mipmap textures
Halation is drawn, and generates the blur effect of the Lens Flare;Wherein, the different levels of the mipmap textures are by by institute
Stating large texture textures carries out generation after different Fuzzy processings.
9. Lens Flare method for drafting as claimed in claim 1, it is characterised in that the large texture textures include halation texture
Textures, starburst texture mapping and ring of light texture mapping;Wherein, the halation texture mapping includes octagon halation texture
Textures, circular halation texture mapping, hexagon halation texture mapping, pentagon halation texture mapping.
10. Lens Flare method for drafting as claimed in claim 1, it is characterised in that methods described passes through instancing wash with watercolours
Dyeing technique is drawn to each Lens Flare.
11. Lens Flare method for drafting as claimed in claim 1, it is characterised in that the quad patch is facing
Piece.
12. Lens Flare method for drafting as claimed in claim 1, it is characterised in that the quad patch includes two three
Angular dough sheet.
A kind of 13. Lens Flare drawing apparatus, it is characterised in that including:
Parameter receiver module, the parameter of some Lens Flares for receiving input, and successively in incoming tinter;
Large texture textures cache module, for the texture mapping to be used of some Lens Flares to be merged into a large texture
Textures, the large texture textures are committed to large texture textures caching are generated in the caching of GPU;
Attribute tuning module, sets up halation model in three-dimensional scenic, according to the parameter and current field of some Lens Flares
The attribute of each Lens Flare in scape real-time adjustment tinter;
Drafting module, for the attribute according to each Lens Flare, calls a quad patch, reads the large texture patch
Figure caching, is drawn by tinter to each Lens Flare.
14. Lens Flare method for drafting as claimed in claim 13, it is characterised in that the drafting module passes through below equation
Each Lens Flare is drawn:
Wherein, Iflare_resultIt is the halation image obtained after being drawn to each Lens Flare, IflareIt is Lens Flare
Each pixel, n is the number of Lens Flare, and i is the index of Lens Flare, and T (x, y, i) is that Lens Flare is carried out according to attribute
Displacement, the apex coordinate after scaling and being rotationally-varying, c (i) is the face of each pixel that the Lens Flare is obtained according to attribute
Colour, a (i) is the transparence value of each pixel that the Lens Flare is obtained according to attribute, and x and y is the quad patch
Apex coordinate.
15. Lens Flare drawing apparatus as claimed in claim 13, it is characterised in that the parameter of the Lens Flare includes line
One or more in reason index, color, size, skew, Yes/No rotation, brightness, transparency, fuzziness.
16. Lens Flare drawing apparatus as claimed in claim 13, it is characterised in that the drafting module is in the following manner
Each Lens Flare is drawn:
Offset parameter values k and the current scene light source according to any Lens Flare to screen center side-play amount P,
With on the straight line where the scene light source and the screen center and to the screen center side-play amount for k*P position
On the Lens Flare is drawn.
17. Lens Flare drawing apparatus as claimed in claim 13, it is characterised in that the halation result bag of the Lens Flare
Include fade in effect and effect of fading out;The effect of fading in is that under default scene, the transparency of the Lens Flare is predetermined
Time in by 0 to 1 change;The effect of fading out is that under default scene, the transparency of the Lens Flare is predetermined
By 1 to 0 change in time.
18. Lens Flare drawing apparatus as claimed in claim 13, it is characterised in that the tinter includes vertex shader
And fragment shader;
The vertex shader is used for according to the parameter of the skew of the Lens Flare, scaling, Yes/No rotation is generated respectively
The offset effect of Lens Flare, size effect, rotates effe;
The fragment shader generates the mirror respectively for the parameter of the color according to the Lens Flare, brightness, fuzziness
Color effects, chiaroscuro effect, the blur effect of head halation.
19. Lens Flare drawing apparatus as claimed in claim 13, it is characterised in that the drafting module includes:
Scaling drawing unit, for by the changing coordinates on each summit in the quad patch respectively with the Lens Flare
Zooming parameter value obtains the size effect of the Lens Flare after being multiplied;
Rotation drawing unit, for each summit in the quad patch to be entered according to the rotation angle value of the Lens Flare
The rotates effe of the Lens Flare is obtained after row rotation;The rotation angle value of the Lens Flare is by the Lens Flare
The position generation of Yes/No rotation parameter and current scene light source;
Color drawing unit, obtains for each fragment in the quad patch to be multiplied with the color parameter of the Lens Flare
Obtain the color effects of the Lens Flare;
Brightness drawing unit, obtains for each fragment in the quad patch to be multiplied with the luminance parameter of the Lens Flare
Obtain the brightness effects of the Lens Flare;
Transparency drawing unit, for the transparency parameter of the Lens Flare to be assigned in the quad patch per a piece of
The transparency of section obtains the transparency interaction of the Lens Flare.
20. Lens Flare drawing apparatus as claimed in claim 13, it is characterised in that the drafting module is painted including fuzziness
Unit processed, it is right after being sampled in the different levels of mipmap textures for the fuzziness parameter according to any Lens Flare
The Lens Flare is drawn, and generates the blur effect of the Lens Flare;Wherein, the different levels of the mipmap textures
Generated after the large texture textures are carried out into different Fuzzy processings.
21. Lens Flare drawing apparatus as claimed in claim 13, it is characterised in that the large texture textures include halation line
Reason textures, starburst texture mapping and ring of light texture mapping;Wherein, the halation texture mapping includes octagon halation line
Reason textures, circular halation texture mapping, hexagon halation texture mapping, pentagon halation texture mapping.
22. Lens Flare drawing apparatus as claimed in claim 13, it is characterised in that described device passes through instancing wash with watercolours
Dyeing technique is drawn to each Lens Flare.
23. Lens Flare method for drafting as claimed in claim 13, it is characterised in that the quad patch is facing
Piece.
24. Lens Flare method for drafting as claimed in claim 13, it is characterised in that the quad patch includes two three
Angular dough sheet.
25. a kind of Lens Flare method for drafting, it is characterised in that including step:
The position of the Lens Flare on the position calculating screen of parameter and current scene light source according to Lens Flare, and
The position of the Lens Flare on screen sets a quad patch;Wherein, the parameter of the Lens Flare is pre-entered simultaneously
In incoming tinter;
The parameter of attribute and the Lens Flare according to the current scene light source obtains the category of the quad patch in real time
Property;
According to the attribute of the quad patch, corresponding texture mapping in a large texture textures is extracted in, and by described
Color device generates corresponding halation image after being drawn to the quad patch;Wherein, the large texture textures include some
The texture mapping to be used of Lens Flare.
26. Lens Flare method for drafting as claimed in claim 25, it is characterised in that the parameter of the Lens Flare includes line
One or more in reason index, color, size, skew, Yes/No rotation, brightness, transparency, fuzziness.
27. Lens Flare method for drafting as claimed in claim 25, it is characterised in that calculate the camera lens in the following manner
The position of halation:
Offset parameter values k and the current scene light source according to any Lens Flare are incited somebody to action to the side-play amount P of screen center
The Lens Flare be arranged at the current scene light source and the screen center where straight line on and to the screen center
Side-play amount for k*P position on.
28. Lens Flare method for drafting as claimed in claim 25, it is characterised in that the halation result bag of the Lens Flare
Include fade in effect and effect of fading out;The effect of fading in is that under default scene, the transparency of the Lens Flare is predetermined
Time in by 0 to 1 change;The effect of fading out is that under default scene, the transparency of the Lens Flare is predetermined
By 1 to 0 change in time.
29. Lens Flare method for drafting as claimed in claim 25, it is characterised in that the large texture textures include halation line
Reason textures, starburst texture mapping and ring of light texture mapping;Wherein, the halation texture mapping includes octagon halation line
Reason textures, circular halation texture mapping, hexagon halation texture mapping, pentagon halation texture mapping.
30. Lens Flare method for drafting as claimed in claim 25, it is characterised in that methods described passes through instancing wash with watercolours
Dyeing technique is drawn to the quad patch.
A kind of 31. Lens Flare drawing apparatus, it is characterised in that including:
Dough sheet setup module, for the mirror on the position calculating screen of the parameter according to Lens Flare and current scene light source
The position of head halation, and the position of the Lens Flare on screen sets a quad patch;Wherein described Lens Flare
Parameter pre-enter and in incoming tinter;
Dough sheet attribute acquisition module, the parameter for the attribute according to current scene light source and the Lens Flare obtains institute in real time
State the attribute of quad patch;
Drafting module, for the attribute according to the quad patch, is extracted in corresponding texture mapping in a large texture textures,
And corresponding halation image is generated after being drawn to the quad patch by the tinter;Wherein, the large texture
Textures include the texture mapping to be used of some Lens Flares.
32. Lens Flare drawing apparatus as claimed in claim 31, it is characterised in that the parameter of the Lens Flare includes line
One or more in reason index, color, size, skew, Yes/No rotation, brightness, transparency, fuzziness.
33. Lens Flare drawing apparatus as claimed in claim 31, it is characterised in that the dough sheet setup module is by following
Mode calculates the position of the Lens Flare:
Offset parameter values k and current scene light source according to any Lens Flare incite somebody to action described to the side-play amount P of screen center
Lens Flare be arranged at the current scene light source and the screen center where straight line on and to the inclined of the screen center
Shifting amount is on the position of k*P.
34. Lens Flare drawing apparatus as claimed in claim 31, it is characterised in that the halation result bag of the Lens Flare
Include fade in effect and effect of fading out;The effect of fading in is that under default scene, the transparency of the Lens Flare is predetermined
Time in by 0 to 1 change;The effect of fading out is that under default scene, the transparency of the Lens Flare is predetermined
By 1 to 0 change in time.
35. Lens Flare drawing apparatus as claimed in claim 31, it is characterised in that the large texture textures include halation line
Reason textures, starburst texture mapping and ring of light texture mapping;Wherein, the halation texture mapping includes octagon halation line
Reason textures, circular halation texture mapping, hexagon halation texture mapping, pentagon halation texture mapping.
36. Lens Flare drawing apparatus as claimed in claim 31, it is characterised in that described device passes through instancing wash with watercolours
Dyeing technique is drawn to the quad patch.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710032937.0A CN106846454A (en) | 2017-01-17 | 2017-01-17 | Lens Flare method for drafting and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710032937.0A CN106846454A (en) | 2017-01-17 | 2017-01-17 | Lens Flare method for drafting and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN106846454A true CN106846454A (en) | 2017-06-13 |
Family
ID=59123719
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710032937.0A Pending CN106846454A (en) | 2017-01-17 | 2017-01-17 | Lens Flare method for drafting and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106846454A (en) |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107369200A (en) * | 2017-07-04 | 2017-11-21 | 福建星网视易信息系统有限公司 | A kind of 3D scene special effects processing method and storage device |
CN108038896A (en) * | 2017-12-06 | 2018-05-15 | 北京像素软件科技股份有限公司 | Halation gradual change implementation method and device |
CN109529333A (en) * | 2018-11-21 | 2019-03-29 | 北京像素软件科技股份有限公司 | Lens Flare analogy method, Lens Flare simulator and terminal device |
CN110766779A (en) * | 2019-10-23 | 2020-02-07 | 网易(杭州)网络有限公司 | Method and device for generating lens halo |
CN111225232A (en) * | 2018-11-23 | 2020-06-02 | 北京字节跳动网络技术有限公司 | Video-based sticker animation engine, realization method, server and medium |
CN111899157A (en) * | 2020-07-16 | 2020-11-06 | 中国人民解放军海军航空大学 | Method for simulating stray light interference by using mask technology |
CN111951156A (en) * | 2020-08-24 | 2020-11-17 | 杭州趣维科技有限公司 | Method for drawing photoelectric special effect of graph |
CN112435323A (en) * | 2020-11-26 | 2021-03-02 | 网易(杭州)网络有限公司 | Light effect processing method, device, terminal and medium in virtual model |
CN112604294A (en) * | 2020-12-29 | 2021-04-06 | 完美世界(北京)软件科技发展有限公司 | Rendering method and device of map resource, electronic equipment and storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102306391A (en) * | 2011-09-20 | 2012-01-04 | 深圳Tcl新技术有限公司 | OpenGL (open graphics library)-based inverted image display processing device and method |
US20150130805A1 (en) * | 2013-11-11 | 2015-05-14 | Oxide Interactive, LLC | Method and system of anti-aliasing shading decoupled from rasterization |
CN105741228A (en) * | 2016-03-11 | 2016-07-06 | 腾讯科技(深圳)有限公司 | Graph processing method and device |
CN105976423A (en) * | 2016-04-29 | 2016-09-28 | 网易(杭州)网络有限公司 | Method and device for generating lens flare |
-
2017
- 2017-01-17 CN CN201710032937.0A patent/CN106846454A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102306391A (en) * | 2011-09-20 | 2012-01-04 | 深圳Tcl新技术有限公司 | OpenGL (open graphics library)-based inverted image display processing device and method |
US20150130805A1 (en) * | 2013-11-11 | 2015-05-14 | Oxide Interactive, LLC | Method and system of anti-aliasing shading decoupled from rasterization |
CN105741228A (en) * | 2016-03-11 | 2016-07-06 | 腾讯科技(深圳)有限公司 | Graph processing method and device |
CN105976423A (en) * | 2016-04-29 | 2016-09-28 | 网易(杭州)网络有限公司 | Method and device for generating lens flare |
Non-Patent Citations (1)
Title |
---|
刘圆 等: "真实感炫光效果实时绘制", 《计算机辅助设计与图形学学报》 * |
Cited By (14)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107369200A (en) * | 2017-07-04 | 2017-11-21 | 福建星网视易信息系统有限公司 | A kind of 3D scene special effects processing method and storage device |
CN107369200B (en) * | 2017-07-04 | 2021-07-16 | 福建星网视易信息系统有限公司 | 3D scene special effect processing method and storage device |
CN108038896B (en) * | 2017-12-06 | 2021-06-11 | 北京像素软件科技股份有限公司 | Halo gradual change realization method and device |
CN108038896A (en) * | 2017-12-06 | 2018-05-15 | 北京像素软件科技股份有限公司 | Halation gradual change implementation method and device |
CN109529333A (en) * | 2018-11-21 | 2019-03-29 | 北京像素软件科技股份有限公司 | Lens Flare analogy method, Lens Flare simulator and terminal device |
CN111225232A (en) * | 2018-11-23 | 2020-06-02 | 北京字节跳动网络技术有限公司 | Video-based sticker animation engine, realization method, server and medium |
CN110766779A (en) * | 2019-10-23 | 2020-02-07 | 网易(杭州)网络有限公司 | Method and device for generating lens halo |
CN110766779B (en) * | 2019-10-23 | 2024-02-06 | 网易(杭州)网络有限公司 | Method and device for generating lens halation |
CN111899157A (en) * | 2020-07-16 | 2020-11-06 | 中国人民解放军海军航空大学 | Method for simulating stray light interference by using mask technology |
CN111951156A (en) * | 2020-08-24 | 2020-11-17 | 杭州趣维科技有限公司 | Method for drawing photoelectric special effect of graph |
CN111951156B (en) * | 2020-08-24 | 2021-08-03 | 杭州小影创新科技股份有限公司 | Method for drawing photoelectric special effect of graph |
CN112435323A (en) * | 2020-11-26 | 2021-03-02 | 网易(杭州)网络有限公司 | Light effect processing method, device, terminal and medium in virtual model |
CN112435323B (en) * | 2020-11-26 | 2023-08-22 | 网易(杭州)网络有限公司 | Light effect processing method, device, terminal and medium in virtual model |
CN112604294A (en) * | 2020-12-29 | 2021-04-06 | 完美世界(北京)软件科技发展有限公司 | Rendering method and device of map resource, electronic equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106846454A (en) | Lens Flare method for drafting and device | |
CN112215934B (en) | Game model rendering method and device, storage medium and electronic device | |
CN108876931B (en) | Three-dimensional object color adjustment method and device, computer equipment and computer readable storage medium | |
US6956576B1 (en) | Graphics system using sample masks for motion blur, depth of field, and transparency | |
CN109410298B (en) | Virtual model manufacturing method and expression changing method | |
CN108564646A (en) | Rendering intent and device, storage medium, the electronic device of object | |
CN111127591B (en) | Image hair dyeing processing method, device, terminal and storage medium | |
US7953275B1 (en) | Image shader for digital image modification | |
US8019182B1 (en) | Digital image modification using pyramid vignettes | |
CN104469179A (en) | Method for combining dynamic pictures into mobile phone video | |
JPH10143678A (en) | Illumination and shading simulation of computer graphics /image generator | |
CN106780313A (en) | Image processing method and device | |
CN108765520B (en) | Text information rendering method and device, storage medium and electronic device | |
WO2023093291A1 (en) | Image processing method and apparatus, computer device, and computer program product | |
CN110286979A (en) | Reduce the rendering method and system of Overdraw caused by UI covers | |
EP1324273A2 (en) | Rendering device and method | |
CN109461197A (en) | A kind of cloud real-time rendering optimization algorithm based on spherical surface UV and re-projection | |
CN107230249A (en) | Shading Rendering method and apparatus | |
CN115311395A (en) | Three-dimensional scene rendering method, device and equipment | |
WO2017174006A1 (en) | Image processing method and device | |
CN114612641A (en) | Material migration method and device and data processing method | |
CN110458922A (en) | Method for rendering graph and Related product | |
Li et al. | ARF-Plus: Controlling Perceptual Factors in Artistic Radiance Fields for 3D Scene Stylization | |
JP3501479B2 (en) | Image processing device | |
CN107135356A (en) | Captions clap generation method and device, image processing method and device |
Legal Events
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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20170613 |
|
RJ01 | Rejection of invention patent application after publication |