Smooth Scene Fade Transition in VR

Using multiple scene is a great way to better organize and optimize your VR game. But how can you go smoothly from one scene to another without breaking the player's immersion ? This is what I'll show you in this unity VR tutorial.
▶ SUBSCRIBE : / @valemtutorials
▶ PATREON : / valemvr
▶ DISCORD: / discord
▶ MAIN CHANNEL : / valemvr
How to setup the XR Rig for Unity Interaction Toolkit : • Introduction to VR in ...
How to setup Ray to interact with User Interface :
• Introduction to VR in ...
Download the Unlit Transparent Color Shader :
drive.google.com/file/d/1xgK1...

Пікірлер: 90

  • @elephin
    @elephin Жыл бұрын

    For anyone having the same problem as I had, I believe that it is bcs of a newer version of Unity or maybe the material itself, but if you try the fadeIn action and can't try changing the name of the material you are calling from "_Color" to "_BaseColor"

  • @BossKing1243

    @BossKing1243

    Жыл бұрын

    Yeooo that works! Thanks bro

  • @wenli4070

    @wenli4070

    6 ай бұрын

    You're a genius! Thank you!!

  • @sardarshahrukh5682

    @sardarshahrukh5682

    6 ай бұрын

    This comment should be pinned Great!

  • @lucutes2936

    @lucutes2936

    2 ай бұрын

    What

  • @drruka850
    @drruka8502 жыл бұрын

    Yes, thank you so much! You have no idea how long I have been thinking about this. Can't wait to try this out in my game this weekend.

  • @ValemTutorials

    @ValemTutorials

    2 жыл бұрын

    Nice let me know how it works ! :D

  • @zillieness
    @zillieness Жыл бұрын

    Thank you so very much for these tutorials. They are extremely helpful and still work a year later!

  • @cedricknapp2889
    @cedricknapp28892 жыл бұрын

    Merry Christmas, thanks for the great tutorial!

  • @sl4927
    @sl4927 Жыл бұрын

    Thank you for the tutorial and especially for the very didactic approach

  • @wenli4070
    @wenli40706 ай бұрын

    Thanks for the detailed tutorial, learnt a lot!

  • @aliasd5423
    @aliasd54232 жыл бұрын

    Exactly what I needed when I needed it, suggestion, I used post processing volumes for my fading instead of a quad, and it's much nicer because you can add stuff like zoom and bloom

  • @criskywalker17

    @criskywalker17

    Жыл бұрын

    Nice one! How can it be done? Because this way I get my grab and teleportation rays too buggy

  • 2 жыл бұрын

    You are already making me work on holidays! Painful but great! :-)

  • @serpnta1267
    @serpnta12672 жыл бұрын

    Great tutorial! Thank you.

  • @CaseyBoller
    @CaseyBoller2 жыл бұрын

    You should really make an announcement video on main, as a long time viewer (and patreon sub, though I hadn't checked in a while) I had no idea this channel existed! Great video as always :)

  • @ValemTutorials

    @ValemTutorials

    2 жыл бұрын

    Thats a good point Casey thank you ! I'll make a new video announcing the new channel soon

  • @moritzfriedrich
    @moritzfriedrich Жыл бұрын

    You are brilliant. Thanks so much!

  • @michaorzechowski4948
    @michaorzechowski49482 жыл бұрын

    Merry Christmas!

  • @ScareFire
    @ScareFire2 жыл бұрын

    Nice tutorial !

  • @ChuckiBinner
    @ChuckiBinner2 ай бұрын

    Fantastic! Great video, very helpful, thank you🤟

  • @silwer222
    @silwer2222 жыл бұрын

    Merry Christmas! Great tutorial as always. Fade mechanism is very useful in VR. I am currently trying to prevent user from looking through the walls. Not sure how to do it, but I'll probably need to use some kind of collider attached to user's camera. The fading mechanism will also be usefull, I can block user's vision when he tries to pass through the wall :D

  • @samsil187

    @samsil187

    Жыл бұрын

    I was thinking the same thing. Whats to stop the player from cutting through other objects? I think setting the render on the fade object really high would work. Did you find a solution?

  • @Tester13565
    @Tester13565 Жыл бұрын

    always thank you

  • @MsGul
    @MsGul Жыл бұрын

    Thank you so much!

  • @kingbrodan
    @kingbrodan2 жыл бұрын

    Great video! Would love to see a save and load function that works in VR, having a hard time understanding how to save and load position and rotation or even variables when transitioning scenes instead of having to restart the whole scene.

  • @tctopcat1981
    @tctopcat19812 жыл бұрын

    wow great tut.

  • @usernotfound6407
    @usernotfound640711 ай бұрын

    dude i searched your channel for 20 minutes, just to show someone how fucking beautiful Belgian accent is

  • @CactusVRstudios
    @CactusVRstudios2 жыл бұрын

    Good one. I'll use some of this for the next Cactus Cowboy VR game. It's much less complex than the spaghetti code I did for my fader. Note for others; You also use this quite easily as a damage vignette / indicator.

  • @dantheman3825

    @dantheman3825

    5 ай бұрын

    CACTUS I NEED YOUR TIPS ON HOW TO MAKE AN INDE GAME AS GREAT AS YOURS

  • @esrivera2228
    @esrivera22282 ай бұрын

    Thaks for your help

  • @TheARTofMining
    @TheARTofMining7 ай бұрын

    Thanks for the video. Note one thing this makes the controller rays dissapear (laser pointers). Possibly best way is to disable the fader quad all together and then enable it only when required. I believe the XR rig its fighting/blocking the laser pointer rendering. I think its becasue the shader you provided does not compensate for the render queue but my knowledge is limited on shaders. This is on Standard Render Pipeline. I did try scaling the quad to .1 and changing material render queue to no avail.

  • @REC_crazy
    @REC_crazy Жыл бұрын

    Hey, can you help? I want to make it an on collision script so that whenever I touch it the scene changes

  • @genofelice6034
    @genofelice6034 Жыл бұрын

    Thanks. I have been looking for a way to fade XR scenes for a while. This seems to be the answer. Fade out works great but, for some reason, fade in happens in a flash no matter what duration I set.

  • @Andrew-lo2lk

    @Andrew-lo2lk

    Жыл бұрын

    This happens to me too, fade in keeps flashing :(

  • @chikodarkzcaguaii
    @chikodarkzcaguaii2 жыл бұрын

    oh shit, this is good

  • @A_walk_in_the_park
    @A_walk_in_the_park Жыл бұрын

    Hello Valem, awesome tutorial as always. Even though the scene loading is done asynchronously, there is usually still the default hourglass icon from oculus appearing and the music still freezes on the transition. How could this be resolved?

  • @hate7486
    @hate7486 Жыл бұрын

    Great Tutorial! Is there any possibility to keep the XR interactor Line Visual?

  • @frankyredente4152
    @frankyredente41523 ай бұрын

    @ValemTutorials thank you this is great. I have implemented this method in my VR game, the fade in and and out works great. The Async of the scene is not working. I still get a little freeze hang time after one scene fades out and before the fade in on the next scene starts. Do you think you could help me to understand why? I get no errors so I am not sure what's going on. But it seems that there is no Async loading while the fade out is happening. The Async method is exactly has you done it in the video - and is implemented correctly in the UI buttons. Thank you

  • @georgegonzalez5322
    @georgegonzalez53222 жыл бұрын

    What about when the scene is not empty and the game chuggs even with this solution? How would you control or prevent player from fading too soon, due to awake and start functions? We have tried delaying the fade out a few seconds after and it would still chugg.

  • @johnkarl3143
    @johnkarl31432 жыл бұрын

    Any idea as too why my Ui elements show through the quad? (text and images can been seen through the quad when the renderer is set to 1?) Not too bad as it me made look into fading my Ui which has give me more control over the looks of my game.

  • @davidson4101
    @davidson41012 жыл бұрын

    I'm a big fan of yours I always wanted to have a vr glasses to play but I don't have a stove how to make a homemade game for glasses made of cardboard

  • @Andrew-lo2lk
    @Andrew-lo2lk Жыл бұрын

    I'm having a problem where if you call the FadeIn in another script it'll reach 50% opacity but then flicker and reset to 100% opacity, the fade in plane is not too close to camera! I see someone else a few months ago was having the same problem :(

  • @silentshadow89
    @silentshadow892 жыл бұрын

    Hi bro, nice work, why doesn't Visual Studio recognize the 'Color' and 'Renderer' parameters, what library or resource do I need to have installed for it to work? I'm trying to develop something in VR and I have installed everything I need in theory, but I don't know what happen.

  • @billybobthe9thjr786

    @billybobthe9thjr786

    Жыл бұрын

    same here mate

  • @jamesprise4252
    @jamesprise4252 Жыл бұрын

    any help on how to fade in to one scene, wait 30 seconds, then fade to the next???

  • @TurkiKAlqou
    @TurkiKAlqou2 жыл бұрын

    It's messing with my ray interactor help

  • @fatamatojjohora3755
    @fatamatojjohora37555 ай бұрын

    hi i am totally beginner,i am looking for that but i need to do that from beginning how to put cube button scene .is it a one video or its has other series as well

  • @sudhakarkumar2080
    @sudhakarkumar208015 күн бұрын

    I am using OVR Rig and Ray Interactor SDK for UI when i created Screen Fader by following you, the ray interactor is not accessing UI elements, How can i fix this problem.

  • @krestenkuzkuz
    @krestenkuzkuz Жыл бұрын

    Any idea of how to just make the scene black for a specific duration? I tried with nested while loops and three alphas, didn't work....

  • @ValemTutorials

    @ValemTutorials

    Жыл бұрын

    after fading you can wait a bit before un fading by doing : yield return new WaitForSeconds ( and give it the number of second you want to wait

  • @benemy9
    @benemy9Ай бұрын

    The FaderScreen seems to not only block ray interactors, but also the UI canvas. As a quick fix for this, I modified the SceneTransitionManager to set the FadeScreen GameObject to be active only during the fade, and inactive otherwise: public class SceneTransitionManager : MonoBehaviour { public FadeScreen fadeScreen; private void Start() { StartScene(); } private void StartScene() { StartCoroutine(StartSceneRoutine()); } private IEnumerator StartSceneRoutine() { fadeScreen.gameObject.SetActive(true); fadeScreen.FadeIn(); yield return new WaitForSeconds(fadeScreen.fadeDuration); // set FadeScreen to inactive, to prevent blocking ray interactors and UI canvas fadeScreen.gameObject.SetActive(false); } public void GoToScene(int sceneIndex) { StartCoroutine(GoToSceneRoutine(sceneIndex)); } private IEnumerator GoToSceneRoutine(int sceneIndex) { fadeScreen.gameObject.SetActive(true); fadeScreen.FadeOut(); yield return new WaitForSeconds(fadeScreen.fadeDuration); SceneManager.LoadScene(sceneIndex); } }

  • @twistedsagedk
    @twistedsagedk2 жыл бұрын

    An idea could be to store the IEnumerator instance and stop the existing fade if already in progress :)

  • @ValemTutorials

    @ValemTutorials

    2 жыл бұрын

    Good advice !

  • @willworkforfood9102
    @willworkforfood9102 Жыл бұрын

    Great video, thank you. How can I activate the transition manager script when entering a collider? I would like to use this to load the next scene when the player reaches the end of the level just by reaching an end zone/collider.

  • @willworkforfood9102

    @willworkforfood9102

    Жыл бұрын

    Managed to figure it out. Simple cube for the restart zone, disabled the mesh rendered and added a triggered collider and rigidbody. Then just add a XR simple intractable and drop the Transition manager on one of the entered events.

  • @fernandocgi3874
    @fernandocgi38742 жыл бұрын

    Awesome thanks alot! But when i change the scenes, the loaded one gets laggy any idea how to fix it? before used to run smoothly

  • @fernandocgi3874

    @fernandocgi3874

    2 жыл бұрын

    Nvm it runs smoothly when its build into the oculus. Only on the editor it gets laggy

  • @cherrycoked3
    @cherrycoked3 Жыл бұрын

    Hello, amazing video. How can I make it that instead of when they click the button, it is when they touch an item that they get automatically transported?

  • @imanniom

    @imanniom

    11 ай бұрын

    you can use the OnTriggerEnter in another script that can detect whether the user have toch the object or not. the use the method inside OnTriggerEnter to use in the logic valem explained for scene transition.

  • @rylee5233
    @rylee52332 жыл бұрын

    would you mind if I ask a question? I can not public FadeScreen fadeScreen; it seems like if I just define this I got a error" The type or namespace name 'fadeScreen' could not be found".How can I make it work?

  • @neilfosteronly

    @neilfosteronly

    2 жыл бұрын

    The public FadeScreen is the name of the first script he made. Check if you made the current name.

  • @pratyasha4849
    @pratyasha48498 ай бұрын

    the button is not clickable in VR, how can we solve this problem

  • @jackward5944
    @jackward594411 ай бұрын

    Hey great tutorial! Is there a way to prevent really bad lag and stuttering when the quad is infront of the camera? The fade works great but as soon as the quad has faded out looking around my scene becomes incredibly jarring. Any help would be greatly appreciated. Thanks

  • @ValemTutorials

    @ValemTutorials

    11 ай бұрын

    Thats weird that it makes your game lag :o maybe try to disable the quad completely after the fading?

  • @jackward5944

    @jackward5944

    11 ай бұрын

    @@ValemTutorials Thank you for your response! I'll try that. What would the easiest way to implement it be do you reckon? As i'd need to have it reactivated for when the user would want to switch back to the original scene. Thank you again for your repsonse

  • @moxx
    @moxx Жыл бұрын

    Thank you so much for the tutorial!! I would like to ask how to make the Box Collider with a trigger to work with this Scene Transition Manager script? I want to create that a character touches a portal and transits to another scene. it would be great to add an additional tutorial about scene change with different interactions involved! millions thanks again!!

  • @ValemTutorials

    @ValemTutorials

    Жыл бұрын

    Create a box collider, set it to is trigger = true, create a script attached to the box collider with OnTriggerEnter, And if the collider entering the box collider is the one on the hand of the player you can simply call the GoToScene function to transition to a new scen. :)

  • @moxx

    @moxx

    11 ай бұрын

    @@ValemTutorials thank you so much for your reply! I figured it out finally!

  • @zackng9544
    @zackng95442 жыл бұрын

    Hi Valem and everyone here, I got my view blinking after adding the Fader Screen and my ray interactor line no longer active. Can you help explain what's the problem?

  • @neilfosteronly

    @neilfosteronly

    2 жыл бұрын

    Your fader screen is probably to close to your camera for the blinking. Maybe you kept on the mesh collider blocking ray interactor line.

  • @neilfosteronly
    @neilfosteronly2 жыл бұрын

    Was trying to do this for a few days. Thanks. The FadeIn() was going a little fast for me so I added this code to update and added a public float. This adds a time the screen is all black before transition. Took off FadeIn() on Start. public float timerFadeIn = 2f; void Update() { StartFadeIn(); } void StartFadeIn() { timerFadeIn -= Time.deltaTime; if (fadeOnStart && timerFadeIn

  • @elenix4082
    @elenix4082 Жыл бұрын

    Thanks for the tutorial bud! its amazing. by the way, is there any way to fix the controller material? if I change it to different material, it will not change the valid and invalid color gradient anymore. Like in your video, it will always stay black line

  • @luiginicastro1101

    @luiginicastro1101

    Жыл бұрын

    I am currently facing this as well :/

  • @elenix4082

    @elenix4082

    Жыл бұрын

    @@luiginicastro1101 i changed my method. instead of using quad, i use world space canvas with image just for this fading transition

  • @luiginicastro1101

    @luiginicastro1101

    Жыл бұрын

    @@elenix4082 Interesting. I just changed my script so that when my Fade is done, the Fader gameobject turns off which shows my raycast and when I go to load a level it turns it back on which keeps everything working. I think I like your solution more haha

  • @elenix4082

    @elenix4082

    Жыл бұрын

    @@luiginicastro1101 your method is good too. Looks like we programmer can survive this problem challenge in different way x'D

  • @zillieness

    @zillieness

    Жыл бұрын

    @@elenix4082 @Luigi Nicastro Thank you for saying this! We are using BOTH of these fixes. Changing the quad to a world space UI canvas and UI image (attached to the Main Camera) was not enough to fix the controller material issue. But I think this method actually looks better than the quad, because it seems to fix slight shadows on the fader when you move your view around. Disabling the UI image after the fader transitions did fix the controller material issue.

  • @bhanupatil6034
    @bhanupatil6034 Жыл бұрын

    Hi I am facing an issue with this fader screen my UI rays don't appear while this fader layer is on but teleportation ray works. any idea why this must be happening ?

  • @TkMe2Mrz

    @TkMe2Mrz

    Жыл бұрын

    I have the same issue. Would love a solution.

  • @TheARTofMining

    @TheARTofMining

    7 ай бұрын

    @@TkMe2Mrz Possibly best way is to disable the fader quad all together and then enable it only when required. I believe the XR rig its fighting/blocking the laser pointer rendering. I think its beacsue the sahder provided does not compensate for the render queue but my knowledge is limited on shaders.

  • @adhochero6619
    @adhochero66192 жыл бұрын

    im going to guess how you do it before I watch. you change the alpha of a plane in front of the camera and switch scenes when its opaque then fade it back to transparent.

  • @ValemTutorials

    @ValemTutorials

    2 жыл бұрын

    Good guess! :]

  • @adhochero6619

    @adhochero6619

    2 жыл бұрын

    @@ValemTutorials its how I would have done it

  • @davidson4101
    @davidson41012 жыл бұрын

    make a tutorial on how to make a game for cardboard vr glasses

  • @billybobthe9thjr786

    @billybobthe9thjr786

    Жыл бұрын

    u can't the cardboard glasses dont have any way to detect inputs and other stuff, they are just a phone in cardboard

  • @lucutes2936
    @lucutes29362 ай бұрын

    bak