Camera Dither Fade
Last updated
Last updated
In most games, an object occurring between the character and camera will be dithered out, or fading out, according to the duration it blocks the character.
ComponentCameraSystem offers an easy way to setup camera dither fade. Just follow the next steps:
Create a new blueprint class inherting the EPlayerCamaraManager
class:
Open the blueprint class you just created and you can see several parameters in the Dither section. Tweak them according to your needs. An introduction to these parameter is presented at the end of this page. When you finish, don't forget to set this class in your player controller.
The next step is to setup the materials you want to apply dither fade to.
For the player character, go to the main material (e.g., the M_Mannequin material in UE5) and connect to the Opacity Mask node as follows:
That is, first create a scalar parameter named EFadeWeight (mandatory name) and set its default value as zero; then substract it with 1 followed by a DitherTemporalAA node. Finally connect it to Opacity Mask.
For other materials including foliage, buildings, etc, do the same thing and connect to the Opacity Mask pin. But for some materials, you should first set the Blend Mode to Masked because the Opacity Mask pin shows up only in the Blend Mode.
Remarks: Dither fade now only supports Masked materials. For materials that cannot be set as Masked blend mode, I recommend using ResolveOcclusionExtension.
Now enjoy the nice dithering effect!
Known issue: The DitherTemporalAA node can result in an issue under some occasions: it causes low-bit shadow artifacts, as shown below. If you really care about this issue, maybe you should avoid using this feature, and I will attempt to deal with it in the Beta version.
Update 1: You can partly solve this issue by adding a ShadowPassSwitch node right after the DitherTemporalAA node to have shadows opaque. The downside is that if you do so, the shadows will never disappear even if the object itself turns fully transparent.
Descriptions of dither paramerters:
Enable Dither
Whether to enable dither fade.
Dither Fade Params
A set of parameters defining dither behaviours.
Object Types
Array of object types of actors that should be taken into account for fade. Note that this parameter should exclude the type of self, which is usually Pawn.
Actors Types to Ignore
Actor types to ignore for fade.
Actors to Ignore
Actors ignored for fade.
Sphere Radius
Sphere radius for tracing objects.
Max Trace Length
Maximum trace length. Set as 0 to use the length from camera to target.
Enable Self Dither
Whether to enable self dither fade.
Self Type
Object type of self, usually Pawn.
Dither Self Trace Length
Trace length for dither fading the controlled pawn (self).
Dither Self Max Weight Distance
Distance determining max dither weight. If camera-hit distance is less than this value, weight of self dither would be the largest.
Show Debug
Whether to show debug info.
Max Weight
Maximum dither fade weight. 1 represents fully faded.
Dither Fade In Time
Fade in time.
Dither Fade Out Time
Fade out time.
Dither Tick Interval
Tick interval, in seconds. Large values save more performance but will result in lagging.