[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN106204714A - Video fluid illumination calculation method based on Phong model - Google Patents

Video fluid illumination calculation method based on Phong model Download PDF

Info

Publication number
CN106204714A
CN106204714A CN201610624318.6A CN201610624318A CN106204714A CN 106204714 A CN106204714 A CN 106204714A CN 201610624318 A CN201610624318 A CN 201610624318A CN 106204714 A CN106204714 A CN 106204714A
Authority
CN
China
Prior art keywords
alpha
fluid
specular reflection
component
channel
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.)
Granted
Application number
CN201610624318.6A
Other languages
Chinese (zh)
Other versions
CN106204714B (en
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.)
East China Normal University
Original Assignee
East China Normal University
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 East China Normal University filed Critical East China Normal University
Priority to CN201610624318.6A priority Critical patent/CN106204714B/en
Publication of CN106204714A publication Critical patent/CN106204714A/en
Application granted granted Critical
Publication of CN106204714B publication Critical patent/CN106204714B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/50Lighting effects
    • G06T15/506Illumination models

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 method that the invention discloses video fluid illumination calculation, the method is intended to utilize Phong model, utilizes flow surface geological information, quickly calculates Phong model illumination parameter.First, ambient light and irreflexive composition are obtained by the method for linear fit.On this basis, update flow surface geological information, further according to ambient light composition, diffuse-reflectance composition and flow surface geological information, by the means of cluster, obtain the direct reflection index of fluid scene.Finally according to the intensity of flow surface, it is calculated the specular reflection component of fluid scene.By experiment test and error analysis, it was demonstrated that the method studied in the present invention is the most effective.The present invention can be effectively applied in research and the application of the reverse engineering of fluid, can obtain the lighting effect consistent with sample fluid outward appearance, overcome computationally intensive in existing fluid illumination calculation and need the problems such as user's initialization in heavily emulation.

Description

