Download

How to add a simple, generic, level independent fade to black (in VR)?

I’m trying to add a simple fade to black to my game. I’ve done a bunch of searching and I can’t find any solutions that will both work for me and that I don’t feel are giant hacks.

Doing it through a matinee will not work for me, for a bunch of reasons. The fade needs to be controlled by a gameplay blueprint and matinees can only live in the level. Yes, I could do a search for the actor on BeginPlay or whatever, but that means that every one of our levels has to have the same copy+paste actor in it in order to support fading to black. It’s gross and it doesn’t scale.

What I really want is something completely level independent that can be reused in a generic fashion. Bonus points if I’m able to turn it into a central system or manager that can handle multiple fade requests.

The other major caveat is that I’m doing this in VR. This means that anything hacky, like attaching something to the camera, won’t work, because the player can always move his head outside of the shape.

As always, any help is appreciated. Thanks.

Try using post process Material which goes black over time and put a few scalar parameters and if else conditions in the shader to control it via game code/Blueprint

I done before this using UMG. I have two widgets, one FadeInFromBlack, and another, FadeOutToBlack.

They are just border widgets that fill the screen and are coloured black.
I add an animation that changes the opacity, then run this animation OnConstruct. (FadeIn goes from 1 alpha to 0 alpha, FadeOut goes from 0 alpha to 1).

Then I add events in GameInstance, FadeIn and FadeOut that adds them to the viewport, and then removes them after a delay. This way I can add fade in/outs from anywhere, by getting game instance and calling them.

I’m guessing that this was not done in VR?

It was in VR yep, works fine

Hmm, I guess I’ll have to do some more research into UMG. I wasn’t able to get that working so that it would cover both eyes. Thanks for the tip.

Thanks also for the post process tip. I’ll investigate that, as well.