skylight to enhance outdoor scenes 02564 real time
play

Skylight to enhance outdoor scenes 02564 Real-Time Graphics - PowerPoint PPT Presentation

Skylight to enhance outdoor scenes 02564 Real-Time Graphics Skylight and irradiance environment maps Jeppe Revall Frisvad March 2016 Esplanade, Saint Clair, Dunedin, New Zealand: -45.9121, 170.4893 Kamaole Beach Park II, Maui, Hawaii, USA:


  1. Skylight to enhance outdoor scenes 02564 Real-Time Graphics Skylight and irradiance environment maps Jeppe Revall Frisvad March 2016 Esplanade, Saint Clair, Dunedin, New Zealand: -45.9121, 170.4893 Kamaole Beach Park II, Maui, Hawaii, USA: 20.717, -156.447 The atmosphere Rayleigh scattering ◮ Quote from Lord Rayleigh [On the light from the sky, its polarization and colour. Philosophical Magazine 41 , pp. 107–120, 274–279, 1871] : If I represent the intensity of the primary light after traversing a thickness x of the turbid medium, we have dI = − kI λ − 4 dx , where k is a constant independent of λ . On integration, I = I 0 e − k λ − 4 x , Reference - Bel´ em, A. L. Modeling Physical and Biological Processes in Antarctic Sea Ice. PhD Thesis, Fachbereich Biologie/Chemie der Universit¨ at if I 0 correspond to x = 0 , —a law altogether similar to that of absorption, and showing how the light tends to become yellow and Bremen, February 2002. finally red as the thickness of the medium increases.

  2. Solar radiation Colorimetry - - XYZ gamut — RGB gamut — CRT/LCD monitor gamut CIE color matching functions The chromaticity diagram � R = C ( λ )¯ r ( λ ) d λ V � G = C ( λ )¯ g ( λ ) d λ V � C ( λ )¯ B = b ( λ ) d λ , V where V is the interval of visible wavelengths and C ( λ ) is the spectrum that we want to transform to RGB. [Source: http://en.wikipedia.org/wiki/Sunlight] Gamut mapping Dynamic range ◮ Gamut mapping is mapping one tristimulus color space to another. ◮ Ambient luminance levels for some common lighting environments: ◮ Gamut mapping is a linear transformation. Example: Illumination (cd/m 2 )       Condition X 0 . 4124 0 . 3576 0 . 1805 R  . = 0 . 2126 0 . 7152 0 . 0722 Y G 10 − 3 Starlight      0 . 0193 0 . 1192 0 . 9505 Z B 10 − 1 Moonlight 10 2 Indoor lighting    3 . 2405 − 1 . 5371 − 0 . 4985    R X 10 5 Sunlight G = − 0 . 9693 1 . 8760 0 . 0416 Y       B 0 . 0556 − 0 . 2040 1 . 0572 Z 10 2 Maximum intensity of common monitors ◮ Y in the XYZ color space is called luminance . ◮ Luminance is a measure of how bright a scene appears. Reference ◮ From the linear transformation above, we have - Reinhard, E., Ward, G., Pattanaik, S., Debevec, P., Heidrich, W., and Myszkowski, K. High Dynamic Range Imaging: Acquisition, Display and Image-Based Lighting, second edition, Morgan Kaufmann/Elsevier, 2010. Y = 0 . 2126 R + 0 . 7152 G + 0 . 0722 B .

  3. Tone mapping Analytical sky models [Preetham et al. 1999] (input parameters) ◮ Simplistic tone mapping: scale and gamma correct: � ( sR ) 1 /γ , ( sG ) 1 /γ , ( sB ) 1 /γ � ( R ′ , G ′ , B ′ ) = , where s and γ are user-defined parameters. ◮ The framework uses s = 0 . 025 (and γ = 1) for the sun and sky. ◮ Another tone mapping operator (Ferschin’s exponential mapping): � (1 − e − R ) 1 /γ , (1 − e − G ) 1 /γ , (1 − e − B ) 1 /γ � ◮ Solar declination angle: ( R ′ , G ′ , B ′ ) = . � 2 π ( J − 81) � δ = 0 . 4093 sin . 368 ◮ This is useful for avoiding overexposed pixels. ◮ Solar position: π sin ℓ sin δ − cos ℓ cos δ cos π t � � = 2 − arcsin θ s , ◮ Other tone mapping operators use sigmoid functions based on the luminance 12 − cos δ sin π t levels in the scene [Reinhard et al. 2010]. � � 12 φ s = arctan , cos ℓ sin δ − sin ℓ cos δ cos π t 12 where J ∈ [1 , 365] is Julian day, t is solar time, and ℓ is latitude. Direct sunlight Skylight ◮ Environment mapping: Map an omnidirectional image onto everything surrounding the scene. ◮ Cube mapping: Use a direction to perform look-ups into an omnidirectional image ◮ Assume the Sun is a diffuse emitter of total power Φ = 3 . 91 · 10 26 W and surface consisting of six texture images area A = 6 . 07 · 10 18 m 2 . (square resolution, 90 ◦ field of view). ◮ Radiance from the Sun to the Earth: L = π A ≈ 2 . 05 · 10 7 Φ W m 2 sr . ◮ We use Preetham’s analytical model ◮ Assume the Sun is in zenith and at a distance to the Earth of r = 1 . 5 · 10 11 m. to precompute a sky cube map. ◮ The solid angle subtended by the Sun as seen from Earth: ◮ Look-ups then return the radiance 4 r 2 ≈ 6 . 74 · 10 − 5 sr. ω = A s A r 2 = L sky ( � ω ) received from the sky when looking in the direction � ω . ◮ Energy received in a 1 × 1 m 2 patch of Earth atmosphere: E = L ω ≈ 1383 W m 2 . ◮ A directional source with its color set to the solar irradiance at Earth will deliver the same energy in a square meter.

  4. Precomputing a cube map Environment mapping +y -z We precompute by storing L sky ( � v ijk ) in the -x +x texel at index i , j of face k . +z � � � � 2 i 2 j -y Folded + � v ijk = � � a k + � u k res − 1 b k res − 1 , +x where the faces are numbered from 0 to Top 5 and ordered as follows: left, right, top, +z ◮ Reflective environment mapping: bottom, front, back +z +x -z -x p e � � ◮ � � r = � n · � a k is the major axis direction of face k , i = , � i − 2 � n . � i R ight Front Left Back � p e � -y -y -y -y ◮ � u k is the up direction of face k , and ◮ We need world space directions when looking up in a cube map. ◮ � b k is the right direction of face k . +x Bottom 3 × 3 � Unfolded V − 1 � � � r w = r , -z where V is the view matrix and A 3 × 3 takes the upper left 3 × 3 part of A . Environment mapping - filling the background The Rendering Equation Object World Eye Model View ◮ When rendering surfaces, the equation we try to evaluate is [Kajiya 1986] � ω ′ ) cos θ d ω ′ , ω ′ , � L o ( x , � ω ) = L e ( x , � ω ) + f r ( x , � ω ) L i ( x , � Projection 2 π Normalized Clip Window ◮ where device W divide Viewport L o is outgoing radiance, L e is emitted radiance, L i is incoming radiance, x is a surface position, ◮ Given window space pixel coordinates x p , y p find the direction from the eye to the � ω is the direction of the light, corresponding point on the image plane. ω ′ is the direction toward the light source, � 2 x p f r is the bidirectional reflectance distribution function (BRDF), 0 W − 1     d ω ′ is an element of solid angle, 3 × 3 2 y p V − 1 � � 0 H − 1  P − 1 p n �     ω ′ and the surface normal � ω ′ · � i w = , p n =  . θ is the angle between � n at x , such that cos θ = � n .     0 0   References 0 0 0 0 1 - Kajiya, J. The Rendering Equation. Computer Graphics (Proceedings of ACM SIGGRAPH 86) 20 (4), pp. 143–150, 1986. ◮ Note that depth is unimportant as � i w is the direction of an eye ray.

  5. Splitting the evaluation Sky irradiance E sky and ambient occlusion A ◮ Excluding direct sunlight from L i , we have ◮ Distinguishing between: � ω ′ , � ◮ Direct illumination L direct . L indirect ( x , � ω o ) = f r ( x , � ω ) L i ( x , � ω i )( � n · � ω i ) d ω i 2 π ◮ Light reaching a surface directly from the source. ρ d � ◮ Indirect illumination L indirect . = V ( x , � ω i ) L sky ( � ω i )( � n · � ω i ) d ω i + ρ s V ( x ,� r ) L sky ( � r w ) , π ◮ Light reaching a surface after at least one bounce. 2 π where ◮ The rendering equation is then ◮ L i ( x , � ω i ) = V ( x , � ω i ) L sky ( � ω i ) is incident skylight, ◮ f r ( x , � ω ′ , � ω ) = ρ d /π is the BRDF of perfectly diffuse (Lambertian) materials, ◮ ρ d is the diffuse reflectance (diffuse color), and L = L e + L direct + L indirect . ◮ ρ s is the specular reflectance. ◮ L e is emission. ◮ The remaining integral is called the irradiance E , and ◮ L direct is sampling of lights. � ◮ L indirect is sampling of the BRDF excluding lights. E ( x , � n ) = V ( x , � ω i ) L sky ( � ω i )( � n · � ω i ) d ω i 2 π 1 � � ◮ In a real-time skylight setting: ≈ V ( x , � ω i )( � n · � ω i ) d ω i L sky ( � ω i )( � n · � ω i ) d ω i π ◮ L direct is direct sunlight (using the Phong illumination model without ambient). 2 π Ω ◮ L indirect is integrated skylight and specular reflection of the sky. = A ( x ) E sky ( � n ) . Integrating skylight Irradiance environment map ◮ The sky irradiance integral (neglecting visibility): � E sky ( � n ) = L sky ( � ω i )( � n · � ω i ) d ω i . 2 π ◮ Monte Carlo estimator: N L sky ( � ω i , j )( � n · � ω i , j ) n ) = 1 � E sky , N ( � . pdf( � ω i , j ) N j =1 skylight to sky irradiance ω i , j ) = � n · � ω i , j ◮ A good choice of pdf would be pdf( � π . ◮ Precompute cube map on the GPU using layered rendering and sampling. ◮ We sample � ω i , j on a cosine-weighted hemisphere using ◮ In the geometry shader (integrator.geom): (cos − 1 � ◮ emit triangle vertices to each cube map face using a loop and gl Layer . ( θ i , φ i ) = 1 − ξ 1 , 2 πξ 2 ) , ξ 1 , ξ 2 ∈ [0 , 1) (random numbers) ◮ In the fragment shader (integrator.frag): ( x , y , z ) = (cos φ i sin θ i , sin φ i sin θ i , cos θ i ) ◮ implement the cosine-weighted sampling of the skylight with � n = � v ijk 1 − n 2   x / (1 + n z )   − n x n y / (1 + n z )     n x (use rnd(t) to get a random number).  + y  + z  . 1 − n 2 ω i , j � = − n x n y / (1 + n z ) y / (1 + n z )  x n y     ◮ The framework progressively improves the sky irradiance map using these shaders. − n x − n y n z

Recommend


More recommend