CN1410948A - Real time light tracing method of non linear refraction and reflection on plane and spherical surfaces - Google Patents

Real time light tracing method of non linear refraction and reflection on plane and spherical surfaces Download PDF

Info

Publication number
CN1410948A
CN1410948A CN 02130945 CN02130945A CN1410948A CN 1410948 A CN1410948 A CN 1410948A CN 02130945 CN02130945 CN 02130945 CN 02130945 A CN02130945 A CN 02130945A CN 1410948 A CN1410948 A CN 1410948A
Authority
CN
China
Prior art keywords
empty
reflection
scene
plane
refraction
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
CN 02130945
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.)
Tsinghua University
Original Assignee
Tsinghua 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 Tsinghua University filed Critical Tsinghua University
Priority to CN 02130945 priority Critical patent/CN1410948A/en
Publication of CN1410948A publication Critical patent/CN1410948A/en
Pending legal-status Critical Current

Links

Images

Abstract

The optical mapped virtual vertex for each vertex of the polyhedron to be refracted or reflected is calculated. Based on the topological relation of the polyhedron, each virtual vertex is connected to form the virtual object composed of several virtual faces. In rendering, the virtual object is projected to the relevant refraction or reflection surfaces by using recursive algorithm. With being mixed with the color value of the surface, the reality graphics, similar to the graphics obtained by the ray tracing method, is obtained. The invention gives the formula to calculate the virtual vertex P' for any point P in five circumstances: the object inside or outside the plane refractive body, the three-dimension refraction, the spherical surface reflection and refraction as well as the algorithm and drawing procedure.

Description

