A New Technique for Spherical Radiance ... - Semantic Scholar

1 downloads 0 Views 497KB Size Report
grand total of Niter x Nfixed importance rays4. With the new technique, using Niter iterations and one spherical importance distribution calculation (between.
A New Technique for Spherical Radiance Calculation António Costa

António Augusto Sousa

DEI-ISEP-IPP/INESC Porto [email protected]

FEUP/INESC Porto [email protected]

Helder Parracho

Pedro Cruz

DEI-ISEP-IPP/INESC Porto [email protected]

FEUP/INESC Porto [email protected]

Abstract This document describes a new technique for spherical radiance calculation. In a previous work, [Costa99] et al described a semi-automatic lighting design system in which the calculation of spherical radiance distributions dominated most of the processing time. In that system, the calculation of the radiance that passes through a point in space is very important because it is used in the optimisation phase to search for the best lighting solution. To accurately sample the spherical radiance around a point, many directions must be used. While this improves accuracy, it also slows down the system performance. The previous technique was based on the random sampling of a large number of directions around a point. In this document, we show how to substitute the aforementioned brute force technique with a new adaptive one, which uses a priori information about the scene (BSDF and geometry) to build suitable data structures that allow faster overall processing times without compromising accuracy. This technique uses a smaller and adaptive number of sample directions to calculate the spherical radiance distribution. Keywords Lighting design, radiance distribution, adaptive calculation.

1. INTRODUCTION Lighting design aims to find the best set of lighting conditions, for a predefined 3D environment, that allows some design goals to be satisfactorily achieved. Geometric primitives, created with geometric and/or architectural modellers, usually describe the 3D environment. The radiative properties of objects are described by complex mathematical functions, the BSDF (bi-directional scattering distribution function, commonly separated into reflective and transmissive components).

/ constraints and to specify how and where the desired luminaries should be placed. This design information is then converted into a set of design parameters. Finally, the system uses the 3D geometry, the materials and the design parameters to search for the best set of parameters, in the sense that they represent the minimum of a particular cost function associated with the design problem (Figure 2). Setup

In [Costa99], a new semi-automatic lighting design system was presented that aimed to solve most of all lighting design problems (Figure 1). Scene

Application

Solution

Parameters Evaluation

Cost

End? N

Y

Engine

Objectives

?

Generation

Figure 2 – Design as a global optimisation process Figure 1 – The CASSILDE lighting design system

In many of those problems, the geometry and materials are known before the lighting design phase – what remains to do is to find the best set of luminaries that satisfies some lighting related criteria. The lighting design system allows the designer to define lighting design goals

This system uses the duality of radiance (importance) to drive an iterative search. In the absence of asymmetrical BSDF’s1, radiance and importance have the same trans1

Usually associated with transmissive materials.

port equations. If there is at least one asymmetrical BSDF in the 3D scene, then the same transport equations can be used if radiance is replaced with basic radiance (radiance divided by the square of the material’s refractive index) [Veach97]. The lighting goals act as importance emitters and the iterative search requires the calculation of spherical importance around 3D points. Because radiance and importance are dual entities, the lighting design system uses a radiance calculation tool to compute those 3D spherical importance distributions (the Engine block in Figure 2). The radiance / importance calculation tool was adapted from the “rtrace” program of the RADIANCE simulation package, one of the most tested and validated software packages ever developed for physically based simulations of light transport [Ward94].

shadows, umbra, penumbra or highlights (as design constraints), but their approach is not capable of handling indirectly lit spaces. The Design Gallery approach of Marks et al. [Marks97] is interesting because it presents a methodology for the exploration of solutions in large multidimensional problems, somewhat different from conventional paradigms like interactive evolution or inverse design. Costa et al. [Costa99] presented a lighting design system based on the inverse design paradigm. This system is able to cope with a wide range of design parameters and constraints. Due to its flexibility and broad range of applications, it is one of the most powerful design systems and was tested with complex 3D environments and demanding lighting design goals and constraints.

A prototype of this system has been presented to Portuguese architects and it was considered very promising [Costa01]. Although the lighting design system is able to find “optimal” solutions, the required processing time is still very large to be considered interactive – from a dozen minutes to several hours, depending on the problem’s complexity and the extension of the search. Consequently, we decided to search for techniques that can reduce the processing time without compromising accuracy. Because most of the processing time is spent calculating spherical importance distributions around 3D points, we directed our efforts into the replacement of the previously implemented brute-force technique by a new technique that, although requiring some pre-processing, is able to adaptively control the sampling of directions around the 3D point and produce equivalent results with shorter processing times. The pre-processing step is used to analyse the 3D environment and to identify “special” objects and materials that may require special treatment during the calculation of spherical importance distributions. These “special” entities are handled separately, because they can significantly affect the importance distributions. Section 2 (Previous Work) describes previous and related work in lighting design. In section 3 (Overview) we give an overview of the lighting design system and the role of importance calculation in such system. Section 4 (Technique Description) presents the new technique in detail. In section 5 (Results) we present some preliminary results with the new technique and a comparison with the previous one. Section 6 (Conclusions and Future Work) we present some conclusions about the new technique and briefly discuss several future research directions in the field of lighting design systems. 2. PREVIOUS WORK Schoeneman et al. [Schoe93] and Kawai et al. [Kawai93] addressed the inverse lighting design problem, but solved it only partially for mostly diffuse environments and have ignored many types of design constraints. Poulin et al. [Pouli97] described an approach that allows the interactive positioning of simplified luminaries from sketches of

Figure 3 – Example of lighting design solution

Figure 3 shows an example of lighting design solution for a problem with five down-lighting luminaries, several lighting goals / constraints and six design parameters. The desired goals and constraints were to achieve homogeneous lighting on the desktops and to avoid glare while looking at the monitor in sitting position. Shacked et al. [Shacked01] presented a lighting design approach for the comprehensible rendering of 3D objects. It uses a perception-based cost function and searches for “optimal” values of several pre-defined lighting parameters (mainly light positions). The CASSILDE Portuguese research project2 started in 2001 as a follow-up to the work described in [Costa99]. This ongoing project aims to build a fully functional application that runs on all platforms. Currently this project has produced a functional prototype for demonstrative purposes. 3. OVERVIEW The CASSILDE lighting design system relies heavily on the calculation of spherical importance distributions. From these distributions the system computes a cost function value that is used in the iterative search. Figure 4 2

Supported by Portuguese Foundation for Science and Technology (FCT), code POSI/EEI/13215/98-CASSILDE.

shows an example of a spherical importance distribution – the figure shows importance peaks in the near vertical directions.

polygon). A collection of N “homogeneous” samples is calculated by a custom Monte-Carlo based software tool that generates an initial distribution and progressively improves the homogeneity between samples. Because the set is “homogeneous”, each sample direction has the same weight. The calculation of the average importance value crossing the 3D point is just the average of the 4096 importance values. The “4096” value was empirically found to be a good compromise between speed and accuracy; number of samples below 2048 should always be avoided because there is a great chance of missing important directional phenomena (many of which show up through small solid angles).

