CN109529333A - Lens Flare analogy method, Lens Flare simulator and terminal device - Google Patents

Lens Flare analogy method, Lens Flare simulator and terminal device Download PDF

Info

Publication number
CN109529333A
CN109529333A CN201811394068.7A CN201811394068A CN109529333A CN 109529333 A CN109529333 A CN 109529333A CN 201811394068 A CN201811394068 A CN 201811394068A CN 109529333 A CN109529333 A CN 109529333A
Authority
CN
China
Prior art keywords
hot spot
model
vertex
spot model
coordinate
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
Application number
CN201811394068.7A
Other languages
Chinese (zh)
Inventor
陈安治
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Pixel Software Technology Co Ltd
Original Assignee
Beijing Pixel Software Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Beijing Pixel Software Technology Co Ltd filed Critical Beijing Pixel Software Technology Co Ltd
Priority to CN201811394068.7A priority Critical patent/CN109529333A/en
Publication of CN109529333A publication Critical patent/CN109529333A/en
Pending legal-status Critical Current

Links

Classifications

    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/50Controlling the output signals based on the game progress
    • A63F13/52Controlling the output signals based on the game progress involving aspects of the displayed game scene
    • A63F13/525Changing parameters of virtual cameras
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/60Generating or modifying game content before or while executing the game program, e.g. authoring tools specially adapted for game development or game-integrated level editor
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F2300/00Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game
    • A63F2300/60Methods for processing data by generating or executing the game program
    • A63F2300/66Methods for processing data by generating or executing the game program for rendering three dimensional images

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Processing Or Creating Images (AREA)

Abstract

Lens Flare analogy method, Lens Flare simulator and terminal device provided in an embodiment of the present invention, are related to Lens Flare analogue technique field.Wherein, the Lens Flare analogy method includes: to judge whether the sun is blocked according to the current location of preset depth map and the sun;If the sun is not blocked, halation model is constructed, wherein the halation model includes multiple hot spot models;For each hot spot model, the hot spot model is rendered according to preset rules, to complete the simulation of halation.By the above method, preset depth map can be sampled to judge whether the sun is blocked, improve rendering efficiency.

Description

