PostProcessStageLibrary

包含用于创建常见后处理阶段的函数。

Methods

static Cesium.PostProcessStageLibrary.createBlackAndWhiteStage() → PostProcessStage

创建一个后处理阶段,以黑白渐变渲染输入纹理。

此阶段有一个 uniform 值 gradations,用于缩放每个像素的亮度。

Returns:
一个以黑白渐变渲染输入纹理的后处理阶段。

static Cesium.PostProcessStageLibrary.createBlurStage() → PostProcessStageComposite

创建一个对输入纹理应用高斯模糊的后处理阶段。此阶段通常与其他阶段结合使用。

此阶段具有以下 uniforms:delta、sigma 和 stepSize。

delta 和 sigma 用于计算高斯滤波器的权重。公式为 exp((-0.5 * delta * delta) / (sigma * sigma))。 delta 的默认值为 1.0。sigma 的默认值为 2.0。 stepSize 是到下一个纹素的距离。默认值为 1.0。

Returns:
一个对输入纹理应用高斯模糊的后处理阶段。

static Cesium.PostProcessStageLibrary.createBrightnessStage() → PostProcessStage

创建一个使输入纹理饱和的后处理阶段。

此阶段有一个 uniform 值 brightness,用于缩放每个像素的饱和度。

Returns:
一个使输入纹理饱和的后处理阶段。

static Cesium.PostProcessStageLibrary.createDepthOfFieldStage() → PostProcessStageComposite

创建一个应用景深(depth of field)效果的后处理阶段。

景深模拟相机对焦。场景中处于对焦状态的物体 会很清晰,而未对焦的物体会被模糊。

此阶段具有以下 uniforms:focalDistance、delta、sigma 和 stepSize。

focalDistance 是从相机到对焦点的距离(米)。

delta、sigma 和 stepSize 与 PostProcessStageLibrary#createBlurStage 中的属性相同。 模糊会应用于失焦区域。

Returns:
一个应用景深效果的后处理阶段。

static Cesium.PostProcessStageLibrary.createEdgeDetectionStage() → PostProcessStage

创建一个检测边缘的后处理阶段。

当位于边缘上时,将颜色写入输出纹理,并将 alpha 设为 1.0。

此阶段具有以下 uniforms:color 和 length

  • color 是突出显示边缘的颜色。默认值为 Color#BLACK。
  • length 是边缘的长度(像素)。默认值为 0.5。

This stage is not supported in 2D.

Returns:
一个应用边缘检测效果的后处理阶段。
Example:
// multiple silhouette effects
const yellowEdge = Cesium.PostProcessStageLibrary.createEdgeDetectionStage();
yellowEdge.uniforms.color = Cesium.Color.YELLOW;
yellowEdge.selected = [feature0];

const greenEdge = Cesium.PostProcessStageLibrary.createEdgeDetectionStage();
greenEdge.uniforms.color = Cesium.Color.LIME;
greenEdge.selected = [feature1];

// draw edges around feature0 and feature1
postProcessStages.add(Cesium.PostProcessStageLibrary.createSilhouetteStage([yellowEdge, greenEdge]);

static Cesium.PostProcessStageLibrary.createLensFlareStage() → PostProcessStage

创建一个模拟相机镜头眩光(lens flare)效果的后处理阶段。

此阶段具有以下 uniforms:dirtTexture、starTexture、intensity、distortion、ghostDispersal、 haloWidth、dirtAmount 和 earthRadius。

  • dirtTexture 是用于模拟镜头上灰尘的纹理。
  • starTexture 是用于镜头眩光星型图案的纹理。
  • intensity 是一个标量,乘以镜头眩光的结果。默认值为 2.0。
  • distortion 是一个影响色差效果畸变的标量值。默认值为 10.0。
  • ghostDispersal 是一个标量,表示光晕效果距离纹理中心的距离。默认值为 0.4。
  • haloWidth 是一个标量,表示从光晕扩散出的光晕宽度。默认值为 0.4。
  • dirtAmount 是一个标量,表示镜头上灰尘的数量。默认值为 0.4。
  • earthRadius 是地球的最大半径。默认值为 Ellipsoid.WGS84.maximumRadius。

Returns:
一个用于应用镜头眩光效果的后处理阶段。

static Cesium.PostProcessStageLibrary.createNightVisionStage() → PostProcessStage

创建一个为输入纹理添加夜视效果的后处理阶段。
Returns:
一个为输入纹理添加夜视效果的后处理阶段。

static Cesium.PostProcessStageLibrary.createSilhouetteStage(edgeDetectionStages) → PostProcessStageComposite

创建一个应用轮廓(silhouette)效果的后处理阶段。

轮廓效果将边缘检测过程的颜色与输入颜色纹理进行合成。

当 edgeDetectionStages 为 undefined 时,此阶段具有以下 uniforms:color 和 length

color 是突出显示边缘的颜色。默认值为 Color#BLACK。 length 是边缘的长度(像素)。默认值为 0.5。

Name Type Description
edgeDetectionStages Array.<PostProcessStage> optional 边缘检测后处理阶段的数组。
Returns:
一个应用轮廓效果的后处理阶段。

static Cesium.PostProcessStageLibrary.isAmbientOcclusionSupported(scene) → boolean

是否支持环境光遮蔽阶段。

此阶段需要 WEBGL_depth_texture 扩展。

Name Type Description
scene Scene 场景。
Returns:
此后期处理阶段是否受支持。
See:

static Cesium.PostProcessStageLibrary.isDepthOfFieldSupported(scene) → boolean

是否支持景深阶段。

此阶段需要 WEBGL_depth_texture 扩展。

Name Type Description
scene Scene 场景。
Returns:
此后期处理阶段是否受支持。
See:

static Cesium.PostProcessStageLibrary.isEdgeDetectionSupported(scene) → boolean

是否支持边缘检测阶段。

此阶段需要 WEBGL_depth_texture 扩展。

Name Type Description
scene Scene 场景。
Returns:
此后期处理阶段是否受支持。
See:

static Cesium.PostProcessStageLibrary.isSilhouetteSupported(scene) → boolean

是否支持轮廓阶段。

此阶段需要 WEBGL_depth_texture 扩展。

Name Type Description
scene Scene 场景。
Returns:
此后期处理阶段是否受支持。
See:
需要帮助?获取答案的最快方式是在 Cesium 论坛 上向社区和团队提问。