English中文

PostProcessStageLibrary

包含用于创建常见后处理阶段的函数。 Contains functions for creating common post-process stages.

方法 Methods

static Cesium.PostProcessStageLibrary.createBlackAndWhiteStage()PostProcessStage

创建一个后处理阶段,以黑白渐变渲染输入纹理。 Creates a post-process stage that renders the input texture with black and white gradations.

这一阶段有一个统一的值, This stage has one uniform value, gradations,缩放每个像素的亮度。 , which scales the luminance of each pixel.

返回: Returns:
后处理阶段,用黑白渐变渲染输入纹理。 A post-process stage that renders the input texture with black and white gradations.

static Cesium.PostProcessStageLibrary.createBlurStage()PostProcessStageComposite

创建一个后处理阶段,将高斯模糊应用于输入纹理。该阶段通常与另一个阶段结合应用。 Creates a post-process stage that applies a Gaussian blur to the input texture. This stage is usually applied in conjunction with another stage.

本阶段有以下制服: This stage has the following uniforms: delta, sigma, 和 , and stepSize.

delta and sigma 用于计算高斯滤波器的权重。等式是 are used to compute the weights of a Gaussian filter. The equation is exp((-0.5 * delta * delta) / (sigma * sigma))。默认值为 . The default value for delta is 1.0。默认值为 . The default value for sigma is 2.0. stepSize 是到下一个纹素的距离。默认为 is the distance to the next texel. The default is 1.0.

返回: Returns:
将高斯模糊应用于输入纹理的后处理阶段。 A post-process stage that applies a Gaussian blur to the input texture.

static Cesium.PostProcessStageLibrary.createBrightnessStage()PostProcessStage

创建一个使输入纹理饱和的后处理阶段。 Creates a post-process stage that saturates the input texture.

这一阶段有一个统一的值, This stage has one uniform value, brightness,缩放每个像素的饱和度。 , which scales the saturation of each pixel.

返回: Returns:
使输入纹理饱和的后处理阶段。 A post-process stage that saturates the input texture.

static Cesium.PostProcessStageLibrary.createDepthOfFieldStage()PostProcessStageComposite

创建应用景深效果的后处理阶段。 Creates a post-process stage that applies a depth of field effect.

景深模拟相机对焦。场景中对焦的物体将是清晰的,而未对焦的物体将是模糊的。 Depth of field simulates camera focus. Objects in the scene that are in focus will be clear whereas objects not in focus will be blurred.

本阶段有以下制服: This stage has the following uniforms: focalDistance, delta, sigma, 和 , and stepSize.

focalDistance 是设置相机焦点时距相机的距离(以米为单位)。 is the distance in meters from the camera to set the camera focus.

delta, sigma, 和 , and stepSize 与以下属性相同 are the same properties as PostProcessStageLibrary#createBlurStage。模糊应用于焦点之外的区域。 . The blur is applied to the areas out of focus.

返回: Returns:
应用景深效果的后处理阶段。 A post-process stage that applies a depth of field effect.

static Cesium.PostProcessStageLibrary.createEdgeDetectionStage()PostProcessStage

创建检测边缘的后处理阶段。 Creates a post-process stage that detects edges.

当位于边缘时,将颜色写入输出纹理,并将 alpha 设置为 1.0。 Writes the color to the output texture with alpha set to 1.0 when it is on an edge.

本阶段有以下制服: This stage has the following uniforms: color and length

  • color 是突出显示边缘的颜色。默认为 is the color of the highlighted edge. The default is Color#BLACK.
  • length 是边缘的长度(以像素为单位)。默认为 is the length of the edges in pixels. The default is 0.5.

2D 不支持此阶段。 This stage is not supported in 2D.

返回: Returns:
应用边缘检测效果的后处理阶段。 A post-process stage that applies an edge detection effect.
示例: 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

创建一个后处理阶段,应用模拟相机镜头光耀斑的效果。 Creates a post-process stage that applies an effect simulating light flaring a camera lens.