Lens Flare analogy method, Lens Flare simulator and terminal device
Technical field
The present invention relates to Lens Flare analogue technique fields, in particular to a kind of Lens Flare analogy method, camera lens Halation simulator and terminal device.
Background technique
In current 3d gaming scene, simulating sunny has been very usual thing, and when video camera is against the sun, Charming Lens Flare effect true to nature can be showed, then can add more more atmosphere to scene of game.It is understood that mirror The head often lens set that is made of many piece eyeglasses, although each eyeglass permeability is very high, inevitably some be anti- It penetrates and scatters, and these have resulted in the appearance of halation with other incident lights holding consistent light in direction.Through inventor The study found that there is a problem that simulation calculates complexity in existing Lens Flare analogue technique.
Summary of the invention
In view of this, the purpose of the present invention is to provide a kind of Lens Flare analogy method, Lens Flare simulator and Terminal device, to improve problems of the prior art.
To achieve the above object, the embodiment of the present invention adopts the following technical scheme that
A kind of Lens Flare analogy method, which comprises
Judge whether the sun is blocked according to the current location of preset depth map and the sun;
If the sun is not blocked, halation model is constructed, wherein the halation model includes multiple hot spot models;
For each hot spot model, the hot spot model is rendered according to preset rules, to complete the simulation of halation.
In the embodiment of the present invention preferably selects, the described the step of hot spot model is rendered according to preset rules Include:
The coordinate of reference point is calculated according to preset sun direction and video camera direction;
The hot spot model is calculated around the rotation angle of video camera according to the coordinate of reference point;
The hot spot model is rotated according to the coordinate of the reference point and the rotation angle, to complete to the light The rendering of spot model.
In the embodiment of the present invention preferably selects, each hot spot model is made of multiple rectangles, wherein each rectangle It is made of four vertex, the described the step of hot spot model is rendered according to preset rules further include:
Conversion process is carried out by parameter information of the vertex shader to each vertex of the hot spot model;
Interpolation processing is carried out to the parameter information Jing Guo conversion process by rasterizer;
The color clarity of the hot spot model is calculated according to the parameter information Jing Guo interpolation processing by piece member tinter;
According to the coordinate of the reference point, the rotation angle, the color clarity and it is described pass through conversion process Parameter information rotation and color treatments are carried out to the hot spot model, to complete rendering to the hot spot model.
In the embodiment of the present invention preferably selects, the parameter information on each vertex includes apex coordinate, passes through vertex The step of tinter carries out conversion process to the parameter information on each vertex of the hot spot model include:
For each vertex of the hot spot model, the apex coordinate on the vertex is passed sequentially through into world's transition matrix, view See that transition matrix and projection transform matrix are converted, to obtain the cutting coordinate on the vertex.
In the embodiment of the present invention preferably selects, the parameter information on each vertex further includes texture coordinate, according to Before the step of preset rules render the hot spot model, the method also includes:
For each hot spot model, it is bonded corresponding texture coordinate respectively for each vertex of the hot spot model;
By rasterizer to Jing Guo conversion process parameter information carry out interpolation processing the step of include:
For each vertex of the hot spot model, interpolation processing is carried out to the texture coordinate on the vertex, to obtain the top The interpolation texture coordinate of point.
In the embodiment of the present invention preferably selects, by piece member tinter according to the parameter information meter Jing Guo interpolation processing The step of calculating the color clarity of the hot spot model include:
For each vertex of the hot spot model, interpolation texture coordinate and preset color clarity to the vertex into Row calculates, to obtain the final color transparency on the vertex.
The embodiment of the invention also provides a kind of Lens Flare simulator, described device includes:
Judgment module, for judging whether the sun is blocked according to the current location of preset depth map and the sun;
Halation model construction module, for constructing halation model when the sun is not blocked, wherein the halation model Including multiple hot spot models;
Hot spot model rendering module carries out the hot spot model according to preset rules for being directed to each hot spot model Rendering, to complete the simulation of halation.
In the embodiment of the present invention preferably selects, each hot spot model is made of multiple rectangles, wherein each rectangle It is made of four vertex, the hot spot model rendering module includes:
Reference point computational submodule, for the seat of reference point to be calculated according to preset sun direction and video camera direction Mark;
Angle computational submodule is rotated, the hot spot model is calculated around video camera for the coordinate according to reference point Rotate angle;
Submodule is rotated, for revolving according to the coordinate and the rotation angle of the reference point to the hot spot model Turn, to complete the rendering to the hot spot model.
In the embodiment of the present invention preferably selects, the hot spot model rendering module further include:
Informoter module, for being carried out by parameter information of the vertex shader to each vertex of the hot spot model Conversion process;
Information interpolation submodule, for carrying out interpolation processing to the parameter information Jing Guo conversion process by rasterizer;
Diaphanometer operator module, for calculating the light according to the parameter information Jing Guo interpolation processing by piece member tinter The color clarity of spot model;
Model rendering submodule, for according to the coordinate of the reference point, the rotation angle, the color clarity with And the parameter information by conversion process carries out rotation and color treatments to the hot spot model, to complete to the light spot mode The rendering of type.
The embodiment of the invention also provides a kind of terminal devices, including memory, processor and above-mentioned Lens Flare mould Quasi- device, wherein the Lens Flare simulator includes that one or more is stored in the memory and by the processor The software function module of execution.
Lens Flare analogy method, Lens Flare simulator and terminal device provided by the invention, by preset Depth map is sampled to judge whether the sun is blocked, and Lens Flare analogy method and Lens Flare simulator are improved Rendering efficiency.
Further, by multiple hot spot modeling Lens Flares, the Lens Flare simulated is with camera lens in the solar cycle Side can rotate when mobile, improve the practicability of Lens Flare analogy method and Lens Flare simulator.
To enable the above objects, features and advantages of the present invention to be clearer and more comprehensible, preferred embodiment is cited below particularly, and cooperate Appended attached drawing, is described in detail below.
Detailed description of the invention
Fig. 1 is the structural schematic diagram of terminal device provided in an embodiment of the present invention.
Fig. 2 is the flow diagram of Lens Flare analogy method provided in an embodiment of the present invention.
Fig. 3 is the flow diagram of the step S130 in Fig. 2.
Fig. 4 is another flow diagram of the step S130 in Fig. 2.
Fig. 5 is the structural block diagram of Lens Flare simulator provided in an embodiment of the present invention.
Fig. 6 is the structural block diagram of hot spot model rendering module provided in an embodiment of the present invention.
Icon: 10- terminal device;12- memory;14- processor;100- Lens Flare simulator;110- judges mould Block;120- halation model construction module;130- hot spot model rendering module;131- reference point computational submodule;132- rotation angle Spend computational submodule;133- rotates submodule;134- informoter module;135- information interpolation submodule;136- transparency Computational submodule;137- model rendering submodule.
Specific embodiment
In order to make the object, technical scheme and advantages of the embodiment of the invention clearer, below in conjunction with the embodiment of the present invention In attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment only It is a part of the embodiments of the present invention, instead of all the embodiments.The present invention being usually described and illustrated herein in the accompanying drawings The component of embodiment can be arranged and be designed with a variety of different configurations.
Therefore, the detailed description of the embodiment of the present invention provided in the accompanying drawings is not intended to limit below claimed The scope of the present invention, but be merely representative of selected embodiment of the invention.Based on the embodiments of the present invention, this field is common Technical staff's every other embodiment obtained without creative efforts belongs to the model that the present invention protects It encloses.
It should also be noted that similar label and letter indicate similar terms in following attached drawing, therefore, once a certain Xiang Yi It is defined in a attached drawing, does not then need that it is further defined and explained in subsequent attached drawing.In description of the invention In, term " first ", " second " etc. are only used for distinguishing description, and should not be understood as only or imply relative importance.
In the description of the present invention unless specifically defined or limited otherwise, term " setting ", " connected ", " connection " are answered It is interpreted broadly, for example, it may be being fixedly connected, may be a detachable connection, or be integrally connected;It can be mechanical connect It connects, is also possible to be electrically connected;It can be directly connected, can also can be in two elements indirectly connected through an intermediary The connection in portion.For the ordinary skill in the art, the tool of above-mentioned term in the present invention can be understood with concrete condition Body meaning.
As shown in Figure 1, the embodiment of the invention provides a kind of terminal device 10, including memory 12, processor 14 and mirror Head halation simulator 100.
Wherein, the terminal device 10 may include, but be not limited to smart phone, PC (personal Computer, PC), tablet computer, personal digital assistant (personal digital assistant, PDA), mobile Internet access set Standby (mobile Internet device, MID) etc..In the present embodiment, the terminal device 10 is preferably movable termination Equipment, such as mobile phone.By the Lens Flare simulator 100, can solve in existing Lens Flare analogue technique due to The computationally intensive and problem that causes movable termination amount of equipment power consumption big, and then when increasing effective use of movable termination equipment Between.
Further, in this embodiment, directly or indirectly electrically connect between the memory 12 and processor 14 It connects, to realize the transmission or interaction of data.For example, these elements can pass through one or more communication bus or signal between each other Line, which is realized, to be electrically connected.The Lens Flare simulator 100 includes that at least one can be with software or firmware (firmware) Form is stored in the software function module in the memory 12.The processor 14 stores in the memory 12 for executing Executable module, such as software function module and computer program etc. included by the Lens Flare simulator 100, with Realize Lens Flare analogy method.
Wherein, the memory 12 may be, but not limited to, random access memory (Random Access Memory, RAM), read-only memory (Read Only Memory, ROM), programmable read only memory (Programmable Read-Only Memory, PROM), erasable read-only memory (Erasable Programmable Read-Only Memory, EPROM), Electricallyerasable ROM (EEROM) (Electric Erasable Programmable Read-Only Memory, EEPROM) etc.. Wherein, memory 12 is for storing program, and the processor 14 executes described program after receiving and executing instruction.
The processor 14 may be a kind of IC chip, the processing capacity with signal.Above-mentioned processor 14 It can be general processor, including central processing unit (Central Processing Unit, CPU), network processing unit (Network Processor, NP) etc.;It can also be digital signal processor (DSP), specific integrated circuit (ASIC), scene Programmable gate array (FPGA) either other programmable logic device, discrete gate or transistor logic, discrete hardware group Part.General processor can be microprocessor or the processor is also possible to any conventional processor etc..
It is appreciated that structure shown in FIG. 1 is only to illustrate, the terminal device 10 may also include more than shown in Fig. 1 Perhaps less component or with the configuration different from shown in Fig. 1, for example, it is also possible to include for being counted with server According to interactive communication unit.Each component shown in Fig. 1 can be realized using hardware, software, or its combination.
In conjunction with Fig. 2, the embodiment of the present invention also provides a kind of Lens Flare simulation side that can be applied to above-mentioned terminal device 10 Method, method and step defined in the related process of the method can be realized by the processor 14.It below will be to shown in Fig. 2 Detailed process is described in detail.
Step S110 judges whether the sun is blocked according to the current location of preset depth map and the sun.If the sun does not have It is blocked, thens follow the steps S120.
In detail, the depth map includes the depth information of each object and camera lens in render scenes, the depth The value of degree information changes between 0-1 according to the distant relationships of each object and camera lens, for example, object and video camera mirror Head is remoter, and the value of depth information is bigger, and object is closer with camera lens, and the value of depth information is with regard to smaller.In video camera mirror On head to the extending direction of each object, the depth information of each object is recorded according to distant relationships, on same extending direction, Depth map can only retain the value of the smallest depth information of numerical value.For example, since the sun is distant apart from the camera lens, it will After the completion of sun rendering, if the sun is not blocked, numerical value of the position on corresponding depth map where the sun is 1, is being taken the photograph Depth information is 1 on camera lens to the extending direction of the sun;If the sun is blocked, the depth information of object is blocked less than 1, Depth information is less than 1 on camera lens to the extending direction of the sun.Therefore, according to the present bit of preset depth map and the sun It sets, can judge whether the sun is blocked by the depth information on the extending direction of camera lens to the sun.
Wherein, due to the sun not instead of a point, there is area, it is possible to adopt to 3 points around the sun Sample is finally averaged.Then, it may is that according to the formula that the average value judges whether the sun is blocked
Float ocllusion=tex2D (S_Depth, SunUV.xy) .r;
Ocllusion+=tex2D (S_Depth, SunUV.xy+SunRadius* (0.5,0.5));
Ocllusion+=tex2D (S_Depth, SunUV.xy+SunRadius* (0.5, -0.5));
Ocllusion+=tex2D (S_Depth, SunUV.xy+SunRadius* (- 0.5, -0.5));
Ocllusion=ocllusion/4.
Wherein, ocllusion is the value of depth information, and S_Depth is the depth information of preset depth map, SunUV.xy For the coordinate of the sun, SunRadius is the coordinate of the point around the sun.
In detail, if (ocllusion >=0.9f), then the sun is not blocked;Otherwise the sun is blocked.
Step S120 constructs halation model, wherein the halation model includes multiple hot spot models.
In the present embodiment, the halation model may include multiple hot spot models.Wherein, the shape of each hot spot model Shape size is unrestricted, can be configured according to actual needs, for example, can be according to the environmental demand or time letter in application Breath is configured.In the present embodiment, each hot spot model is made of multiple rectangles, wherein each rectangle is by four vertex Two triangulars of connection are at so that rasterizer is by being assembled into triangle for vertex to form rectangle.
Step S130 renders the hot spot model according to preset rules, for each hot spot model to complete light Dizzy simulation.
With the above arrangement, being sampled to preset depth map to judge whether the sun is blocked, camera lens light is improved The rendering efficiency of dizzy analogy method.
Optionally, unrestricted in such a way that preset rules render hot spot model, it can be according to practical application It is configured, such as, if the halation model for needing to simulate can be rotated when sun periphery is mobile to be changed.In this reality It applies in example, in conjunction with Fig. 3, step S130 may include step S131, step S132 and step S133, to carry out to hot spot model Rendering processing.
The coordinate of reference point is calculated according to preset sun direction and video camera direction by step S131.
In detail, the formula for obtaining the coordinate of reference point may is that
RayDir.xyz=cameraDir.xyz-sunDir.xyz;
RayDir.xyz=normalise (rayDir.xyz);
CenterPos.xyz=cameraPos.xyz+rayDir.xyz*100.
Wherein, cameraDir indicates video camera direction, and cameraPos indicates that camera position, sunDir indicate sun court To normalise (rayDir.xyz) indicates unitization rayDir vector, and centerPos is exactly the reference point that we obtain.Light Spot model will be using reference point centerPos as starting point, and along rayDir, this direction is distributed.
The hot spot model is calculated around the rotation angle of video camera according to the coordinate of reference point in step S132.
In detail, calculate hot spot model may is that around the formula of the rotation angle of video camera
Float cosVal=rayDir.xyz* (0.0,1.0,1.0);
Float radian=acos (cosVal);
Quaternion qua(radian,cameraDir);
CameraRotateRight=qua*cameraRight;
CameraRotateRight=qua*cameraRight.
Wherein, rayDir.xyz is hot spot distribution direction, and cameraRight is the dextrad amount of video camera, and cameraUp is The upper vector of video camera, cameraRotateRight indicate the dextrad amount of postrotational video camera, and cameraRotateUp is indicated The upper vector of postrotational video camera.
Step S133 rotates the hot spot model according to the coordinate of the reference point and the rotation angle, with Complete the rendering to the hot spot model.
Further, each hot spot model is made of multiple rectangles, wherein each rectangle is made of four vertex, is The vertex information of hot spot model is converted, in conjunction with Fig. 4, step S130 can also include step S134, step S135, step Rapid S136 and step S137.
Step S134 carries out conversion process by parameter information of the vertex shader to each vertex of the hot spot model.
It in the present embodiment, can be in multiple light spot modes to guarantee that the halation display effect simulated has more authenticity Each vertex of type is bonded corresponding texture coordinate respectively.Therefore, the parameter information can be on the vertex including each vertex It further include texture coordinate on the basis of coordinate.It in the present embodiment, can be defeated by the parameter information on each vertex of hot spot model Enter in the vertex shader of graphics processor, conversion process is carried out with the parameter information to a vertex.Wherein, the side of conversion process Formula can be configured according to the particular content of the parameter information on vertex.
Optionally, the mode for carrying out conversion process is unrestricted, can be configured according to practical application request, for example, In the example that one kind can substitute, for each vertex of hot spot model, the apex coordinate on the vertex can successively be led to World's transition matrix is crossed, depending on seeing that transition matrix and projection transform matrix are converted, to obtain the cutting coordinate on the vertex.
In detail, for each vertex, the apex coordinate on the vertex belong to the halation model of construction Model Space Between, the apex coordinate on the vertex can be converted to world space to obtain world coordinates posWorld by world's transition matrix (x, y, z) by depending on seeing that conversion square converts obtained world coordinates to camera space to obtain depending on seeing coordinate, and passes through projection Transition matrix will be obtained depending on seeing that coordinate is converted to clip space to obtain cutting coordinate clipsPos (x, y, z).
Step S135 carries out interpolation processing to the parameter information Jing Guo conversion process by rasterizer.
In detail, in the present embodiment, it is the color clarity convenient for piece member shader computations hot spot model, can passes through Rasterizer carries out interpolation processing to parameter information.
Optionally, the mode for carrying out interpolation processing is unrestricted, can be configured according to practical application request, for example, In the example that one kind can substitute, for each vertex of the hot spot model, interpolation is carried out to the texture coordinate on the vertex Processing, to obtain the interpolation texture coordinate on the vertex.
Optionally, the texture coordinate is also possible to directly either input the rasterizer by vertex shader The rasterizer is inputted, is configured according to actual needs.In the present embodiment, by the texture coordinate and the cutting Coordinate is saved respectively in the register specified to graphics processor, and the cutting that rasterizer can obtain the vertex by register is sat The interpolation texture coordinate uv2 (x, y) on the obtained vertex to carry out interpolation processing, and is input to piece member by mark and texture coordinate In tinter.
Step S136 calculates the color of the hot spot model by piece member tinter according to the parameter information Jing Guo interpolation processing Transparency.
In the present embodiment, can be different according to the effect of the halation of simulation, piece member shader computations obtain hot spot model Color clarity can have different selections.
Optionally, calculate hot spot model color clarity mode it is unrestricted, can according to practical application request into Row setting, for example, in the example that one kind can substitute, for each vertex of the hot spot model, to the interpolation on the vertex Texture coordinate and preset color clarity are calculated, to obtain the final color transparency on the vertex.
In detail, the formula for calculating the final color transparency on the vertex may is that
OutColor.rgba=tex2D (S_Diffuse, uv2.xy);
FragColor.rgba=outColor.rgba*color.rgba.
Wherein, uv2 (x, y) is interpolation texture coordinate, and color (r, g, b, alpha) is preset color clarity, rgb For color, alpha is transparency.
Step S137, according to the coordinate of the reference point, the rotation angle, the color clarity and the process The parameter information of conversion process carries out rotation and color treatments to the hot spot model, to complete the rendering to the hot spot model.
In detail, the parameter information by conversion process is to cut coordinate, which is passed through corresponding face Color transparency renders to screen, and the simulation of halation may be implemented.
In conjunction with Fig. 5, the embodiment of the present invention also provides a kind of Lens Flare simulation dress that can be applied to above-mentioned terminal device 10 Set 100.Wherein, the Lens Flare simulator 100 may include judgment module 110, halation model construction module 120 and light Spot model rendering module 130.
The judgment module 110, for judging whether the sun is hidden according to the current location of preset depth map and the sun Gear.In the present embodiment, the judgment module 110 can be used for executing step S110 shown in Fig. 2, about the judgment module 110 specific descriptions are referred to the description to step S110 above.
The halation model construction module 120, for constructing halation model, wherein the halation model includes multiple light Spot model.In the present embodiment, the halation model construction module 120 can be used for executing step S120 shown in Fig. 2, about institute The specific descriptions for stating halation model construction module 120 are referred to the description to step S120 above.
The hot spot model rendering module 130, for being directed to each hot spot model, according to preset rules to the light spot mode Type is rendered, to complete the simulation of halation.In the present embodiment, the hot spot model rendering module 130 can be used for executing Fig. 2 Shown step S130, the specific descriptions about the hot spot model rendering module 130 are referred to above to step S130's Description.
In conjunction with Fig. 6, each hot spot model is made of multiple rectangles, wherein each rectangle is made of four vertex, described Hot spot model rendering module 130 may include reference point computational submodule 131, rotation angle computational submodule 132, rotation submodule Block 133, informoter module 134, information interpolation submodule 135, diaphanometer operator module 136 and model rendering submodule 137。
The reference point computational submodule 131, for ginseng to be calculated according to preset sun direction and video camera direction The coordinate of examination point.In the present embodiment, the reference point computational submodule 131 can be used for executing step S131 shown in Fig. 3, close The description to step S131 above is referred in the specific descriptions of the reference point computational submodule 131.
The rotation angle computational submodule 132, for the coordinate according to reference point be calculated the hot spot model around The rotation angle of video camera.In the present embodiment, the rotation angle computational submodule 132 can be used for executing step shown in Fig. 3 Rapid S132, the specific descriptions about the rotation angle computational submodule 132 are referred to the description to step S132 above.
The rotation submodule 133, for the coordinate and the rotation angle according to the reference point to the light spot mode Type is rotated, to complete the rendering to the hot spot model.In the present embodiment, the rotation submodule 133 can be used for executing Step S133 shown in Fig. 3, the specific descriptions about the rotation submodule 133 are referred to above retouch step S133 It states.
The informoter module 134, for the parameter by vertex shader to each vertex of the hot spot model Information carries out conversion process.In the present embodiment, the informoter module 134 can be used for executing step shown in Fig. 4 S134, the specific descriptions about the informoter module 134 are referred to the description to step S134 above.
The information interpolation submodule 135, for carrying out interpolation to the parameter information Jing Guo conversion process by rasterizer Processing.In the present embodiment, the information interpolation submodule 135 can be used for executing step S135 shown in Fig. 4, about the letter The specific descriptions of breath interpolation submodule 135 are referred to the description to step S135 above.
The diaphanometer operator module 136, for passing through piece member tinter according to the parameter information Jing Guo interpolation processing Calculate the color clarity of the hot spot model.In the present embodiment, the diaphanometer operator module 136 can be used for executing Fig. 4 Shown step S136, the specific descriptions about the diaphanometer operator module 136 are referred to above to step S136's Description.
The model rendering submodule 137, for the coordinate according to the reference point, the rotation angle, the color Transparency and the parameter information by conversion process carry out rotation and color treatments to the hot spot model, with completion pair The rendering of the hot spot model.In the present embodiment, the model rendering submodule 137 can be used for executing step shown in Fig. 4 S137, the specific descriptions about the model rendering submodule 137 are referred to the description to step S137 above.
Lens Flare analogy method, Lens Flare simulator 100 and terminal device 10 provided by the invention, by pre- If depth map sampled to judge whether the sun is blocked, improve Lens Flare analogy method and Lens Flare simulation dress Set 100 rendering efficiency.
Further, by multiple hot spot modeling Lens Flares, the Lens Flare simulated is with camera lens in the solar cycle Side can rotate when mobile, improve the practicability of Lens Flare analogy method and Lens Flare simulator 100.
In several embodiments provided by the embodiment of the present invention, it should be understood that disclosed device and method, it can also To realize by another way.Device and method embodiment described above is only schematical, for example, in attached drawing Flow chart and block diagram show that the devices of multiple embodiments according to the present invention, method and computer program product are able to achieve Architecture, function and operation.In this regard, each box in flowchart or block diagram can represent module, a program A part of section or code, a part of the module, section or code include that one or more is patrolled for realizing defined Collect the executable instruction of function.It should also be noted that in some implementations as replacement, function marked in the box It can occur in a different order than that indicated in the drawings.For example, two continuous boxes can actually be held substantially in parallel Row, they can also be executed in the opposite order sometimes, and this depends on the function involved.It is also noted that block diagram and/or The combination of each box in flow chart and the box in block diagram and or flow chart, can the function as defined in executing or dynamic The dedicated hardware based system made is realized, or can be realized using a combination of dedicated hardware and computer instructions.
In addition, each functional module in each embodiment of the present invention can integrate one independent portion of formation together Point, it is also possible to modules individualism, an independent part can also be integrated to form with two or more modules.
It, can be with if the function is realized and when sold or used as an independent product in the form of software function module It is stored in a computer readable storage medium.Based on this understanding, technical solution of the present invention is substantially in other words The part of the part that contributes to existing technology or the technical solution can be embodied in the form of software products, the meter Calculation machine software product is stored in a storage medium, including some instructions are used so that a computer equipment (can be a People's computer, electronic equipment or network equipment etc.) execute all or part of step of each embodiment the method for the present invention Suddenly.And storage medium above-mentioned includes: USB flash disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), deposits at random The various media that can store program code such as access to memory (RAM, Random Access Memory), magnetic or disk. It should be noted that, in this document, the terms "include", "comprise" or its any other variant are intended to the packet of nonexcludability Contain, so that the process, method, article or equipment for including a series of elements not only includes those elements, but also including Other elements that are not explicitly listed, or further include for elements inherent to such a process, method, article, or device. In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that including the element Process, method, article or equipment in there is also other identical elements.
The foregoing is only a preferred embodiment of the present invention, is not intended to restrict the invention, for the skill of this field For art personnel, the invention may be variously modified and varied.All within the spirits and principles of the present invention, made any to repair Change, equivalent replacement, improvement etc., should all be included in the protection scope of the present invention.

Claims (10)

1. a kind of Lens Flare analogy method, which is characterized in that the described method includes:
Judge whether the sun is blocked according to the current location of preset depth map and the sun;
If the sun is not blocked, halation model is constructed, wherein the halation model includes multiple hot spot models;
For each hot spot model, the hot spot model is rendered according to preset rules, to complete the simulation of halation.
2. Lens Flare analogy method according to claim 1, which is characterized in that it is described according to preset rules to the hot spot The step of model is rendered include:
The coordinate of reference point is calculated according to preset sun direction and video camera direction;
The hot spot model is calculated around the rotation angle of video camera according to the coordinate of reference point;
The hot spot model is rotated according to the coordinate of the reference point and the rotation angle, to complete to the light spot mode The rendering of type.
3. Lens Flare analogy method according to claim 2, which is characterized in that each hot spot model is by multiple rectangles It constitutes, wherein each rectangle is made of four vertex, and described the step of rendering according to preset rules to the hot spot model is also Include:
Conversion process is carried out by parameter information of the vertex shader to each vertex of the hot spot model;
Interpolation processing is carried out to the parameter information Jing Guo conversion process by rasterizer;
The color clarity of the hot spot model is calculated according to the parameter information Jing Guo interpolation processing by piece member tinter;
According to the coordinate of the reference point, the rotation angle, the color clarity and the ginseng by conversion process Number information carries out rotation and color treatments to the hot spot model, to complete the rendering to the hot spot model.
4. Lens Flare analogy method according to claim 3, which is characterized in that the parameter information on each vertex includes Apex coordinate, the step of conversion process is carried out to the parameter information on each vertex of the hot spot model by vertex shader packet It includes:
For each vertex of the hot spot model, the apex coordinate on the vertex is passed sequentially through into world's transition matrix, is turned depending on seeing It changes matrix and projection transform matrix is converted, to obtain the cutting coordinate on the vertex.
5. Lens Flare analogy method according to claim 4, which is characterized in that the parameter information on each vertex also wraps Texture coordinate is included, before the step of being rendered according to preset rules to the hot spot model, the method also includes:
For each hot spot model, it is bonded corresponding texture coordinate respectively for each vertex of the hot spot model;
By rasterizer to Jing Guo conversion process parameter information carry out interpolation processing the step of include:
For each vertex of the hot spot model, interpolation processing is carried out to the texture coordinate on the vertex, to obtain the vertex Interpolation texture coordinate.
6. Lens Flare analogy method according to claim 5, which is characterized in that by piece member tinter according to by inserting Parameter information the step of calculating the color clarity of the hot spot model of value processing includes:
For each vertex of the hot spot model, the interpolation texture coordinate and preset color clarity on the vertex are counted It calculates, to obtain the final color transparency on the vertex.
7. a kind of Lens Flare simulator, which is characterized in that described device includes:
Judgment module, for judging whether the sun is blocked according to the current location of preset depth map and the sun;
Halation model construction module, for constructing halation model when the sun is not blocked, wherein the halation model includes Multiple hot spot models;
Hot spot model rendering module, for being rendered to the hot spot model according to preset rules for each hot spot model, To complete the simulation of halation.
8. Lens Flare simulator according to claim 7, which is characterized in that each hot spot model is by multiple rectangles It constitutes, wherein each rectangle is made of four vertex, and the hot spot model rendering module includes:
Reference point computational submodule, for the coordinate of reference point to be calculated according to preset sun direction and video camera direction;
Angle computational submodule is rotated, the hot spot model is calculated around the rotation of video camera for the coordinate according to reference point Angle;
Submodule is rotated, for being rotated according to the coordinate and the rotation angle of the reference point to the hot spot model, To complete the rendering to the hot spot model.
9. Lens Flare simulator according to claim 8, which is characterized in that the hot spot model rendering module also wraps It includes:
Informoter module, for being converted by parameter information of the vertex shader to each vertex of the hot spot model Processing;
Information interpolation submodule, for carrying out interpolation processing to the parameter information Jing Guo conversion process by rasterizer;
Diaphanometer operator module, for calculating the light spot mode according to the parameter information Jing Guo interpolation processing by piece member tinter The color clarity of type;
Model rendering submodule, for according to the coordinate of the reference point, the rotation angle, the color clarity and institute It states the parameter information by conversion process and rotation and color treatments is carried out to the hot spot model, to complete to the hot spot model Rendering.
10. a kind of terminal device, which is characterized in that including memory, processor and the described in any item camera lenses of claim 7-9 Halation simulator, wherein the Lens Flare simulator includes that one or more is stored in the memory and by described The software function module that processor executes.
CN201811394068.7A 2018-11-21 2018-11-21 Lens Flare analogy method, Lens Flare simulator and terminal device Pending CN109529333A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811394068.7A CN109529333A (en) 2018-11-21 2018-11-21 Lens Flare analogy method, Lens Flare simulator and terminal device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811394068.7A CN109529333A (en) 2018-11-21 2018-11-21 Lens Flare analogy method, Lens Flare simulator and terminal device

Publications (1)

Publication Number Publication Date
CN109529333A true CN109529333A (en) 2019-03-29

Family

ID=65849023

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811394068.7A Pending CN109529333A (en) 2018-11-21 2018-11-21 Lens Flare analogy method, Lens Flare simulator and terminal device

Country Status (1)

Country Link
CN (1) CN109529333A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105976423A (en) * 2016-04-29 2016-09-28 网易(杭州)网络有限公司 Method and device for generating lens flare
CN106355634A (en) * 2016-08-30 2017-01-25 北京像素软件科技股份有限公司 Sun simulating method and device
CN106846454A (en) * 2017-01-17 2017-06-13 网易(杭州)网络有限公司 Lens Flare method for drafting and device
CN108038896A (en) * 2017-12-06 2018-05-15 北京像素软件科技股份有限公司 Halation gradual change implementation method and device
CN108182723A (en) * 2017-12-06 2018-06-19 北京像素软件科技股份有限公司 Star field simulation method and star field simulation device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105976423A (en) * 2016-04-29 2016-09-28 网易(杭州)网络有限公司 Method and device for generating lens flare
CN106355634A (en) * 2016-08-30 2017-01-25 北京像素软件科技股份有限公司 Sun simulating method and device
CN106846454A (en) * 2017-01-17 2017-06-13 网易(杭州)网络有限公司 Lens Flare method for drafting and device
CN108038896A (en) * 2017-12-06 2018-05-15 北京像素软件科技股份有限公司 Halation gradual change implementation method and device
CN108182723A (en) * 2017-12-06 2018-06-19 北京像素软件科技股份有限公司 Star field simulation method and star field simulation device

Similar Documents

Publication Publication Date Title
US11257286B2 (en) Method for rendering of simulating illumination and terminal
US9311746B2 (en) Systems and methods for generating a 3-D model of a virtual try-on product
CN112288665B (en) Image fusion method and device, storage medium and electronic equipment
TW201015490A (en) Method and system for rendering 3D model of 3D object
CN112215934A (en) Rendering method and device of game model, storage medium and electronic device
US6989840B1 (en) Order-independent transparency rendering system and method
CN108460841A (en) A kind of indoor scene light environment method of estimation based on single image
CN109308734A (en) The generation method and its device of 3D text, equipment, storage medium
CN106204746A (en) A kind of augmented reality system realizing 3D model live paint
CN110458959A (en) Body Three-dimensional Display emulation mode, device, equipment and computer readable storage medium
CN107707899A (en) Multi-view image processing method, device and electronic equipment comprising moving target
CN110120087A (en) The label for labelling method, apparatus and terminal device of three-dimensional sand table
CN113870439A (en) Method, apparatus, device and storage medium for processing image
CN109903374B (en) Eyeball simulation method and device for virtual object and storage medium
CN117649478B (en) Model training method, image processing method and electronic equipment
CN106204418B (en) Image warping method based on matrix inversion operation in a kind of virtual reality mobile terminal
CN108074285A (en) Volume cloud analogy method and volume cloud simulator
US9704290B2 (en) Deep image identifiers
CN108182723A (en) Star field simulation method and star field simulation device
CN109671097A (en) Motion blur implementation method and device
CN111161388B (en) Method, system, device and storage medium for generating retail commodity shelf images
CN112580213A (en) Method and apparatus for generating display image of electric field lines, and storage medium
CN109529333A (en) Lens Flare analogy method, Lens Flare simulator and terminal device
Tabkhi et al. A power-efficient FPGA-based mixture-of-Gaussian (MoG) background subtraction for full-HD resolution
CN111710044A (en) Image processing method, apparatus and computer-readable storage medium

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20190329