# Blending in new PostProcess settings via script

**URL:** <https://forums.unrealengine.com/t/blending-in-new-postprocess-settings-via-script/271272>\
**Category:** UDK Programming and UnrealScript\
**Tags:** unreal-engine\
**Created:** [January 9, 2022, 9:51pm UTC](https://forums.unrealengine.com/t/blending-in-new-postprocess-settings-via-script/271272 "2022-01-09T21:51:42Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Coldscooter](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Coldscooter](https://forums.unrealengine.com/u/Coldscooter)\
**Post date:** [January 9, 2022, 9:51pm UTC](https://forums.unrealengine.com/t/blending-in-new-postprocess-settings-via-script/271272/1 "2022-01-09T21:51:42Z")

</div>

I’m trying to blend in new PP settings (such as DOF). I have the current code I’m playing with:

```auto
function SetDOF(float dist, float maxBlur)
{
    local PostProcessSettings newPpSettings;

    newPpSettings = Worldinfo.DefaultPostProcessSettings;

    newPpSettings.DOF_FocusInnerRadius = dist;
    newPpSettings.DOF_MaxFarBlurAmount = maxBlur;

LocalPlayer(GetALocalPlayerController().Player).OverridePostProcessSettings(newPpSettings, 5.0);
}
```

It works fine to blend in the new settings, but once it’s blended in, it then blends out by itself.

Does anyone know how I can get it to stay on the new settings once blended in?

The method on LocalPlayer.uc I’m calling is defined as follows:

```auto
/**
 * Begins an override of the current post process settings.
 */
simulated native function OverridePostProcessSettings( PostProcessSettings OverrideSettings, optional float BlendInTime );
```

---

<div class="post-metadata">

**Author:** ![CobaltUDK](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/cobaltudk/32/1194497_2.png) [@CobaltUDK](https://forums.unrealengine.com/u/CobaltUDK)\
**Post date:** [January 11, 2022, 10:30am UTC](https://forums.unrealengine.com/t/blending-in-new-postprocess-settings-via-script/271272/2 "2022-01-11T10:30:24Z")

</div>

I never used OverridePostProcessSettings, for the DOF I use tick to modify parameters in the way you use. But for change other parameters perhaps is no valid.

---

<div class="post-metadata">

**Author:** ![Chosker](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/chosker/32/710746_2.png) [@Chosker](https://forums.unrealengine.com/u/Chosker)\
**Post date:** [January 11, 2022, 11:06am UTC](https://forums.unrealengine.com/t/blending-in-new-postprocess-settings-via-script/271272/3 "2022-01-11T11:06:33Z")

</div>

you shouldn’t be trying to change the Default PostProcessSettings directly, but rather the already-initialized PP on the Player.

I actually don’t animate them so my process is more rudimentary. it’s probably not relevant to you but in case you do Material Effects it might be useful:

> **My Process**
>
> to do that I followed this method:
> 
> - from the PlayerController’s LocalPlayer get PlayerPostProcess and Find the PP you want by name (the name is what you put in the PP node in the chain in the editor), typecasted
> - change the settings on it
> 
> ```auto
> // find them and cache them
> myUberPP = UberPostProcessEffect(LocalPlayer(myPlayerController.Player).PlayerPostProcess.FindPostProcessEffect('UberPP'));
> mySSAO = AmbientOcclusionEffect(LocalPlayer(myPlayerController.Player).PlayerPostProcess.FindPostProcessEffect('SSAO'));
> myCustomMatPP = MaterialEffect(LocalPlayer(myPlayerController.Player).PlayerPostProcess.FindPostProcessEffect('SomeMaterialPP'));
> // and so on
> 
> // example of changing
> myUberPP.MotionBlurAmount = 0.0f;
> 
> ```

for you it’s probably as simple as replacing one line, where you get newPpSettings:

```auto
newPpSettings = LocalPlayer(myPlayerController.Player).PlayerPostProcess;

```

if you modify the PP make sure you remove the PP chain on level change because references to the PP settings are especially prone to fail with garbage collection and cause crashes. I clear them like so:

```auto
// my playercontroller
simulated event Destroyed()
{
	if (Player != None)
	{
		LocalPlayer(Player).RemoveAllPostProcessingChains();
	}

	Super.Destroyed();
}

```

I put that not only on Destroyed() but also on ClientRestartMap(). there might be other places needed for you since your game is multiplayer

---

<div class="post-metadata">

**Author:** ![Nathaniel3W](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nathaniel3W](https://forums.unrealengine.com/u/Nathaniel3W)\
**Post date:** [January 11, 2022, 6:59pm UTC](https://forums.unrealengine.com/t/blending-in-new-postprocess-settings-via-script/271272/4 "2022-01-11T18:59:21Z")

</div>

In Himeko Sutori, when I zoom the camera in and out, I change the DOF settings directly, without the `OverridePostProcessSettings`.

```auto
WorldInfo.DefaultPostProcessSettings.DOF_FocusDistance = ...
WorldInfo.DefaultPostProcessSettings.DOF_FocusInnerRadius = ...

```

This works just fine for me, and nothing undoes the settings that I change manually. I don’t know the downsides to how I do it. Maybe this approach could cause problems if I used more post process volumes, or if my game were multiplayer.

Maybe I should start doing as @ says and start trying to access PlayerPostProcess instead.

---

<div class="post-metadata">

**Author:** ![Nathaniel3W](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nathaniel3W](https://forums.unrealengine.com/u/Nathaniel3W)\
**Post date:** [January 11, 2022, 7:02pm UTC](https://forums.unrealengine.com/t/blending-in-new-postprocess-settings-via-script/271272/5 "2022-01-11T19:02:15Z")

</div>

One thing I was never able to do was fade in a color lookup table via UScript. If you set a new color lookup table in a post process volume, it fades in very nicely. If you try to change the color lookup table via UScript, it changes immediately, and I don’t see any way to fade into the change. Any idea how you could fade into that change?

---

<div class="post-metadata">

**Author:** ![Nathaniel3W](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nathaniel3W](https://forums.unrealengine.com/u/Nathaniel3W)\
**Post date:** [February 14, 2022, 5:48pm UTC](https://forums.unrealengine.com/t/blending-in-new-postprocess-settings-via-script/271272/6 "2022-02-14T17:48:22Z")

</div>

A postprocess volume broke the technique I was using before to set depth-of-field postprocess settings. So this is what I do now:

```auto
function UpdateDOF()
{
	local PostProcessSettings OverrideSettings;
	local PlayerController PC;

	PC = GetALocalPlayerController();

	// Calculate DOF settings...

	OverrideSettings.bEnableDOF = true;
	OverrideSettings.bOverride_DOF_FocusDistance = true;
	OverrideSettings.DOF_FocusDistance = // ******calculate DOF_FocusDistance******
	OverrideSettings.bOverride_DOF_FocusInnerRadius = true;
	OverrideSettings.DOF_FocusInnerRadius = // ******calculate DOF_FocusInnerRadius******
	OverrideSettings.bOverride_DOF_FalloffExponent = true;
	OverrideSettings.DOF_FalloffExponent = // ******whatever you want the FalloffExponent to be******
	OverrideSettings.DOF_InterpolationDuration = 0.0;

	LocalPlayer(PC.Player).OverridePostProcessSettings(OverrideSettings);
}

```

---

<div class="post-metadata">

**Author:** ![Coldscooter](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Coldscooter](https://forums.unrealengine.com/u/Coldscooter)\
**Post date:** [February 15, 2022, 12:41am UTC](https://forums.unrealengine.com/t/blending-in-new-postprocess-settings-via-script/271272/7 "2022-02-15T00:41:22Z")

</div>

@Nathaniel3W I think you’ll find that if you provide a BlendInTime to OverridePostProcessSettings(), it will blend in as expected, but then blend out once it’s reached it’s target (ie: it won’t stay on the effect).

---

<div class="post-metadata">

**Author:** ![Nathaniel3W](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nathaniel3W](https://forums.unrealengine.com/u/Nathaniel3W)\
**Post date:** [February 15, 2022, 7:01am UTC](https://forums.unrealengine.com/t/blending-in-new-postprocess-settings-via-script/271272/8 "2022-02-15T07:01:08Z")

</div>

Yeah, that’s what happened. So what I do instead is calculate the blend myself and apply the override every tick without a blend time. That doesn’t seem to affect performance at all.
