1 / 37

Radiosity

Radiosity. What we can do with scan line conversion and ray tracing What we can’t do Radiosity. Types of Illumination. Scan-line Techniques Diffuse reflection of light sources Specular reflection of light sources Ray tracing and move advanced scan line techniques

dean-rice
Download Presentation

Radiosity

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Radiosity • What we can do with scan line conversion and ray tracing • What we can’t do • Radiosity

  2. Types of Illumination • Scan-line Techniques • Diffuse reflection of light sources • Specular reflection of light sources • Ray tracing and move advanced scan line techniques • Specular reflection from other objects • Transmission • Seem like anything is missing, here?

  3. The Big Lie!!! • Ambient Light! • Does not really exist • It’s faking light reflecting from other surfaces

  4. What really happens • Light reflects off of surfaces and illuminates other surfaces • Every surface affects every other surface • One hacky solution • Assume all of the light from all surfaces is averaged into a single illumination lighting that goes everywhere • That’s what we’ve been calling ambient light.

  5. Ambient Light is an approximation • Many elements of natural lighting are not modeled well by ambient lighting at all • Corners • Interiors • Moving items

  6. Characteristics of Diffuse Reflection Light How will OpenGL draw this box? What about ray tracing? What about nature? Box

  7. Our box on edge

  8. Complex Lighting Environments • This is really a complicated lighting environment. • There is specular and diffuse reflection everywhere in the box. • Ray tracing can approximate the specular reflection fairly well, but not the diffuse reflection. • Let’s just look at diffuse reflection for now. • Note: In the real world diffuse and specular reflection interact in a complex manner. We’ll get to combining the two later.

  9. Radiosity • Fundamental principle: • Conservation of energy • Light is either absorbed or reflected!

  10. Radiosity • Every surface is treated as a diffuse reflector and emitter and all surfaces are assumed to conserve light energy. • The rate at which energy leaves the surface, the radiosity, is the sum of the rates at which the surface reflects or transmits energy from other surfaces and the rate at which the surface emits energy. • Note: we no longer have disjoint light sources. • Every object in the space is treated the same. • A light source is simply a surface that emits energy.

  11. How do we solve this? • Simple example: two surfaces

  12. Solving this… • Every surface’s radiosity is dependent upon the light falling on that surface from other surfaces, • which is a function of their radiosity, • which will be dependent upon every other surface’s radiosity • which will be dependent upon every other surface’s radiosity • which will be dependent upon every other surface’s radiosity • Is it any surprise that we will be either solving or approximating solutions to simultaneous equations?

  13. Pure Radiosity vs. Real World • Pure Radiosity systems don’t have light sources, surfaces are light sources • Lighted panels are easy to do, as are light bulbs, etc. • Neon is just too cool… • But, many systems compute reflection from light sources, then augment with the radiosity solution.

  14. Problems with our box • What do we model? • Surfaces? • Points?

  15. Patches • Radiosity systems break surfaces into smaller areas called patches • Surfaces are too big for a single radiosity • Points are just too small

  16. The Radiosity Equation • Bi - The radiosity of patch i. • the rate at which light is emitted. This is units of energy per unit area per time. • This is what we are computing. Note that this may be a spectra (color). Do all this stuff for R, G, and B. • Ei - The emissivity of the patch. • This is the light generated by the patch and is of the same units as Bi, will be zero for anything that is not a light source.

  17. The Radiosity Equation • ri - The reflectivity of the surface. • This is equivalent to kdr in the Hall model. • Bj - The radiosity of some other patch j. • Fj-i - The form factor. • What fraction of energy leaving patch j will arrive at patch i. • This is dependent upon shape, relative angles, intervening patches, etc. • Ai and Aj are the areas of the patches i and j.

  18. What’s that Aj/Ai ratio? • For patch j of area Aj, the amount of energy leaving per unit area is Bj. • Since the area can be of any size, we are interested in the total amount of energy! • This is BjAj. • But, Bi is also energy per unit area. • So, we divide the total energy getting to Bi from Bj by Ai. • Hence, the ratio Aj/Ai.

  19. A Simplification • The unit area energy leaving patch j is scaled by Fj-iAj. • Likewise, unit area energy leaving patch i is scaled by Fi-jAi. • These are symmetrical paths • So, Fi-jAi = Fj-iAj. So, Fj-iAj/Ai = Fi-j • We can plug that into the above equation and ELIMINATE the areas:

  20. How do we solve this? • We have one massive simultaneous equation • Note that the problem is O(N2) • A variety of “short-cuts” exist. • We can solve using Gauss-Seidel iteration, a numerical method for solving simultaneous equations.

  21. Solving…

  22. TNT::Array2D<double> A(patchcnt, patchcnt); TNT::Array1D<double> b(patchcnt); // Create matrix A and vector b for(i=0; i<patchcnt; i++) { for(int j=0; j<patchcnt; j++) { A[i][j] = -m_patches[i].r * m_patches[i].ff[j]; if(i == j) A[i][j] += 1.; } b[i] = m_patches[i].e; } // Solve for x JAMA::QR<double> qr(A); TNT::Array1D<double> x = qr.solve(b); // Result is in x for(i=0; i<patchcnt; i++) { m_patches[i].b = x[i]; }

  23. But, these are radiosities for patches • Won’t the image look patchy? • No... • We average the colors for patches to make vertex colors and interpolate

  24. View Independence • Note that all of the diffuse lighting is view independent • We can compute it once and display it afterwards with varying views… • Or, we can add this component to other computed light components • Use ray tracing to compute the specular surface colors, radiosity to compute the diffuse

  25. Examples OpenGL Rendering Radiosity Rendering

  26. Form Factors Ai – Area of patch i Hij – 1 if path from dAi to dAj exists. nj fj ni fi r Patch j Patch i

  27. double ainv = 1. / (m_subdivide * m_subdivide); // Inverse of the area of a patch for(i=0; i<patchcnt; i++) { Patch *patchi = &m_patches[i]; patchi->ff.resize(patchcnt); for(int j=0; j<patchcnt; j++) { Patch *patchj = &m_patches[j]; // Vector from i to j CGrPoint itoj = patchj->c - patchi->c; itoj.Normalize3(); // Vector from j to i CGrPoint jtoi = -itoj; // Distance between? double r = (patchi->c - patchj->c).Length3(); r = 1.0; if(i == j) patchi->ff[j] = 0; else patchi->ff[j] = (Dot3(patchi->n, itoj) * Dot3(patchj->n, jtoi) / (GR_PI * r * r)) * ainv; } }

  28. Form Factor Computations • Direct analytical computation of form factors is not practical • Life is too short for numerical integration… • Instead, we’ll use an approximation technique

  29. Cohen and Greenberg Form Factor Estimation Algorithm • We are interested in determining Fij, the form factor for light traveling from patch i to patch j. • We’ll approximate this using the following technique

  30. Hemicube • Create a half cube - called a hemicube - consisting of rectangular square areas called cells:

  31. Projecting on Hemicube • Project all the surfaces onto the surface of the hemicube. This will take 5 different projections to accomplish (why?)

  32. Think of this as viewing • When I view from the center of a patch, the following affects the form factor • How big it appears • The angles to the surface • How far to the projection • Note the far and large is the same as near and smaller… • If we use the item buffer algorithm, we can tell what’s closer and not occluded

  33. Projecting on a Hemicube • We have 5 item buffers, each one for the cells on one face of the hemicube

  34. Cells equal parts of the form factor • Suppose cell p has item j in it. • We add DFp to Fij • For top faces • For side faces (xp,yp,zp) is center of cell. DA is the area of the cell.

  35. Any options other than “hemicube”? • …

  36. Substructuring • How much do we subdivide? • Too much is costly, not enough looks bad Substructuring – Compute at one level of subdivision and further divide if we get large differences in intensities What will we have to recompute?

  37. Substructuring • Very effective at finding shadow lines, and varying gradients

More Related