Rise
The Vieneo Province
Loading...
Searching...
No Matches
CloudOrbitResolution11.h
Go to the documentation of this file.
1#pragma once
2#include <algorithm>
3#include <cmath>
4
5namespace Rendering
6{
7 inline float CloudRefinedFlightResolution11(float width,float height)
8 {
9 // Refined first-hit searches near the deck are substantially more
10 // expensive than orbital rays. Bound work at large viewports while
11 // preserving the existing quarter grid in smaller windows. Density
12 // filtering still uses the reference half grid in CloudRenderer11.
13 const double pixels=double(width)*height;
14 if(!std::isfinite(pixels) || pixels<=0)return .25f;
15 return (std::max)(.125f,(std::min)(.25f,float(std::sqrt(105000./pixels))));
16 }
17 inline bool CloudDistantOrbit11(float altitudeKm,bool wasDistant)
18 {
19 // Screen-detail/performance policy, not an atmospheric boundary.
20 // Fixed tiers avoid reallocating targets on every ascent frame.
21 return std::isfinite(altitudeKm) && altitudeKm>(wasDistant ? 200.f : 250.f);
22 }
23 inline bool CloudGlobeOrbit11(float altitudeKm,bool wasGlobe)
24 {
25 // Sampling policy for a smaller projected globe, not an atmosphere layer.
26 return std::isfinite(altitudeKm) && altitudeKm>(wasGlobe ? 1600.f : 2000.f);
27 }
28 inline float CloudOrbitResolution11(float width,float height,bool distant=false,bool globe=false)
29 {
30 // Bound orbital ray work across viewports. Keep the reference-sized
31 // image at 50%. Larger viewports need more reconstruction work, so
32 // smoothly reduce near-orbit ray work from 395k to 290k between two
33 // and four megapixels. This offsets continuous sheet detail cost without
34 // changing density or reducing the reference-size detail.
35 // Beyond the distant-orbit handoff, 360k rays retain broad formations
36 // while reconstruction filters detail smaller than the sample grid.
37 // At globe distance the lower occupied area allows 680k rays, reducing
38 // blockiness without sharpening the unresolved density/noise itself.
39 // Orbital sampling retains its one-quarter floor. Above 4K that floor
40 // may exceed this allowance; this is not a universal frame-time cap.
41 const double pixels=double(width)*height;
42 if(!std::isfinite(pixels) || pixels<=0)return .5f;
43 const double large=(std::max)(0.,(std::min)(1.,(pixels-2000000.)/2000000.));
44 const double nearBudget=395000.-105000.*large*large*(3.-2.*large);
45 return (std::max)(.25f,(std::min)(.5f,float(std::sqrt((globe ? 680000. : distant ? 360000. : nearBudget)/pixels))));
46 }
47}
float CloudOrbitResolution11(float width, float height, bool distant=false, bool globe=false)
bool CloudGlobeOrbit11(float altitudeKm, bool wasGlobe)
bool CloudDistantOrbit11(float altitudeKm, bool wasDistant)
float CloudRefinedFlightResolution11(float width, float height)