5 #include "programdata.h"
6 #include "rendertarget.h"
11 class DirectionalLight;
16 Renders a procedurally generated sky at the background. Based on the paper
17 "A Scalable and Production Ready Sky and Atmosphere Rendering Technique" by
18 Sébastien Hillaire (https://sebh.github.io/publications/egsr2020.pdf).
20 class Sky: public Effect
25 Color rayleigh_scatter;
29 float rayleigh_density_decay;
30 float mie_density_decay;
31 float ozone_band_center;
32 float ozone_band_extent;
33 float atmosphere_thickness;
39 static Planet earth();
42 struct Template: Effect::Template
44 class Loader: public DataFile::DerivedObjectLoader<Template, Effect::Template::Loader>
47 static ActionMap shared_actions;
50 Loader(Template &, Collection &);
52 virtual void init_actions();
55 DirectionalLight *sun = 0;
57 virtual Sky *create(const std::map<std::string, Renderable *> &) const;
62 DirectionalLight &sun;
63 RenderTarget transmittance_lookup;
64 const Program &transmittance_shprog;
65 bool transmittance_lookup_dirty;
67 const Program &distant_shprog;
68 const Mesh &fullscreen_mesh;
69 const Program &backdrop_shprog;
70 const Sampler &sampler;
71 const Sampler &wrap_sampler;
72 mutable ProgramData shdata;
77 Sky(Renderable &, DirectionalLight &);
79 void set_planet(const Planet &);
80 void set_view_height(float);
82 Color get_transmittance(const Vector3 &);
84 virtual void setup_frame(Renderer &);
85 virtual void finish_frame();
86 virtual void render(Renderer &, Tag = Tag()) const;
88 virtual void set_debug_name(const std::string &);