ULimenScreenVisibilityChecker
Overview
ULimenScreenVisibilityChecker is a custom UActorComponent designed to determine if an actor is visible on the screen. It uses a render target, scene capture, and a compute shader to perform this check. The component can be spawned in Blueprints and provides events for visibility updates.
Properties
Type | Name | Access | Description |
|---|---|---|---|
| DebugVisualizationRenderTarget | Protected | A soft pointer to a debug visualization render target. Only available in editor mode. |
| RenderTargetSizeScale | EditDefaultsOnly | The scale factor for the render target size relative to the viewport. Default is 0.5. |
| StencilCheckerMaterial | EditDefaultsOnly | A soft pointer to the material used for stencil checking. |
| MaskParameter | EditDefaultsOnly | The name of the parameter in the stencil checker material that defines the mask to check. Default is "Mask". |
| MaskToCheck | EditDefaultsOnly | The value of the mask to check against. Default is 1. |
Functions
Return Type | Signature | Description |
|---|---|---|
| OnActorVisibilityUpdated | A multicast delegate that fires when the actor's visibility changes. |
| GetStencilMask() const | Returns the current mask value being checked. |
| IsVisible() const | Returns whether the actor is currently visible on the screen. |
| GetRenderTarget() const | Returns the render target used for capturing the scene. |
Usage & Implementation Notes
Threading Constraints: The component uses asynchronous tasks to handle GPU readback, ensuring that it does not block the game thread.
Replication Requirements: This component is designed to be used in a single-player or local environment and does not require replication.
Memory Lifetime Management: The render target, scene capture, and material instances are managed using strong and weak pointers to ensure proper memory management.
Initialization Dependencies: The component requires an owner camera to function correctly. It attempts to find the camera from the owning pawn or the root component of the actor.