PDA

View Full Version : Post-processing problem using Unrealscript



rit
12-02-2010, 08:45 PM
Hi all!

I'm new to unrealscript and I'm trying to do post-processing(a simple blur effect) via unrealscript but currently I encounter some issues.

I set a hotkey for toggling PP effect. ("Z" for PP, "X" to reset)

When I first press the "Z" key, the screen gradually changed from the default PP effect to the PP effect I override.

However, if I reset that ( by pressing"X" key, which then calls a ZeroOverridePPDeltaSettings() function to clean the override effect ) and press "Z" again, the screen turns to the blur effect immediately without that interpolation moment.

I suspect it has to do with some variables I didn't reset it after I clean the override PP effect for the first time, but I can't figure out what variable it is.

This is probably a simple question but I'm new to unrealscript and any help will be appreciated.

Thank you!

***Edit 2010/12/03***

This is the function I called after pressing "Z" key:

function ChangePPSettings(Pawn inPawn)
{
local LocalPlayer LocalPlayer;
local PostProcessSettings DarkSettings;

`log("Test out postprocessing effect in run-time!");

LocalPlayer = LocalPlayer( PlayerController(inPawn.Controller).Player );

LocalPlayer.bOverridePostProcessSettings = true;
DarkSettings = LocalPlayer.CurrentPPInfo.LastVolumeUsed.Settings;

DarkSettings.bEnableDOF = true;
DarkSettings.DOF_FocusInnerRadius = 1.f;
DarkSettings.DOF_BlurKernelSize = 12.f;
DarkSettings.DOF_MaxFarBlurAmount = 2.f;
DarkSettings.DOF_InterpolationDuration = 15.f;

LocalPlayer.OverridePostProcessSettings(DarkSettin gs, -1.f);

if ( UTPawn( inPawn) != None )
{
`log("AI can't see you!");
UTPawn( inPawn ).SetInvisible( true );
}
}

...and this is the function called when pressing "X" key:

function ResetPPSettings(Pawn inPawn)
{
local LocalPlayer LocalPlayer;

`log("Clear PP override settings");

LocalPlayer = LocalPlayer( PlayerController(inPawn.Controller).Player );
LocalPlayer.ClearPostProcessSettingsOverride(PPRec overyDuration);
}