Presentation is loading. Please wait.

Presentation is loading. Please wait.

Dynamic Sky Dome GDC March 2nd, 2011 by Igor Lobanchikov

Similar presentations


Presentation on theme: "Dynamic Sky Dome GDC March 2nd, 2011 by Igor Lobanchikov"— Presentation transcript:

1 Dynamic Sky Dome GDC March 2nd, 2011 by Igor Lobanchikov

2 Agenda Dynamic Sky Dome lighting model Dynamic clouds rendering
Introduction into rendering equation Fog integration Sun shafts Dynamic clouds rendering Bonus trick Making dynamic – static ?????

3 Effects to Achieve Rayley scattering Mie scattering
High chromatic dependency Reyley model – wavelength >> particle size. Light is only scattered. Works for air molecules. Shorter wavelenth blue light scatters more than longer wavekength green and red which makes the sky blue. * Mie model – wavelength <= 2πr (Prticle size). Light is both scattered and absorbed. Works for mist, smoke, dust and so on. Occurs mostly in the lower part of the atmosphere, where aerosols are mostly concentrated. © David Iliff Mie scattering Achromatic

4 Sky Dome Rendering History
[PSS99][HP03][O’N05] Single scattering only Or viewable from ground only Or all of the above Or not real-time Atmospheric light scattering is complex phenomena. Hard to model, hard to calculate. Different model simplifications are used to make it real-time.

5 Current Approach Multiple scattering Aerial perspective
Viewable from space LUTs are pre-computed on GPU

6 L(x,v,s)=(L0+R[L]+S[L])(x,v,s)
Rendering Equation L(x,v,s)=(L0+R[L]+S[L])(x,v,s) x – position, v – view direction, s – sun direction Final lighting includes: L0 – attenuated direct sun light R[L] – light reflected at point (x0) and attenuated S[L] – light scattered toward the viewer between x and x0 Usually computed by numerical integration

7 Direct Sun Light L0(x,v,s)=T(x,x0)Lsun, or 0
Direct sunlight attenuated by the transmittance function T(x,x0) before reaching viewer at x Accounts for occlusion by the horizon Smooth shadow transition to hide sharp border on the clouds L0 eazily can be generalized to include all direct light coming from extra-terrestrial objects we see – light coming from the moon, stars, nebulas, etc..

8 R[L](x,v,s)=T(x,x0)I[L](x0,s)
Reflected Light R[L](x,v,s)=T(x,x0)I[L](x0,s) Light reflected at x0 and attenuated by transmittance towards x I[L] == 0 at the top atmosphere boundary This stands for the light coming from solid and transparent objects such as clouds, ground, etc.. Additionally this should include illumination from sun and other light sources. Direct illumination is approximated using common techniques – general dynamic lighting with shadowmaps or other shadowing techniques.

9 S[L](x,v,s)=∫T(x,y)J[L](y,v,s)dy
Inscattered Light x0 S[L](x,v,s)=∫T(x,y)J[L](y,v,s)dy x Light scattered between x and x0 toward x The very essence of visible sky color.

10 Look-up Tables (LUT) Re-parametrise functions and store them in LUT
Pre-compute LUTs on GPU Transmittance (r, μ) Irradiance (r, μS) Inscatter (r, μ, μS, ν) Terms which need numerical integration and don’t have high spatial frequency details as direct lighting does are put into LUTs. Re-parametrisation is used to lower both lighting equation parameter space dimensions and LUT size. GPU is used to speed up LUT pre-computation. Still can’t do it real-time – too costly for that. But computational time is short.

11 View from Space Realistic atmosphere with fictional space objects.

12 Simple Fog vs Inscatter
Fast Change parameters in real time Accounts for transmittance only Looks fine Slower Precompute Accounts for transmittance and inscatter Extremely realistic Fog both scatters (and extincts) light coming from solid and transparent objects and inscatters light coming from all other directions.

13 Inscatter

14 Sun shafts Use industry-standard mask generation Radial blur it
Modulate inscattered light with the mask Cheap, known, works for all types of geometry Sun shafts effect is a scattered light coming from the sun shaped by the objects which occlude this light. Our approximation is far from being physically correct, but it delivers eye-pleasing results.

15 Sun shafts

