200 likes | 336 Views
GR2 Advanced Computer Graphics AGR. Lecture 16 Radiosity - continued. Calculating Form Factors. The calculation of: is difficult In practice a hemicube is formed about the centre of the patch - projection on to flat planes is much easier.
E N D
GR2Advanced Computer GraphicsAGR Lecture 16 Radiosity - continued
Calculating Form Factors • The calculation of: is difficult • In practice a hemicube is formed about the centre of the patch - projection on to flat planes is much easier Fdi-j = (cos i cos j ) /( r2 ) dAj
Ni Ai Hemicube Continuing our 2D cross section view: but imagine this in 3D as a hemicube centred on the centre of Ai
Ni Ai Hemicube - Pixels Divide the faces of the hemicube into small ‘pixels’ - say 50x50 on top face
Aj Ni Ai Hemicube - Project patch j Project Aj onto the hemicube, noting pixels which are covered. For these pixels, record patch (Aj) and its depth. If two patches project to same pixel, only record nearest since others are invisible to Ai - this is the same idea as z-buffering.
Aj Ni Ai Hemicube - Form Factors We compute mini form factors for each pixel - say, Fq, for pixel q. These can be pre-computed and stored in a look up table Then we get Fi-j as: Fi-j = Fq where the summation is over all pixels q covered by the projection. See Watt or Foley, van Dam for how to calculate the mini form factors
Radiosity - Summary • The basic radiosity method is: 1) decompose the scene into patches Ai 2) compute the form factors Fi-j using hemicubes 3) solve the radiosity system of equations to get Bi for each patch i (for R,G,B) 4) render by feeding the Bi values into a Gouraud interpolation renderer • Note: • 1) and 2) depend only on geometry • 3) depends on 1) and 2) plus reflection and emission values • 4) depends on 1),2),3) and view
Radiosity - Further Examples Cornell group radiosity image, using progressive refinement approach 30,000 patches
Radiosity - Further Examples Scene from the opera ‘La Boheme’ by the Cornell group.
Radiosity - Further Examples Museum drawn using radiosity by progressive refinement.
Radiosity - Analysis • Radiosity algorithm is expensive in computation and storage • For accuracy we need to decompose into many small patches (typically N>1000) • But this means N2 form factors that need to be computed and stored
Progressive Refinement • Aim is to generate sequence of improving images • Basic algorithm works against this: • large initial start up in generating ALL the form factors (which need to be stored) • during one iteration of Gauss-Seidel, we generate B1, B2, etc so it takes a long time before we calculate BN - even if BN is significant, say a light source
Revisit the Basic Algorithm • Basic equation for Bi: • Bi = Ei + Ri Bj Fi-j for each patch Ai • each term of summation is patch j effect on patch i, ie • Bi due to Bj = Ri Bj Fi-j this gathers radiosity from all the other patches • Different approach is to shoot radiosity from one patch to all other patches
Shoot rather than Gather • So now: • Bj due to Bi = Rj Bi Fj-i for all j • this shoots Bi radiosity to each of the other patches in turn • But: • Fj-i for each j requires different hemicube calculation • So: • using reciprocity relationship (Fj-i Aj = Fi-j Ai) • Bj due to Bi = Rj Bi Fj-i = Rj Bi Fi-j Ai /Aj for all j • which uses same hemicube
Progressive Refinement Algorithm • Algorithm works as follows: • Set initial radiosities Bi and increments Bi to Ei • For each patch i do build hemicube, calculate form factors Fi-j for each patch j do Radiosity = RjBi Fi-j Ai / Aj Bj = Bj + Radiosity Bj = Bj + Radiosity Bi = 0 • Repeat until convergence
Progressive Refinement Algorithm - Optimization • Initially the scene will be dark apart from light sources, then gets steadily lighter • For best effect: • start off with simple ambient illumination • at each stage, select patch i for shooting that has highest BiAi ie greatest unshot radiosity.
Efficient Radiosity • Use shooting method to solve the radiosity equation, where increments are made to patches j from patch i • Choose patch i at each stage to achieve most effect • Add a (decreasing) ambient term in the early stages
Issues in Radiosity • Artefacts in radiosity images occur due to: • approximations in hemicube method • using linear interpolation to reconstruct radiosity function across a patch • using a mesh structure which does not take into account variations in radiosity function
Hemicube Approximations • Hemicube is divided into uniform set of pixels of finite size • … and it is assumed that each patch projects onto ‘whole’ pixels - which is unlikely to be the case • An example of an aliasing effect - cf jagged lines in line drawing in 2D graphics
Interpolation of Radiosity Function • Situation analogous to Gouraud shading… • … reflectance calculation assumes radiosity constant over patch • … radiosity at vertices found by averaging • … internal radiosity within patch found by linear interpolations • … causing Mach banding due to discontinuities of radiosity gradient