Video fluid illumination calculation method based on Phong model
Technical Field
The invention relates to a method for calculating illumination in video fluid re-simulation. And (3) calculating the ambient light and diffuse reflection components of the fluid scene by using a Phong model and a result of height calculation of a fluid video sample frame and using a linear fitting method, updating the height information of the fluid surface on the basis, and further obtaining the specular reflection index of the scene by using a clustering method, so that the specular reflection components of the scene can be calculated.
Background
The real fluid-sensitive weight simulation is widely applied to the fields of game design, fluid animation simulation, special effect design of movies, fluid military simulation and the like, and research on video fluid illumination calculation has achieved a lot of results. The complexity of particle motion limited to fluid scenes has led to a complication in the problem of video fluid illumination calculations, which has been the subject of much recent research. How to fully utilize the intensity in the fluid video and the geometric information of the fluid surface, and further effectively calculate the illumination parameters of the video fluid, thereby realizing the realistic drawing, which is a problem to be solved urgently in the video fluid reverse engineering.
In recent years, some research works are based on Bidirectional Reflectance Distribution Function (BRDF), torance-spark illumination model, or Phong model, but how to automatically calculate the illumination of a scene is still a difficult problem in research, and especially, the complexity of fluid motion brings difficulty to the research of the scene illumination problem.
In the research of people's illumination calculation problem of video fluid at present, the problem that exists is mainly: some works are to obtain the illumination information of the fluid scene by using an optimization method and means, such research measures are mainly inconvenient for practical application, and ideal results are difficult to obtain when the illumination of the fluid scene is calculated by using the existing methods. In the recently developed research methods, a pretreatment is required by people, which is inconvenient to solve the problem of fluid scene illumination calculation. Therefore, the method for rapidly and conveniently calculating the illumination parameters of the fluid scene still is a practical problem to be solved urgently, and particularly in the research of the reverse engineering problem of the video fluid, the calculation problem of the illumination parameters of the fluid scene is a crucial problem.
Disclosure of Invention
The invention aims to provide a video fluid illumination calculation method aiming at the defects of the prior art and the requirements of realistic re-simulation in video fluid reverse engineering.
The specific technical scheme for realizing the purpose of the invention is as follows: a method for calculating illumination of a video fluid based on Phong model, characterized in that, an RGB color model is used for the video fluid, and the color components of any pixel P in a sample frame F of the fluid video are represented as R, G and B, then according to Phong model:
R = C a R + k d R ( L m · N ) i m , d R + k s R ( R m · V ) α i m , s R - - - ( 1 )
G = C a G + k d G ( L m · N ) i m , d G + k s G ( R m · V ) α i m , s G - - - ( 2 )
B = C a B + k d B ( L m · N ) i m , d B + k s B ( R m · V ) α i m , s B - - - ( 3 )
wherein,andis the component of ambient light in three channels of RGBAndis an ambient light component;
andis the rate of the diffuse reflectance and,andthe intensities of diffuse reflection in three channels of RGB are respectively;is marked asIs marked asIs marked asCombined balanceAndis a diffuse reflection component;
Lmis a unit normal vector from any point in the scene to the light source direction, N is a unit normal vector from any point on the fluid surface, V is a unit vector in the line of sight direction, L is a unit vector in the line of sight directionmThe direction of an angle bisector between the V and the V is E and RmIs the unit vector of the reflected light direction at any point on the fluid surface, and V is the unit vector of the sight line direction according to V and RmThe included angle between N and E is twice of the included angle between N and E, and the use ofCalculating L in equations (1) to (3)mDot product L with Nm·N;Andis the reflection of a mirror surface, and, andα is the index of specular reflection;is marked asIs marked asIs marked asBalanceAndis a specular reflection component;
by the height h of the pixel PPInstead of R in the formulae (1) to (3)mAnd V dot product RmV, then, from (1) to (3):
R = C a R + ( 2 h p 2 - 1 ) C d R + C s R h P α - - - ( 4 )
G = C a G + ( 2 h p 2 - 1 ) C d G + C s G h P α - - - ( 5 )
B = C a B + ( 2 h p 2 - 1 ) C d B + C s B h P α - - - ( 6 )
the illumination parameters of the fluid scene are effectively calculated by the following steps:
(1) calculating the ambient light component and the diffuse reflection component of the Phong illumination model, specifically:
(a) constructing a set L by using all pixels satisfying the formula (7) in the fluid video sample frame F;
Dp≤TL(7)
Dpis the intensity of the pixel P, DpThe calculation is as follows:
Dp=0.299*R+0.587*G+0.114*B (8)
t in formula (7)LIs an intensity threshold, which is calculated as TL=(Dmax-Dmin)*2/9+Dmin,DmaxAnd DminThe maximum value and the minimum value of the intensities of all pixels in the F are respectively;
(b) calculating ambient light and diffuse reflectance components of the fluid scene using the set L, specifically:
for any one of the pixels Q in L, it can be obtained according to equations (4) to (6):
C a R + ( 2 h Q 2 - 1 ) C d R - I Q R = 0 - - - ( 9 )
C a G + ( 2 h Q 2 - 1 ) C d G - I Q G = 0 - - - ( 10 )
C a B + ( 2 h Q 2 - 1 ) C d B - I Q B = 0 - - - ( 11 )
wherein,andis the intensity component of Q in the three RGB channels;
calculating the height h of the fluid surfaceQAnd use ofInformation of all pixels in L for the ambient light component in (9), (10) and (11)Andand a diffuse reflection componentAndsolving by adopting a linear fitting method;
(2) updating the fluid surface height information
The ambient light component of the R channel obtained in the step (1)And a diffuse reflection componentSubstituting into equation (9), recalculate the height h of each particleQH is to beQIs marked as hR(ii) a The ambient light component of G channelAnd a diffuse reflection componentSubstituting into equation (10), recalculate the height h of each particleQH is to beQIs marked as hG(ii) a Mixing the ambient light component of the B channelAnd a diffuse reflection componentSubstituting into equation (11), recalculate each particle height hQH is to beQIs marked as hB(ii) a Finally, the height information of the particle is updated to hn=(hR+hG+hB)/3;
(3) Specular reflection index and specular reflection component calculation
(a) Constructing a set H by using all pixels satisfying the formula (12) in the F;
Dp≥TH(12)
THis an intensity threshold, calculated as TH=(Dmax-Dmin)*8/9+Dmin
(b) Calculating specular reflection index and specular reflection component using H
For any two pixels P in H1And P2If P is1Is of color R1、G1And B1,P2Is of color R2、G2And B2,P1Is assumed to be h1,P2Is assumed to be h2(ii) a According to Phong illumination model:
C s R h 1 α = R 1 - C a R - C d R ( 2 h 1 2 - 1 ) - - - ( 13 )
C s R h 2 α = R 2 - C a R - C d R ( 2 h 2 2 - 1 ) - - - ( 14 )
C s G h 1 α = G 1 - C a G - C d G ( 2 h 1 2 - 1 ) - - - ( 15 )
C s G h 2 α = G 2 - C a G - C d G ( 2 h 2 2 - 1 ) - - - ( 16 )
C s B h 1 α = B 1 - C a B - C d B ( 2 h 1 2 - 1 ) - - - ( 17 )
C s B h 2 α = B 2 - C a B - C d B ( 2 h 2 2 - 1 ) - - - ( 18 )
the results α of the specular reflection index can be obtained from the R channel by equations (13) and (14)R
α R = lg ( f 1 / f 2 ) lg ( h 1 / h 2 ) - - - ( 19 )
Wherein
Calculating the specular reflection index of an R channel by using any pair of pixels in the H; get NRFor the pixel, then use (13), (14) and (19) to get NRCalculation results of R channelsAnd form a setNRIs a natural number, N is more than or equal to 1000RLess than or equal to 5000; clustering by adopting a k-means method to obtain the specular reflection index of the R channelSpecifically, for any pair SRAny two ofAndif so:
| &alpha; R U - &alpha; R V | < T R &alpha; - - - ( 20 )
thenAndare grouped into the same class;andis a setAre two different elements of (A), U and V are serial numbers, andand satisfies that U is more than or equal to 0 and less than or equal to NR-1,0≤V≤NR-1, while U ≠ V;a threshold value that is the difference between the specular reflection indices; finally, the mean value of all the specular reflection indexes in the class with the most collected samples is used as the average valuec represents clustering;
by the same token, the specular reflection indexes of the G channel and the B channel can be obtainedAnd
in calculating the specular reflection index of three channelsAndthen, the threshold value of the difference between the specular reflection indexes is a set value and is set to be 0.1;
finally, the specular reflection index is calculated as:
&alpha; = ( &alpha; R C + &alpha; G C + &alpha; B C ) / 3 - - - ( 21 )
for any pixel P in F, the specular reflection component is calculated as followsAnd
from equations (4), (5) and (6):
C s R = ( R - C a R - ( 2 h p 2 - 1 ) C d R ) / h P &alpha; - - - ( 22 )
C s G = ( G - C a G - ( 2 h p 2 - 1 ) C d G ) / h P &alpha; - - - ( 23 )
C s B = ( B - C a B - ( 2 h p 2 - 1 ) C d B ) / h P &alpha; - - - ( 24 )
the average value of the R-channel specular reflection components calculated for all pixels is used asAs a result, similarly, a result of obtaining a G-channel specular reflection component can be obtainedAnd the result of specular component in the B channel
(4) Application in re-simulation
In the fluid simulation, for each frame in the fluid simulation, the height h of any fluid particle is obtainedrCalculating the color component R of the particle using (25) to (27)r,GrAnd Br
R r = C a R + ( 2 h r 2 - 1 ) C d R + C s R h r &alpha; - - - ( 25 )
G r = C a G + ( 2 h r 2 - 1 ) C d G + C s G h r &alpha; - - - ( 26 )
B r = C a R + ( 2 h r 2 - 1 ) C d B + C s B h r &alpha; - - - ( 27 )
By utilizing an effective method of video fluid illumination calculation, a realistic illumination result can be obtained in real time in fluid weight simulation.
The method has the characteristics of simplicity and practicality, can effectively realize the illumination calculation of the video fluid, overcomes the problems of user intervention and high complexity in the conventional illumination parameter calculation research, and further demonstrates the effectiveness of the method. The method can realize the problem of relighting in the re-simulation of the fluid scene, and the researched illumination calculation method is suitable for various fluid types including advection, sea waves and the like.
Drawings
FIG. 1 is a graph of the results of fluid scene illumination calculations according to an embodiment of the present invention;
FIG. 2 is a graph of a fluid scene relighting result, obtained by testing in a re-simulation, according to an embodiment of the present invention;
fig. 3 is a graph of a fluid scene relighting result obtained in a re-simulation boundary test according to an embodiment of the present invention.
Detailed Description
Examples
The invention is further described below with reference to the accompanying drawings.
The embodiment adopts the fluid video (for example, the fluid video such as 54ab 110) in the DynTex dynamic texture library to perform fluid scene illumination calculation. The method is implemented under the Windows7 operating system on a PC, and the hardware configuration is 2.66GHz Intel core (TM)2Duo CPU and 4GB RAM.
Video fluid illumination calculation based on Phong model is characterized in that: using the RGB color model for video streaming, representing the color components of any pixel P in a sample frame F of streaming video as R, G and B, then according to the Phong model there are: a method for calculating illumination of a video fluid based on Phong model, characterized in that, an RGB color model is used for the video fluid, and the color components of any pixel P in a sample frame F of the fluid video are represented as R, G and B, then according to Phong model:
R = C a R + k d R ( L m &CenterDot; N ) i m , d R + k s R ( R m &CenterDot; V ) &alpha; i m , s R - - - ( 1 )
G = C a G + k d G ( L m &CenterDot; N ) i m , d G + k s G ( R m &CenterDot; V ) &alpha; i m , s G - - - ( 2 )
B = C a B + k d B ( L m &CenterDot; N ) i m , d B + k s B ( R m &CenterDot; V ) &alpha; i m , s B - - - ( 3 )
wherein,andis the component of ambient light in three channels of RGBAndis an ambient light component;
andis the rate of the diffuse reflectance and,andthe intensities of diffuse reflection in three channels of RGB are respectively;is marked asIs marked asIs marked asCombined balanceAndis a diffuse reflection component;
Lmis a unit normal vector from any point in the scene to the light source direction, N is a unit normal vector from any point on the fluid surface, V is a unit vector in the line of sight direction, L is a unit vector in the line of sight directionmThe direction of an angle bisector between the V and the V is E and RmIs the unit vector of the reflected light direction at any point on the fluid surface, and V is the unit vector of the sight line direction according to V and RmThe included angle between N and E is twice of the included angle between N and E, and the use ofCalculating L in equations (1) to (3)mDot product L with Nm·N;Andis the reflection of a mirror surface, and, andα is the index of specular reflection;is marked asIs marked asIs marked asBalanceAndis a specular reflection component;
by the height h of the pixel PPInstead of R in the formulae (1) to (3)mAnd V dot product RmV, then, from (1) to (3):
R = C a R + ( 2 h p 2 - 1 ) C d R + C s R h P &alpha; - - - ( 4 )
G = C a G + ( 2 h p 2 - 1 ) C d G + C s G h P &alpha; - - - ( 5 )
B = C a B + ( 2 h p 2 - 1 ) C d B + C s B h P &alpha; - - - ( 6 )
the illumination parameters of the fluid scene are effectively calculated by the following steps:
(1) calculating the ambient light component and the diffuse reflection component of the Phong illumination model, specifically:
(a) constructing a set L by using all pixels satisfying the formula (7) in the fluid video sample frame F;
Dp≤TL(7)
Dpis the intensity of the pixel P, DpThe calculation is as follows:
Dp=0.299*R+0.587*G+0.114*B (8)
t in formula (7)LIs an intensity threshold, which is calculated as TL=(Dmax-Dmin)*2/9+Dmin,DmaxAnd DminThe maximum value and the minimum value of the intensities of all pixels in the F are respectively;
(b) calculating ambient light and diffuse reflectance components of the fluid scene using the set L, specifically:
for any one of the pixels Q in L, it can be obtained according to equations (4) to (6):
C a R + ( 2 h Q 2 - 1 ) C d R - I Q R = 0 - - - ( 9 )
C a G + ( 2 h Q 2 - 1 ) C d G - I Q G = 0 - - - ( 10 )
C a B + ( 2 h Q 2 - 1 ) C d B - I Q B = 0 - - - ( 11 )
wherein,andis the intensity component of Q in the three RGB channels;
calculating the height h of the fluid surfaceQAnd using the information of all pixels in L for the ambient light components in (9), (10) and (11)Andand a diffuse reflection componentAndsolving by adopting a linear fitting method;
(2) updating the fluid surface height information
The ambient light component of the R channel obtained in the step (1)And a diffuse reflection componentSubstituting into equation (9), recalculate the height h of each particleQH is to beQIs marked as hR(ii) a The ambient light component of G channelAnd a diffuse reflection componentSubstituting into equation (10), recalculate the height h of each particleQH is to beQIs marked as hG(ii) a Mixing the ambient light component of the B channelAnd a diffuse reflection componentSubstituting into equation (11), recalculate each particle height hQH is to beQIs marked as hB(ii) a Finally, the height information of the particle is updated to hn=(hR+hG+hB)/3;
(3) Specular reflection index and specular reflection component calculation
(a) Constructing a set H by using all pixels satisfying the formula (12) in the F;
Dp≥TH(12)
THis an intensity threshold, calculated as TH=(Dmax-Dmin)*8/9+Dmin
(b) Calculating specular reflection index and specular reflection component using H
For any two pixels P in H1And P2If P is1Is of color R1、G1And B1,P2Is of color R2、G2And B2,P1Is assumed to be h1,P2Is assumed to be h2(ii) a According to Phong illumination model:
C s R h 1 &alpha; = R 1 - C a R - C d R ( 2 h 1 2 - 1 ) - - - ( 13 )
C s R h 2 &alpha; = R 2 - C a R - C d R ( 2 h 2 2 - 1 ) - - - ( 14 )
C s G h 1 &alpha; = G 1 - C a G - C d G ( 2 h 1 2 - 1 ) - - - ( 15 )
C s G h 2 &alpha; = G 2 - C a G - C d G ( 2 h 2 2 - 1 ) - - - ( 16 )
C s B h 1 &alpha; = B 1 - C a B - C d B ( 2 h 1 2 - 1 ) - - - ( 17 )
C s B h 2 &alpha; = B 2 - C a B - C d B ( 2 h 2 2 - 1 ) - - - ( 18 )
the results α of the specular reflection index can be obtained from the R channel by equations (13) and (14)R
&alpha; R = lg ( f 1 / f 2 ) lg ( h 1 / h 2 ) - - - ( 19 )
Wherein
Calculating the specular reflection index of an R channel by using any pair of pixels in the H; get NRFor the pixel, then use (13), (14) and (19) to get NRCalculation results of R channelsAnd form a setNRIs a natural number, N is more than or equal to 1000RLess than or equal to 5000; clustering by adopting a k-means method to obtain the specular reflection index of the R channelSpecifically, for any pair SRAny two ofAndif so:
| &alpha; R U - &alpha; R V | < T R &alpha; - - - ( 20 )
thenAndare grouped into the same class;andis a setU and V are serial numbers, and satisfy that U is greater than or equal to 0 and is less than or equal to NR-1,0≤V≤NR-1, while U ≠ V;a threshold value that is the difference between the specular reflection indices; finally, all classes with the most samples are gatheredMean value of specular reflection index asc represents clustering;
by the same token, the specular reflection indexes of the G channel and the B channel can be obtainedAnd
in calculating the specular reflection index of three channelsAndthen, the threshold value of the difference between the specular reflection indexes is a set value and is set to be 0.1;
finally, the specular reflection index is calculated as:
&alpha; = ( &alpha; R C + &alpha; G C + &alpha; B C ) / 3 - - - ( 21 )
for any pixel P in F, the specular reflection component is calculated as followsAnd
from equations (4), (5) and (6):
C s R = ( R - C a R - ( 2 h p 2 - 1 ) C d R ) / h P &alpha; - - - ( 22 )
C s G = ( G - C a G - ( 2 h p 2 - 1 ) C d G ) / h P &alpha; - - - ( 23 )
C s B = ( B - C a B - ( 2 h p 2 - 1 ) C d B ) / h P &alpha; - - - ( 24 )
the average value of the R-channel specular reflection components calculated for all pixels is used asAs a result, similarly, a result of obtaining a G-channel specular reflection component can be obtainedAnd the result of specular component in the B channel
(4) Application in re-simulation
In the fluid weight simulation, the 2D movement speed of the first frame of the video is calculated by using the existing method, and then the Lattice Boltzmann Methods (LBM) are initialized, and in the deduction process of the fluid weight simulation, for each frameCalculating the height h of the fluid particles in one framerCalculating the color component R of the particle using (25) to (27)r,GrAnd Br
R r = C a R + ( 2 h r 2 - 1 ) C d R + C s R h r &alpha; - - - ( 25 )
G r = C a G + ( 2 h r 2 - 1 ) C d G + C s G h r &alpha; - - - ( 26 )
B r = C a R + ( 2 h r 2 - 1 ) C d B + C s B h r &alpha; - - - ( 27 )
FIG. 1 is the result of illumination calculation, where the first column is the sample frame of the original video (taking the first frame as the sample frame); the second column is the result of illumination calculation in the present invention, and the relighting intensity of the fluid surface is obtained using the calculated ambient light component, diffuse reflection component, specular reflection component, and specular reflection index. It can be seen from the illustration of fig. 1 that the video fluid illumination calculation method of the present invention is very efficient, with the recalculated illumination very close to the appearance of the sample frame.
Comparing the method of the invention with existing methods: in order to verify the effectiveness of the video fluid illumination calculation method in the invention, the method is compared with the illumination parameter calculation method of Thiago research. The errors of the illumination parameter calculation of the invention and the Thiago method are respectively calculated by adopting the following methods:
E a = ( 0.299 &Sigma; i = 0 N p - 1 | R i - R i r | + 0.587 &Sigma; i = 0 N p - 1 | G i - G i r | + 0.114 &Sigma; i = 0 N p - 1 | B i - B i r | ) / N p - - - ( 28 )
E r = 0.299 &Sigma; i = 0 N p - 1 | R i - R i r | + 0.587 &Sigma; i = 0 N p - 1 | G i - G i r | + 0.114 &Sigma; i = 0 N p - 1 | B i - B i r | 0.299 &Sigma; i = 0 N p - 1 R i + 0.587 &Sigma; i = 0 N p - 1 G i + 0.114 &Sigma; i = 0 N p - 1 B i - - - ( 29 )
wherein N ispIs the number of pixels in the scene, Ri,GiAnd BiIs the color component of the ith pixel in the sample frame in the RGB color space,andis the illumination result recalculated according to the illumination model, i is a non-negative integer and the value range is that i is more than or equal to 0 and less than or equal to Np-1。
TABLE 1 error comparison of illumination calculations for two different methods
Table 1 shows the results of the comparative error, where the first column in the results is the name of the fluid sample; the second and third columns are the Thiago research method and the absolute error E of the invention, respectivelya(ii) a The fourth and fifth columns are the Thiago research method and the relative error E of the present invention, respectivelyr. Compared with the existing method, the error result of the method has the characteristic of obviously smaller error, no matter the absolute error EaOr relative error ErThe effectiveness of the illumination calculation method of the present invention is clearly demonstrated.
Verifying relighting in the fluid weight simulation: the method for calculating the illumination parameters provided by the invention is applied to the application of fluid weight simulation.
The 2D motion velocity of the first frame of the video is calculated by using the existing method, then the Lattice Boltzmann Methods (LBM) model is initialized, and the simulation fluid is relighted by using the method according to the height of the fluid particles of each frame in the deduction process of the fluid re-simulation, wherein fig. 2 shows the result of the relighting. As can be seen from the relighting effect in the figure, the illumination calculation method is very effective, can be applied to the fluid re-simulation process, and is convenient and practical.
The application of the illumination calculation method in the re-simulation relighting is as follows: the method is applied to the boundary test process of the fluid weight simulation, and a satisfactory illumination result is obtained. The effectiveness of the present invention can be seen in fig. 3.

