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
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
Жыл бұрын
Yeooo that works! Thanks bro
@wenli4070
6 ай бұрын
You're a genius! Thank you!!
@sardarshahrukh5682
6 ай бұрын
This comment should be pinned Great!
@lucutes2936
2 ай бұрын
What
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
2 жыл бұрын
Nice let me know how it works ! :D
Thank you so very much for these tutorials. They are extremely helpful and still work a year later!
Merry Christmas, thanks for the great tutorial!
Thank you for the tutorial and especially for the very didactic approach
Thanks for the detailed tutorial, learnt a lot!
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
Жыл бұрын
Nice one! How can it be done? Because this way I get my grab and teleportation rays too buggy
You are already making me work on holidays! Painful but great! :-)
Great tutorial! Thank you.
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
2 жыл бұрын
Thats a good point Casey thank you ! I'll make a new video announcing the new channel soon
You are brilliant. Thanks so much!
Merry Christmas!
Nice tutorial !
Fantastic! Great video, very helpful, thank you🤟
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
Жыл бұрын
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?
always thank you
Thank you so much!
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.
wow great tut.
dude i searched your channel for 20 minutes, just to show someone how fucking beautiful Belgian accent is
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
5 ай бұрын
CACTUS I NEED YOUR TIPS ON HOW TO MAKE AN INDE GAME AS GREAT AS YOURS
Thaks for your help
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.
Hey, can you help? I want to make it an on collision script so that whenever I touch it the scene changes
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
Жыл бұрын
This happens to me too, fade in keeps flashing :(
oh shit, this is good
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?
Great Tutorial! Is there any possibility to keep the XR interactor Line Visual?
@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
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.
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.
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
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 :(
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
Жыл бұрын
same here mate
any help on how to fade in to one scene, wait 30 seconds, then fade to the next???
It's messing with my ray interactor help
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
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.
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
Жыл бұрын
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
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); } }
An idea could be to store the IEnumerator instance and stop the existing fade if already in progress :)
@ValemTutorials
2 жыл бұрын
Good advice !
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
Жыл бұрын
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.
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
2 жыл бұрын
Nvm it runs smoothly when its build into the oculus. Only on the editor it gets laggy
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
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.
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
2 жыл бұрын
The public FadeScreen is the name of the first script he made. Check if you made the current name.
the button is not clickable in VR, how can we solve this problem
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
11 ай бұрын
Thats weird that it makes your game lag :o maybe try to disable the quad completely after the fading?
@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
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
Жыл бұрын
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
11 ай бұрын
@@ValemTutorials thank you so much for your reply! I figured it out finally!
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
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.
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
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
Жыл бұрын
I am currently facing this as well :/
@elenix4082
Жыл бұрын
@@luiginicastro1101 i changed my method. instead of using quad, i use world space canvas with image just for this fading transition
@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
Жыл бұрын
@@luiginicastro1101 your method is good too. Looks like we programmer can survive this problem challenge in different way x'D
@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.
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
Жыл бұрын
I have the same issue. Would love a solution.
@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.
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
2 жыл бұрын
Good guess! :]
@adhochero6619
2 жыл бұрын
@@ValemTutorials its how I would have done it
make a tutorial on how to make a game for cardboard vr glasses
@billybobthe9thjr786
Жыл бұрын
u can't the cardboard glasses dont have any way to detect inputs and other stuff, they are just a phone in cardboard
bak