Stratified Sampling of Projected Spherical Caps
Total Page:16
File Type:pdf, Size:1020Kb
Eurographics Symposium on Rendering 2018 Volume 37 (2018), Number 4 T. Hachisuka and W. Jakob (Guest Editors) Stratified Sampling of Projected Spherical Caps Carlos Ureña1 Iliyan Georgiev2 1Universidad de Granada 2Solid Angle Abstract We present a method for uniformly sampling points inside the projection of a spherical cap onto a plane through the sphere’s center. To achieve this, we devise two novel area-preserving mappings from the unit square to this projection, which is often an ellipse but generally has a more complex shape. Our maps allow for low-variance rendering of direct illumination from finite and infinite (e.g. sun-like) spherical light sources by sampling their projected solid angle in a stratified manner. We discuss the practical implementation of our maps and show significant quality improvement over traditional uniform spherical cap sampling in a production renderer. CCS Concepts •Computing methodologies ! Rendering; Ray tracing; Visibility; 1. Introduction it involves first computing and then uniformly sampling this pro- A key ingredient in achieving visual realism in computer-generated jection. Even if the solid angle has a simple shape, e.g. a spherical images is the use of soft illumination from area light sources. cap for a spherical light, the shape of its projection onto the tan- Spherical luminaires are commonly utilized in modern production gent plane is not necessarily simple too. For a spherical triangle, rendering as a substitute for classical point lights to provide both Ureña [Un00] proposed to adaptively subdivide its projection into smooth lighting and soft shadows. When placed at infinity, such smaller triangles with nearly constant cosine and then uniformly lights can also simulate directional illumination form the sun. sample their solid angle [Arv95]. Recent work on spherical cap preserving transformations on the sphere [DHB17] provides an ap- Monte Carlo integration is the standard method for estimating proximate method for producing samples distributed according to the illumination from an area light source at a point [SWZ96, projected area (clamped cosine distribution) in an arbitrary spher- PJH16]. This involves sampling the radiance contribution from di- ical cap. To our knowledge, the only existing stratified exact solid rections inside the solid angle subtended by the luminaire. Do- angle sampling technique is that of Arvo [Arv01] for polygonal ing that accurately is crucial for minimizing the amount of noise light sources. Sampling the projection of a solid angle is gener- in the rendered image. A good strategy is to distribute the direc- ally more computationally expensive than sampling the solid angle. tions uniformly inside the subtended solid angle by transforming However, in most practical scenes, where the sample contribution stratified canonical unit-square sample points. This requires devis- evaluation is orders of magnitude more costly than the sample gen- ing a specialized mapping for each type of light source. Spherical eration, the resulting lower variance improves the overall efficiency. lights have been among the first to be addressed as their solid an- gle is a simple spherical cap [Wan92]. To facilitate stratification In this paper, we present practical techniques for projected solid and improve sampling quality, area-preserving solid angle maps angle sampling of spherical light sources. To this end, we devise have been developed for triangles [Arv95] and rectangles [UFK13]. two analytical area-preserving maps from the unit square to the pro- Gamito [Gam16] proposed a method for cylindrical and disk lumi- jection of a spherical cap at a surface point (see Figure1). Our maps naires based on bounding their solid angle by simpler shapes fol- ∗ can be used to warp stratified points on the unit square into stratified lowed by rejection sampling. Recently, Guillén et al. [GUnK 17] points on that projection, whose shape is often an ellipse but is gen- derived analytical parameterizations of the solid angle of disks. erally more complex. Besides allowing for sampling only the visi- When the shading point is on a surface, an even more efficient ble parts of the sphere, our maps are continuous under continuous strategy is to importance sample the cosine illumination foreshort- change in the sphere’s position relative to the shading point, which ening term. According to the Nusselt analog [CWH93, p. 80], doing prevents noise discontinuities in the rendered image. We discuss this is equivalent to sampling points uniformly inside the projection the efficient practical implementation of our method and demon- of the solid angle on the shading point’s tangent plane. Unfortu- strate the efficiency improvement it brings over uniform spherical nately, this is hard to achieve for an arbitrary-shaped luminaire as cap sampling in the Arnold production renderer. c 2018 The Author(s) Computer Graphics Forum c 2018 The Eurographics Association and John Wiley & Sons Ltd. Published by John Wiley & Sons Ltd. C. Ureña & I. Georgiev / Stratified Sampling of Projected Spherical Caps ~z 2. Problem statement a C c w Our goal is to compute the outgoing radiance at a surface point x ~y b in direction wo due to scattered direct illumination from a sphere- x w shaped light source S. This radiance is given by an integral over C? ~x the spherical cap C subtended by the light source at x: ? Z Figure 1: A spherical cap C (blue) and its projection C (red) on Lo(x;wo) = Li(x;w) fs(x;wo;w)jcosqjds(w); (1) the tangent plane, parameterized in a reference frame aligned with C the surface normal and the cap center. The shape of C? can be an where Li(x;w) is the incident radiance at x from direction w, and fs ellipse (left), the union of an ellipse and a lune (middle), or just is the bidirectional scattering distribution function (BSDF) describ- a lune (right), respectively when C is entirely above the horizon, ing the scattering properties at x. The term jcosqj accounts for the mostly above the horizon, or mostly below the horizon. light foreshortening effect at grazing angles q between w and the surface normal at x, and ds is the differential solid angle measure. Monte Carlo estimation of Equation (1) using N sample direc- 2.2. Overview tions wi has the following form: N The radiance estimator (5) uses the Nusselt analog to reduce the 1 Li(x;wi) fs(x;wi;wo)jcosqj Lo(x;wo) ≈ : (2) task of sampling cosine-distributed directions w on the spherical N ∑ p(w ) i=1 i cap C to the task of sampling uniform points w on its tangent-plane Traditionally, uniform solid angle sampling is used to generate di- projection C? (see Figure1, middle). This can in turn be achieved rections with a constant pdf p(wi) = 1=s(C) inside the spherical by using an area-preserving mapping to transform stratified unit- cap C. This technique is easy to implement [Wan92, SWZ96] but square sample points to stratified points in C?. We devise two such can cause high variance in the radiance estimator (2), especially maps that differ in the way they parameterize the area of C?. when the light source illuminates the point x from a grazing angle. Given a point (s;t) 2 [0;1]2, the idea of both our maps is to first find a line segment that cuts a portion of C? with area tA(C?) and 2.1. Stratified projected solid angle sampling then to sample a distance along that segment using s. Our parallel map cuts slices of C? enclosed between two parallel lines, and our While the incident radiance L and BSDF fs are scene- and i ? position-dependent, the cosine foreshortening is always the same. It radial map cuts sectors of C by sweeping a radial line about its is therefore sensible to importance sample this term when estimat- center. ing Equation (1), i.e. to factor it in the sample distribution. To this The remainder of the paper is organized as follows. In the fol- end, we first express the direction w as a function of its projection lowing Section3 we compute the geometry of the spherical cap C w on the tangent plane at x. It holds that dA(w)=ds(w) = jcosqj, and its projection C?. We then present our area-preserving maps in where dA is the differential area measure. We then make a change Section4. In Section5, we discuss the practical implementation of of variable in Equation (1) to write it as an integral over the projec- our maps and compare their sampling qualities against traditional ? tion C of the spherical cap: uniform spherical cap sampling. We draw final conclusions and dis- Z cuss future work in Section6. Lo(x;wo)= Li(x;w(w)) fs(x;wo;w(w))dA(w) (3) C? Z = Li(x;w(w(s;t))) fs(x;wo;w(w(s;t)))Jw(s;t)dsdt: 3. Geometric configuration [0;1]2 (4) In this section we take the first step toward deriving our maps, In Equation (4) we make an additional change of variable to express which is to choose a reference frame and parameterize the geom- ? point w 2 C? as a function of a point (s;t) on the unit square [0;1]2. etry of the spherical cap C and its projection C in it. These are illustrated in Figures1 and2. In this paper we seek to devise mappings from the unit square to the projected spherical cap C? that have a constant Jacobian ? Jw(s;t) = A(C ). This property preserves relative areas from one 3.1. Spherical cap domain to the other, which allows for easy stratification by using Given a surface shading point x with normal vector n and a spher- jittered or low-discrepancy unit-square patterns.