本阶段有以下制服: This stage has the following uniforms: dirtTexture, starTexture, intensity, distortion, ghostDispersal, haloWidth, dirtAmount, 和 , and earthRadius.

  • dirtTexture 是为了模拟镜头上的污垢而采样的纹理。 is a texture sampled to simulate dirt on the lens.
  • starTexture 是为耀斑的星形图案采样的纹理。 is the texture sampled for the star pattern of the flare.
  • intensity 是一个标量乘以镜头光斑的结果。默认值为 is a scalar multiplied by the result of the lens flare. The default value is 2.0.
  • distortion 是影响色彩效果失真的标量值。默认值为 is a scalar value that affects the chromatic effect distortion. The default value is 10.0.
  • ghostDispersal 是一个标量,指示光晕效果距纹理中心的距离。默认值为 is a scalar indicating how far the halo effect is from the center of the texture. The default value is 0.4.
  • haloWidth 是一个标量,表示来自重影扩散的光晕宽度。默认值为 is a scalar representing the width of the halo from the ghost dispersal. The default value is 0.4.
  • dirtAmount 是表示镜头上污垢量的标量。默认值为 is a scalar representing the amount of dirt on the lens. The default value is 0.4.
  • earthRadius 是地球的最大半径。默认值为 is the maximum radius of the earth. The default value is Ellipsoid.WGS84.maximumRadius.

返回: Returns:
应用镜头光晕效果的后处理阶段。 A post-process stage for applying a lens flare effect.

static Cesium.PostProcessStageLibrary.createNightVisionStage()PostProcessStage

创建一个后期处理阶段,为输入纹理添加夜视效果。 Creates a post-process stage that adds a night vision effect to the input texture.
返回: Returns:
为输入纹理添加夜视效果的后处理阶段。 A post-process stage that adds a night vision effect to the input texture.

static Cesium.PostProcessStageLibrary.createSilhouetteStage(edgeDetectionStages)PostProcessStageComposite

创建应用剪影效果的后处理阶段。 Creates a post-process stage that applies a silhouette effect.

轮廓效果将边缘检测通道中的颜色与输入颜色纹理进行合成。 A silhouette effect composites the color from the edge detection pass with input color texture.

此阶段有以下制服: This stage has the following uniforms when edgeDetectionStages is undefined: color and length

color 是突出显示边缘的颜色。默认为 is the color of the highlighted edge. The default is Color#BLACK. length 是边缘的长度(以像素为单位)。默认为 is the length of the edges in pixels. The default is 0.5.

名称 Name 类型 Type 说明 Description
edgeDetectionStages Array.<PostProcessStage> 可选 optional 一系列边缘检测后处理阶段。 An array of edge detection post process stages.
返回: Returns:
应用剪影效果的后期处理阶段。 A post-process stage that applies a silhouette effect.

static Cesium.PostProcessStageLibrary.isAmbientOcclusionSupported(scene)boolean

是否支持环境光遮挡阶段。 Whether or not an ambient occlusion stage is supported.

此阶段需要 WEBGL_depth_texture 扩展。 This stage requires the WEBGL_depth_texture extension.

名称 Name 类型 Type 说明 Description
scene Scene 现场。 The scene.
返回: Returns:
是否支持此后处理阶段。 Whether this post process stage is supported.
另见: See:

static Cesium.PostProcessStageLibrary.isDepthOfFieldSupported(scene)boolean

是否支持景深阶段。 Whether or not a depth of field stage is supported.

此阶段需要 WEBGL_depth_texture 扩展。 This stage requires the WEBGL_depth_texture extension.

名称 Name 类型 Type 说明 Description
scene Scene 现场。 The scene.
返回: Returns:
是否支持此后处理阶段。 Whether this post process stage is supported.
另见: See:

static Cesium.PostProcessStageLibrary.isEdgeDetectionSupported(scene)boolean

是否支持边缘检测阶段。 Whether or not an edge detection stage is supported.

此阶段需要 WEBGL_depth_texture 扩展。 This stage requires the WEBGL_depth_texture extension.

名称 Name 类型 Type 说明 Description
scene Scene 现场。 The scene.
返回: Returns:
是否支持此后处理阶段。 Whether this post process stage is supported.
另见: See:

static Cesium.PostProcessStageLibrary.isSilhouetteSupported(scene)boolean

是否支持剪影舞台。 Whether or not a silhouette stage is supported.

此阶段需要 WEBGL_depth_texture 扩展。 This stage requires the WEBGL_depth_texture extension.

名称 Name 类型 Type 说明 Description
scene Scene 现场。 The scene.
返回: Returns:
是否支持此后处理阶段。 Whether this post process stage is supported.
另见: See:
需要帮助吗?获得答案的最快方法是从社区和团队那里获得答案 Need help? The fastest way to get answers is from the community and team on the Cesium Forum.