How to seamlessly change environment or a map or a level ? ( VR - Blueprints - Level Streaming )

Hello developers,
Little about my self. I am not a game developer but I been using Unreal since 4.27 and learning a lot and want to produces something and may be share it with people. I am computer scientist and I can program in C/C++/C# and python and since I am a visual learner, I find blueprints way easy to use.

Now, the main question. I have been developing an VR application. Currently on version 5.4 and I use meta quest 3 and it is currently a windows application. I have a VR pawn, the hierarchy for the pawn is CapsuleComponent has the --CameraRoot has the HMD. (Sorry, I will attach the image soon). What I want to do is that when I hover my hand over an object, I can either grab it or interact with it using the “X” press on the motion controller. (Lets see if I can describe the next part for everyone to understand) If I press the interact button, I want to change the level or map from the current main level to a new level with fade in about 1 second and the new level loads which looks same as the main level but environment has changed a bit (from day to night, some other object around moved etc.) and fade out 1 second into this new level. I want to pass the reference to the object that I interacted, so that I can place and transform that object or another instance of it in that new level. After I am done with the task in the new level or map or environment, I want my VR pawn to go back to the same location in main level, when I press a button “B” on the motion controller and all the objects are there are as it is. I am breaking this larger task into smaller parts to get the required functionality.

The problem I am encountering is :

  1. First, I want to see if the fade-in works when I press button “X” and fade-out when I press button “B” - It does not, I tried using the “Get Player Camera Manager” to do the fade-in and out and nothing happens. It is because of the VR nature of the camera? I saw videos where people use widget to do the fade in and out, I will try that later. But is there a better or right way to do the fade-in and -out for a VR based camera ?
  2. For level change, I dont know what to do. I have seen a lots of videos doing the level change the classic way (from which I understood that all the states of actors in the previous level are lost, unless you save their game state and load them back, please correct me if I am wrong ) or using level streaming (which keeps all the references ? ). All the video I have seen, they change the level to something new using the trigger box, but I want current environment to change from place I am standing as seamlessly as possible using button press. (Like changing reality in Avengers - https://www.youtube.com/watch?v=x7Yg6uiYsSg at 1.38, but using fade-in and fade-out) and when change back to the main level with the button press. This is the first biggest problem I am facing right now.

I think I can find a quick and dirty solution but I want to take time to find right and good solution that is good for the performance of my application. It would be very helpful, if any developer has any good insights or a suggestion, especially about the level change. Thank you, looking forward for the replies

P.S - Sorry for such a long post.

As far as I know, there is no camera fade function. You can’t fade a level out. You can make everything black, for sure, but then you can’t see the new level :slight_smile:

As far as swapping levels go, level streaming or level instances will get you there. But again, no fading. Also check out the game instance for passing information between levels, slightly easier than the save game.

If you only want to change the level in subtle ways, then I would recommend staying in the same level, and fading the actors in and out. That IS something you can do with translucent materials, for example.

As far as the Avengers effect goes, good luck :rofl: This is a little like it, and is made using a post processing effect

1 Like

Thank you for the response. Few clarification, I dont want the level to fade, I want it to appear level change as a fade. When the HMD camera has a faded to black for a second or so, it should load a new level or streaming level and fade out into new level.

“Also check out the game instance for passing information between levels, slightly easier than the save game.” - i will try that.

“As far as the Avengers effect goes, good luck :rofl: This is a little like it, and is made using a post processing effect” - Haha, I dont want this effect, I just want the environment to change like that from my stand of view and use fade-in/out to make this transition. :slight_smile:

1 Like

Ok, if you want fade to black / change level / fade back in, then you can just use a vignette ( part of the camera post process )

vig

Thank you the fade-in and out suggestion. It works. I was also able to implement the shader mentioned in the video suggestion but I had to turn off the forward-shading for VR, which forced me to use the TAA instead of MSAA. So I installed the new FSR3 plugin, and its not bad, the game is smoother at higher pixel-density at 3.0 but there is some ghosting/flickering. May be I shall try DLSS sometime in the future. As for vignetting fade in and out, there is still a small region in the center of both the eyes where it is not black and this might not be suitable for level change as the user might see the pop-up of new models, so I will try to make a widget for it and check that as well. I will later try out the level change and if everything works, I will report and close this issue.

1 Like

Great. Try playing with the other vignette param, ‘size’ I think it is…

This is what I do to level swap in VR.

  1. Spawn sphere attached to player head ( material translucent and opacity is zero meaning its transparent )
  2. Slowly turn opacity from 0 to 1 ( screen turns black )
  3. Load “loading” level ( which is a level used to like make the player stay while the real next level is loading.
  4. Once the “loading” level is loaded, the player spawns there and the sphere is attached immediately with opacity 1 meaning its all black.
  5. The opacity is removed and the player sees they are in the loading level. They can move around and wait while the real next level is loaded asyncronously.
  6. Finally, when the real next level is loaded, the same thing happens, spawn sphere attached to their head with opacity 0, slowly make it dark, load next level, and then remove the darkness again.
  7. If you need the darkness to like go towards where the player is looking, you can probably pass the camera forward vector to the material and do some shading trick so that the opacity of the sphere slowly turns black in that direction. I simply use perlin noise.

Works pretty well for me and I still use forward shading.

Thank you for the reply. It is a good idea and saves me the trouble of crating a widget for it.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.