--- /dev/null
+#ifndef MSP_GL_SKY_H_
+#define MSP_GL_SKY_H_
+
+#include "effect.h"
+#include "framebuffer.h"
+#include "programdata.h"
+#include "texture2d.h"
+
+namespace Msp {
+namespace GL {
+
+class Mesh;
+class Light;
+class Program;
+
+/**
+Renders a procedurally generated sky at the background. Based on the paper
+"A Scalable and Production Ready Sky and Atmosphere Rendering Technique" by
+Sébastien Hillaire (https://sebh.github.io/publications/egsr2020.pdf).
+*/
+class Sky: public Effect
+{
+public:
+ struct Planet
+ {
+ Color rayleigh_scatter;
+ Color mie_scatter;
+ Color mie_absorb;
+ Color ozone_absorb;
+ float rayleigh_density_decay;
+ float mie_density_decay;
+ float ozone_band_center;
+ float ozone_band_extent;
+ float atmosphere_thickness;
+ float planet_radius;
+ Color ground_albedo;
+
+ Planet();
+
+ static Planet earth();
+ };
+
+private:
+ const Light &sun;
+ Texture2D transmittance_lookup;
+ const Program &transmittance_shprog;
+ Framebuffer transmittance_fbo;
+ bool transmittance_lookup_dirty;
+ Texture2D distant;
+ const Program &distant_shprog;
+ Framebuffer distant_fbo;
+ const Mesh &fullscreen_mesh;
+ const Program &backdrop_shprog;
+ const Sampler &sampler;
+ const Sampler &wrap_sampler;
+ mutable ProgramData shdata;
+ bool rendered;
+
+public:
+ Sky(Resources &, Renderable &, const Light &);
+
+ void set_planet(const Planet &);
+ void set_view_height(float);
+
+ virtual void setup_frame(Renderer &);
+ virtual void finish_frame();
+ virtual void render(Renderer &, Tag = Tag()) const;
+};
+
+} // namespace GL
+} // namespace Msp
+
+#endif