The real time ray tracing method of plane and sphere nonlinear refraction and reflection
Technical field
The real time ray tracing method of plane and sphere nonlinear refraction and reflection belongs to the computer graphics techniques field.
Background technology
The ray trace algorithm is one of the most frequently used algorithm that generates in the three dimension realistic figure, it be T.Whitted in 1980 at international magazine Comm.ACM, Vol.23, a kind of photo realism graphic generation method that puts forward in the paper of delivering on the No.6 " An improved Illumination Model forShaded Display ".It can generate high-quality photo realism graphic, but its computing velocity is slow, can not be applied to the application system of real-time, interactive.In order to improve the speed of ray trace, multiple improving one's methods arisen at the historic moment.People such as P.S.Heckbert in 1984 and P.Hanrahan publish thesis on " Computer Graphics ", have proposed the method for pencil tracing first.Pencil tracing is used to improve the speed of playing up as a kind of improvement of traditional ray trace, handles the problem of losing shape, and improves and plays up quality and efficient or the like.But pencil tracing can only be handled the direct reflection of plane reflection body, then can not handle for the nonlinear refraction problem that resembles heavy sheet glass one class and camber reflection problem or the like, can only make linear-apporximation.
1996, people such as M.Levoy and P.Hanrahan. published thesis on SIGGRAPH, had proposed to realize with 4 dimension light fields the method for the drafting of figure, image.In pre-service,, when showing in real time, in each frame, reuse Image Results then with the reflection of multidimensional light field computed image.But problems such as still having the image information storage in the light field method, lose shape and search fast remains further to be solved.
The method of the environment mappings that viewpoint is irrelevant is that people such as W.Heidrich put forward in 1998.Utilize environment mappings, realize the demonstration of photo realism graphic reaching mutual speed by the support of hardware, but but can not reach real-time.It generally is used for handling reflex more, and usually has tangible error.
Ofek in 1998 and Rappoport have proposed to utilize reflection virtual object and expansion mapping (explosion map) to realize the ray trace effect of camber reflection, it at reflecting body with the summit that might be in the reflector space carry out conversion, generate virtual object, equally unify to handle with real-world object then; But they can not handle refraction problems, and the error of expansion mapping is bigger, the accumulation of error and propagate very seriously in recursive procedure, and the resultant image quality of generation is not high.Though they adopt interpolation method to be improved, effect is limited, has but increased many calculated amount.
Have many interactive graphics systems to utilize hardware at present, can handle a large amount of three-dimensional dough sheets p.s., but the drafting effect of depth buffer (Z-Buffer) algorithm all can only be provided basically, can not handle the real-time photo realism graphic problem of reflection and refraction scene.
Summary of the invention
The object of the present invention is to provide and to unify to solve nonlinear reflection and refraction problems, can improve the plane of efficiency of algorithm and the real time ray tracing method of sphere nonlinear refraction and reflection again.
The invention is characterized in:
For the polyhedron that is refracted or reflects, at first calculate the empty summit on this each summit of polyhedron, successively all empty summits are connected into the optics mapping virtual object that is constituted and finally formed reflection or refraction by many empty faces according to the topological relation between original point of this polyhedron and the face then, abbreviate virtual object as; When display graphics, this virtual object is recursively projected on reflection or the refractive surface with recursive algorithm, thereby obtain and the similar image effect of ray trace; Wherein, empty summit P ' can be expressed as: P ′ = V + l B - V | B - V | ,
Wherein V is a viewpoint, l by light L when superrefraction or reflection arrive some P in the scene corresponding with this void summit the length summation in path of process; B is a sampled point on the projection plane.
For the plane refraction body outside the refractile body, it contains successively and has the following steps for scene:
(1) calculate each empty summit P ': P ′ = V + l I 1 - V | I 1 - V | ;
l=|V-I 1|+|I 1-I 2|+|I 2-P|, I 1 = Q + d U - Q | U - Q | ,
Q=V-w 1N, U = V - C 3 + C T V C T ( P - V ) ( P - V ) ,
When wherein, l arrives some P in the scene by light through refraction the length summation in path of process; w 1Horizontal range for vision point and refractile body; D is an I 1Vertical range with vision point; Q is that refractile body plane of incidence lower end and vision point are in a bit on the same horizontal level; U is the intersection point of the line VP and the refractile body plane of incidence, and the equation of the refractile body plane of incidence is made as C 0X+C 1Y+C 2Z+C 3=0, and note C=(C 0, C 1, C 2) TI 1, I 2Be respectively light L and plane refraction body projection plane and promptly go into, go out the intersection point of two planes of refraction, N is an I 1The unit normal vector at place.
For the plane refraction body in the refractile body, it contains successively and has the following steps for scene:
(1) calculate each empty summit P ': P ′ = V + l I - V | I - V | ;
l=|V-I|+|I-P|, I = Q + d U - Q | U - Q | ,
Q=V-w 1N, U = V - C 3 + C T V C T ( P - V ) ( P - V ) ,
Wherein, I is the intersection point of the plane of incidence of light L and plane refraction body, and the equation of this plane of incidence is made as C 0X+C 1Y+C 2Z+C 3=0, and note C=(C 0, C 1, C 2) TN is a unit normal vector at I place; D is an I 1Vertical range with vision point; Q is that refractile body plane of incidence lower end and vision point are in a bit on the same horizontal level; U is the intersection point of the line VP and the refractile body plane of incidence;
For the refraction of the orthogonal three-dimensional planar of plane of refraction, it contains successively and has the following steps:
(1) calculate each empty summit P ': P ′ = V + d I 1 - V | I 1 - V | ;
d=|V-I 1|+|I 1-I 2|+|I 2-P|,
I 1=V+dx+dy+dz,
dx=xe x,dy=ye y,dz=ze z
e y=N 2, e z=-N 1, e yMultiplication cross e zUnitization obtains e again x,
Wherein, P is to be point on the object in the scene, and V is a viewpoint, N 1Be the outer normal vector of the plane of incidence, N 2Be the outer normal vector of exit facet, the plane of incidence is vertical with exit facet, N 1, N 2Be vector of unit length, e x, e y, e zBe the base under the local coordinate system, x, y, z are the coordinates under the local coordinate system, dx, and dy, dz are I 1Point is with respect to the side-play amount of viewpoint; I 2 = I 1 - N 1 C 1 - x 2 + y 2 η 2 ( x 2 + y 2 + z 2 ) - e ^ C x 2 + y 2 η x 2 + y 2 + z 2 , Wherein, e ^ = V - I 1 - N 1 [ ( V - I 1 ) · N 1 ] | V - I 1 - N 1 [ ( V - I 1 ) · N 1 ] | , C = η ( a - y ) y x 2 + y 2 + z 2 , η is the refractive index of three-dimensional refractile body, and α is the vertical range that viewpoint arrives the refractile body exit facet.For the spheric reflection body, it contains successively and has the following steps: (1) calculates each empty summit P ': P ′ = V + ( x + y ) I - V | I - V | ,
Reflection spot when I shines sphere for light L, it can be expressed as: I=TL I, wherein, L I=[L Ix, L Iy, P z, 1] T, it is the coordinate of some I under local coordinate system on the sphere; T is for being tied to the transformation matrix of world coordinate system from local coordinate: T = u x v x w x 0 u y v y w y 0 u z v z w z 0 0 0 0 1 ,
W wherein x=N x, w y=N y, w z=N zN=(N x, N y, N z) TThe normal vector of the plane VPO that forms for the centre of sphere O of vision point, sphere and the some P in the scene; With O is initial point, is the z axle with N, is the y axle with OP, is the x axle with OP * N, sets up local coordinate system;
u x=v yw z-w yv z,u y=w xv z-v xw z,u z=v xw y-w xv y
v x, v yAnd v zBe respectively unit vector (P-O)/| three coordinate components of P-O|;
X, y are respectively the distance between the some P of some I in vision point and the scene on the sphere: x=|V-I|, y=|I-P|; Application of formula I=TL IJust can be L ILocal coordinate system is transformed to world coordinate system.
For the refraction at spherical surface body, it contains successively and has the following steps:
(1) calculate each empty summit P ': P ′ = V + ( x + | I 1 - I 2 | + y ) I 1 - V | I 1 - V | ,
Wherein, I 1, I 2Be respectively incidence point and the eye point that light is mapped to the refraction at spherical surface body, use formula I=TL I, I 1, I 2Transformation of local coordinates become the coordinate of world coordinate system; X, y are respectively vision point to incidence point I 1, and eye point I 2The distance of 1 P in the scene, i.e. x=|V-I 1|, y=|I 2-P|; T is for being tied to the transformation matrix of world coordinate system from local coordinate: T = u x v x w x 0 u y v y w y 0 u z v z w z 0 0 0 0 1 , Wherein,
u x=v yw z-w yv z,u y=w xv z-v xw z,u z=v xw y-w xv y
v x, v yAnd v zBe respectively unit vector (P-O)/| three coordinate components of P-O|;
w x=N x,w y=N y,w z=N z
N=(N x, N y, N 2) TThe normal vector of the plane VPO that forms for the centre of sphere O of vision point, sphere and the some P in the scene; With O is true origin, is the z axle with N, is the y axle with OP, is the x axle with OP * N, sets up local coordinate system;
Described process of coming display graphics with recursive algorithm contains and has the following steps:
Algorithm 1 pre-service
In the 1st step,,, then replace this ball to participate in structure BSP tree with 6 faces that closely contain the square of this ball if contain spherical reflection or refractile body in the scene to the tree of the object configurations y-bend space subdivision (BSP) in the scene;
In the 2nd step, collect various reflections and refractile body in the scene, and form reflection and refractile body Object table;
In the 3rd step,, determine each reflection in reflection, the refraction body surface, the sequencing of refractile body according to current viewpoint; Because BSP tree is irrelevant with viewpoint, thus can be very fast reflected, the order of refractile body;
The 4th step, calculate empty summit and generate all virtual objects, produce empty scene;
Algorithm 2 produces empty scene for refractile body or reflecting body:
I) arrive maximum recursive hierarchical? be then to return;
If ii) be reflecting body, calculate the empty scene of reflection; If be refractile body, calculate the empty scene of refraction;
Iii) reflection in the empty scene and refractile body are sorted according to viewpoint;
If also have reflection or refractile body in the iv) empty scene,, change i) then to the reflection in the empty scene, this algorithm of refractile body recursive call; Otherwise change v);
V) return;
Algorithm 2 has following characteristics:
(1) Shang Mian algorithm is a recursive algorithm, and recurrence mainly is to carry out at the reflection in the scene, refractile body;
(2) be unified the processing for reflecting body and refractile body;
(3) for reflecting body, what generate empty scene use is the reflection formula, and the summit order of corresponding dough sheet will change, and promptly reflects the summit order and the original reversed in order of virtual object dough sheet, points to correct direction so that guarantee the outer method arrow on plane;
(4) in arbitrary empty scene, all will according to viewpoint and BSP tree redefine wherein reflection and the order of refractile body so that the back can correctly show in real time;
(5) if the number of reflection in the scene or refractile body greater than the end condition of 1 algorithm be depth of recursion be not more than given maximum depth of recursion value;
If viewpoint changes,, need not rerun for the empty scene of pure reflection; But must recomputate for the empty scene that occurs in any one refractile body and the later recursive procedure thereof; Be the algorithm that viewpoint recomputates empty scene when changing below:
Algorithm 3 viewpoint positions recomputate empty scene when changing
I) be refractile body?
Ii) be to call algorithm 2;
Iii) otherwise, this algorithm of recursive call then;
Realize the real-time rendering scene, can adopt and support the three-dimensional picture accelerator card of OpenGL programming (OpenGL-compatible) to carry out hardware-accelerated way; At this moment, we will use the software interface of graphic hardware---the OpenGL graphics system; The generation of the virtual object of front is for our real-time rendering lays the foundation; Be the real-time rendering algorithm that we use below;
Algorithm 4 real-time renderings and demonstration (this algorithm be at certain reflecting body in the real scene or refractile body)
X) rendering parameter (forbid that the color buffer memory writes, forbid that depth buffer writes, forbid depth ratio, ban use of Alpha to mix, make value+1 of the masterplate buffer zone of being drawn) of OpenGL is set;
Xi) draw reflection, refractile body itself;
Xii) if contain reflection or refractile body in its empty scene, then change i), recursively draw reflection, refractile body in the empty scene;
Xiii) rendering parameter (make the value of the masterplate buffer zone of being drawn constant, the color buffer memory can be write, and depth buffer can be write, and depth ratio comes into force, and other rendering parameter is constant) of OpenGL is set;
Xiv) other virtual object in the current empty scene of drafting in current stencil buffer;
Xv) rendering parameter (the color buffer memory can be write, and depth buffer can be write, and depth ratio comes into force, and Alpha mixes and to come into force, and makes the value-1 of the masterplate buffer zone of being drawn) of OpenGL is set;
Xvi) draw reflection, refractile body itself;
Xvii) rendering parameter (recover depth buffer and can write, the color buffer memory can be write, and forbids that Alpha mixes, and forbids touching the plate operation) of OpenGL is set;
Xviii) return.
Experimental results show that: it has reached intended purposes.
Description of drawings
Fig. 1 utilizes ray trace to calculate the synoptic diagram on empty summit.
The synoptic diagram of Fig. 2 arbitrary plane reflection.
Fig. 3 reflects first kind of situation--the synoptic diagram of scene outside refractile body.
Fig. 4 reflects second kind of situation--the synoptic diagram of scene in refractile body.
The orthogonal three-dimensional refractive light paths figure of Fig. 5 plane of refraction.
The light path synoptic diagram of Fig. 6 spheric reflection.
The light path synoptic diagram of Fig. 7 refraction at spherical surface.
Fig. 8 determines the incidence point and the eye point synoptic diagram of sphere.
Fig. 9 square box (a) and virtual object (b) synoptic diagram thereof.
Figure 10 is algorithm 1 a pre-service block diagram.
Figure 11 produces the program flow chart of empty scene for algorithm 2 plane refraction bodies or reflecting body.
Figure 12 recomputates the program flow chart of empty scene when changing for algorithm 3 viewpoint positions.
Figure 13 is the program flow chart of algorithm 4 real-time renderings and demonstration.
Embodiment
1, basic thought
As shown in Figure 1, light L arrives the V point from viewpoint A after superrefraction and reflection, and this is the basic ideas of ray trace.Yet given any 1 V will obtain arriving the light L ' that V is ordered from viewpoint A through refraction exactly, in theory but is to be difficult to calculate, because refraction problems generally is non-linear.
When L through several times reflection or refraction, different with traditional ray trace algorithm when intersecting at the V point with the plane M of jobbie, we utilize illumination model to calculate the color value of corresponding picture element, but the optics of calculation level V shines upon empty summit V '.When supposing light L through several times reflection or refraction arrival V, the length summation in the path of process is: d=d 1+ d 2+ Λ+d 5
The computing formula of then empty summit V ' is: V ′ = A + d B - A | B - A | , Wherein A is a viewpoint, and B is sampled point on the projection plane." notion of optics mapping virtual pair elephant " of our proposition that Here it is.
For the polyhedron that is reflected or reflects, we at first calculate the empty summit on each summit, successively empty summit are connected into the limit of virtual object then according to topological relation, the final optics mapping virtual object (abbreviation virtual object) that forms reflection or refraction.For example a square box is seen Fig. 9 (a), its summit P 1, P 2..., P 8Empty summit be followed successively by P ' 1, p ' 2..., P ' 8, then we can obtain the virtual object of this square box correspondence, shown in Fig. 9 (b).When display graphics, these virtual objects are projected on reflection or the refractive surface.This process can recursively be carried out, thereby obtains and the similar image effect of ray trace.In order to obtain high-quality photo-realistic images, be reflected or the size on the plane that reflects can not be too big, otherwise the plane should be subdivided into littler rectangle or triangle.For the curved face object that is reflected in the scene or reflects, then should earlier curved surface be separated into some facets, represent curved face object with polyhedron approximation.
2, the computing formula on empty summit
For the plane reflection problem, we can adopt the thought of similar pencil tracing algorithm to calculate the empty summit on each summit:
Suppose to have one to cross some R=[V x, V y, V z, 1] TThe plane, as shown in Figure 2, its per unit system vector is N=[a, b, c, 0] T, N TN=1, its plane equation is
ax+by+cz+d=0
Wherein, d=-N TR, V are viewpoint.
Any one some P=[P in the three-dimensional scenic x, P y, P z, 1] TWith respect to this plane do to arrive behind the reflection transformation P '=[P ' x, P ' y, P ' z, 1] TAccording to geometric relationship, can obtain:
P′=T mP
Wherein, T m = 1 - 2 a 2 - 2 ab - 2 ac - 2 ad - 2 ab 1 - 2 b 2 - 2 bc - 2 bd - 2 ac - 2 bc 1 - 2 c 2 - 2 cd 0 0 0 1 ,
P ' is the empty summit of reflection that P is ordered.
Refraction problems is more more complex than plane reflection problem.The nonlinear refraction of plane refraction body has two kinds of situations: object is (as shown in Figure 3) and object two kinds of (see figure 4)s in refractile body outside refractile body.Below we are discussed respectively.
1) two dimensional surface refraction
(a) object is outside refractile body
As shown in Figure 3, V is a viewpoint, and P is a bit that choose arbitrarily in the scene, and it is in the outside of refractile body, and P ' is the empty summit corresponding with P.Ask the derivation of equation of its virtual object as follows:
Known: w 1, w 2, w 3, h makes η=Sin α/Sin β=η 2/ η 1, ξ=1+w 3/ w 1,, can get according to geometric relationship
Ad 4+Bd 3+Cd 2+Dd+E=0???????????????????????????????????????(1)
Wherein,
A=(1-η 22
B=2η 2hξ-2hξ,
C=h 2+w 2 22h 2-w 1 2η 2ξ 2
D=2η 2hξw 1 2
E=-w 1 2η 2h 2
From (1) formula, can solve d.According to the value of d, can calculate the intersection I of refracted ray and plane of refraction then 1And I 2Thereby, obtain empty summit P '.
Empty summit P ' solution procedure is as follows:
(1) connect V and P, obtain the intersection point U on VP and plane: U = V - C 3 + C T V C T ( P - V ) ( P - V ) ,
Wherein, the equation on this plane is C 0X+C 1Y+C 2Z+C 3=0, in addition, C=(C 0, C 1, C 2) T
(2)Q=V-w 1N; ( 3 ) - - - I 1 = Q + d U - Q | U - Q | .
In like manner, can obtain I 2
Make l=|V-I 1|+| I 1-I 2|+| I 2-P|, then the P empty summit of ordering P ′ = V + l I 1 - V | I 1 - V | .
We have produced two groups of points with the method for ray trace, use top formula then, inverse I 1, obviously, if I 1Identical, I then 2Also identical, concrete result is as shown in the table.
The point that ray trace produces Point with the formula inverse
Vision point Some P in the scene ???????I 1 ???????I 2 ???????I 1 ???????I 2
??x ??y ??z ??-3.486133 ??-91.011276 ??-30.972000 ??-286.265348 ??137.319548 ??-64.033415 ??-247.000000 ??110.000000 ??-59.442668 ??-270.903693 ??150.000000 ??-62.237392 ??-247.000000 ??110.000000 ??-59.442668 ??-270.903693 ??150.000000 ??-62.237392
??x ??y ??z ??-3.486133 ??-91.011276 ??-30.972000 ??-275.475363 ??136.992740 ??-59.345723 ??237.000000 ??110.000000 ??-55.332001 ??-260.364890 ??150.000000 ??-57.769409 ??237.000000 ??110.000000 ??-55.332001 ??-260.364890 ??150.000000 ??-57.769409
(b) object is in refractile body
As the fish in the fish jar, object (fish) is at refractile body (fish jar) inner face.The computing formula of this situation should be with first to be deeply in love condition be different.As shown in Figure 4, V is a viewpoint among the figure, and P is the point of choosing arbitrarily in the scene, and it is in refractile body inside, and P ' is the empty summit of P correspondence.Similarly, we can obtain following unary biquadratic equation according to geometric relationship:
Ad 4+Bd 3+Cd 2+Dd+E=0???????????????????????????????????????(2)
Wherein,
A=η 2-1,
B=-2hA,
C=h 2A+η 2w 1 2-w 2 2
D=-2η 2hw 1 2
E=w 1 2η 2h 2
From (2) formula, can solve d, just can calculate the intersection I of refracted ray and plane of refraction then, thereby obtain empty summit P '.Empty summit P ' solution procedure is as follows:
(1) connect V and P, VP and mirror plane intersect at U, and the formula that U can indiscriminately imitate the front obtains;
(2)Q=V-w 1N; ( 3 ) - - - I = Q + d U - Q | U - Q | ;
( 4 ) - - - p ′ = V + l I - V | I - V | , Wherein, l=|V-I|+|I-P|.
We have produced two groups of points with the method for ray trace, use top formula then, and inverse goes out intersection I.Concrete result is as shown in the table.
The point that ray trace produces Point with the formula inverse
Vision point Some P in the scene ???????I ?????????I
??x ??y ??z ??-3.486133 ??-91.011276 ??-30.972000 ??-286.265348 ??137.319548 ??-64.033415 ??-252.000000 ??110.000000 ??-61.498001 ??-252.000000 ??110.000000 ??-61.498001
??x ??y ??z ??-3.486133 ??-91.011276 ??-30.972000 ??-275.475363 ??136.992740 ??-59.345723 ??-237.000000 ??110.000000 ??-55.332001 ??-237.000000 ??110.000000 ??-55.332001
That (c) separates chooses
Obviously, (1) formula and (2) formula all are the equations of separating more, and they all have 4 real roots at the most.Therefore, after solving an equation, will the result who separate be selected.According to the principle of optics, light when any arrives another, will select shortest path to propagate in medium.Like this, we connect the some P in vision point and the scene, obtain straight line, from nearest the separating of this straight line, are exactly the point that we ask.
2) three-dimensional planar refraction
As Fig. 5, known: vision point, the some P that chooses arbitrarily in the scene, refractive index η, AD=a, VA=z, PF=b, e = | ( VP → ) x | , f = | ( VP → ) y | , g = | ( VP → ) z | . In Fig. 5, light is from vision point, through medium upper surface I 1The point refraction enters medium, arrives the medium right flank then, from I 2The point refraction enters air, and finally reaches the some P in the scene.
By Snell refraction law and geometric relationship, we just can obtain two following equations:
X and y can be obtained according to two top equations, just I can be calculated successively by the value of x, y and z and refractive index η then 1And I 2Three-dimensional coordinate, thereby obtain the position of the empty summit P ' of P.
(3) and (4) formula be 4 Nonlinear System of Equations of a binary, in order to improve computing velocity, we adopt and carry out approximate processing in the following method:
At first, calculate d:f with following formula 0+ f 1D+f 2d 2+ f 3d 3+ f 4d 4=0, ignore the high-order (>2) of d,
f 0+f 1d+f 2d 2=0,
Wherein, f 0 = ( 1 4 C 7 - 1 4 C 1 - C 2 C 1 ) 2 ( C 4 - C 7 ) 2 - 2 b 2 C 1 ( C 7 - C 1 ) ( C 4 - C 7 ) ( 1 4 C 7 - 1 4 C 1 + C 2 C 1 ) + b 4 C 1 2 ( C 7 - C 1 ) 2 , f 1 = - 2 C 9 b 2 C 1 ( C 4 - C 7 ) ( C 2 C 5 + 1 4 C 6 - 1 4 C 5 + C 7 - C 1 ) + 2 b 4 C 1 2 C 9 ( C 6 - C 5 ) - { 2 C 9 b 2 C 1 ( 2 C 5 - C 6 ) + [ 2 C 9 b 2 C 5 + ( 2 C 6 - 2 C 5 ) b 2 C 1 ] C 8 } ( 1 4 C 7 - 1 4 C 1 + C 2 C 1 ) + 2 b 4 C 1 C 5 ( C 7 - C 1 ) 2 + 2 ( C 4 - C 7 ) ( 2 C 5 - C 6 ) ( 1 4 C 7 - 1 4 C 1 - C 2 C 1 ) 2 + 2 ( 1 4 C 7 - 1 4 C 1 - C 2 C 1 ) ( C 4 - C 7 ) 2 ( C 7 - C 1 - C 2 C 5 + 1 4 C 6 - 1 4 C 5 ) , f 2 = ( 1 4 C 7 - 1 4 C 1 - C 2 C 1 ) 2 [ 2 ( C 4 - C 7 ) ( 2 - η 2 ) + ( 2 C 5 - C 6 ) 2 ] + 4 ( 1 4 C 7 - 1 4 C 1 - C 2 C 1 ) ( 1 4 C 6 - 1 4 C 5 - C 2 C 5 + C 7 - C 1 ) ( C 4 - C 7 ) ( 2 C 5 - C 6 ) + [ 2 ( C 7 - C 1 4 - C 2 C 1 ) ( C 7 - C 1 - C 2 + 1 4 η 2 + C 6 - C 5 - 1 4 ) + ( C 7 - C 1 - C 2 C 5 + C 6 - C 5 4 ) 2 ] ( C 4 - C 7 ) 2 - 2 ( C 7 - C 1 ) b 2 C 1 ( C 4 - C 7 ) ( - 1 4 + C 2 + 1 4 η 2 + C 6 - C 5 + C 7 - C 1 ) - { ( 2 C 7 - 2 C 1 ) b 2 C 1 ( 2 C 5 - C 6 ) + ( C 4 - C 7 ) [ ( 2 C 7 - 2 C 1 ) b 2 C 5 + 2 ( C 6 - C 5 ) b 2 C 1 ] } ( C 2 C 5 + C 6 - C 5 4 + C 7 - C 1 ) - { 2 ( C 7 - C 1 ) b 2 C 1 ( 2 - η 2 ) + [ 2 ( C 7 - C 1 ) b 2 C 5 + 2 ( C 6 - C 5 ) b 2 C 1 ] ( 2 C 5 - C 6 ) + [ 2 ( C 7 - C 1 ) b 2 + 2 ( C 6 - C 5 ) b 2 C 5 + ( 2 η 2 - 2 ) b 2 C 1 ] ( C 4 - C 7 ) } ( 1 4 C 7 + C 2 C 1 - 1 4 C 1 ) + b 4 C 1 2 [ 2 ( C 7 - C 1 ) ( η 2 - 1 ) + ( C 6 - C 5 ) 2 ] + 4 b 4 C 1 C 5 ( C 7 - C 1 ) ( C 6 - C 5 ) + b 4 ( 2 C 1 + C 5 2 ) ( C 7 - C 1 ) 2 .
In the middle of superincumbent 3 formulas, C 1 = ( a - 1 2 ) 2 , C 2 = ( g - z ) 2 , C 3 = C 1 + z 2 , C 4 = 2 C 1 + z 2 , C 5 = - 2 a + 1 , C 6 = η 2 C 5 , C 7 = η 2 C 3 , C 8 = C 4 - C 7 , C 9 = C 7 - C 1 .
With d substitution following formula, just can calculate the value of y when x=0 then, we are designated as y to it 0, promptly
y 0=a-(0.5+d)。
Usually d is a very little amount, | d|≤0.5; In the superincumbent calculating, we have ignored high-order (〉=3) item of d, if keep more high-order (3, the 4 rank) item of d, can improve computational accuracy, but this can make also calculated amount slightly increase.Linear-apporximation is launched and done to (4) formula at the x=0 point:
y=y 0+y 1x,
Wherein,
Figure A0213094500181
With y=y 0+ y 1X substitution (3) formula,
Figure A0213094500183
From following formula, obtain x, and with the value substitution formula (4) of x and find the solution a biquadratic equation about y, this equation through arrangement is:
H 4y 4+H 3y 3+H 2y 2+H 1y+H 0=0,
Wherein,
H 4=e 2(2-η 2),
H 3=-2aex(2-η 2),
H 2=a 2x 2(2-η 2)+e 2(1-η 2)(x 2+z 2)-b 2x 2
H 1=-2aex(1-η 2)(x 2+z 2),
H 0=a 2x 2(1-η 2)(x 2+z 2)。
Can calculate an I by x, y and z and η again 1And I 2Three-dimensional coordinate, thereby obtain empty summit P '.
When the system of equations of being made up of formula (3) and formula (4) is found the solution x and y, also has another kind of scheme: obtain y in front 0After, (3) formula is launched and made linear-apporximation at the x=0 point, obtain:
y=y 0+y 1x,
Wherein, y 1 = ( η 2 - 1 ) y 0 2 + η 2 z 2 e ( η 2 - 1 ) y 0 ;
Then, with y=y 0+ y 1X substitution (4) formula, arrangement obtains
T 4x 4+T 3x 3+T 2x 2+T 1x+T 0=0,
Wherein
Figure A0213094500186
Figure A0213094500191
e 2 y 0 2 [ ( 1 - η 2 ) + ( 2 - η 2 ) y 1 2 ] - b 2 y 0 2 , From following formula, obtain x, and, can directly solve y the value substitution formula (3) of x: y = ± x 2 + ( g - z ) 2 x 2 ( e - x ) 2 - η 2 ( x 2 + z 2 ) η 2 - 1 .
What adopt in the experiment with computing of back is preceding a kind of scheme.
The concrete I that calculates 1, I 2And the process of empty summit P ' is as follows::
A). ask I 1
If the point on the object is P, viewpoint is V, the outer normal vector n of the plane of incidence 1, the outer normal vector n of exit facet 2, the plane of incidence is vertical with exit facet, n 1, n 2It is vector of unit length.The base of local coordinate system is e x, e y, e z, e wherein y=n z, e x=-n 1, e yMultiplication cross e z, unitization can get e again x
The x that calculates, y, z are the coordinates under the local coordinate system.If dx, dy, dz are I 1Point has with respect to the side-play amount of viewpoint:
dx=xe x
dy=ye y
dz=ze z
I then 1=V+dx+dy+dz.
B). ask I 2
Known incident radiation direction vector IN=I 1-V, plane of refraction method vector n 1, refractive index η can calculate refracted ray direction vector OUT.By 1 I on the refracted ray 1With and direction and exit facet normal vector n 2A bit, can obtain the intersection I of refracted ray and exit plane on the face of reaching 2We can provide I 2Formula as follows: I 2 = I 1 - n 1 C 1 - x 2 + y 2 η 2 ( x 2 + y 2 + z 2 ) - e ^ C x 2 + y 2 η x 2 + y 2 + z 2 ,
Wherein e ^ = V - I 1 - n 1 [ ( V - I 1 ) · n 1 ] | V - I 1 - n 1 [ ( V - I 1 ) · n 1 ] | , C = η ( a - y ) y x 2 + y 2 + z 2 .
C). ask P '
From the viewpoint to the object point, the distance that light is passed by is d=‖ V-I 1‖ I 1-I 2‖+‖ I 2-P ‖, in the computing formula that can obtain empty summit P ': P , = V + d ( I 1 - V ) | | I 1 - V | | .
We have produced two groups of points with the method for ray trace, use top formula then, inverse I 1, obviously, if I 1Close, I then 2Also close.Concrete result is as shown in the table, and wherein ε is a relative error, that is: the empty summit P ' with the approximate formula inverse arrives the distance of accurate empty summit p ' and the ratio that viewpoint arrives the distance on empty summit
ε=|P′-p′|/|V-p′|。
The point that ray trace produces Point with the formula inverse
?V ?P ?I 1 ?I 2 ?p’ ?I 1 ?I 2 ?P’
?100 ?100 ?50 ?217.123957 ?210.684713 ?102.631579 ?175 ?150 ?80 ?200.000000 ?176.814175 ?90.000000 ?200.000000 ?176.814175 ?90.000000 ?174.540108 ?150.000000 ?79.788060 ?200.000000 ?177.399736 ?89.962460 ?236.239496 ?191.386704 ?104.444653 ?0.002957
?106 ?106 ?56 ?217.123957 ?210.249311 ?106.231579 ?181 ?156 ?86 ?200.000000 ?176.378773 ?93.600000 ?235.378947 ?192.252632 ?107.751579 ?173.321464 ?150.000000 ?83.009974 ?200.000000 ?178.308774 ?93.713641 ?235.760911 ?190.809209 ?108.061239 ?0.009305
3) spheric reflection and refraction
(1) spheric reflection
Known: vision point, the some P that chooses arbitrarily in the scene, the radius of establishing reflection sphere is r, the centre of sphere is at 0 point, as shown in Figure 6.Make a=|V-P|, b=|V-O|, c=|O-P|.
Can obtain according to geometric optical theory:
2bcxyzcos(α+β)=bcxysin 2(α+β)-b 2y 2z-c 2x 2z????????????????(5)
x(r 2+y 2-c 2)=y(x 2+r 2-b 2)?????????????????????????????????????(6)
Wherein, z=(a 2-(x-y) 2)/(4abc).
Getting vision point is true origin, and viewpoint is a unit length to the distance of the centre of sphere 0.Can solve y from (6) formula, it can regard the function of x as.Y is made Taylor expansion at the x=b-r place, and line taking is approximate
y=A+Bx,????????????????????????????????????????????????????(7)
Wherein, A = ( c - b ) ( c - r ) / c , B = b ( c - r ) c ( b - r ) .
With (7) substitution (5) formula, can obtain following biquadratic equation:
x(A+Bx)[a 2-(x-A-Bx) 2]cos(α+β)=
2bcx(A+Bx)sin 2(α+β)-[b 2(A+Bx) 2+c 2x 2][(a 2-(x-A-Bx) 2]/(2bc),(8)
Solve x, substitution then (7) can be obtained y, thereby calculates empty summit P '.
Introduce below and how to calculate empty summit P ':
I. because V, 0,3 of P in one plane, we are initial point with 0, the normal vector N=[N of plane VP0 x, N y, N z] TBeing the z axle, is the y axle with 0P, and 0P * N is the x axle, sets up local coordinate system.We can obtain being tied to from world coordinates the transition matrix of local coordinate system like this: T = u x v x w x 0 u y v y w y 0 u z v z w z 0 0 0 0 1 ,
Wherein, w x=N x, w y=N y, w z=N z
u x=v yw z-w yv z,u y=w xv z-v xw z,u z=v xw y-w xv y
v x, v yAnd v zBe respectively unit vector (P-O)/| three coordinate components of P-O|;
X, y are respectively the distance between the some P of some I in vision point and the scene on the sphere: x=|V-I|, y=|I-P|; Application of formula I=T.L IJust can be L IBe transformed to coordinate under the world coordinate system from local coordinate system.
II. in local coordinate system, respectively with 0, V, P are the center of circle, and R (radius of ball), x, y are that radius is done three circles, are designated as c respectively 1, c 2, c 3
III. obtain c 1And c 2Two intersection point p 1, p 3, c 1And c 3Two intersection point p 3, p 4Calculate p respectively 1p 3, p 1p 4, p 2p 3And p 2P 4Distance, get the mean value of the minimum a pair of point coordinate of distance, be the coordinate that some I fastens in local coordinate on the sphere, be designated as LI[L Ix, L Iy, P z, 1] TApplication of formula I=TL IWith L ITransformation of local coordinates become coordinate under the world coordinate system, the result is designated as I.IV. calculate P ′ = V + ( x + y ) I - V | I - V | .
We have produced two groups of points with the method for ray trace, use top formula then, inverse I 1And I 2Concrete result is as shown in the table.
The point that ray trace produces Point with the formula inverse
Viewpoint Point in the scene I Accurate empty summit I Approximate empty summit Relative deviation ε
?-116.995399 ?96.421837 ?-31.162001 ?270.128968 ?1170.523969 ?124.238610 -81.650197 34.787454 -38.100506 512.488025 -1001.261011 -154.733903 -81.651880 34.786900 -38.100637 512.460899 -1001.275845 -154.736798 0.000024
?-116.995399 ?96.421837 ?-31.162001 ?-488.154348 ?602.063430 ?-436.722567 -87.328756 32.818073 -42.643174 246.401988 -682.683540 -171.799019 -87.328580 32.818149 -42.642386 246.404709 -682.683837 -171.789592 0.000011
(2) refraction at spherical surface
As shown in Figure 7, the radius of ball is r, can obtain according to geometrical optics: { ( a 2 + r 2 - x 2 ) ( b 2 + r 2 - y 2 ) x 2 cos θ 4 abr 2 - [ x 2 - ( x 2 + r 2 - a 2 ) 2 4 r 2 ] ( xy cos θ ab + (9) 2 η 2 ) + x 2 } 2 = x 2 sin 2 θ [ r 2 x + y ] ( a 2 - x 2 ) ] 2 a 2 b 2 r 2 [ x 2 - ( x 2 + r 2 - a 2 ) 2 4 r 2 ] , y(x 2+r 2-a 2)=x(y 2+r 2-b)。(10) be without loss of generality, getting vision point is true origin, and viewpoint is a unit length to the distance of the centre of sphere 0.Make x=a-r+t, (11) make Taylor expansion to (10) formula at the t=0 place, and make linear-apporximation, can get: y = b - r + a ( b - r ) b ( a - r ) t , With (11) and (12) formula substitutions (9) formula, and ignore (more than 5 times) higher order term of t, y=G 0+ G 1T+G 2t 2+ G 3t 3+ G 4t 4, (13) wherein, G 0=T 0 2-C 1S 0R 0G 1=2T 0T 1-C 1(S 0R 1+ S 1R 0); G 2=2T 0T 2+ T 1T 1-C 1(S 0R 2+ S 1R 1+ S 2R 0); G 3=2T 0T 3+ 2T 1T 2-C 1(S 0R 3+ S 1R 2+ S 2R 1+ S 3R 0); G 4=2T 0T 4+ 2T 1T 3+ T 2 2-C 1(S 0R 4+ S 1R 3+ S 2R 2+ S 3R 1+ S 4R 0); C 0=a-r; C 1=sin 2θ/(a 2b 2r 2); C 2=-1/ (4r 2); C 3=cos θ/(4abr 2); C 4=cos θ/(ab); C 5=2/ η 2+ C 4AC 0C 6=C 4(A+BC 0); C 7=C 4B; S 0=C 0 2+ C 2(C 0 2-a 2+ r 2) 2S 1=2C 0+ 4C 2C 0(C 0 2-a 2+ r 2); S 2=1+2C 2(3C 0 2-a 2+ r 2); S 3=4C 2C 0S 4=C 2Q 0=r 2C 0+ A (a 2-C 0 2); Q 1=r 2-2AC 0+ B (a 2-C 0 2);
Q 2=-A-2BC 0
Q 3=-B;
U 0=Q 0C 0 2
U 1=2Q 0C 0+Q 1C 0 2
U 2=Q 0+2Q 1C 0+Q 2C 0 2
U 3=Q 1+2Q 2C 0+Q 3C 0 2
U 4=Q 2+2Q 3C 0
R 0=Q 0U 0
R 1=Q 0U 1+Q 1U 0
R 2=Q 0U 2+Q 1U 1+Q 2U 0
R 3=Q 0U 3+Q 1U 2+Q 2U 1+Q 3U 0
R 4=Q 0U 4+Q 1U 3+Q 2U 2+Q 3U 1
P 0=(a 2+r 2-C 0 2)(b 2+r 2-A 2);
P 1=-2AB(a 2+r 2-C 0 2)-2C 0(b 2+r 2-A 2);
P 2=-B 2(a 2+r 2-C 0 2)+4C 0AB-(b 2+r 2-A 2);
P 3=2C 0B 2+2AB;
P 4=BB;
T 0=C 3C 0 2P 0-C 5S 0+C 0 2
T 1=C 3(C 0 2P 1+2C 0P 0)-C 5S 1-C 6S 0+2C 0
T 2=C 3(C 0 2P 2+2C 0P 1+P 0)-C 5S 2-C 6S 1-C 7S 0+1;
T 3=C 3(C 0 2P 3+2C 0P 2+P 1)-C 5S 3-C 6S 2-C 7S 1
T 4=C 3(C 0 2P 4+2C 0P 3+P 2)-C 5S 4-C 6S 3-C 7S 2
Can calculate t from (13) formula, t substitution (11) and (12) formula can be obtained x and y respectively, so just can obtain empty summit P '.
Determine I 1And I 2Method:
After obtaining x and y, be the center of circle with V and P respectively, x and y are that radius is drawn circle, meet at I respectively with sphere in plane of refraction 1', I 1" and I 2', I 2", see Fig. 8.The incidence point I of sphere 1Take from I 1' and I 1" in some, eye point I 2Take from I 2' and I 2" in some.That is to say I 1And I 2Four kinds of possible following the example of are arranged.At this moment, we will use refraction law, select our desired that a kind of possibility situation.Notice, if I 1And I 2Be accurate incidence point and eye point, then sin β sin α = 1 η , In other words, 1 - cos 2 β 1 - cos 2 α = 1 η 2 , Simultaneously, cos β = | | I 1 I 2 | | 2 r , cos α = - x 2 + r 2 - a 2 2 xr = - y 2 + r 2 - b 2 2 yr , Thereby 1 - | | I 1 I 2 | | 2 4 r 2 1 - ( x 2 + r 2 - a 2 2 xr ) 2 = 1 η 2 , 1 - | | I 1 I 2 | | 2 4 r 2 1 - ( y 2 + r 2 - b 2 2 yr ) 2 = 1 η 2 . So our criterion of choosing is to get feasible | 1 - | | I 1 I 2 | | 2 4 r 2 1 - ( x 2 + r 2 - a 2 2 xr ) 2 - 1 η 2 | + | 1 - | | I 1 I 2 | | 2 4 r 2 1 - ( y 2 + r 2 - b 2 2 yr ) 2 - 1 η 2 |
Minimum that group I 1I 2
Introduce below and how to calculate empty summit P ':
I. because V, O, P, I 1, I 25 in one plane, and we are initial point with the O point, the normal vector N=[N of plane VPO x, N y, N z] TBeing the z axle, is the y axle with OP, and N * OP is the x axle, sets up local coordinate system.We can obtain being tied to from local coordinate the transformation matrix of world coordinate system like this: T = u x v x w x 0 u y v y w y 0 u z v z w z 0 0 0 0 1 ,
Wherein,
w x=N x,w y=N y,w z=N z
u z=v yw z-w yv z,u y=w xv z-v xw z,u z=v xw y-w xv y
v x, v yAnd v zIt is respectively unit vector Three coordinate components.
II. application of formula I=TL IWith I 1And I 2Local coordinate convert the coordinate of world coordinate system to, the result still uses I 1And I 2Expression.
III. calculate P ′ = V + ( x + | I 2 - I 1 | + y ) I 1 - V | I 1 - V | .
We have produced two groups of points with the method for ray trace, use top formula then, inverse I 1And I 2Concrete result is as shown in the table.
The point that ray trace produces Point with the formula inverse
Viewpoint Point in the scene I 1 I 2 Accurate empty summit I 1 Approximate empty summit Relative deviation
-116.995399 96.421837 -31.162001 -50.186456 -53.644613 -41.899063 -84.352570 34.299263 -41.259456 -72.458122 7.408969 -43.096134 -40.861831 -48.467971 -54.712513 -84.352023 34.299371 -41.260124 -40.860776 -48.467295 -54.714001 ?0.000012
-116.995399 96.421837 -31.162001 -56.922493 -35.934910 -58.193442 -83.721483 32.225986 -32.146602 -72.598188 7.090201 -38.115781 -47.772221 -37.131448 -33.210370 -83.712906 32.219162 -32.131935 -47.762689 -37.129611 -33.179613 ?0.000214
3, algorithm is realized
Algorithm 1: pre-service, as shown in figure 10.
In the 1st step,,, then replace this ball to participate in structure BSP tree with 6 faces that closely contain the square of this ball if contain spherical reflection or refractile body in the scene to the tree of the object configurations y-bend space subdivision (BSP) in the scene;
In the 2nd step, collect all reflection and refractile bodies in the scene, and form reflection and refractile body Object table;
In the 3rd step,, determine each reflection in reflection, the refraction body surface, the sequencing of refractile body according to current viewpoint; Because BSP tree is irrelevant with viewpoint, thus can be very fast reflected, the order of refractile body;
The 4th step, calculate empty summit and generate all virtual objects, produce empty scene.
Algorithm 2 is for plane refraction body or reflecting body produce empty scene, as shown in figure 11.Following characteristics are arranged:
(1) Shang Mian algorithm is a recursive algorithm, and recurrence mainly is to carry out at the reflection in the scene, refractile body;
(2) be unified the processing for reflecting body and refractile body;
(3) for reflecting body, what generate empty scene use is the reflection formula, and the summit order of corresponding dough sheet will change, and promptly reflects the summit order and the original reversed in order of virtual object dough sheet, points to correct direction so that guarantee the outer method arrow on plane;
(4) in arbitrary empty scene, all will according to viewpoint and BSP tree redefine wherein reflection and the order of refractile body so that the back can correctly show in real time;
(5) if the number of reflection in the scene or refractile body greater than the end condition of 1 algorithm be depth of recursion be not more than given maximum depth of recursion value;
If viewpoint changes,, need not rerun for the empty scene of pure reflection; But must recomputate for the empty scene that occurs in any one refractile body and the later recursive procedure thereof; Be the algorithm that viewpoint recomputates empty scene when changing below:
Algorithm 3 recomputates empty scene when changing for viewpoint position, as shown in figure 12.
Realize the real-time rendering scene, just must adopt hardware-accelerated way.At this moment, we will use the public software interface OpenGL of graphic hardware.The generation of the virtual object of front is for our real-time rendering lays the foundation.Be the real-time rendering algorithm that we use below.
Algorithm 4 is real-time rendering and demonstration, as shown in figure 13.

