How-To: Fade Occluding Geometry
Goal: fade out walls / foliage that come between the camera and the pawn, instead of (or alongside) pulling the camera in.
M_CrimsonCameraOccluderFade) and references it by default in Project Settings, so an occluder's own material is never modified.1. Add the occlusion component
UCrimsonCameraOcclusionComponent traces from the camera to the pawn each tick. For occluders that carry the fade tag it temporarily swaps each material slot to a dynamic instance of the project's dither fade material, drives the fade scalar in, then restores the originals once the occluder no longer blocks (a fast FadeOutInterpSpeed returns the original almost immediately). It runs only for the locally-controlled pawn.
2. Tag the occluders
- Add the
FadeableActorTag(defaultCameraFadeable) to each occluder actor (Actor -> Tags). That is the only per-occluder step - their materials are left untouched. - Optionally tune
FadedAmount,FadeInterpSpeed,FadeOutInterpSpeed(faster reappear),TraceRadius, andTraceChannelon the component.
3. The fade material (optional)
Fading works out of the box: Config/DefaultCrimsonCamera.ini points Project Settings -> Crimson -> Crimson Camera -> Occluder Fade Material at the bundled M_CrimsonCameraOccluderFade. To use your own look, set that project setting, or set FadeMaterialOverride on one pawn's component. A fade material just needs a scalar parameter named by FadeParameterName (default FadeAmount, 0 = opaque -> 1 = invisible) wired to a dither / opacity-mask.
FadeOutInterpSpeed returns the originals almost immediately once it stops blocking. If no fade material is configured (override and project default both unset), the component logs once and does nothing.See also
- How-To: Prevent Camera Clipping - pull the camera in instead of (or alongside) fading occluders.
- How-To: Expose Camera Options as User Settings - let players turn occlusion fade on/off and set its strength.