In the context of rendering to texture with a Scene Capture Component 2D
, I am looking for a way, preferably in Blueprint, to make some actors visible to certain cameras (player) and invisible to others (render to texture).
Although the question has been asked a number of times on AnswerHub, I haven’t found a satisfactory answer yet.
This could be as simple as calling SetVisibility
from the Blueprint of the capture, but I don’t see what events I could use. Also, a stateless solution would be better.
HI Julien,
There are two methods on USceneCaptureComponent that are both Blueprint-callable:
- HideComponent (hides a specific component)
- HideActorComponents (hides all components owned by the actor).
If working with a capture actor rather than a capture component, you should be able to call them via the CaptureComponent2D member of the capture actor.
These control hiding/showing things for the scene capture. If you want to prevent things from being drawn for a particular player during normal rendering, then you can either add to UPlayerController::HiddenActors or implement/override BuildHiddenComponentList, UpdateHiddenActors, or UpdateHiddenComponents, depending on your specific needs. These aren’t currently exposed to Blueprints, but it would be easy to do so in a game-specific blueprint function library or UPlayerController subclass.
Cheers,
Michael Noland
Answer is on the spot, thank you.
Hi Julien, do you have any objection if we anonymously copy this question/answer over to the public Answerhub? Thanks
Hi Stephen, sure, go ahead.