Claims (1)

1. A method for calculating illumination of a video fluid based on Phong model, characterized in that, an RGB color model is used for the video fluid, and the color components of any pixel P in a sample frame F of the fluid video are represented as R, G and B, then according to Phong model:
R = C a R + k d R ( L m &CenterDot; N ) i m , d R + k s R ( R m &CenterDot; V ) &alpha; i m , s R - - - ( 1 )
G = C a G + k d G ( L m &CenterDot; N ) i m , d G + k s G ( R m &CenterDot; V ) &alpha; i m , s G - - - ( 2 )
B = C a B + k d B ( L m &CenterDot; N ) i m , d B + k s B ( R m &CenterDot; V ) &alpha; i m , s B - - - ( 3 )
wherein,andis the component of ambient light in three channels of RGBAndis an ambient light component;
andis the rate of the diffuse reflectance and,andthe intensities of diffuse reflection in three channels of RGB are respectively;is marked as Is marked as Is marked asCombined balanceAndis a diffuse reflection component;
Lmis a unit normal vector from any point in the scene to the light source direction, N is a unit normal vector of any point on the fluid surface, and V is a sight lineUnit vector of direction, LmThe direction of an angle bisector between the V and the V is E and RmIs the unit vector of the reflected light direction at any point on the fluid surface, and V is the unit vector of the sight line direction according to V and RmThe included angle between N and E is twice of the included angle between N and E, and the use ofCalculating L in equations (1) to (3)mDot product L with Nm·N;Andis the reflection of a mirror surface, and, andα is the index of specular reflection;is marked as Is marked as Is marked asBalanceAndis a specular reflection component;
by the height h of the pixel PPInstead of R in the formulae (1) to (3)mAnd V dot product RmV, then, from (1) to (3):
R = C a R + ( 2 h p 2 - 1 ) C d R + C s R h P &alpha; - - - ( 4 )
G = C a G + ( 2 h p 2 - 1 ) C d G + C s G h P &alpha; - - - ( 5 )
B = C a B + ( 2 h p 2 - 1 ) C d B + C s B h P &alpha; - - - ( 6 )
the illumination parameters of the fluid scene are effectively calculated by the following steps:
(1) calculating the ambient light component and the diffuse reflection component of the Phong illumination model, specifically:
(a) constructing a set L by using all pixels satisfying the formula (7) in the fluid video sample frame F;
Dp≤TL(7)
Dpis the intensity of the pixel P, DpThe calculation is as follows:
Dp=0.299*R+0.587*G+0.114*B (8)
t in formula (7)LIs an intensity threshold, which is calculated as TL=(Dmax-Dmin)*2/9+Dmin,DmaxAnd DminThe maximum value and the minimum value of the intensities of all pixels in the F are respectively;
(b) calculating ambient light and diffuse reflectance components of the fluid scene using the set L, specifically:
for any one of the pixels Q in L, it can be obtained according to equations (4) to (6):
C a R + ( 2 h Q 2 - 1 ) C d R - I Q R = 0 - - - ( 9 )
C a G + ( 2 h Q 2 - 1 ) C d G - I Q G = 0 - - - ( 10 )
C a B + ( 2 h Q 2 - 1 ) C d B - I Q B = 0 - - - ( 11 )
wherein,andis the intensity component of Q in the three RGB channels;
calculating the height h of the fluid surfaceQAnd using the information of all pixels in L for the ambient light components in (9), (10) and (11)Andand a diffuse reflection componentAndsolving by adopting a linear fitting method;
(2) updating the fluid surface height information
The ambient light component of the R channel obtained in the step (1)And a diffuse reflection componentSubstituting into equation (9), recalculate the height h of each particleQH is to beQIs marked as hR(ii) a The ambient light component of G channelAnd a diffuse reflection componentSubstituting into equation (10), recalculate the height h of each particleQH is to beQIs marked as hG(ii) a Mixing the ambient light component of the B channelAnd a diffuse reflection componentSubstituting into equation (11), recalculate each particle height hQH is to beQIs marked as hB(ii) a Finally, the height information of the particle is updated to hn=(hR+hG+hB)/3;
(3) Specular reflection index and specular reflection component calculation
(a) Constructing a set H by using all pixels satisfying the formula (12) in the F;
Dp≥TH(12)
THis an intensity threshold, calculated as TH=(Dmax-Dmin)*8/9+Dmin
(b) Calculating specular reflection index and specular reflection component using H
For any two pixels P in H1And P2If P is1Is of color R1、G1And B1,P2Is of color R2、G2And B2,P1Is assumed to be h1,P2Is assumed to be h2(ii) a According to Phong illumination model:
C s R h 1 &alpha; = R 1 - C a R - C d R ( 2 h 1 2 - 1 ) - - - ( 13 )
C s R h 2 &alpha; = R 2 - C a R - C d R ( 2 h 2 2 - 1 ) - - - ( 14 )
C s G h 1 &alpha; = G 1 - C a G - C d G ( 2 h 1 2 - 1 ) - - - ( 15 )
C s G h 2 &alpha; = G 2 - C a G - C d G ( 2 h 2 2 - 1 ) - - - ( 16 )
C s B h 1 &alpha; = B 1 - C a B - C d B ( 2 h 1 2 - 1 ) - - - ( 17 )
C s B h 2 &alpha; = B 2 - C a B - C d B ( 2 h 2 2 - 1 ) - - - ( 18 )
the results α of the specular reflection index can be obtained from the R channel by equations (13) and (14)R
&alpha; R = lg ( f 1 / f 2 ) lg ( h 1 / h 2 ) - - - ( 19 )
Wherein
Calculating the specular reflection index of an R channel by using any pair of pixels in the H; get NRFor the pixel, then use (13), (14) and (C)19) To obtain NRCalculation results of R channelsAnd form a setNRIs a natural number, N is more than or equal to 1000RLess than or equal to 5000; clustering by adopting a k-means method to obtain the specular reflection index of the R channelSpecifically, for any pair SRAny two ofAndif so:
| &alpha; R U - &alpha; R V | < T R &alpha; - - - ( 20 )
thenAndare grouped into the same class;andis a setU and V are serial numbers, and satisfy that U is greater than or equal to 0 and is less than or equal to NR-1,0≤V≤NR-1, while U ≠ V;a threshold value that is the difference between the specular reflection indices; finally, the mean value of all the specular reflection indexes in the class with the most collected samples is used as the average valuec represents clustering;
by the same token, the specular reflection indexes of the G channel and the B channel can be obtainedAnd
in calculating the specular reflection index of three channelsAndthen, the threshold value of the difference between the specular reflection indexes is a set value and is set to be 0.1;
finally, the specular reflection index is calculated as:
&alpha; = ( &alpha; R C + &alpha; G C + &alpha; B C ) / 3 - - - ( 21 )
for any pixel P in F, the specular reflection component is calculated as followsAnd
from equations (4), (5) and (6):
C s R = ( R - C a R - ( 2 h p 2 - 1 ) C d R ) / h P &alpha; - - - ( 22 )
C s G = ( G - C a G - ( 2 h p 2 - 1 ) C d G ) / h P &alpha; - - - ( 23 )
C s B = ( B - C a B - ( 2 h p 2 - 1 ) C d B ) / h P &alpha; - - - ( 24 )
the average value of the R-channel specular reflection components calculated for all pixels is used asAs a result, similarly, a result of obtaining a G-channel specular reflection component can be obtainedAnd the result of specular component in the B channel
CN201610624318.6A 2016-08-01 2016-08-01 Video fluid illumination calculation method based on Phong model Expired - Fee Related CN106204714B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610624318.6A CN106204714B (en) 2016-08-01 2016-08-01 Video fluid illumination calculation method based on Phong model

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610624318.6A CN106204714B (en) 2016-08-01 2016-08-01 Video fluid illumination calculation method based on Phong model

