Create Whole Screen Effects and cycle through them while in-game with press of a button!
In this tutorial I show you the unrealscript code to dynamically set the Post Process Material Effects for your Post Process Chain for Your Level.
This enables you to do things like:
1. show indicator of damage taken as the edges of the player screen glowing red in a spherical shape
2. make the whole screen turn blurry for a short time to show sudden velocity increase
3. Fade the screen to a desaturation (more black and white) as the player unit dies
4. Create a visual overlay of a Lightning Effect across entire player screen to show player is being hit by a lightning weapon.
Here's a video I made showing you what this tutorial will help you do!
Be sure to get to the part of video where I demo my Rainbow Effect !
I find it exceedingly entertaining
(starts at 5:20 in video)
~~~
Three Material Effects For You
At the end of this tutorial I give you the whole code for 3 of the material effects in this video, including my absolute favorite!
1. Intense Motion Blur
2. Sine Wavy Effect
3. Rainbow Effect
~~~
Creating Whole Screen Effects For Your Game
Effects that alter your entire screen while in game, known as the Scene, are controlled via something called the Post Process Chain.
Every level has only 1 Post Process Chain as its default chain.
After you've created your Post Process Chain, go to view-> world properties in the UDK to Set your PPC.

~~~
Creating and Naming Post Process Chain Nodes
If your level doesn't have one that you feel like modifying, you need to make a new one by right-clicking-> new post process chain while in your preferred package.

Add an UberPostProcessNode and a Material Effect Node.
Then you can tweak the settings till you are happy with how your game looks.

Make sure the little G in top button row of UDK is pressed, so you are seeing the game view of your PPC in action.

Note you should add a Material Effect node but you dont have to set it to anything, just give it a name that you will then use in your code.
~~~
Using The Code Below With Many Levels
The PPC for each level must have the same kinds of nodes with the same exact names.
So the materialeffect node must have same name in every level's Post Process Chain.
~~~
Code to Change Material Effects While In-Game
~~~
Calling cycleScreenEffects()
See this tutorial of mine for info on how you can capture user input to run the cycleScreenEffects() function any time you want while in game:
Capturing User Keyboard/Mouse Input
~~~
Creating Your Material Effects
Look up info on Material Instances if you want to be able to change the actual properties of your material effect during gameplay.
For this tutorial I am showing simple materials.
Here's the whole code I used for 3 of the Materials you see in my video (the 4th one used a custom texture I made):
Extreme Blur Material Effect

Sine Wavy Material Effect

Rainbow Material Effect

~~~
Multiple Material Effects at Same Time?
Simply create additional Material Effect Nodes in your PPC and give them unique names!
So you could have your EnvironmentalMaterialNode, and your DamageIndicatorNode, etc etc.
Turn any of them off by setting the material to none or setting bshowinGame to false;
~~~
Summary
Using the code I've provided you with and your own creativity with making material effects, you can create all sorts of new themes, special effect, environment effects, damage indicators, speed of motion indicators and much more!
And you can show these material effects and specify their duration with simple function calls!
Enjoy!
Rama
PS: Advanced:
Use Material Instances to set parameters for your materials that you can edit via unrealscript, to for example, have a slowly increasing desaturation of the scene that is controlled by unrealscript code as the desaturation value in the material is a parameter.
Material Instance Tutorial
In this tutorial I show you the unrealscript code to dynamically set the Post Process Material Effects for your Post Process Chain for Your Level.
This enables you to do things like:
1. show indicator of damage taken as the edges of the player screen glowing red in a spherical shape
2. make the whole screen turn blurry for a short time to show sudden velocity increase
3. Fade the screen to a desaturation (more black and white) as the player unit dies
4. Create a visual overlay of a Lightning Effect across entire player screen to show player is being hit by a lightning weapon.
Here's a video I made showing you what this tutorial will help you do!
Be sure to get to the part of video where I demo my Rainbow Effect !
I find it exceedingly entertaining

~~~
Three Material Effects For You
At the end of this tutorial I give you the whole code for 3 of the material effects in this video, including my absolute favorite!
1. Intense Motion Blur
2. Sine Wavy Effect
3. Rainbow Effect
~~~
Creating Whole Screen Effects For Your Game
Effects that alter your entire screen while in game, known as the Scene, are controlled via something called the Post Process Chain.
Every level has only 1 Post Process Chain as its default chain.
After you've created your Post Process Chain, go to view-> world properties in the UDK to Set your PPC.

~~~
Creating and Naming Post Process Chain Nodes
If your level doesn't have one that you feel like modifying, you need to make a new one by right-clicking-> new post process chain while in your preferred package.

Add an UberPostProcessNode and a Material Effect Node.
Then you can tweak the settings till you are happy with how your game looks.

Make sure the little G in top button row of UDK is pressed, so you are seeing the game view of your PPC in action.

