Process-wide defaults for creating shadows per light family. 更多...
#include <ShadowScheme.h>
Public 成员函数 | |
| int | resolvedAtlasMapSize () const |
| Atlas edge length actually allocated for GPU shadow maps. | |
| float | resolvedDirectionalMaxDistance () const |
CSM far clamp used by buildDirectionalCSM. | |
静态 Public 成员函数 | |
| static ShadowSchemeSettings & | current () |
| Borrow the process-wide settings object. | |
Public 属性 | |
| bool | enableDirectionalCsm = true |
| bool | enableSpotPerspective = true |
| bool | enablePointCube = false |
| int | directionalMapSize = ShadowConfig::kMapSize |
| Preferred directional CSM atlas edge length (texels); clamped to {256..4096}². | |
| int | localMapSize = 1024 |
| Preferred local-spot atlas edge length; shares the directional array today. | |
| float | directionalMaxDistance = ShadowConfig::kMaxDistance |
| Practical CSM far distance (camera-forward meters). Camera far is clamped to this so large scenes keep usable texel density. | |
| int | maxSpotShadowCasters = ShadowConfig::kLocalSlots |
| Max local atlas occupants this frame (≤ kLocalSlots). | |
| int | maxPointShadowCasters = 0 |
| float | defaultSpotBias = 0.002f |
| float | defaultPointBias = 0.003f |
| bool | enableLocalPaging = true |
| Score by camera importance and sticky-slot hysteresis (vs intensity only). | |
| int | maxLocalUpdatesPerFrame = ShadowConfig::kLocalSlots |
| Max local shadow layers redrawn per frame (time-slice). Occupants beyond this still sample last-written depth when paging keeps them. | |
| float | hysteresisBonus = 0.35f |
| Multiplicative bonus for casters that already own a slot (reduces flicker). | |
| float | minPageScore = 1e-4f |
| Drop candidates below this score when paging view is valid. | |
| bool | enableAdaptiveCascadeResolution = true |
Allocate different effective resolutions per CSM cascade from camera distance and screen coverage (shadow-edge / silhouette importance). Vulkan depth arrays require uniform layer extent, so the GPU still allocates one atlas edge; each cascade renders into a top-left viewport of its size and shaders remap UVs via ShadowUBO::cascadeUvScale. | |
| float | adaptiveScreenWeight = 0.65f |
| Extra weight for cascades that cover more of the screen (edges / silhouettes that span the frame). 0 disables the screen term. | |
| float | adaptiveDistanceWeight = 1.f |
| Extra weight for near-camera distance (1/midSplit). | |
| float | adaptiveSizeHysteresis = 0.2f |
| Hysteresis: only change a cascade size when the new candidate differs by at least this ratio (reduces flicker when scores wobble). | |
详细描述
Process-wide defaults for creating shadows per light family.
Controllers (RenderControl / script / PhotoMode) mutate this; RenderSystem3D and Graphics backends read it each frame when selecting casters, building CSM, and allocating/resizing the depth-array atlas.
Directional CSM and local spot shadows currently share one depth array, so resolvedAtlasMapSize() (max of the clamped directional/local sizes) is the GPU extent. Changing map size recreates shadow GPU resources on the next ensure/create path (@cost relative magnitude: full atlas realloc + deferred FrameGraph rebuild; amortized across frames until the next size change).
Local spot shadows use a fixed atlas (kLocalSlots). When more casters request shadows than slots, paging scores by intensity / distance / soft screen coverage and keeps sticky occupancy (hysteresis). An independent update budget can time-slice redraws while still sampling cached maps.
@thread Render thread only.
在文件 ShadowScheme.h 第 67 行定义.
成员函数说明
◆ current()
|
static |
Borrow the process-wide settings object.
在文件 Shadow.cpp 第 216 行定义.
被这些函数引用 eve::graphics::buildDirectionalCSM(), eve::graphics::setShadowSchemeDirectionalMaxDistance() , 以及 eve::graphics::setShadowSchemeMapSizes().
◆ resolvedAtlasMapSize()
| int eve::graphics::ShadowSchemeSettings::resolvedAtlasMapSize | ( | ) | const |
Atlas edge length actually allocated for GPU shadow maps.
- 返回
- Power-of-two size in [kMinMapSize, kMaxMapSize].
在文件 Shadow.cpp 第 242 行定义.
引用了 eve::graphics::clampShadowMapSize(), directionalMapSize, local , 以及 localMapSize.
◆ resolvedDirectionalMaxDistance()
| float eve::graphics::ShadowSchemeSettings::resolvedDirectionalMaxDistance | ( | ) | const |
CSM far clamp used by buildDirectionalCSM.
- 返回
- Positive finite meters (falls back to
ShadowConfig::kMaxDistance).
在文件 Shadow.cpp 第 248 行定义.
引用了 directionalMaxDistance , 以及 eve::graphics::ShadowConfig::kMaxDistance.
类成员变量说明
◆ adaptiveDistanceWeight
| float eve::graphics::ShadowSchemeSettings::adaptiveDistanceWeight = 1.f |
Extra weight for near-camera distance (1/midSplit).
在文件 ShadowScheme.h 第 112 行定义.
◆ adaptiveScreenWeight
| float eve::graphics::ShadowSchemeSettings::adaptiveScreenWeight = 0.65f |
Extra weight for cascades that cover more of the screen (edges / silhouettes that span the frame). 0 disables the screen term.
在文件 ShadowScheme.h 第 110 行定义.
◆ adaptiveSizeHysteresis
| float eve::graphics::ShadowSchemeSettings::adaptiveSizeHysteresis = 0.2f |
Hysteresis: only change a cascade size when the new candidate differs by at least this ratio (reduces flicker when scores wobble).
在文件 ShadowScheme.h 第 117 行定义.
◆ defaultPointBias
| float eve::graphics::ShadowSchemeSettings::defaultPointBias = 0.003f |
在文件 ShadowScheme.h 第 84 行定义.
◆ defaultSpotBias
| float eve::graphics::ShadowSchemeSettings::defaultSpotBias = 0.002f |
在文件 ShadowScheme.h 第 83 行定义.
◆ directionalMapSize
| int eve::graphics::ShadowSchemeSettings::directionalMapSize = ShadowConfig::kMapSize |
Preferred directional CSM atlas edge length (texels); clamped to {256..4096}².
在文件 ShadowScheme.h 第 72 行定义.
被这些函数引用 resolvedAtlasMapSize().
◆ directionalMaxDistance
| float eve::graphics::ShadowSchemeSettings::directionalMaxDistance = ShadowConfig::kMaxDistance |
Practical CSM far distance (camera-forward meters). Camera far is clamped to this so large scenes keep usable texel density.
在文件 ShadowScheme.h 第 79 行定义.
被这些函数引用 resolvedDirectionalMaxDistance() , 以及 eve::graphics::setShadowSchemeDirectionalMaxDistance().
◆ enableAdaptiveCascadeResolution
| bool eve::graphics::ShadowSchemeSettings::enableAdaptiveCascadeResolution = true |
Allocate different effective resolutions per CSM cascade from camera distance and screen coverage (shadow-edge / silhouette importance). Vulkan depth arrays require uniform layer extent, so the GPU still allocates one atlas edge; each cascade renders into a top-left viewport of its size and shaders remap UVs via ShadowUBO::cascadeUvScale.
在文件 ShadowScheme.h 第 105 行定义.
◆ enableDirectionalCsm
| bool eve::graphics::ShadowSchemeSettings::enableDirectionalCsm = true |
在文件 ShadowScheme.h 第 68 行定义.
◆ enableLocalPaging
| bool eve::graphics::ShadowSchemeSettings::enableLocalPaging = true |
Score by camera importance and sticky-slot hysteresis (vs intensity only).
在文件 ShadowScheme.h 第 87 行定义.
◆ enablePointCube
| bool eve::graphics::ShadowSchemeSettings::enablePointCube = false |
在文件 ShadowScheme.h 第 70 行定义.
◆ enableSpotPerspective
| bool eve::graphics::ShadowSchemeSettings::enableSpotPerspective = true |
在文件 ShadowScheme.h 第 69 行定义.
◆ hysteresisBonus
| float eve::graphics::ShadowSchemeSettings::hysteresisBonus = 0.35f |
Multiplicative bonus for casters that already own a slot (reduces flicker).
在文件 ShadowScheme.h 第 94 行定义.
◆ localMapSize
| int eve::graphics::ShadowSchemeSettings::localMapSize = 1024 |
Preferred local-spot atlas edge length; shares the directional array today.
在文件 ShadowScheme.h 第 74 行定义.
被这些函数引用 resolvedAtlasMapSize().
◆ maxLocalUpdatesPerFrame
| int eve::graphics::ShadowSchemeSettings::maxLocalUpdatesPerFrame = ShadowConfig::kLocalSlots |
Max local shadow layers redrawn per frame (time-slice). Occupants beyond this still sample last-written depth when paging keeps them.
在文件 ShadowScheme.h 第 92 行定义.
◆ maxPointShadowCasters
| int eve::graphics::ShadowSchemeSettings::maxPointShadowCasters = 0 |
在文件 ShadowScheme.h 第 82 行定义.
◆ maxSpotShadowCasters
| int eve::graphics::ShadowSchemeSettings::maxSpotShadowCasters = ShadowConfig::kLocalSlots |
Max local atlas occupants this frame (≤ kLocalSlots).
在文件 ShadowScheme.h 第 81 行定义.
◆ minPageScore
| float eve::graphics::ShadowSchemeSettings::minPageScore = 1e-4f |
Drop candidates below this score when paging view is valid.
在文件 ShadowScheme.h 第 96 行定义.
该结构体的文档由以下文件生成:
- src/modules/graphics/ShadowScheme.h
- src/modules/graphics/Shadow.cpp