Publications (2)

Publication Number Publication Date
CN106204714A true CN106204714A (en) 2016-12-07
CN106204714B CN106204714B (en) 2019-02-01

Family

ID=57497157

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610624318.6A Expired - Fee Related CN106204714B (en) 2016-08-01 2016-08-01 Video fluid illumination calculation method based on Phong model

Country Status (1)

Country Link
CN (1) CN106204714B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112819941A (en) * 2021-03-05 2021-05-18 网易(杭州)网络有限公司 Method, device, equipment and computer-readable storage medium for rendering water surface

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5739820A (en) * 1992-11-19 1998-04-14 Apple Computer Inc. Method and apparatus for specular reflection shading of computer graphic images
US20100103169A1 (en) * 2008-10-29 2010-04-29 Chunghwa Picture Tubes, Ltd. Method of rebuilding 3d surface model
CN103413346A (en) * 2013-04-09 2013-11-27 华东师范大学 Method for real-time reconstruction of realistic fluid and system thereof
CN104517299A (en) * 2014-12-19 2015-04-15 华东师范大学 Method for restoring and resimulating physical video fluid driving model
CN105447906A (en) * 2015-11-12 2016-03-30 浙江大学 Method for calculating lighting parameters and carrying out relighting rendering based on image and model

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5739820A (en) * 1992-11-19 1998-04-14 Apple Computer Inc. Method and apparatus for specular reflection shading of computer graphic images
US20100103169A1 (en) * 2008-10-29 2010-04-29 Chunghwa Picture Tubes, Ltd. Method of rebuilding 3d surface model
CN103413346A (en) * 2013-04-09 2013-11-27 华东师范大学 Method for real-time reconstruction of realistic fluid and system thereof
CN104517299A (en) * 2014-12-19 2015-04-15 华东师范大学 Method for restoring and resimulating physical video fluid driving model
CN105447906A (en) * 2015-11-12 2016-03-30 浙江大学 Method for calculating lighting parameters and carrying out relighting rendering based on image and model

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
HONGYAN QUAN 等: "Fluid re-simulation based on physically driven model from video", 《THE VISUAL COMPUTER》 *
XIAOZHENG ZHANG 等: "GENERALISED AMBIENT REFLECTION MODELS FOR LAMBERTIAN AND PHONG SURFACES", 《ICIP 2009》 *
俞铭琪 等: "真实感流体实时重建", 《计算机辅助设计与图形学学报》 *
全红艳,王长波: "一种流体运动矢量计算的有效方法", 《计算机学报》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112819941A (en) * 2021-03-05 2021-05-18 网易(杭州)网络有限公司 Method, device, equipment and computer-readable storage medium for rendering water surface
CN112819941B (en) * 2021-03-05 2023-09-12 网易(杭州)网络有限公司 Method, apparatus, device and computer readable storage medium for rendering water surface

