CG-Lion Cyber-Enhancement shader for Unreal Engine 4 written by Oded Erell (c)2020
cgl_ppm_cyber_enhance is an HLSL custom node for Unreal Engine 4 designed to be used within a Post Process Material to produce a customizable cyber-style magnification effect for game development.
UE4 custom node input parameters:
Shading system inputs:
ColorIn: Input pixel color - UE4 SceneTexture node set to PostProcessInput0
Coords: UV coordinates of the image plane - UE4 TexCoords node set to channel 0
Time: Game time input - UE4 Time node
Custom shader inputs:
These parameters control the design and state of the effect, And should be either defined as prameters to be set in a UE4 material instance, or connected to parameters in a UE4 Material Parameter Collection for dynamic control via C++ or Blueprint
Factor: Distortion factor 0.0 - 1.0 value used to control the magnification effect
Size: Distortion size as a 0.0 - 1.0 percent of the screen plane
Magnification: The amount of magnification at the main effect area
ColorGraphics: The color of the magnify effect graphics
ColorMult: Color multiplier for the magnified area color - white is neutral
ColorDesat: The amount at which the magnified area color is desaturated - 0.0 - 1.0
AnimSpeedMin: Rotation animation speed at Factor 0.0
AnimSpeedMax: Rotation animation speed at Factor 1.0
Variables read from the wrapping UE4 HLSL shader:
Functions called from the wrapping UE4 HLSL shader:
The magnification only works correctly in full-screen view mode.
- Copy the shader file to the Engine/Shaders folder in the Unreal Engine Installation Folder.
- Create a Post Process material.
- Create a custom node including this shader: #include "/Engine/cgl_ue4_ppm_cyber_enhance.usf" return 0;
- Add the needed inputs to to the custom node (see list above)
- Connect the custom node to the Emissive_Color input of the material.
- To control the effect dynamically, Create a Material Parameter Collection with suitable parameters, connect them to the node's inputs, update them during game-play via Blueprint.
Quicker way to do 3, 4: Copy the Blueprint code here: https://github.com/CGLion/CGL_HLSL/blob/master/UE4/cgl_ue4_ppm_cyber_enhance_nodes_setup.txt
Ans paste it into the material to generate the needed nodes setup.