- Home /
Display 2 Cameras at the same time 50/50 opacity?
I want to create a dizzy effect like when you drank too much alcohol so that your eyes cannot focus correctly and you see all a bit double.
I think it would work if I use 2 cameras that render at the same time and every camera renders with 50% visibility.
is that somehow possible?
Answer by bfowle · May 17, 2013 at 07:01 PM
There are quite a few examples of camera controllers on Unify Community. One in specific being CrossFade.
I found that too but it fades from one into another camera. I want this to stay at 50% opacity for both cameras... I picked the code out for the fade but.... I dont get it what happens in the code. can you tell me?
function CrossFadePro (cam1 : Camera, cam2 : Camera, time : float) {
if (!renderTex) {
renderTex = new RenderTexture(Screen.width, Screen.height, 24);
}
cam1.targetTexture = renderTex;
tex = renderTex;
CameraSetup (cam1, cam2, true, true);
yield AlphaTimer(time);
cam1.targetTexture = null;
renderTex.Release();
CameraCleanup (cam1, cam2);
}
CrossFade fades entirely from cam1 to cam2. Assu$$anonymous$$g you have cam1 at 1.0 opacity and cam2 at 0 opacity during gameplay, you would fade cam1 from 1.0 to 0.5, cam2 from 0 to 0.5. Or using CrossFade, ins$$anonymous$$d of fading to 100% from cam1->cam2, just fade to 50% of cam2. Then you would perform your dizzying effects on the camera(s).
I meant what does the parts of the script do like cam1.targetTexture = renderTex; but thanks anyway If I find some time I will try to create a script that does that.
The CrossFadePro script creates a runtime texture (RenderTexture) to generate the effect. This is a Pro only feature. I would suggest reading up on it on Unity's RenderTexture documentation, as all the info is compiled there already.