Also Published As

Publication number Publication date
CN106204714B (en) 2019-02-01

Similar Documents

Publication Publication Date Title
Murray et al. Star formation in self-gravitating turbulent fluids
Burkhart et al. Characterizing magnetohydrodynamic turbulence in the small magellanic cloud
Chen et al. Change of magnetic field-gas alignment at the gravity-driven alfvénic transition in molecular clouds: implications for dust polarization observations
Svakhine et al. Illustration and photography inspired visualization of flows and volumes
Christensen An approximate reflectance profile for efficient subsurface scattering
CN103679802A (en) Method for drawing surface of SPH (smoothed particle hydrodynamics) fluid in real time on basis of screen spaces
King et al. BSSRDF importance sampling
CN103514430A (en) Method and device for detecting flame
Goswami A survey of modeling, rendering and animation of clouds in computer graphics
Webanck et al. Procedural cloudscapes
Gutierrez et al. Non-linear Volume Photon Mapping.
CN101950421B (en) Evaluation method of flame model reliability
CN107871337B (en) Visualization method of supersonic two-dimensional flow field data
CN106204714B (en) Video fluid illumination calculation method based on Phong model
Rosborough et al. Modeling the Reverberation Response of the Broad-line Region in Active Galactic Nuclei
Hiyama et al. Augmented reality system for measuring and learning tacit artisan skills
CN106023296B (en) Fluid scene illumination parameter computational methods
Gazol et al. Density Power Spectrum in Turbulent Thermally Bistable Flows
Liu et al. Physically based animation of sandstorm
Gil et al. Soap film flow and thickness for soap bubble rendering
Rushmeier Input for participating media
Sanders et al. Mass estimators for flattened dispersion-supported galaxies
CN103886636A (en) Real-time smoke rendering algorithm based on ray cast stepping compensation
CN109191447A (en) A kind of three-dimensional grid quality evaluating method based on geometric buckling analysis
Impett et al. A facial affect mapping engine

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20190201

Termination date: 20210801

CF01 Termination of patent right due to non-payment of annual fee