Playmaker Forum

PlayMaker Help & Tips => VR Help => Topic started by: iain2 on February 12, 2017, 01:49:36 PM

Title: Camera Fade Out / Fade In works but not in VR (Vive) Help!
Post by: iain2 on February 12, 2017, 01:49:36 PM
I have a scene which has four ordinary static cameras. An empty object has a playmaker script attached which moves the viewpoint between the cameras. Its quite simple. You start at camera 1 and looking through the Vive HMD can look around as normal. Then using Camera Fade Out action after 30 seconds you fade up to white over 2 seconds, switch to camera 2 and Fade In from white to the scene over 2 seconds, again viewing from that new camera 2 position for 30 seconds. Same then for cameras 3 and 4 and then it loops back to camera 1. This works fine when viewed on the monitor but in VR the fades are ignored and its just a sharp camera cut. There are solutions of course but its very inconvenient and wondered if there is a fix coming or a very simple solution I am missing as I am new to Playmaker and not a programmer. (A bit much that VR Tools are out but no update in the manual for actions saying where relevant something like: "***Note: Does not work in VR***" Makes me wonder what else I will come a cropper with) Help!
Title: Re: Camera Fade Out / Fade In works but not in VR (Vive) Help!
Post by: jeanfabre on February 13, 2017, 02:49:51 AM
Hi,

 Fading is done using the old GUI, you should move away from this and use your own fading solution using a plane or a UI element and animate the alpha with it.

 Bye,

 Jean
Title: Re: Camera Fade Out / Fade In works but not in VR (Vive) Help!
Post by: iain2 on February 19, 2017, 02:03:09 PM
Thanks. I am new to Playmaker so apologies if this is a simplistic question. Can I control the Image Effects Vignette level using a Playmaker FSM? This would do the same as a fade in and out if if could be and extreme full vignette from zero vignette? I was also thinking of using this in a similar way to Google EarthVRs solution to solving motion sickness when moving ?? (Maybe point me to a tutorial that lets you control Components parameters over time as I can't see one ?) Thanks

Title: Re: Camera Fade Out / Fade In works but not in VR (Vive) Help!
Post by: tcmeric on February 20, 2017, 11:41:20 PM
You can use an asset like Beautify. It is 35$, but it does work with single pass rendering and I have personally tested it with steam VR. Its performance hit is fairly low (depending on which filter you are using). It also seems to not have any issues with the lab renderer. It has vignette with various options that can be set and changed during run time.

Put the script on the main camera eye of the VR rig. Create a new FSM on an object. Create a new state. Drag and drop the script FROM the main camera eye (not from the project browser), onto the state (where you normally have all your actions setup). You will then get a get/set option for the script. Choose set. Look for vignette. Set the bool to true or false as necessary to turn on and off the vignette.

Create a mask for the vignette (has one by default but you can change it from the inspector easy). Turn up and down the alpha of the black color to make it cover more and more of the screen and eventually fade completely to black.

I also use playmaker to disable the script when not in use to save resources.

As for the playmaker action to use over time. You could create a look with a wait state. Ie, -5 alpha, wait .1 seconds, repeat. Then do a int check to see when it reaches -100 and finish. Or look into a int lerp or float lerp.

https://www.assetstore.unity3d.com/en/#!/content/61730
Title: Re: Camera Fade Out / Fade In works but not in VR (Vive) Help!
Post by: tcmeric on February 20, 2017, 11:44:20 PM
PS, if you just want a fade to black.

Make a black cube. Make it the child of the eye in the VR rig. Set its location to 0,0,0 and it will be right on your head. Deactivate it and set the alpha to 0 until its needed.

Use playmaker to activate the object when you are ready. Use playmaker to lerp an int on the alpha channel of the black object till it reaches 100. (The screen will be black).

Put the FSM directly on the cube to make it easy. Duplicate cube as necessary and put it over all necessary cameras.
Title: Re: Camera Fade Out / Fade In works but not in VR (Vive) Help!
Post by: iain2 on February 25, 2017, 01:31:09 PM
Thanks for your detailed responses tcmeric - great!
I will investigate lerp/float int and also Beautify - not come across that asset.
Thankyou
Title: Re: Camera Fade Out / Fade In works but not in VR (Vive) Help!
Post by: westingtyler on April 01, 2017, 02:19:42 PM
In my oculus pc vr game, I create a black fadeout using a shader forge shader I made, where the alpha slider is incremented over a certain amount of time to transition to black using a smoky-looking texture cutout gradient map. I don' know how to "auto lerp", so I have a playmaker script that sets it to .1, waits. .1, adds .1. etc. until black. this video shows it happening, as you move between scenes. I put the shader on a sphere around the player. watch at 28 seconds in, when the level loads, to see it in reverse.

I was also able to ensure it renders over all objects, regardless of distance, even though it is a sphere in space, using something like camera layers, where the sphere is on a higher layer than the rest of the scene, or something. if you want more detail I can give it.