Note you should add a Material Effect node but you dont have to set it to anything, just give it a name that you will then use in your code.
~~~
Using The Code Below With Many Levels
The PPC for each level must have the same kinds of nodes with the same exact names.
So the materialeffect node must have same name in every level's Post Process Chain.
~~~
Code to Change Material Effects While In-Game
Code:
//Put this code in an ACTOR subclass //because of the attempt to access //WorldInfo as used in the code //PPC data that is set in defaultproperties //testing only var PostProcessChain PPC; var int curMaterialEffectIndex; //global temp data //for speed efficiency var array<PostProcessEffect> curEffects; //====================================== //list all the nodes in the //Post Process Chain assigned //via defaultproperties //just for testing really function listPPEs() { local int v; for (v = 0; v < PPC.Effects.length; v++ ) { `log("ppe"$v@PPC.Effects[v].EffectName); } } //I modified loadCurEffects code from the UDN tutorial function loadCurEffects(Name effectName, optional class<PostProcessEffect> MatchingPostProcessEffectClass = class'PostProcessEffect') { local PostProcessEffect PostProcessEffect; local PlayerController PlayerController; local LocalPlayer LocalPlayer; //----- clear the old global array data ----- curEffects.length = 0; //----------------------------------------------- // Affect the world post process chain if (WorldInfo != None) { ForEach WorldInfo.AllControllers(class'PlayerController', PlayerController) { LocalPlayer = LocalPlayer(PlayerController.Player); if (LocalPlayer != None && LocalPlayer.PlayerPostProcess != None) { PostProcessEffect = LocalPlayer.PlayerPostProcess.FindPostProcessEffect(effectName); if (PostProcessEffect != None && (PostProcessEffect.Class == MatchingPostProcessEffectClass || ClassIsChildOf(PostProcessEffect.Class, MatchingPostProcessEffectClass)) ) { curEffects.AddItem(PostProcessEffect); } } } } } //repeated calls to this function //cycle the material effect among 3 choices //you must create/choose which //effects are displayed. //I provide you with the code //for 3 of the effects below function cycleScreenEffects() { local MaterialEffect ppe; local int v; //get all nodes from the current PPC //that are named 'VictoryScreenEffects' //you must name your PPC nodes //via UDK editor //you can create new PPC //and add a uberpostprocess node //and a materialeffect node //and name both to have most //PostProcess effects available to you //via code (the other big one is a Blur node) //load the material effect node by name loadCurEffects('VictoryScreenEffects'); if (curEffects.Length <= 0) return; for (v = 0; v < curEffects.length; v++) { //get the next node that is named //'VictoryScreenEffects' ppe = MaterialEffect(curEffects[v]); if (ppe != None) { curMaterialEffectIndex++; //reset cycle if (curMaterialEffectIndex > 3) curMaterialEffectIndex = 0; if (curMaterialEffectIndex == 0) { ppe.Material = none; } else if (curMaterialEffectIndex == 1) { ppe.Material = Material'YourPackage.blurEffect'; } else if (curMaterialEffectIndex == 2) { ppe.Material = Material'YourPackage.sineWavyEffect'; } else if (curMaterialEffectIndex == 3) { ppe.Material = Material'YourPackage.RainbowEffect'; } } // end ppe != none } //for loop } DefaultProperties { //PPC //get path of your PPC in UDK //by right clicking on it //"copy full path" //if you have many levels with different PPCs //dont worry, this is just for testing really //and is not used in the main code. PPC = PostProcessChain'YourPackage.YourPostProcessChain' }
Calling cycleScreenEffects()
See this tutorial of mine for info on how you can capture user input to run the cycleScreenEffects() function any time you want while in game:
Capturing User Keyboard/Mouse Input
~~~
Creating Your Material Effects
Look up info on Material Instances if you want to be able to change the actual properties of your material effect during gameplay.
For this tutorial I am showing simple materials.
Here's the whole code I used for 3 of the Materials you see in my video (the 4th one used a custom texture I made):
Extreme Blur Material Effect

Sine Wavy Material Effect

Rainbow Material Effect

~~~
Multiple Material Effects at Same Time?
Simply create additional Material Effect Nodes in your PPC and give them unique names!
So you could have your EnvironmentalMaterialNode, and your DamageIndicatorNode, etc etc.
Turn any of them off by setting the material to none or setting bshowinGame to false;
~~~
Summary
Using the code I've provided you with and your own creativity with making material effects, you can create all sorts of new themes, special effect, environment effects, damage indicators, speed of motion indicators and much more!
And you can show these material effects and specify their duration with simple function calls!
Enjoy!
Rama
PS: Advanced:
Use Material Instances to set parameters for your materials that you can edit via unrealscript, to for example, have a slowly increasing desaturation of the scene that is controlled by unrealscript code as the desaturation value in the material is a parameter.
Material Instance Tutorial
Comment