Outdoor Light Scattering Sample Update

This release updates the previously published Outdoor Light Scattering sample. Specifically, the following new features are implemented:

  • Multiple scattering of sun light in the atmosphere
    • Multiple scattering has subtle effect during the day time, but makes the sky look much more natural
    • During the twilight, multiple scattering has higher importance (see figures below) add improves realism significantly 
  • Faster method for rendering light shafts using pre-computed look-up table
    • Since sky radiance is pre-computed for all possible locations and directions, this new method do not perform numerical integration of air light integral, but only computes total length of the illuminated ray region and distance to the first lit section. Two look-ups into scattering look-up table are then performed
  • Improved shaders for rendering Earth surface using correct sun light extinction and pre-computed ambient skylight look-up table.
    • The new shaders compute sun light extinction due to the atmosphere for each vertex of the Earth mesh. They also use pre-computed ambient skylight texture to estimate ambient light for the given sun position
  • Better tone mapping
    • The sample implements a number of different tone mapping operators that perform better HDR to LDR conversion

Full sample source code can be downloaded from here. It is also available on GitHub. This document thoroughly describes all the new features.

This is how twilight sky looks with single scattering only:

 single scattering

Multple scattering makes it look more realistic:

 multiple scattering

For more complete information about compiler optimizations, see our Optimization Notice.


Hanyou Y.'s picture

Lighting inscattering include Rayleigh scattering and Mie scattering, but what is light inscattering value?

I set the n steps are 7. In compute inscattering step, i gained the lighting inscattering result  is about (0.002, 0.005, 0.012). Is this correct?

light inscattering add extinction, and the value is 1? I gained the value is about (0.94, 0.89, 0.77).

Bit B.'s picture

The project does not compile as there are 79 errors. Here are just a few:

Error    59    error C2146: syntax error : missing ';' before identifier 'PixelFormat'    c:\program files (x86)\windows kits\8.1\include\um\wincodec.h    943    1    OutdoorLightScatteringSample

Error    60    error C4430: missing type specifier - int assumed. Note: C++ does not support default-int    c:\program files (x86)\windows kits\8.1\include\um\wincodec.h    943    1    OutdoorLightScatteringSample

Error    264    error C2065: 'mRefCount' : undeclared identifier    c:\codes master\unity\outdoorlightscattering-master\cput\cput\cputrefcount.h    33    1    CPUT-DX11

Error    266    error C2065: 'UINT' : undeclared identifier    c:\codes master\unity\outdoorlightscattering-master\cput\cput\cputrefcount.h    37    1    CPUT-DX11

Any idea how to fix this?

The problem was caused by an improper DirectX SDK installation.


Add a Comment

Have a technical question? Visit our forums. Have site or software product issues? Contact support.