Monday, December 7, 2020

in a perspective projection, make a plane to fill the whole screen.

public class fillPlane : MonoBehaviour { public Camera camera = null; void Update() { if ( camera != null) { float fov = camera.fieldOfView; float pos = camera.nearClipPlane; transform.position = camera.transform.position + camera.transform.forward * pos; float yn = Mathf.Tan(Mathf.Deg2Rad * fov / 2.0f) * pos * 2; transform.localScale = new Vector3(yn * camera.aspect, yn, 1); } } }

No comments:

Post a Comment

Task in UnrealEngine

 https://www.youtube.com/watch?v=1lBadANnJaw