16 Clouds Need volumetric realistically looking clouds
Use group of particles to represent a single cloud Use the same lighting equation to blend nicely into the sky Use impostors to save on expensive per-pixel lighting computations Most current techniques simulate time-of-the-day lighting conditions for the clouds using artists-defined data. This data is per time of the day. While it gives good results, data doesn’t varies spatially, which allows much space for improvements. Using the same lighting equation naturally gives us spatially-dependant lighting conditions. Difference is especially noticeable at dawn at sunset time.

17 Clouds lighting Need x0 to apply lighting equation
Use world-space impostor’s pixel position Apply inscattered light and irradiance as to a regular object. To simulate sun direct light scattering use similar to [WENZEL07] technique March in sun direction in impostor space to accumulate light extinction factor to attenuate sun light Add rim light to simulate scattering on the cloud’s edge

18 Clouds lighting

19 Impostor Pixel Position
Special lighting conditions at dawns and sun sets. The sun light is partially blocked by the Earth resulting in shadow running on the cloud.

20 Impostor Pixel Position
Need better pixel position reconstruction: Sun shadow is a crisp horizontal line Can’t pack a group of clouds into a single impostor or have a very large cloud Simple position reconstruction reveals the flat nature of the impostor.

21 Impostor Pixel Position
Accumulate impostor-space linear depth per pixel Simple min doesn’t work well – must account for transparency, linear interpolation problem on borders Simple additive blend doesn’t work – depth on cloud edges blend with impostor clear depth value We could use another position reconstruction technique – assumption about cloud form could allow us to use analytical method to reconstruct position. Won’t work for arbitrary cloud or packed into a single impostor cloud group.

22 Impostor Pixel Position
Min blend Additive blend Min blend behaves really bad for light transparent particle interleaves opaque particle situation additive blend fails when light and transparent particle interleaves clear sky.

23 Impostor Pixel Position
Store both accumulated depth and normalization weight DepthAcc = OldDepthAcc*(1-newDepthWeight) + NewDepth*NewDepthWeight DepthWeightAcc=OldDepthWeightAcc*(1-newDepthWeight) + NewDepthWeight Final depth = DepthAcc/DepthWeightAcc Use particle transparency as DepthWeight => Need 2 FP16 channels to store both impostor depth and density Linear interpolation is not linear anymore, but it is monotonous and works Have two more spare channels – store normal or per-particle ambient occlusion for more sophisticated lighting? This method is a simple weighted sum. The trick is how the weight is calculated. If initial DepthWeightAcc is set to 1 we get common additive blending. Linear interpolation won’t fail on particle edges – it will deliver exact value until DepthAcc will become too small which anyway results into transparent pixel.

24 Impostor Pixel Position

25 Impostor Pixel Position

26 Polarization Sky light is polarized
Max polarization at view-sun angle == 900 Min polarization at view-sun angle == 00 and 1800 Simulate effect of camera with polarized filter attached to add more contrast and depth to the scene * Mimics what we got used to see on photos.

27 Polarization ON OFF To emphasize effect completely physically incorrect polarization intensity dependency was used. Commonly used approximation doesn’t work well in our situation.

28 Questions ?

29 Reference [PSS99]Preetham, A. J., Shirley, P., and Smits., B. E.: A Practical Analytic Model for Daylight. In Siggraph 1999, Computer Graphics Proceedings (Los Angeles, 1999), Rockwood A., (Ed.), Addison Wesley Longman, pp. 91–100. [HP03] Hoffman, N., and Preetham, A. J.: Real-time Light-Atmosphere Interactions for outdoor scenes. Graphics Programming Methods (2003), pp. 337–352. [O’N05] O’NEIL S.: Accurate atmospheric scattering. In GPU Gems 2: Programming Techniques for High-Performance Graphics and General-Purpose Computation (2005), Addison-Wesley Professional. [BrunetonNeyret2008] Bruneton, E. and Neyret, F Precomputed Atmospheric Scattering. EGSR Computer Graphics Forum, 27(4), June 2008, pp [WENZEL07] WENZEL C Real-time Atmospheric Effects in Games Revisited. Conference Session. GDC March 5-9, 2007, San Francisco, CA.


Download ppt "Dynamic Sky Dome GDC March 2nd, 2011 by Igor Lobanchikov"

Similar presentations


Ads by Google