In fact, the effect is not very good, because many effects of delayed illumination do not support orthogonal, many later effects will be blown up, need to use as appropriate
by interpolating the projection matrix to achieve
If the far cross section of the perspective camera and the cross section of the orthogonal camera are too far off, the interpolation is very strange and needs attention.
Effect:
Code:
usingUnityengine;usingSystem.Collections; Public classprojectionlerp:monobehaviour{[Range (0,0.9f)] Public floatLerp; Public floatNearclip =-0.1f; Public floatSize =3f; voidUpdate () {varRatio = Screen.width/(float) Screen.height; varA = Matrix4x4.perspective ( $, ratio,0.1f, 5000f); varb = Matrix4x4.ortho (-size * ratio, size * ratio,-size, size, nearclip, 5000f); Camera.main.projectionMatrix=Lerp (A, B, lerp); } matrix4x4 Lerp (matrix4x4 A, matrix4x4 B,floatlerp) { varresult =Newmatrix4x4 (); Result. Setrow (0, Vector4.lerp (A.getrow (0), B.getrow (0) , lerp)); Result. Setrow (1, Vector4.lerp (A.getrow (1), B.getrow (1) , lerp)); Result. Setrow (2, Vector4.lerp (A.getrow (2), B.getrow (2) , lerp)); Result. Setrow (3, Vector4.lerp (A.getrow (3), B.getrow (3) , lerp)); returnresult; }}
Unity3d camera to orthogonal camera interpolation