29 double baseX = 0.0, baseY = 0.0;
30 double detailX = 0.0, detailY = 0.0;
45 static constexpr int kSize = 256;
53 CloudLayer(std::uint32_t seed,
double cover,
double altitude = 1500.0,
double thickness = 1.0,
int size =
kSize);
56 const std::vector<float>&
Texels()
const {
return m_texels; }
59 int Size()
const {
return m_size; }
61 double Cover()
const {
return m_cover; }
62 double Altitude()
const {
return m_altitude; }
74 double MaxOpticalDepth()
const {
return m_thickness * (2.0 + 30.0 * m_cover * m_cover); }
76 double DepthWidth()
const {
return 0.3 + 0.5 * m_cover * m_cover; }
99 double Lookup(
int c,
double u,
double v)
const;
102 double m_softness = 0.12;
106 double m_threshold = 0.0;
107 double m_meanTransmittance = 1.0;
108 double m_covered = 0.0;
109 std::vector<float> m_texels;
120double DistanceToCloud(
double eyeAltitude,
double mu,
double cloudAltitude,
double groundRadius = 6360e3);
Definition CloudLayer.h:42
CloudLayer(std::uint32_t seed, double cover, double altitude=1500.0, double thickness=1.0, int size=kSize)
double OpticalDepth(double x, double y, const CloudDrift &drift) const
Vertical optical depth of the layer at a horizontal position (see Noise()).
double Softness() const
Width of the cloud edge in noise units (narrower for finer textures, whose detail then shows at the e...
Definition CloudLayer.h:72
double OpticalDepthOfNoise(double noise) const
Optical depth from a noise value.
int Size() const
Texels per side of the noise texture.
Definition CloudLayer.h:59
double Noise(double x, double y, const CloudDrift &drift) const
const std::vector< float > & Texels() const
The noise texture, RGBA float per texel (base, detail, 0, 0), row-major (row along y),...
Definition CloudLayer.h:56
double DetailWeight() const
Weight of the detail channel in the noise.
Definition CloudLayer.h:68
double BasePeriod() const
Tile size of the base channel [m].
Definition CloudLayer.h:64
double CoveredFraction() const
Share of the base tile covered by cloud (optical depth above 0.3).
Definition CloudLayer.h:95
double DetailPeriod() const
Tile size of the detail channel [m].
Definition CloudLayer.h:66
double Threshold() const
Noise value where the cloud starts (edge 0 of the density smoothstep).
Definition CloudLayer.h:70
double MeanTransmittance() const
Mean of exp(-optical depth) over the base tile: the share of the direct sun that gets through on aver...
Definition CloudLayer.h:92
double MaxOpticalDepth() const
Optical depth of the densest cloud (thicker layers for higher coverage, times the thickness).
Definition CloudLayer.h:74
double DepthWidth() const
Noise range over which the optical depth grows to its maximum (wider for overcast,...
Definition CloudLayer.h:76
static constexpr int kSize
Texels per side of the noise texture by default (Visual.CloudResolution = "Normal").
Definition CloudLayer.h:45
Definition CloudLayer.h:24
Rgb CompositeCloud(const Rgb &clear, const Rgb &cloud, double tView, const Rgb &air, double haze=1.0)
double HazeLight(double meanTransmittance)
Rgb CloudRadiance(double tau, double viewUp, double cosSunView, const CloudLight &light)
double CloudViewTransmittance(double tau, double viewUp)
Transmittance of the cloud along the view: exp(-tau / max(viewUp, 0.1)).
double DistanceToCloud(double eyeAltitude, double mu, double cloudAltitude, double groundRadius=6360e3)
std::array< double, 3 > Rgb
Red, green, blue.
Definition SkyModel.h:27
Horizontal offsets of the two noise channels [m], from the wind.
Definition CloudLayer.h:28
Light arriving at the cloud layer (any consistent radiometric unit).
Definition CloudLayer.h:35
double sunUp
Sine of the sun's elevation.
Definition CloudLayer.h:37
Rgb sun
Direct sun irradiance at the cloud altitude, normal to the beam.
Definition CloudLayer.h:36
Rgb sky
Clear-sky irradiance on a horizontal surface.
Definition CloudLayer.h:38