Classic Radiosity

Classic Radiosity

Classic radiosity LiU, ITN, TNCG15 Ali Khashan, [email protected] Fredrik Salomonsson, [email protected] VT 10 Abstract This report describes how a classic radiosity method can be solved using the hemicube method to calculate form factors and sorting for optimizing. First the scene is discretized by subdividing the faces uniformly into smaller faces, called patches. At each patch a hemicube is created where the scene is projected down onto the current hemicube to determine the visibility each patch has. After the scene has been projected onto the hemicube form factors are calculated using the data from the hemicube, to determine how much the light contribution from light sources and other objects in the scene. Finally when the form factors has been calculated the radiosity equation can be solved. To choose witch patch to place the hemicube onto all patches are sorted with regard to the largest unshot energy. The patch that comes on top at iteration of the radiosity equation is the one which the hemicube is placed onto. The equation is solved until a convergence of radiosity is reached, meaning when the difference between a patch’s old radiosity and the newly calculated radiosity reaches a certain threshold the radiosity algorithim stops. After the scene is done Gouraud shading is applied to achieve the bleeding of light between patches and objects. The scene is presented with a room and a few simple primitives using C++ and OpenGL with Glut. The results can be visualized by solving the radiosity equation for each of the three color channels and then applying them on the corresponding vertices in the scene. Table of contents 1 1 1.1 Introduction . 1 2 2 2.1 Radiosity equation . 2 2.2 Scene discretization . 2 2.3 Hemicube . 3 2.4 Projection . 3 2.5 Form-factors . 4 2.6 Implementing radiosity . 4 3 6 3.1 Results . 6 3.2 Discussion . 6 Bibliography 10 Chapter 1 1.1 Introduction In computer graphics it is desirable to achieve photorealistic scenes using realistic light. These light models are called global illumination methods and today they are widely used in graphic applications. Generally these methods are radiosity which produce light behavior on diffuse surfaces and ray tracing which produces light behavior on specular surfaces. Radiosity evalu- ates the intensity at discrete points on a diffuse surface. What is positive about radiosity is that it is view independent. A camera can navigate through a scene using radiosity without any new calculations occurring, therefore a static scene needs to be rendered only once. Whereas ray tracing is view dependent and needs to be up- dated each time frame when camera movement occurs, making it still difficult to implement in realtime with current hardware. Other methods combine radiosity and ray tracing at the cost of computational time and realtime rendering, but produce better looking results. 1 Chapter 2 2.1 Radiosity equation The classic radiosity equation is shown in the equation below. n X Bi = Ei + pi BjFij (2.1) j=1 Bi is radiosity of patch i, Ei is emission of patch i, pj is reflectivity of patch i, Bj is radiosity of patch j, Fij is the form-factor from i to j and n is number of patches. As it can be seen the equation can be solved discreetly over surfaces or points in the scene. Typically the radiosity solution is solved by gathering the light from patches j in the scene to patch i. While doing this the scene is updated only at patch i at each iteration. If instead of gathering light the method shoots light from patch i to patches j to determine watch patch i contributes to all the other patches, the whole scene can be simultaneously updated. The form-factor calculation will still be Fij, meaning the form-factors will still be calculated with a hemicube placed at patch i. But instead at each iteration only one hemicube is needed to add the contribution of that patch to all the other patches in the scene. As described by Cohen & Greenberg [1], shooting, the total contribution from patch i to all the other patches, is given by: pjFijAi F or all patches j : Bj due to Bi = (2.2) Aj 2.2 Scene discretization Before calculating and solving the radiosity equation the scene has to be discretized through subdivision. In this paper a uniform subdivision has been done and been found sufficient enough to produce, subjectively, good, results. As the scene itself is simple it is easy to de- termine which objects should be more subdivided than others, thus, a static manually set subdi- vision for each object has been done. For larger more complex scenes an adaptive subdivision solution is needed. Also an adaptive subdivision is needed to increase the quality of the shadows without needed to subdivide the whole object uniformly and thus increasing the rendering time. By subdividing the objects in the scene, the method will produce a much higher accuracy of the light distribution. And the more subdivided the objects are the more accurate the solution will be but it will also be more demanding to solve the radiosity equation. 2 Each subdivision of a face are called patches. Patches are the elements in the scene that will receive and shoot energy. To calculate the form factors between patches, the hemicube method is used, that is by placing a hemicube on to one patch and project the other patches on to that hemicube. 2.3 Hemicube The form factors are calculated by using hemicubes. Through form factors the radiosity equa- tion can solved discreetly. A hemicube is a uniform, unit length cube that is cut in half and is placed at the center of a patch, called the patch’s middle point, in the scene. The hemicube’s sides are divided into pixels at a given resolution, this resolution depends on number of patches the scene contains, if the resolution of the hemicube sides are to low a grid-like pattern will occur on the faces of the objects, see fig. 2.1, because when projecting the patches onto the hemicube some patches will be missed due to the low resolution of the hemicube sides. Therefore increasing the resolution of the hemicube will give a more accurate result, but also slow the rendering time. The purpose of the hemicube is to project the scene down on the hemicube to determine the visibility and light contribution of the objects in the scene on the current patch or face. 2.4 Projection The projection of patches in the scene is done by simple linear algebra. By calculating point to plane intersection, whereas the points are the edge vertices of the patch and the plane cor- responds to an infinitely large plane that one of the hemicube sides lies in. The intersection points will then correspond to the projected patch edge verices. Using this method of projection the point is projected onto an infinitely large plane and thherefore some patches has to be clipped to fit the plane on the hemicube. The algorithm for clipping that is used is Sutherland-Hodgman clipping algorithm. The same algorithm is also used for clipping patches themselves when they are projected down onto the hemicube, for better approximation of the light contribution. After each of the patches edge vertex are projected onto the hemicube bresenham’s line algorithm is used to fill the remaining pixels in the hemicube between the projected points, and after the contour of the projected patch is done, the inside is also filled. 3 Figure 2.1: Projecting a face onto a hemicube 2.5 Form-factors The form factors describes the part of energy/light leaving one area and hitting another. To calculate the form-factor Fij a ∆form-factor at each of the filled pixels in the hemicube is calculated. The hemicube pixel contribution varies depending on the pixel location and orientation on the hemicube’s surface. Using the equations below the ∆form-factor for the hemicube can be calculated. 1 ∆F orm − factor = ∆A (2.3) Π(y2 + z2 + 1) Z ∆F orm − factor = ∆A (2.4) Π(y2 + z2 + 1) Eq. 2.3 is ∆Form-factor for the top side of the hemicube and eq. 2.4 is ∆Form-factor for the left side of the hemicube. ∆A is the area of a hemicube pixel, and the coordinates in the equations has the origo at the midpoint of the hemicube. n X Fij = BjFij (2.5) j=1 Finally a summation of all ∆form-factors to acquire Fij, where the R is the number of hemicube pixels which are filled by a projection from a patch in the scene. 2.6 Implementing radiosity Following a simple algorithm by Cohen & Greenberg [1] the radiosity method can be imple- mented in a programming environment while using eq. 2.2. The radiosity method is solved in C++ and visualized using OpenGL with GLUT. The method solves each color value (RGB) separately and then is applied on each of the corre- sponding vertices in the scene, in junction with OpenGL. 4 After a complete scene has been rendered Garoud shading is applied to achieve the bleeding effect of diffuse lightning. At this time of when the complete scene is rendered it is desirable to store the radiosity values to not have to re-render the scene once again. 5 Chapter 3 3.1 Results A scene with a room and a few primitives placed inside, gives a good approximation of a room containing diffuse objects thats being lit. The room itself has been subdivided six times, as for the box two times.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    13 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us