载入中...
搜索中...
未找到
SkyAtmosphereLuts.cpp
浏览该文件的文档.
16 return std::all_of(values.begin(), values.end(), [maximum](float v) { return range(v, 0, maximum); });
27 return {ray + mie, ray + mie + vector(p.mieAbsorption) * density + vector(p.ozoneAbsorption) * ozone};
40 std::max(0.0, -height * cosine + std::sqrt(std::max(0.0, height * height * (cosine * cosine - 1) + top * top)));
42 return glm::clamp(glm::dvec2((distance - minimum) / (maximum - minimum), rho / h), glm::dvec2(0), glm::dvec2(1));
45 auto p = glm::clamp(uv * glm::dvec2(width, height) - .5, glm::dvec2(0), glm::dvec2(width - 1, height - 1));
46 unsigned x = unsigned(p.x), y = unsigned(p.y), x1 = std::min(x + 1, width - 1), y1 = std::min(y + 1, height - 1);
51 return glm::mix(glm::mix(at(x, y), at(x1, y), p.x - x), glm::mix(at(x, y1), at(x1, y1), p.x - x), p.y - y);
63 const double rounded = lower + (fraction > .5 || (fraction == .5 && std::fmod(lower, 2.0) != 0));
71Integrated integrate(const SkyAtmosphereParameters& p, const detail::SkyAtmosphereLuts& tables, Vec origin,
92 result.luminance += throughput * source * (Vec(1) - segment) / glm::max(m.extinction, Vec(1e-9));
110 !coefficients(ozoneAbsorption) || !coefficients(groundAlbedo, 1) || !range(rayleighHeightKm, 1e-5f, 1e6f) ||
111 !range(mieHeightKm, 1e-5f, 1e6f) || !range(ozoneHalfWidthKm, 1e-5f, 1e6f) || !range(ozoneCenterKm, 0, 1e6f) ||
113 groundRadiusKm + atmosphereHeightKm <= groundRadiusKm || !range(mieAnisotropy, -.9999f, .9999f) ||
114 !range(multiScatteringFactor, 0, 100) || (heightFog.densityPerMetre > 0 && atmosphereHeightKm <= 6))
122 if (!range(directionalElevationRange[0], -1, 1) || !range(directionalElevationRange[1], -1, 1) ||
125 !range(startDistanceMetres, 0, 1e6f) || !range(maximumOpacity, 0, 1) || !coefficients(inscattering) ||
135Result<detail::SkyAtmosphereLuts> detail::bakeSkyAtmosphereLuts(const SkyAtmosphereParameters& p) {
141 tables.transmittance.resize(size_t(tables.TransmittanceWidth) * tables.TransmittanceHeight * 4);
147 double rho = h * (y + .5) / tables.TransmittanceHeight, height = std::sqrt(rho * rho + bottom * bottom);
169 if (!std::isfinite(luminance.x) || !std::isfinite(luminance.y) || !std::isfinite(luminance.z) ||
177 return Baked::failure(Diagnostic::error(DiagnosticCode::Failed, error.what(), "sky.atmosphere"));
190 return std::all_of(values.begin(), values.end(), [](float v) { return std::isfinite(v) && v >= 0; });
193 tables.transmittance.size() != size_t(tables.TransmittanceWidth) * tables.TransmittanceHeight * 4 ||
203 // Local fixed stream reproduces the reference's stratification without consuming simulation RNG.
242 if (!std::isfinite(average[axis]) || average[axis] < 0 || average[axis] > std::numeric_limits<float>::max())
243 return Ambient::failure(Diagnostic::error(DiagnosticCode::Failed, "Nonfinite distant sky ambient"));
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={}, DiagnosticDetails details={}, std::string source={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.h:125
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:175
EVENGINE_API_BACKENDS Result< SkyAtmosphereLuts > bakeSkyAtmosphereLuts(const SkyAtmosphereParameters ¶meters)
Bake coefficients using UE's default 10/15-sample, two-direction approximation.
Definition SkyAtmosphereLuts.cpp:135
EVENGINE_API_BACKENDS Result< std::array< float, 3 > > bakeDistantSkyAmbient(const SkyAtmosphereParameters ¶meters, const SkyAtmosphereLuts &tables, const std::array< float, 3 > &lightDirection)
Integrate distant-sky ambient radiance per unit incident RGB irradiance at six kilometres.
Definition SkyAtmosphereLuts.cpp:181
卡牌游戏 UI 工具模块:工厂 + 脚本绑定入口。 功能参考 ycarowr/UiCard:扇形手牌布局、抽牌/洗牌、悬浮放大、拖拽到落牌区、 敌方手牌(背面/偷看)、费用不足置灰,以及可实时调节的布局...
Definition Animation.h:25
@ InvalidArgument
@ Failed
Spherical atmospheric coefficients in inverse kilometres and kilometre heights.
Definition SkyAtmospherePass.h:39
float multiScatteringFactor
Definition SkyAtmospherePass.h:52
std::array< float, 3 > groundAlbedo
Definition SkyAtmospherePass.h:51
float ozoneHalfWidthKm
Definition SkyAtmospherePass.h:48
std::array< float, 3 > rayleigh
Definition SkyAtmospherePass.h:40
float groundRadiusKm
Definition SkyAtmospherePass.h:49
std::array< float, 3 > mieAbsorption
Definition SkyAtmospherePass.h:44
float atmosphereHeightKm
Definition SkyAtmospherePass.h:50
std::array< float, 3 > mieScattering
Definition SkyAtmospherePass.h:42
float mieAnisotropy
Definition SkyAtmospherePass.h:45
float ozoneCenterKm
Definition SkyAtmospherePass.h:47
EVENGINE_API_BACKENDS Result< void > validate() const
Validate finite optical coefficients, bounded geometry and energy controls without mutation.
Definition SkyAtmosphereLuts.cpp:106
std::array< float, 3 > ozoneAbsorption
Definition SkyAtmospherePass.h:46
float rayleighHeightKm
Definition SkyAtmospherePass.h:41
float mieHeightKm
Definition SkyAtmospherePass.h:43
SkyHeightFogParameters heightFog
Definition SkyAtmospherePass.h:53
std::array< float, 3 > directionalInscattering
Definition SkyAtmospherePass.h:27
std::array< float, 3 > inscattering
Definition SkyAtmospherePass.h:25
float startDistanceMetres
Definition SkyAtmospherePass.h:24
EVENGINE_API_BACKENDS Result< void > validate() const
Validate finite bounded fog coefficients without mutation.
Definition SkyAtmosphereLuts.cpp:121
float atmosphereContribution
Definition SkyAtmospherePass.h:30
float directionalExponent
Definition SkyAtmospherePass.h:28
float baseHeightMetres
Definition SkyAtmospherePass.h:23
float skyDistanceMetres
Definition SkyAtmospherePass.h:31
float directionalStartDistanceMetres
Definition SkyAtmospherePass.h:29
std::array< float, 2 > directionalElevationRange
Optional directional fog fade over sun direction Y in [-1,1]. Equal endpoints disable fading; otherwi...
Definition SkyAtmospherePass.h:20
float heightFalloffPerMetre
Definition SkyAtmospherePass.h:22
float maximumOpacity
Definition SkyAtmospherePass.h:26
float densityPerMetre
Definition SkyAtmospherePass.h:21
Internal owning RGBA32F table candidates, never partially published.
Definition SkyAtmosphereLuts.h:10
std::vector< float > multiScattering
Definition SkyAtmosphereLuts.h:14
static constexpr unsigned TransmittanceWidth
Definition SkyAtmosphereLuts.h:11
static constexpr unsigned MultiWidth
Definition SkyAtmosphereLuts.h:11
static constexpr unsigned TransmittanceHeight
Definition SkyAtmosphereLuts.h:11
std::vector< float > transmittance
Owned table pixels, allocated during the explicit bake. @cost Copies scale with the fixed LUT texel c...
Definition SkyAtmosphereLuts.h:14
static constexpr unsigned MultiHeight
Definition SkyAtmosphereLuts.h:11