Figure 4 – Importance distribution around a 3D point

In most real world 3D environments, the importance field is too complex to describe analytically and has to be numerically approximated. In these environments, importance (like radiance) is a global entity and can not be accurately accounted for using only local calculations. That is the main reason why we are currently using the RADIANCE software package to perform all radiance / importance related calculations [Ward94]. 3.1 Brute-Force Sampling of Importance The simplest solution to sample importance around a 3D point is to use a fixed set of directions, homogeneously distributed over the unit sphere around the point. Although there are no known analytical methods to find a homogeneous distribution of N points over the unit sphere [Saff97], it is possible to produce good “homogeneous” sets of N points by iterative methods. Up to now, the CASSILDE lighting design system had been using a set of 4096 points “homogeneously” distributed over the unit sphere to determine the set of directions for importance sampling.

3.2 Adaptive Sampling of Importance Brute-force techniques seldom are a good solution. Sometimes, they are the only way to solve a problem. This does not seem to be the case in spherical importance calculation. An alternative clever technique for spherical importance calculation should be able to use a smaller set of fixed samples and adaptively add extra samples to measure special importance contributions. The problem then becomes how to find the number of extra samples and the directions where to send them. This adaptive sampling requires some sort of criteria that should be dependent on the geometry of 3D objects and the material properties, because objects and materials tend to have large effects on the scattering of importance. Additionally, objects and materials are usually pre-defined and can be easily preprocessed. These are the main ideas behind the new technique developed and presented in this paper. In most real world 3D environments, there are a large number of objects with many different surface materials. The radiative properties of a surface material can be mathematically defined by a BSDF, a function describing how a beam of incoming irradiance is scattered into radiance rays around a point. In most real world surface materials, the angles between the incoming incident irradiance beam and each outgoing radiance ray fully determine the BSDF behaviour. Because the BSDF’s are pre-defined and each object has at least one, the 3D scene description can be analysed a priori and “irregular” BSDF’s identified. An “irregular” BSDF has some distinctive features like peak responses and / or sharp transitions. These features usually make those BSDF’s responsible for small solid angle directional phenomena like reflections, highlights, etc.

