PostProcessStageLibrary

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

Methods

static Cesium.PostProcessStageLibrary.createBlackAndWhiteStage()PostProcessStage

创建一个后期处理舞台,该舞台使用黑色和白色渐变渲染输入纹理。

此阶段有一个统一的值,即 gradations(渐变),用于缩放每个像素的明亮度。

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

static Cesium.PostProcessStageLibrary.createBlurStage()PostProcessStageComposite

创建一个后期处理阶段,将高斯模糊应用于输入纹理。此阶段通常与另一个阶段结合使用。

此 stage 具有以下 uniforms:deltasigmastepSize

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

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

static Cesium.PostProcessStageLibrary.createBrightnessStage()PostProcessStage

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

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

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

static Cesium.PostProcessStageLibrary.createDepthOfFieldStage()PostProcessStageComposite

创建应用景深效果的后期处理舞台。

景深模拟摄像机对焦。场景中的焦点对象 将清晰,而未合焦的物体将变得模糊。

此 stage 具有以下 uniforms:focalDistancedeltasigmastepSize

focalDistance 是距摄像机的距离(以米为单位),用于设置摄像机焦点。

deltasigmastepSize 是与 PostProcessStageLibrary#createBlurStage 相同的属性。 模糊应用于失焦区域。

Returns:
应用景深效果的后期处理舞台。

static Cesium.PostProcessStageLibrary.createEdgeDetectionStage()PostProcessStage

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

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

此阶段有以下制服:颜色长度

  • color 是高亮显示的边缘的颜色。默认值为 Color#BLACK
  • length 是边缘的长度(以像素为单位)。默认值为 0.5

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

创建一个后期处理舞台,该舞台应用模拟光线眩光的摄像机镜头。

此阶段有以下制服:dirtTexturestarTextureintensitydistortionghostDispersalhaloWidthdirtAmountearthRadius

  • dirtTexture 是为模拟镜头上的污垢而采样的纹理。
  • starTexture 是为耀斑的星形图案采样的纹理。
  • 强度是标量乘以镜头眩光的结果。默认值为 2.0
  • 失真是影响半音效果失真的标量值。默认值为 10.0
  • ghostDispersal 是一个标量,指示光晕效果与纹理中心的距离。默认值为 0.4
  • haloWidth 是一个标量,表示来自虚影扩散的 halo 的宽度。默认值为 0.4
  • dirtAmount 是表示镜头上污垢量的标量。默认值为 0.4
  • earthRadius 是地球的最大半径。默认值为 Ellipsoid.WGS84.maximumRadius

Returns:
用于应用镜头光晕效果的后期处理阶段。

static Cesium.PostProcessStageLibrary.createNightVisionStage()PostProcessStage

创建一个后期处理阶段,向输入纹理添加夜视效果。
Returns:
一个后期处理阶段,用于向输入纹理添加夜视效果。

static Cesium.PostProcessStageLibrary.createSilhouetteStage(edgeDetectionStages)PostProcessStageComposite

创建应用剪影效果的后处理舞台。

剪影效果将边缘检测过程中的颜色与输入颜色纹理合成。

edgeDetectionStages 未定义时,此 stage 具有以下 uniforms:colorlength

color 是高亮显示的边缘的颜色。默认值为 Color#BLACKlength 是边缘的长度(以像素为单位)。默认值为 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

是否支持 Silhouette 舞台。

此阶段需要 WEBGL_depth_texture 扩展。

Name Type Description
scene Scene 场景。
Returns:
是否支持此后处理阶段。
See:
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.