English中文

PostProcessStageCollection

new Cesium.PostProcessStageCollection()

的集合 A collection of PostProcessStage和/或 s and/or PostProcessStageComposites.

每个后处理阶段的输入纹理是场景渲染的纹理或集合中前一阶段渲染的纹理。 The input texture for each post-process stage is the texture rendered to by the scene or the texture rendered to by the previous stage in the collection.

如果启用了环境光遮挡或光晕阶段,它们将在所有其他阶段之前执行。 If the ambient occlusion or bloom stages are enabled, they will execute before all other stages.

如果启用 FXAA 阶段,它将在所有其他阶段之后执行。 If the FXAA stage is enabled, it will execute after all other stages.

成员 Members

将基于地平线的环境光遮挡 (HBAO) 应用于输入纹理的后处理阶段。 A post-process stage that applies Horizon-based Ambient Occlusion (HBAO) to the input texture.

环境光遮挡模拟环境光的阴影。当表面接收到光时,无论光的位置如何,这些阴影总是存在。 Ambient occlusion simulates shadows from ambient light. These shadows would always be present when the surface receives light and regardless of the light's position.

制服具有以下属性: The uniforms have the following properties:

  • intensity 是一个标量值,用于以指数方式使阴影变亮或变暗。值越高,阴影越暗。默认值为 is a scalar value used to lighten or darken the shadows exponentially. Higher values make the shadows darker. The default value is 3.0.
  • bias 是表示角度(以弧度表示)的标量值。如果样本法线与相机矢量之间的点积小于该值,则采样将在当前方向停止。这用于去除近平面边缘的阴影。默认值为 is a scalar value representing an angle in radians. If the dot product between the normal of the sample and the vector to the camera is less than this value, sampling stops in the current direction. This is used to remove shadows from near planar edges. The default value is 0.1.
  • lengthCap 是表示长度(以米为单位)的标量值。如果当前样本到第一个样本的距离大于该值,则在当前方向停止采样。默认值为 is a scalar value representing a length in meters. If the distance from the current sample to first sample is greater than this value, sampling stops in the current direction. The default value is 0.26.
  • directionCount 是光线行进搜索遮挡物的方向数。默认值为 is the number of directions along which the ray marching will search for occluders. The default value is 8.
  • stepCount 是光线沿每个方向行进的步数。默认值为 is the number of steps the ray marching will take along each direction. The default value is 32.
  • randomTexture 是一个纹理,其中红色通道是 [0.0, 1.0] 中的随机值。默认值为 is a texture where the red channel is a random value in [0.0, 1.0]. The default value is undefined。需要设置该纹理。 . This texture needs to be set.
  • ambientOcclusionOnly 是一个布尔值。当 is a boolean value. When true,只有生成的阴影才会写入输出。当 , only the shadows generated are written to the output. When false,输入纹理通过环境光遮挡进行调制。这是一个有用的调试选项,用于查看更改统一值的效果。默认值为 , the input texture is modulated with the ambient occlusion. This is a useful debug option for seeing the effects of changing the uniform values. The default value is false.

启用后,此阶段将先于所有其他阶段执行。 When enabled, this stage will execute before all others.

光晕效果的后期处理阶段。 A post-process stage for a bloom effect.

绽放效果增加了发光效果,使明亮区域更亮,使黑暗区域更暗。 A bloom effect adds glow effect, makes bright areas brighter, and dark areas darker.

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

  • contrast 是 [-255.0, 255.0] 范围内的标量值,会影响效果的收缩。默认值为 is a scalar value in the range [-255.0, 255.0] and affects the contract of the effect. The default value is 128.0.
  • brightness 是一个标量值。输入纹理 RGB 值转换为色调、饱和度和亮度 (HSB),然后将该值添加到亮度中。默认值为 is a scalar value. The input texture RGB value is converted to hue, saturation, and brightness (HSB) then this value is added to the brightness. The default value is -0.3.
  • glowOnly 是一个布尔值。当 is a boolean value. When true,仅显示发光效果。当 , only the glow effect will be shown. When false,发光将添加到输入纹理中。默认值为 , the glow will be added to the input texture. The default value is false。这是一个调试选项,用于在更改其他统一值时查看效果。 . This is a debug option for viewing the effects when changing the other uniform values.