Claims (6)

1. the real time ray tracing method of plane and sphere nonlinear refraction and reflection, contain useful virtual object and realize the method for real time ray tracing, it is characterized in that: for the polyhedron that is refracted or reflects, at first utilize COMPUTER CALCULATION to go out the empty summit on this each summit of polyhedron, successively all empty summits are connected into the optics mapping virtual object that is constituted and finally formed reflection or refraction by many empty faces according to the topological relation between original point of this polyhedron and the face then, abbreviate virtual object as; When display graphics, utilize the graphic hardware speed technology, this virtual object is recursively projected on reflection or the refractive surface with recursive algorithm, mix by carrying out α, thereby obtain and the similar image effect of ray trace with the brightness value of refractive surface itself; Wherein, the empty summit P ' of any 1 P can be expressed as in the three-dimensional scenic: P ′ = V + l B - V | B - V | ,
Wherein V is a viewpoint, l by light L when superrefraction or the reflection point of arrival P the length summation in path of process; B is a sampled point on the projection plane;
For the plane refraction body outside the refractile body, it contains successively and has the following steps for scene:
(1) calculate each empty summit P ': P ′ = V + l I 1 - V | I 1 - V | ; l=|V-I 1|+|I 1-I 2|+|I 2-P|, I 1 = Q + d U - Q | U - Q | , Q=V-w 1N, U = V - C 3 + C T V C T ( P - V ) ( P - V ) ,
When wherein, l arrives some P in the scene by light through refraction the length summation in path of process; w 1Be the distance of vision point to the refractile body plane of incidence; Q is the intersection point of vision point on the refractile body plane of incidence; D arrives a some I for some Q 1Distance; U is the intersection point of the straight line VP and the refractile body plane of incidence; The equation of the refractile body plane of incidence is made as C 0X+C 1Y+C 2Z+C 3=0, and note C=(C 0, C 1, C 2) TI 1, I 2Be respectively corresponding two surfaces of light L and plane refraction body-promptly go into, the go out intersection point of two planes of refraction, N is a some I 1The unit normal vector at place;
(2) successively each empty summit is connected into the limit of virtual object according to the original topological relation of object in the scene, corresponding face constitutes each empty face;
(3) with recursive algorithm this virtual object is projected on the refractive surface, and carry out after α mixes the display result figure with the local light brightness value of refractive surface itself.
2. the real time ray tracing method of plane and sphere nonlinear refraction and reflection, contain useful virtual object and realize the method for real time ray tracing, it is characterized in that: for the polyhedron that is refracted or reflects, at first utilize COMPUTER CALCULATION to go out the empty summit on this each summit of polyhedron, successively all empty summits are connected into the optics mapping virtual object that is constituted and finally formed reflection or refraction by many empty faces according to the topological relation between original point of this polyhedron and the face then, abbreviate virtual object as; When display graphics, utilize the graphic hardware speed technology, this virtual object is recursively projected on reflection or the refractive surface with recursive algorithm, mix by carrying out α, thereby obtain and the similar image effect of ray trace with the brightness value of refractive surface itself; Wherein, the empty summit P ' of any 1 P can be expressed as in the three-dimensional scenic: P ′ = V + l B - V | B - V | ,
Wherein V is a viewpoint, l by light L when superrefraction or the reflection point of arrival P the length summation in path of process; B is a sampled point on the projection plane;
For the plane refraction in the refractile body, it contains successively and has the following steps for scene:
(1) calculate each empty summit P ': P ′ = V + l I - V | I - V | ;
l=|V-I|+|I-P|, I = Q + d U - Q | U - Q | ,
Q=V-w 1N, U = V - C 3 + C T V C T ( P - V ) ( P - V ) ,
Wherein, I is the intersection point of the plane of incidence of light L and plane refraction body, and the equation of this plane of incidence is made as C 0X+C 1Y+C 2Z+C 3=0, and note C=(C 0, C 1, C 2) TN is a unit normal vector at I place; Q is the intersection point of vision point on the refractile body plane of incidence; D arrives a some I for some Q 1Distance; U is the intersection point of the straight line VP and the refractile body plane of incidence;
(2) successively each empty summit is connected into the limit of virtual object according to the original topological relation of object in the scene, corresponding face constitutes empty face;
(3) with recursive algorithm this virtual object is projected on the refractive surface, and carry out after α mixes the display result figure with the local light brightness value of refractive surface itself.
3. the real time ray tracing method of plane and sphere nonlinear refraction and reflection, it is characterized in that: for the polyhedron that is refracted or reflects, at first utilize COMPUTER CALCULATION to go out the empty summit on this each summit of polyhedron, successively all empty summits are connected into the optics mapping virtual object that is constituted and finally formed reflection or refraction by many empty faces according to the topological relation between original point of this polyhedron and the face then, abbreviate virtual object as; When display graphics, utilize the graphic hardware speed technology, this virtual object is recursively projected on reflection or the refractive surface with recursive algorithm, mix by carrying out α, thereby obtain and the similar image effect of ray trace with the brightness value of refractive surface itself; Wherein, the empty summit P ' of any 1 P can be expressed as in the three-dimensional scenic: P ′ = V + l B - V | B - V | ,
Wherein V is a viewpoint, l by light L when superrefraction or reflection arrive some P in the scene corresponding with this void summit the length summation in path of process; B is a sampled point on the projection plane;
For the orthogonal three-dimensional planar refraction of two planes of refraction of refractile body is gone into, gone out to light, it contained successively and has the following steps:
(1) calculate each empty summit P ': P ′ = V + d I 1 - V | I 1 - V | ;
d=|V-I 1|+|I 1-I 2|+|I 2-P|,
I 1=V+dx+dy+dz,
dx=xe x,dy=ye y,dz=ze z
e y=N 2,e z=-N 1,e x=e y×e z
Wherein, P is the point on the object in the scene, and V is a viewpoint, N 1Be the outer normal vector of the plane of incidence, N 2Be the outer normal vector of exit facet, the plane of incidence is vertical with exit facet, N 1, N 2Be vector of unit length, e x, e y, e zBe the base vector under the local coordinate system, x, y, z are the coordinates under the local coordinate system, and dx, dy, dz are the side-play amount of I1 point with respect to viewpoint; I 2 = I 1 - N 1 c 1 - x 2 + y 2 η 2 ( x 2 + y 2 + z 2 ) - e ^ c x 2 + y 2 η x 2 + y 2 + z 2 , Wherein, e ^ = V - I 1 - N 1 [ ( V - I 1 ) · N 1 ] | V - I 1 - N 1 [ ( V - I 1 ) · N 1 ] , c = η ( a - y ) y x 2 + y 2 + z 2 ,
η is the refractive index of three-dimensional refractile body, and α is the vertical range that viewpoint arrives the refractile body exit facet;
(2) successively each empty summit is connected into the limit of virtual object according to the original topological relation of object in the scene, corresponding face constitutes empty face;
(3) with recursive algorithm this virtual object is projected on the refractive surface, and carry out after α mixes the display result figure with the local light brightness value of refractive surface itself.
4. the real time ray tracing method of plane and sphere nonlinear refraction and reflection, it is characterized in that: for the polyhedron that is refracted or reflects, at first utilize COMPUTER CALCULATION to go out the empty summit on this each summit of polyhedron, successively all empty summits are connected into the optics mapping virtual object that is constituted and finally formed reflection or refraction by many empty faces according to the topological relation between original point of this polyhedron and the face then, abbreviate virtual object as; When display graphics, utilize the graphic hardware speed technology, this virtual object is recursively projected on reflection or the refractive surface with recursive algorithm, mix by carrying out α, thereby obtain and the similar image effect of ray trace with the brightness value of refractive surface itself; Wherein, the empty summit P ' of any 1 P can be expressed as in the three-dimensional scenic: P ′ = V + l B - V | B - V | ,
Wherein V is a viewpoint, l by light L when superrefraction or the reflection point of arrival P the length summation in path of process; B is a sampled point on the projection plane;
For the spheric reflection body, it contains successively and has the following steps:
(1) calculate each empty summit P ': P ′ = V + ( x + y ) I - V | I - V | ,
I is the incidence point of light L on sphere, and it can be expressed as: I=TL I, wherein, L I=[L Ix, L Iy, P z, 1] TIt is the coordinate of some I under local coordinate system on the sphere; T is for being tied to the transformation matrix of world coordinate system from local coordinate: T = u x v x w x 0 u y v y w y 0 u z v z w z 0 0 0 0 1 ,
Wherein,
u x=v yw z-w yv z,u y=w xv z-v xw z,u z=v xw y-w xv y
v x, v yAnd v zBe respectively unit vector (P-O)/| three coordinate components of P-O|;
w x=N x,w y=N y,w z=N z
N=(N x, N y, N z) TThe normal vector of the plane VPO that forms for the centre of sphere O of vision point, sphere and the some P in the scene; With O is true origin, is the z axle with N, is the y axle with OP, is the x axle with OP * N, sets up local coordinate system;
X, y are respectively the distance between the some P of some I in vision point and the scene on the sphere: x=|V-I|, y=|I-P|; Application of formula I=TL IJust can be L ITransform to world coordinate system from local coordinate system;
(2) successively each empty summit is connected into the limit of virtual object according to the original topological relation of object in the scene, corresponding face constitutes each empty face;
(3) with recursive algorithm this virtual object is projected on the reflecting surface, and carry out after α mixes the display result figure with the local light brightness value of reflecting surface itself.
5. the real time ray tracing method of plane and sphere nonlinear refraction and reflection, it is characterized in that: for the polyhedron that is refracted or reflects, at first utilize COMPUTER CALCULATION to go out the empty summit on this each summit of polyhedron, successively all empty summits are connected into the optics mapping virtual object that is constituted and finally formed reflection or refraction by many empty faces according to the topological relation between original point of this polyhedron and the face then, abbreviate virtual object as; When display graphics, utilize the graphic hardware speed technology, this virtual object is recursively projected on reflection or the refractive surface with recursive algorithm, mix by carrying out α, thereby obtain and the similar image effect of ray trace with the brightness value of refractive surface itself; Wherein, the empty summit P ' of any 1 P can be expressed as in the three-dimensional scenic: P ′ = V + l B - V | B - V | ,
Wherein V is a viewpoint, l by light L when superrefraction or the reflection point of arrival P the length summation in path of process; B is a sampled point on the projection plane;
For the refraction at spherical surface body, it contains successively and has the following steps:
(1) calculate each empty summit P ': P ′ = V + ( x + | I 1 - I 2 | + y ) I 1 - V | I 1 - V | ,
Wherein, I 1, I 2Be respectively incidence point and the eye point that light is mapped to the refraction at spherical surface body, use formula I=TL I, I 1, I 2Transformation of local coordinates become the coordinate of world coordinate system; X, y are respectively vision point to incidence point I 1, and eye point I 2The distance of 1 P in the scene, i.e. x=|V-I 1|, y=|I 2-P|; T is for being tied to the transformation matrix of world coordinate system from local coordinate: T = u x v x w x 0 u y v y w y 0 u z v z w z 0 0 0 0 1 ,
Wherein,
u x=v yw z-w yv z,u y=w xv z-v xw z,u z=v xw y-w xv y
v x, v yAnd v zBe respectively unit vector (P-O)/| three coordinate components of P-O|;
w x=N x,w y=N y,w z=N z
N=(N x, N y, N z) TThe normal vector of the plane VPO that forms for the centre of sphere O of vision point, sphere and the some P in the scene; With O is true origin, is the z axle with N, is the y axle with OP, is the x axle with OP * N, sets up local coordinate system;
(2) successively each empty summit is connected into the limit of virtual object according to the original topological relation of object in the scene, corresponding face constitutes each empty face;
(3) with recursive algorithm this virtual object is projected on the refractive surface, and carry out after α mixes the display result figure with the local light brightness value of refractive surface itself.
6. according to claim 1 or 2, or 3, or 4, or the real time ray tracing method of 5 described planes and sphere nonlinear refraction and reflection, it is characterized in that: described process of coming display graphics with recursive algorithm contains and has the following steps and algorithm:
Algorithm 1 pre-service
In the 1st step,,, then replace this ball to participate in structure BSP tree with 6 faces that closely contain the square of this ball if contain spherical reflection or refractile body in the scene to the tree of the object configurations y-bend space subdivision (BSP) in the scene;
In the 2nd step, collect all reflection and refractile bodies in the scene, and form reflection and refractile body Object table;
In the 3rd step,, determine each reflection in reflection, the refraction body surface, the sequencing of refractile body according to current viewpoint; Because BSP tree is irrelevant with viewpoint, thus can be very fast reflected, the order of refractile body;
The 4th step, calculate empty summit and generate all virtual objects, produce empty scene;
Algorithm 2 produces empty scene for refractile body or reflecting body:
I) arrive maximum recursive hierarchical? be then to return;
If ii) be reflecting body, calculate the empty scene of reflection; If be refractile body, calculate the empty scene of refraction;
Iii) reflection in the empty scene and refractile body are sorted according to viewpoint;
If also have reflection or refractile body in the iv) empty scene,, change i) then to the reflection in the empty scene, this algorithm of refractile body recursive call; Otherwise change v);
V) return;
If viewpoint changes,, need not rerun for the empty scene of plane reflection; But must recomputate for all empty scenes that occur in the empty scene of any one refractile body or spheric reflection body and the later recursive procedure; Be the algorithm that viewpoint recomputates empty scene when changing below:
Algorithm 3 viewpoint positions recomputate empty scene when changing
I) be refractile body?
Ii) be to call algorithm 2;
Iii) otherwise, this algorithm of recursive call;
Algorithm 4 real-time renderings and demonstration (this algorithm be at certain reflecting body in the real scene or refractile body)
I) rendering parameter (forbid that the color buffer memory writes, forbid that depth buffer writes, forbid depth ratio, ban use of Alpha to mix, make value+1 of the masterplate buffer zone of being drawn) of OpenGL is set;
Ii) draw reflection, refractile body itself;
If iii) contain reflection or refractile body in its empty scene, then change i), recursively draw reflection, refractile body in the empty scene; Otherwise, change iv);
The rendering parameter (make the value of the masterplate buffer zone of being drawn constant, the color buffer memory can be write, and depth buffer can be write, and depth ratio comes into force, and other rendering parameter is constant) of OpenGL iv) is set;
V) in current stencil buffer, draw other virtual object in the current empty scene;
The rendering parameter (the color buffer memory can be write, and depth buffer can be write, and depth ratio comes into force, and the Alpha mixing comes into force, and makes the value-1 of the masterplate buffer zone of being drawn) of OpenGL vi) is set;
Vii) draw reflection, refractile body itself;
The rendering parameter (recover depth buffer and can write, the color buffer memory can be write, and forbids that Alpha mixes, and forbids touching the plate operation) of OpenGL viii) is set;
Ix) return.
CN 02130945 2002-09-23 2002-09-23 Real time light tracing method of non linear refraction and reflection on plane and spherical surfaces Pending CN1410948A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 02130945 CN1410948A (en) 2002-09-23 2002-09-23 Real time light tracing method of non linear refraction and reflection on plane and spherical surfaces

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 02130945 CN1410948A (en) 2002-09-23 2002-09-23 Real time light tracing method of non linear refraction and reflection on plane and spherical surfaces

