Object Fading

Fading Settings

The fading behavior is controlled by the "Fade Settings" section within your FATPCCameraMode structure. Each parameter influences how objects fade in and out of view, allowing you to tailor the effect to your game's visual style.

  • Fade Times:

    • FadeInTime: Smooth Reappearance: Controls the time (in seconds) it takes for faded objects to become fully visible again. Higher values result in a slower and more gradual fade-in.

    • FadeOutTime: Gentle Disappearance: Determines the time (in seconds) it takes for obstructing objects to fade out of view. Higher values lead to a slower and smoother fade-out.

  • Material Parameter Control:

    • MaterialFadeMinValue: Transparency Floor: Sets the minimum value for the material parameter that controls the object's transparency. Typically, this value represents full transparency (e.g., 0 for opacity or 1 for transparency).

    • MaterialFadeMaxValue: Opacity Ceiling: Defines the maximum value for he material parameter controlling transparency. This value typically represents full opacity (e.g., 1 for opacity or 0 for transparency).

    • MaterialFadeParamNames: Targeted Parameters: Contains an array of material parameter names that the fading system should manipulate. These parameters must exist in your materials and be of a scalar type (float).

  • Object Detection:

    • FadeChannel: Trace for Obstructions: Specifies the collision channel used for line traces to detect objects between the camera and the character. Choose a channel that appropriately reflects the collision properties of the objects you want to fade.

  • Self-Fading (Character Transparency):

    • bFadeSelfIfCollision: Character Fading: Enables fading for the character itself when the camera collides with it. This prevents the character from obscuring the player's view in tight spaces.

    • bUseCustomFadeOutTimeForSelfFade: Custom Fade Time: Allows you to use a separate fade-out time specifically for character fading.

    • SelfFadeCustomFadeOutTime: Character Fade Duration: Sets the fade-out time (in seconds) for the character if bUseCustomFadeOutTimeForSelfFade is enabled.

    • SelfFadeCheckRadius: Collision Detection Range: Defines the radius of the sphere used to detect collisions between the camera and the character for self-fading.

    • bSelfFadeAttachedActors: Include Attachments: When enabled, any actors attached to the character (e.g., weapons or accessories) will also fade out along with the character during self-fading.

To ensure that the fading system works correctly with your meshes, you need to set up your materials appropriately:

  1. Adding a Transparency Parameter:

    1. Open your material in the Material Editor.

    2. Create a new scalar parameter (float) and give it a descriptive name (e.g., "Opacity" or "Transparency"). This parameter will control the object's transparency level.

    3. Add this parameter name to the MaterialFadeParamNames array in your Camera Mode's Fade Settings.

  2. Connecting the Parameter:

    1. Connect the scalar parameter to the Opacity input of your material's main node (usually a "Standard" or "Base Color" node).

    2. If you are using a more complex material setup with multiple material layers, ensure that the parameter is appropriately connected to control the overall transparency of the material.

  3. Collision Settings:

    1. Make sure that your meshes have appropriate collision settings that correspond to the FadeChannel you have chosen in your Camera Mode settings. This ensures that the line traces used for object detection will work correctly.

  4. Example: Opacity-Based Fading

    1. In a simple setup, you might have a scalar parameter named "Opacity" in your material. Set the MaterialFadeMinValue to 0 (fully transparent) and MaterialFadeMaxValue to 1 (fully opaque). Connect this "Opacity" parameter to the Opacity input of your material's main node. When the fading system detects an obstruction, it will smoothly lerp the "Opacity" parameter between 0 and 1, causing the object to fade in and out of view.

Last updated