delta, sigma, 和 , and stepSize 与以下属性相同 are the same properties as PostProcessStageLibrary#createBlurStage。模糊应用于图像生成的阴影,使其更加平滑。 . The blur is applied to the shadows generated from the image to make them smoother.

启用后,此阶段将先于所有其他阶段执行。 When enabled, this stage will execute before all others.

HDR 开启时控制曝光。小于 1.0 会使色调映射变暗,而大于 1.0 会使色调映射变亮。 Control the exposure when HDR is on. Less than 1.0 makes the tonemapping darker while greater than 1.0 makes it brighter.
默认值: Default Value: 1.0
示例: Example:
viewer.scene.postProcessStages.exposure = 1.0;
快速近似抗锯齿的后处理阶段。 A post-process stage for Fast Approximate Anti-aliasing.

启用后,此阶段将在所有其他阶段之后执行。 When enabled, this stage will execute after all others.

该集合中的后处理阶段的数量。 The number of post-process stages in this collection.
确定集合中的所有后处理阶段是否已准备好执行。 Determines if all of the post-process stages in the collection are ready to be executed.
指定以高动态范围渲染时使用的色调映射算法。 Specifies the tonemapping algorithm used when rendering with high dynamic range. Sandcastle Demo
默认值: Default Value: Tonemapper.PBR_NEUTRAL
示例: Example:
viewer.scene.postProcessStages.tonemapper = Cesium.Tonemapper.ACES;

方法 Methods

将后处理阶段添加到集合中。 Adds the post-process stage to the collection.
名称 Name 类型 Type 说明 Description
stage PostProcessStage | PostProcessStageComposite 添加到集合的后处理阶段。 The post-process stage to add to the collection.
返回: Returns:
添加到集合中的后处理阶段。 The post-process stage that was added to the collection.
抛出: Throws:
  • DeveloperError :后处理阶段已添加到集合中或没有唯一名称。 : The post-process stage has already been added to the collection or does not have a unique name.
返回集合是否包含后处理阶段。 Returns whether the collection contains a post-process stage.
名称 Name 类型 Type 说明 Description
stage PostProcessStage | PostProcessStageComposite 后处理阶段。 The post-process stage.
返回: Returns:
集合是否包含后处理阶段。 Whether the collection contains the post-process stage.
销毁该对象持有的 WebGL 资源。销毁对象可以确定性地释放 WebGL 资源,而不是依赖垃圾收集器来销毁该对象。 Destroys the WebGL resources held by this object. Destroying an object allows for deterministic release of WebGL resources, instead of relying on the garbage collector to destroy this object.

一旦对象被销毁,就不应再使用;调用除 Once an object is destroyed, it should not be used; calling any function other than isDestroyed 将导致 will result in a DeveloperError 例外。因此,分配返回值( exception. Therefore, assign the return value (undefined) 到对象,如示例中所做的那样。 ) to the object as done in the example.

抛出: Throws:
  • DeveloperError : This object was destroyed, i.e., destroy() was called.
另见: See:
获取后处理阶段 Gets the post-process stage at index.
名称 Name 类型 Type 说明 Description
index number 后处理阶段的索引。 The index of the post-process stage.
返回: Returns:
索引处的后处理阶段。 The post-process stage at index.
如果该对象被销毁则返回 true;否则为假。 Returns true if this object was destroyed; otherwise, false.

如果该对象被破坏,则不应使用它;调用除 If this object was destroyed, it should not be used; calling any function other than isDestroyed 将导致 will result in a DeveloperError exception.

返回: Returns:
true 如果该物体被摧毁;否则, if this object was destroyed; otherwise, false.
另见: See:
从集合中删除后处理阶段并销毁它。 Removes a post-process stage from the collection and destroys it.
名称 Name 类型 Type 说明 Description
stage PostProcessStage | PostProcessStageComposite 从集合中删除的后处理阶段。 The post-process stage to remove from the collection.
返回: Returns:
是否删除了后处理阶段。 Whether the post-process stage was removed.
从集合中删除所有后处理阶段并销毁它们。 Removes all post-process stages from the collection and destroys them.
需要帮助吗?获得答案的最快方法是从社区和团队那里获得答案 Need help? The fastest way to get answers is from the community and team on the Cesium Forum.