Publications (1)

Publication Number Publication Date
CN1410948A true CN1410948A (en) 2003-04-16

Family

ID=4746520

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 02130945 Pending CN1410948A (en) 2002-09-23 2002-09-23 Real time light tracing method of non linear refraction and reflection on plane and spherical surfaces

Country Status (1)

Country Link
CN (1) CN1410948A (en)

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101297325A (en) * 2005-12-29 2008-10-29 英特尔公司 Application of interval algorithm for reducing computation time in ray tracking problems
CN101359404A (en) * 2007-07-31 2009-02-04 英特尔公司 Real-time luminosity dependent subdivision
CN100557638C (en) * 2006-11-28 2009-11-04 国际商业机器公司 Carry out the method and system of ray tracing
CN100557637C (en) * 2006-11-28 2009-11-04 国际商业机器公司 Carry out the method and system of ray tracing
CN100570638C (en) * 2006-11-28 2009-12-16 国际商业机器公司 The method of dispensing work load and image processing system
CN101165721B (en) * 2006-10-17 2010-06-02 国际商业机器公司 Ray tracking method and system
CN101894390A (en) * 2010-06-29 2010-11-24 浙江大学 Ray tracing method for non-constant refractive index medium
CN101918769A (en) * 2007-10-24 2010-12-15 伊苏勒有限公司 Heliostat calibration in a kind of central tower receiver solar power plant and tracking control
CN101982838A (en) * 2010-11-02 2011-03-02 长春理工大学 3D virtual set ray tracking method for accelerating back light source irradiation
CN102074041A (en) * 2010-12-21 2011-05-25 长春理工大学 Method for drawing planar caustic effect of 3D virtual scene produced by specular reflection
CN101276479B (en) * 2007-03-29 2011-08-31 国际商业机器公司 Image process method and system
CN102282591A (en) * 2008-09-10 2011-12-14 柯斯提克绘图有限公司 Ray tracing system architectures and methods
CN101506847B (en) * 2006-08-22 2012-03-28 国际商业机器公司 Methods and systems for partitioning a spatial index

