Skip to content

Instantly share code, notes, and snippets.

@edom18
Created May 11, 2018 00:50
Show Gist options
  • Save edom18/5111163139ab6385fc85415b7f0d4cbd to your computer and use it in GitHub Desktop.
Save edom18/5111163139ab6385fc85415b7f0d4cbd to your computer and use it in GitHub Desktop.
UnityでVR開発していてフェードを簡単に行いたい場合の処理
private void OnRenderImage(RenderTexture src, RenderTexture dest)
{
_fadeMaterial.SetPass(0);
GL.PushMatrix();
GL.LoadOrtho();
GL.Color(_fadeMaterial.color); // Update内などでこのcolorを変更する想定
GL.Begin(GL.QUADS);
GL.Vertex3(-1f, -1f, 1f);
GL.Vertex3(-1f, 1f, 1f);
GL.Vertex3( 1f, 1f, 1f);
GL.Vertex3( 1f, -1f, 1f);
GL.End();
GL.PopMatrix();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment