Hi!
Doing that requires rendering your Actor via a SceneCaptureComponent2D and displaying it via post-processing.
Here is the setup I use:
Add a SceneCaptureComponent2D inside your Camera component, and set it projection and FOV settings to match the camera ones. Also configure it to “Use ShowOnly List”, disable “Capture Every Frame” and “Capture on Movement”.
[HR][/HR]
Create a new Material with the Domain set to “Post Process”, Blend Mode to “Translucent”, Blendable Location to “Before Tonemapping” and tick “Output Alpha”.
[HR][/HR]
Create a TextureParam2D parameter in the material and name it “PlayerTexture”. The “PlayerTexture” output RGB channels should go into the final output “Emissive Color”, and the inverse A channel should go on the output “Opacity”.
[HR][/HR]
On your Actor Blueprint, add the “Event BeginPlay” code to:
Create a RenderTarget2D with the Viewport resolution
Set the Target Texture from your SceneCaptureComponent2D to this recently created RenderTarget2D
Setup the SceneCaptureComponent2D to display only this Actor
Dynamically instantiate your previously created Material
Set this Material “PlayerTexture” param value to the previously created RenderTarget2D
Add this Material as a Blendable to your Camera [HR][/HR]
Also, add the “Event Tick” code to:
Disable your Actor rendering
Capture the Scene with SceneCaptureComponent2D manually
Re-enable your Actor rendering
[HR][/HR]You can see my Actor being displayed in front of everything even when it’s clipping the geometry: