voidOnRenderImage(RenderTexture source, RenderTexture destination) { if (RenderMaterial == null) // 用于重建世界坐标的材质 { Graphics.Blit(source, destination); } else { var aspect = currentCamera.aspect; var far = currentCamera.farClipPlane; var right = transform.right; var up = transform.up; var forward = transform.forward; var halfHeight = Mathf.Tan(currentCamera.fieldOfView * 0.5f * Mathf.Deg2Rad);
// 计算远裁剪面处的xyz三方向向量 var rightVec = right * far * halfFovTan * aspect; var upVec = up * far * halfFovTan; var forwardVec = forward * far;
// 计算摄像机到远裁剪平面的四个顶点的向量 var topLeft = (forwardVec - rightVec + upVec); var topRight = (forwardVec + rightVec + upVec); var bottomLeft = (forwardVec - rightVec - upVec); var bottomRight = (forwardVec + rightVec - upVec);