Cited By (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101297325A (en) * 2005-12-29 2008-10-29 英特尔公司 Application of interval algorithm for reducing computation time in ray tracking problems
CN101297325B (en) * 2005-12-29 2013-04-24 英特尔公司 Method and device for radio tracking
CN101506847B (en) * 2006-08-22 2012-03-28 国际商业机器公司 Methods and systems for partitioning a spatial index
CN101165721B (en) * 2006-10-17 2010-06-02 国际商业机器公司 Ray tracking method and system
CN100570638C (en) * 2006-11-28 2009-12-16 国际商业机器公司 The method of dispensing work load and image processing system
CN100557637C (en) * 2006-11-28 2009-11-04 国际商业机器公司 Carry out the method and system of ray tracing
CN100557638C (en) * 2006-11-28 2009-11-04 国际商业机器公司 Carry out the method and system of ray tracing
CN101276479B (en) * 2007-03-29 2011-08-31 国际商业机器公司 Image process method and system
CN101359404A (en) * 2007-07-31 2009-02-04 英特尔公司 Real-time luminosity dependent subdivision
CN101918769A (en) * 2007-10-24 2010-12-15 伊苏勒有限公司 Heliostat calibration in a kind of central tower receiver solar power plant and tracking control
CN101918769B (en) * 2007-10-24 2013-01-16 伊苏勒有限公司 Calibration and tracking control of heliostats in a central tower receiver solar power plant
CN102282591A (en) * 2008-09-10 2011-12-14 柯斯提克绘图有限公司 Ray tracing system architectures and methods
CN101894390A (en) * 2010-06-29 2010-11-24 浙江大学 Ray tracing method for non-constant refractive index medium
CN101894390B (en) * 2010-06-29 2012-07-04 浙江大学 Ray tracing method for non-constant refractive index medium
CN101982838A (en) * 2010-11-02 2011-03-02 长春理工大学 3D virtual set ray tracking method for accelerating back light source irradiation
CN102074041A (en) * 2010-12-21 2011-05-25 长春理工大学 Method for drawing planar caustic effect of 3D virtual scene produced by specular reflection
CN102074041B (en) * 2010-12-21 2012-10-10 长春理工大学 Method for drawing planar caustic effect of 3D virtual scene produced by specular reflection

Similar Documents

Publication Publication Date Title
CN1410948A (en) Real time light tracing method of non linear refraction and reflection on plane and spherical surfaces
CN1924931A (en) Video rendering apparatus and method
CN1114891C (en) Picture processing device and method, game device using same, and memory medium
CN1747559A (en) Three-dimensional geometric mode building system and method
CN1183985C (en) Entertainment apparatus, storage medium and method of deciding weather
CN1146805C (en) Method for communicating and generating computer graphics, animation data, and recording media
CN1849608A (en) Method and program for generating volume data from boundary representation data
CN1343343A (en) Method and apparatus for processing images
CN1774727A (en) Determining a coverage mask for a pixel
CN1691069A (en) Real-time volume drawing method for block-based fragment filtration with multi-GPU acceleration
CN101044507A (en) Image processing method, image processor, and image processing program
CN1835022A (en) Generating a 2d model using 3D transition
CN1339764A (en) Shading tree mixer for image system recirculation
CN1711568A (en) Visualizing system, visualizing method, and visualization processing program
CN1526098A (en) Method and system for output of data related to two- or three-dimensional geometrical entities
CN1645415A (en) Rendering device and rendering method
CN1619596A (en) Map display system, map data processing apparatus, map display apparatus, and map display method
CN1272933A (en) Image processing apparatus and image processing method, program providing medium, and data providing medium
CN1404016A (en) Establishing method of human face 3D model by fusing multiple-visual angle and multiple-thread 2D information
CN1977290A (en) Display, displaying method, information recording medium, and program
CN1855150A (en) Image processing device, method, program and recording medium
CN1910619A (en) Three-dimensional video game system
CN1601562A (en) Image processing apparatus and method of same
CN1815507A (en) Method, apparatus, and medium for transforming graphic data of an object
CN1809844A (en) Virtual visual point image generating method and 3-d image display method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C12 Rejection of a patent application after its publication
RJ01 Rejection of invention patent application after publication