Figure 5 – Homogeneous sampling (4096 directions)

Figure 5 shows an image of 4096 “homogeneous” samples over the unit sphere, each sample being represented by a polygon (the sample is actually in the centre of the

The pre-processing step of the new adaptive sampling technique scans all the materials and only stores in a list the objects that have “irregular” BSDF’s (peaks and / or sharp transitions). For each object in the list, we keep its silhouette and define a sample density per unit solid angle, directly proportional to the “irregularity” of its BSDF.

The rationale behind this pre-processing step is that mostly diffuse objects spread any beam of irradiance uniformly around a hemisphere of directions, which contributes to the average lighting levels of the environment. Materials with “irregular” BSDF’s (non-diffuse objects) concentrate the spreading of outgoing radiance into small solid angles, which generates lighting phenomena like the ones previously mentioned. Shadows and penumbrae are automatically accounted for during the ray tracing computation and do not need to be considered in this technique.

bution, the technique starts with a fixed number of samples homogeneously spread over the sphere of directions around a point. These samples are mainly used to compute the contribution from mostly diffuse objects. (Figure 6 shows a set of 2048 “homogeneous” samples distributed over the unit sphere). Homogeneous samples

3.3 Benefits of the New Technique The CASSILDE lighting design system always tries to find an “optimal” lighting solution. This means that an effort is made to satisfy all user defined goals and constraints. Most of those goals and constraints have directional requirements, which can be largely affected by “irregular” BSDF’s. This means that objects with “irregular” BSDF’s should not be missed during spherical importance calculations, which justifies the pre-processing step and the special treatment that objects with “irregular” BSDF’s must have. As a consequence, the lighting design system will become more capable of solving difficult lighting design problems. Another benefit that comes with this new technique is the potential speed-up of spherical importance calculations. Because “special” objects (those having “irregular” BSDF’s) are explicitly processed, we can reduce the number of importance samples to measure the mostly diffuse importance contribution. This seems reasonable because those objects usually do not generate directional lighting phenomena. 4. TECHNIQUE DESCRIPTION 4.1 Pre-Processing Phase As stated before, this adaptive technique starts by analysing the objects and the materials in the 3D environment. The “special” objects are then recorded in a list. For each of these objects, the pre-processing step computes an approximated silhouette and the density of importance samples to shoot per unit solid angle. The sampling density is computed from the characteristics of the BSDF. Because the RADIANCE scene format divides BSDF’s into several basic types (plastic, metal, mirror, etc), some of those types are pre-defined as “irregular” and all objects using them are immediately considered “special” (BSDF’s like mirror, glass, etc). The remaining material types are analysed and, if some of their parameters fit into a predefined “irregularity” criteria, the BSDF is also defined as “irregular” and all objects using them also become “special” (material types like plastic, metal, etc). 4.2 Run-Time Phase During run-time, the lighting design system requires the calculation of a large number of spherical importance distributions around 3D points. To compute such a distri-

Figure 6 – Homogeneous sampling (2048 directions)

Then, it scans the list of “special” objects, one at a time, and computes how many samples to shoot directly to each object’s silhouette, storing it in a vector. The number of importance samples to shoot is defined by two factors: •

The density of samples (a positive number);



The solid angle that the silhouette subtends (converted to a value between 0 and 1).

Only the second factor needs to be computed, because it depends on the distance between the object and the point that is being processed. Multiplying these two factors gives the actual number of importance samples to shoot into the object’s direction. When the scanning is finished, the aforementioned vector contains the number of importance samples to use for each “special” object. Because the total number of desired importance samples may be prohibitively large, this vector is sorted by decreasing number of samples. Currently we set a maximum number of importance samples to shoot, so scanning the vector prioritises the objects requiring larger numbers of samples. In the end, some objects may be left out because they require very few samples – probably because they are far away from the 3D point and/or they have a not so “irregular” BSDF. Summing the fixed number and the dynamic number of importance samples to shoot, we get a number of samples that varies during run-time and is not homogeneously distributed over the unit sphere. Because of this lack of homogeneity, we cannot assume that all samples have the same weight, as we did with sets of homogeneous samples. Figure 7 shows an example of 3357 sample points over the unit sphere, corresponding to 2048 “homogeneous” and 1309 dynamic directions.

Dynamic samples

sents the processing time with the previous technique). Better results can be expected if we use a fixed number of samples smaller than Nfixed/2. All of our tests have shown that the quality of lighting solutions is the same with both techniques. The test environment used was a closed open-plan space with furniture (Figure 8) and the lighting goals were very simple – maximise the lighting conditions over the desktop of one table near the middle of room. The fixed number of importance samples was set to 2048 and the maximum was 4096.

