# Camera Postprocessing

Unlike camera shakes, native Unreal only supports per-camera camera postprocessing. You can explicitly set the parameters under the `Post Process` group in `Camera Component`. But the post process effects only live when current active camera is the owned one. That is to say, when you transition from one camera with PP to another one without PP, the PP effects will vanish as soon as transition finishes. Moreover, PP blending is not well supported.

If you've already enabled `EPlayerCameraManager` in game mode, you can readily use blueprint node *AddPostProcess* to add your post process effect to current acive camera, and node *RemoveAllPostProcesses* to immediately remove all post processes, without worrying about which specific camera you are using. This will apply to all cameras during the life cycle of post process effects.

1. Add post process. In the blueprint, you should first get the player camera manager in level. Do it by using node `GetPlayerCameraManager`. Then, cast it to the `EPlayerCameraManager` class. Finally, use the `AddPostProcess` node to add a post process effect to camera. You can use `Make PostProcessSettings` to make post process effects in place, or pass in a reference to the `In Post Process` parameter. `In Weight` is the amount of contribution the post process effects make to camera. A value of 1 means full effect, while a value of 0 means no effect. <br>

   <figure><img src="https://1253177398-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIc7aRtmwmEkkqEJZORmC%2Fuploads%2FDfwGkEu055WRdUgxfc81%2Fadd-pp.png?alt=media&#x26;token=02fdeb3f-c823-49e8-917a-b42693397232" alt=""><figcaption></figcaption></figure>
2. Remove post process. You can use node *RemoveAllPostProcesses* to remove all added post process effects. Currently removing a specific post process effect is not supported.
3. Add and remove blendables. A blendable is an asset that has properties which can be smoothly interpolated with other blendables. You can create a blendable material with domain `Post Process` to highly customize camera post-process effects, not only the pre-defined ones shown in `Post Process Settings`. You may also need to use post process volumes for blending. Refer to the official [Post Process Materials](https://docs.unrealengine.com/5.1/en-US/post-process-materials-in-unreal-engine/) and [Post Process Effects](https://docs.unrealengine.com/5.1/en-US/post-process-effects-in-unreal-engine/) documentations for more information. Once you have created a post process material, you can add it via node `AddBlendable`, or remove it via node `RemoveBlendable`. You can also use the utility version [AddBlendable ](https://sulleyyys-organization.gitbook.io/manuals-of-ccs/blueprint-nodes-list/ecameralibrary#addblendable)and [RemoveBlendable](https://sulleyyys-organization.gitbook.io/manuals-of-ccs/blueprint-nodes-list/ecameralibrary#removeblendable) for a more convenient call. If you are using post process volumes, more blueprint nodes can be leveraged to give a finer control over PP effects along with blending. <br>

   <figure><img src="https://1253177398-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIc7aRtmwmEkkqEJZORmC%2Fuploads%2FGB73jag54rGUDFY8k9YB%2Fadd-blendable.png?alt=media&#x26;token=0277b75d-e32f-452d-b94c-23c7e77db3b7" alt=""><figcaption></figcaption></figure>

If you are using blendables, you should setup your materials following the next steps to make post process effects work correctly:

1. Create a material with `Post Process` domain. In the material blueprint, before the output, insert a `lerp` node with the vanilla source as first Input, your post process effect as second input and a parameterized scalar as the third input Alpha. Set the scalar as default 0.

<figure><img src="https://1253177398-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIc7aRtmwmEkkqEJZORmC%2Fuploads%2FcsQeX5BC8LtqNA9B8cfG%2Fmaterial-weight-1.png?alt=media&#x26;token=d70c274f-9e97-4581-8e11-22b227eff84c" alt=""><figcaption><p>In this material I implement a simple desaturation effect. Remember to set the default alpha value as 0.</p></figcaption></figure>

2. Create a material instance from this material and toggle on the blend parameter and set it to 1.

<figure><img src="https://1253177398-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIc7aRtmwmEkkqEJZORmC%2Fuploads%2FxgExXQN0A0Z6JvsRivtB%2Fmaterial-weight-2.png?alt=media&#x26;token=97c4b5ff-a525-4a10-9f3f-28562c6fbb54" alt=""><figcaption></figcaption></figure>

3. At where you want to use this material, invoke the `Add Blendable` node and pass in the material instance you just created. Set other parameters as you want.

<figure><img src="https://1253177398-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIc7aRtmwmEkkqEJZORmC%2Fuploads%2FPRi7FuhWztQY5CmT1Q4C%2Fmaterial-weight-3.png?alt=media&#x26;token=500f610a-0d93-4852-9146-bd7d373adce0" alt=""><figcaption></figcaption></figure>

4. Play the game and you will see the effect now works as expected!

<figure><img src="https://1253177398-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIc7aRtmwmEkkqEJZORmC%2Fuploads%2FbHxz5vKF5AX38AsMMcxA%2Fmaterial-weight.gif?alt=media&#x26;token=500d7d18-c4e3-4c8d-9921-0adc4288d8be" alt=""><figcaption></figcaption></figure>

5. If you followed these steps and observe anomaly, you can delete the blend parameter and re-add it. If it still fails, check the material blueprint and make sure: (1) the blend parameter is the only scalar parameter within range 0 and 1 and, (2) set default as 0. You can refer to [this discussion](https://forums.unrealengine.com/t/post-process-blend-weight-acts-as-boolean-no-fade-in-out/368921/6) for further information.
