Files
engine/docs/en/graphics/postProcess/postProcess.mdx
2025-01-15 18:14:24 +08:00

80 lines
4.8 KiB
Plaintext

---
order: 0
title: Post Process Overview
---
The post-processing system can "process" the results rendered by the camera.
<Comparison
leftSrc="https://gw.alipayobjects.com/zos/OasisHub/3a50ed18-c2d4-4b33-a4e6-af79f2c273f8/2024-07-18%25252018.08.30.gif"
leftText="OFF"
rightSrc="https://gw.alipayobjects.com/zos/OasisHub/4bd5f985-1b82-4aca-b6fa-fd521aab8f57/2024-07-18%25252018.15.30.gif"
rightText="ON"
/>
## Post-Processing Configuration
There are two modes for post-processing:
- Global Mode: Affects all cameras in the current scene.
- Local Mode: Only effective when the camera is within the collision range of the post-processing entity.
The post-processing component has the following properties to control effects, modes, blending distances, etc.:
| Property | Description |
| :-- | :-- |
| [isGlobal](/apis/core/#PostProcess-isGlobal) | Controls whether this post-processing component is in global or local mode. |
| [Blend Distance](/apis/core/#PostProcess-blendDistance) | In local mode, controls how close the camera must be to the collider before blending effects begins. |
| [Priority](/apis/core/#PostProcess-priority) | When there are multiple post-processing components in the scene, a higher priority means blending/overriding starts later. |
| [Layer](/apis/core/#PostProcess-layer) | Used with the camera's [post-processing mask](/apis/core/#Camera-postProcessMask) to determine which post-processing components are effective. |
| [Add Effect](/apis/core/#PostProcess-addEffect) | Adds post-processing effects. |
## Using Post-Processing
### 1. Adding a Post-Processing Component
In the hierarchy panel, several modes for global and local post-processing are preset; simply select and add to use.
<Image src="https://gw.alipayobjects.com/zos/OasisHub/a6e9a327-1823-4dde-94a8-89bb4bf02e3a/2025-01-15%25252011.59.50.gif" />
Of course, you can also manually add post-processing components. Local mode needs to be used with colliders:
<Image src="https://gw.alipayobjects.com/zos/OasisHub/6eb3b8d5-27d1-419d-8bf6-65371861fb97/2025-01-15%25252014.51.12.gif" />
<Callout type="info">
For specific post-processing effects configuration, please refer to the [Post-Processing Effects
List](/en/docs/graphics/postProcess/effects)
</Callout>
### 2. Camera Switch
The camera preview area is controlled by the **Camera Component**. In the camera component, the following properties will also affect the post-processing effects:
| Property | Description |
| :-- | :-- |
| [Post-Processing Switch](/apis/core/#Camera-enablePostProcess) | Enables or disables the post-processing effects of the camera. |
| [HDR Switch](/apis/core/#Camera-enableHDR) | In HDR mode, allows output colors to be stored using floating-point numbers, providing a broader range of values for [bloom effects](/en/docs/graphics/postProcess/effects) and other scenarios. |
| [MSAA Configuration](/apis/core/#Camera-msaaSamples) | Adjusts the multi-sampling anti-aliasing settings to improve image quality, such as reducing jagged edges. |
| [Post-Processing Mask](/apis/core/#Camera-postProcessMask) | Works with the post-processing component's [layer](/apis/core/#PostProcess-layer) to determine which post-processing components are effective. |
<Callout type="info">
For more camera configurations, refer to the [Camera Component](/en/docs/graphics/camera/component)
</Callout>
### 3. Viewport Switch
In addition to the camera preview area, the viewport can also display post-processing effects. The camera in the viewport is independent but has post-processing configurations similar to the camera component.
<Callout type="warning">
The switch in the viewport only affects the view window and does not impact the actual effect exported in the project.
</Callout>
<Image src="https://gw.alipayobjects.com/zos/OasisHub/e3c55184-f51c-4a7a-9a12-ad490774dc26/image-20250115151324628-20250115151336116.png" />
## Best Practices
- Regarding the `HDR` switch in the camera, if the majority of pixels in the scene do not exceed 1 (e.g., no HDR textures used), avoid enabling HDR. When enabled, the engine first renders to a `R11G11B10_UFloat` format RenderTarget before rendering to the screen, incurring performance overhead.
- Regarding the `MSAA` option in the camera, only adjust this value when post-processing is enabled and strict on anti-aliasing performance. The higher the value, the greater the performance overhead.
- In bloom effects, `Down Scale` defaults to `Half`, meaning the initial downsampled resolution is half that of the canvas. If high precision is not required, switch to `Quarter`, saving to a quarter of the canvas.
- In tone mapping effects, while `ACES` offers better color contrast and saturation, it is computationally complex and may cause significant frame drops on low-end devices. Consider using `Neutral` as an alternative.