Figure 7 – Adaptive sampling (2048-4096 directions)

The weight of each importance sample is considered to be proportional to the solid angle that each sample represents. We perform weight calculations by considering the directions as points over the surface of a sphere and finding the co-spherical Voronoi polygons3 around those points. Currently we use the qhull algorithm [Barber96] to compute the set of co-spherical Voronoi polygons. The area of each co-spherical polygon can be computed from its vertices and “edges” and that area is proportional to the subtended solid angle. Using the subtended solid angles as weights, the technique calculates all the importance values and then computes the average importance value for the particular 3D point under consideration. 5. RESULTS The lighting design system searches for the “optimal” lighting solution by trying many sets of parameters values and computing a cost function value for each set. In each iteration one or more spherical importance distributions are computed, depending on each problem specification.

Figure 8 – Test environment used

We added a variable number of small very reflective spheres near the ceiling (between 1 and 100) to make importance scattering more complex and allow a better measurement of the system’s behaviour with both techniques. We also varied the quality options in the ray tracing tool. Figure 9 shows a histogram of the dynamic samples generated during a typical run of the lighting design system (3000 iterations). The average number of dynamic samples is 1030 with a standard deviation of 176. As the fixed number of samples was 2048, the average number of samples used in spherical importance calculations was 3078 samples.

With the previous sampling technique, using Niter iterations and one spherical importance distribution calculation (Nfixed samples) per iteration may require tracing the grand total of Niter x Nfixed importance rays4.

3

4

A co-spherical polygon is a patch of the sphere’ surface delimited by at least three segments of major arcs (arcs with a radius equal to the sphere radius). There are already other acceleration techniques in the CASSILDE lighting design system, described in [Costa99].

100%

Frequency

