Presentation is loading. Please wait.

Presentation is loading. Please wait.

15.1 si31_01 SI31 Advanced Computer Graphics AGR Lecture 15 Radiosity.

Similar presentations


Presentation on theme: "15.1 si31_01 SI31 Advanced Computer Graphics AGR Lecture 15 Radiosity."— Presentation transcript:

1 15.1 si31_01 SI31 Advanced Computer Graphics AGR Lecture 15 Radiosity

2 15.2 si31_01 Review n First a review of the two rendering approaches we have studied: – Phong reflection model – ray tracing

3 15.3 si31_01 Phong Reflection Model n This is the most common approach to rendering – objects represented as polygonal faces local – intensity of faces calculated by Phong local illumination model – polygons projected to viewplane – Gouraud shading applied with Z buffer to determine visibility I( ) = K a ( )I a ( ) + ( K d ( )( L. N ) + K s ( R. V ) n ) I*( ) / dist

4 15.4 si31_01 Phong Reflection Model n Strengths – simple and efficient – models ambient, diffuse and specular reflection n Limitations – only considers light incident from a light source, and not inter-object reflections - ie it is a local illumination method (ambient term is approximation to global illumination – empirical rather than theoretical base – objects typically have plastic appearance

5 15.5 si31_01 Ray Tracing n Ray traced from viewpoint through pixel until first object intersected n Colour calculated as summation of: – local Phong reflection at that point – specularly reflected light from direction of reflection – transmitted light from refraction direction if transparent

6 15.6 si31_01 Ray Tracing n This is done recursively n Colour of light incoming along reflection direction found by: – tracing ray back until it hits an object – colour of light emitted by object is itself summation of local component, reflected component and transmitted component – and so on

7 15.7 si31_01 Ray Tracing - Strengths and Weaknesses n Advantages – increased realism through ability to handle inter-object reflection n Disadvantages – much more expensive than local reflection – still empirical – only handles specular inter-object reflection – entire calculation is view-dependent

8 15.8 si31_01 Radiosity n Based on the physics of heat transfer between surfaces n Developed in 1980s at Cornell University in US (Cohen, Greenberg) n Determine energy balance of light transfer between all surfaces in an enclosed space – equilibrium reached between emission of light and partial absorption of light diffuse n Assume surfaces are opaque, are perfect diffuse reflectors and are represented as sets of patches A i

9 15.9 si31_01 Radiosity Examples

10 15.10 si31_01 Radiosity - Definition n Radiosity defined as: – energy (B i ) per unit area leaving a surface patch (A i ) per unit time B i A i = E i A i + R i ( F j-i B j A j )i=1,2,..N j E i is the light energy emitted by A i per unit area R i is the fraction of incident light reflected in all directions F j-i is the fraction of energy leaving A j that reaches A i N is the number of patches light emitted light reflected light leaving

11 15.11 si31_01 Radiosity - Pictorial Definition AiAi AjAj r NiNi NjNj i j B i A i = E i A i + R i (F j-i B j A j ) Form factor F j-i is fraction of energy leaving A j that reaches A i. It is determined by the relative orientation of the patches and distance r between them Form factors are hard to calculate! Lets assume for now we can do it. j

12 15.12 si31_01 Simplifying the Equation B i A i = E i A i + R i (F j-i B j A j ) ie B i A i = E i A i + R i (B j F j-i A j ) There is a reciprocity relationship: F j-i A j = F i-j A i B i A i = E i A i + R i (B j F i-j A i ) Hence: B i = E i + R i ( B j F i-j ) So the radiosity of patch A i is given by: j j j j

13 15.13 si31_01 Creating a System of Equations n We get one equation for each patch – assume we can calculate form factors – then N equations for N unknowns B 1,B 2,..B N n First equation is: (1-R 1 F 1-1 )B 1 - (R 1 F 1-2 )B 2 - (R 1 F 1-3 )B 3 -.. - (R 1 F 1-N )B N = E 1 n..and we get in all N equations like this. n Generally F i-i will be zero - why? n Most of the E i will be zero - why? B 1 = E 1 + R 1 ( B j F 1-j ) j

14 15.14 si31_01 Solving the Equations n Equations are solved iteratively - ie a first guess chosen, then repeatedly refined until deemed to converge n Suppose we guess solution as: B 1 (0), B 2 (0),.. B N (0) n Rewrite first equation as: B 1 = E 1 + (R 1 F 1-2 )B 2 +.. + (R 1 F 1-N )B N n Then we can improve estimate of B 1 by: B 1 (1) = E 1 + (R 1 F 1-2 )B 2 (0) +.. + (R 1 F 1-N )B N (0) n.. and so on for other B i

15 15.15 si31_01 Solving the Equations n This gives an improved estimate: B 1 (1), B 2 (1),.. B N (1) and we can continue until the iteration converges. Jacobi n This is known as the Jacobi iterative method Gauss-Seidel n An improved method is Gauss-Seidel iteration – this always uses best available values – eg B 1 (1) (rather than B 1 (0) ) used to calculate B 2 (1), etc

16 15.16 si31_01 Rendering n What have we calculated? n The B i are the intensities of light emanating from each patch – the form factors do not depend on wavelength, but the R i do – thus B i depend on, so we need to calculate B i RED, B i GREEN, B i BLUE n We get vertex intensities by averaging the intensities of surrounding faces n Then we can pass to Gouraud renderer code for interpolated shading

17 15.17 si31_01 Pause at this stage n Number of equations can be very large n Calculation is not view dependent n Only diffuse reflection n We still have not seen how to calculate the form factors! n Their calculation dominates

18 15.18 si31_01 Form Factors n The calculation of the form factors is unfortunately quite hard n We begin by looking at the form factor between two infinitesimal areas on the patches

19 15.19 si31_01 Form Factors - Notation AiAi NiNi dA i NjNj AjAj dA j i j Form factor F di-dj gives the fraction of energy reaching dA j from dA i. r r is distance between elements N i, N j are the normals i, j are angles made with normals by line joining elements

20 15.20 si31_01 Form Factor Calculation : 2D Cross Section View Draw in 2D but imagine this in 3D: * create unit hemisphere with dA i at centre * light emits/reflects equally in all directions from dA i * form factor F di-dj is fraction of energy reaching dA j from dA i dA i AjAj dA j AiAi

21 15.21 si31_01 Form Factor Calculation : 2D Cross Section View We begin calculation by * projecting dA j onto the surface of the hemisphere (blue) * this resulting area is (cos j / r 2 ) dAj This gives us the relative area of light energy reaching dA j from dA i dA i AjAj dA j j r NjNj

22 15.22 si31_01 Form Factor Calculation : 2D Cross Section View But we need a measure per unit area of A i so need to adjust for orientation of A i This gives a corrected area as: ( cos i cos j / r 2 ) dAj dA i AjAj dA j i

23 15.23 si31_01 Form Factor Calculation : 2D Cross Section View dA i Total energy comes from integrating this comes to over whole hemisphere - this comes to Hence form factor is given by: F di-dj = ( cos i cos j ) / ( r 2 )dA j

24 15.24 si31_01 Form Factor Calculation : 2D Cross Section View Finally we need to sum up for ALL dA j. This means integrating over the whole of the patch: F di-j = (cos i cos j ) /( r 2 ) dA j dA i AjAj AiAi

25 15.25 si31_01 Form Factor Calculation dA i AjAj AiAi Strictly speaking, we should now integrate over all dA i. In practice, we take F di-j as representative of F i-j and this assumption: F i-j = F di-j works OK in practice. However the calculation of the integral (cos i cos j ) /( r 2 ) dA j is extremely difficult. Next lecture will discuss an approximation.


Download ppt "15.1 si31_01 SI31 Advanced Computer Graphics AGR Lecture 15 Radiosity."

Similar presentations


Ads by Google