80% 60% 40% 20% 0% 50 0 60 0 70 0 80 0 90 0 10 00 11 00 12 00 13 00 14 00 M or e

With the new technique, using Niter iterations and one spherical importance distribution calculation (between Nfixed/2 and Nfixed samples) per iteration requires tracing less than Niter x Nfixed importance rays. This theoretical speed-up can be negatively affected by the processing time required for the computation of co-spherical Voronoi polygons (see section 4.2). Depending on the number, locations and materials of the “special” objects in the 3D environment, the processing time with the new technique should vary between 50% up to near 100% (100% repre-

Histogram of Dynamic Samples

Bin

Figure 9 – Histogram of Dynamic Samples

Figure 10 shows the percentage time ratio between the new and the previous technique within the lighting design

system. This test was performed with the RADIANCE tools configured with a low number of inter-reflection calculation levels. This tends to make the ray tracing operations reasonably fast, although importance calculations may become slightly inaccurate. As the co-spherical Voronoi polygon calculations are not negligible in this situation, the resulting speed-up varies between 68% and 93%. Even in the worst case, the new technique is better than the previous one.

noi polygons is not negligible and can produce a significant overhead in the new technique. Figure 12 and Figure 13 show spherical importance distributions for a point inside the test 3D scene5. The first distribution was obtained with the previous technique (4096 samples), while the second one with the new technique (only 2991 samples). Both figures clearly show that the importance distributions are similar and capture the same incoming importance.

Spherical Importance Calculation 95

% time used

90 85 80 75 70 65 60

Figure 12 – Spherical importance distribution (Point 1, previous technique)

Figure 10 – % time ratio between the techniques (low quality importance tracing)

For the same test, Figure 11 shows that, when the tracing operations are performed with higher quality settings (large number of inter-reflection calculation levels), the performance benefits clearly increase. In this situation, the tracing operations become very time consuming and the relative performance of the new technique improves. The percentage time ratio now only varies between 65% and 76% of the previous technique and the Voronoi processing overhead looses significance.

When comparing Figure 12 with Figure 13, in the last one the density of samples is smaller in the hemispherical constant region (incoming diffuse importance), but is equivalent in the non-diffuse regions.

Spherical Importance Calculation 78 76 % time used

74 72 70 68

Figure 13 – Spherical importance distribution (Point 1, new technique)

66 64 62 60 Figure 11 – % time ratio between the techniques (high quality importance tracing)

In all performed tests, the processing times with the new technique varied between 60% and 95% of the processing times with the previous technique. Depending on the 3D point where spherical importance calculations took place, the number of importance samples varied between 2200 and 3500, approximately. The tests also showed that the processing time in the computation of co-spherical Voro-

Figure 14 and Figure 15 also show spherical importance distributions for another point inside the test 3D scene. The first distribution was produced with the previous technique (4096 samples), while the second comes from the new technique (only 3343 samples). Again, both figures essentially capture the same incoming importance. 5

Each sample is represented by a dot and the distributions are “centred” about the origin of the depicted coordinate system.

6.1 Future Work The new technique replaces brute force computation by a pre-processing step and a priori knowledge about the 3D environment that is efficiently used during run-time. We think that this approach could also be extended to diffuse objects – these objects should be analysed in another preprocessing step, looking for the ones that are closer to light sources and can act as potential “secondary” light sources (i.e., indirect light sources). During run-time, both objects with “irregular” BSDF’s and diffuse objects near light sources would be handled separately, so that their effect on importance scattering could be more accurately calculated. Figure 14 – Spherical importance distribution (Point 2, previous technique)

The comparative analysis of Figure 14 and Figure 15 also shows that the new technique tends to concentrate samples in directions where there is a significant importance variation.

The new technique can possibly be refined in several other ways: •

If there are too many importance samples to shoot, attention should be paid to all “special” objects that require a significant number of samples, not only those with larger values – scaling down the required number of samples per object in some clever way could be advantageous and improve the new technique.



Improving the algorithm that calculates the areas of co-spherical polygons should also be addressed – although we are currently using the well-known and validated qhull code [Barber96], we think that this algorithm can be further optimised for 3D, which may result in considerable time savings.



The naïve method we use for silhouette computation can also be improved by using hardware-assisted techniques (zbuffer, etc); the benefits could be the better sampling of “special” objects and some additional speed-up.



Including diffuse objects near light sources in a preprocessing phase will probably increase the usefulness of the “special” objects’ list. Another enhancement is the detection, during run-time, of “relevant” objects and their addition to the list – “relevant” objects are those objects that scatter significantly high levels of importance and are missed in the preprocessing detection; these objects are only detectable while performing importance scattering calculations and only during run-time can be added to the list. We foresee the use of some RADIANCE internal lighting information to implement this additional list management.

Figure 15 – Spherical importance distribution (Point 2, new technique)

6. CONCLUSIONS AND FUTURE WORK In this paper we described an alternative technique for the computation of spherical importance distributions around 3D points. This technique can also be used with radiance instead of importance, because they are dual entities. By doing a pre-processing step on the objects and materials, the new technique is able to identify “irregular” BSDF’s and the objects that use them. These “special” objects are usually responsible for relevant lighting phenomena, which a lighting design system should always be aware of. Because the “special” objects are handled separately, the remaining objects can be traced with fewer samples. These remaining objects tend to be mostly diffuse and usually do not generate directional lighting phenomena. The preliminary results confirm the initial expectations. The major overhead in the new technique is due to the computation of co-spherical Voronoi polygons, currently performed with external software. Even so, we think that this new technique has a great potential for improvements.

7. REFERENCES [Barber96] Barber, C.; Dobkin, D.; Huhdanpaa, H.; The QuickHull Algorithm for Convex Hulls; ACM Trans. on Mathematical Software, vol. 22, pages 469-483; ACM 1996. [Costa99] Costa, A.; Sousa, A.; Ferreira, F.; Lighting Design: A Goal Based Approach Using Optimisation – Rendering Techniques ‘99, pages 317-328; Springer-Verlag 1999.

[Costa01] Conference “Design de Iluminação Apoiado por Computador”, Secção Regional do Sul da Ordem de Arquitectos Portugueses, November 2001, Lisbon. [Kawai93] Kawai, J.K.; Painter, J.S.; Cohen, M.F.; Radioptimization – Goal Based Rendering – COMPUTER GRAPHICS Proceedings, pages 147-154; SIGGRAPH 1993. [Marks97] Marks, J; Andalman, B.; Beardlsey, P.A.; Freeman, W.; Gibson, S.; Hodgins, J.; Kang, T.; Design Galleries: A General Approach to Setting Parameters for Computer Graphics and Animation – COMPUTER GRAPHICS Proceedings, pages 389-400; SIGGRAPH 1997. [Pouli97] Poulin, P.; Ratib, K.; Jacques, M.; Sketching Shadows and Highlights to Position Lights – Proceedings of Computer Graphics International 97, pages 56-63, 1997.

[Saff97] Saff, E.B.; Kuijlaars, A. J.; Distributing Many Points on a Sphere; The Mathematical Intelligencer, 19(1); 1997. [Schoe93] Schoeneman, C.; Dorsey, J.; Smits, B.; Arvo, J.; Greenberg, D.; Painting with Light – COMPUTER GRAPHICS Proceedings, pages 143-146; SIGGRAPH 1993. [Shacked01] Shacked, R.; Lischinski, D.; Automatic Lighting Design using a Perceptual Quality Metric; EUROGRAPHICS Proceedings; EUROGRAPHICS 2001. [Veach97] Veach, E.; Robust Monte Carlo Methods for Light Transport Simulation; PhD Thesis, Stanford University; 1997. [Ward94] Ward, G.J.; The Radiance Lighting Simulation and Rendering System; COMPUTER GRAPHICS Proceedings, pages 459-472; SIGGRAPH 1994.