Esempio n. 1
0
        protected void SetupPostProcessParameters(PostProcessParameters postProcessParams, RenderTexture source)
        {
            focalDistance = focalDistance < m_camera.nearClipPlane + 0.3f ? m_camera.nearClipPlane + 0.3f : focalDistance;

            postProcessParams.camera          = m_camera;
            postProcessParams.cameraTransform = m_cameraTransform;

            //Done later
            postProcessParams.halfResSource = null;
            postProcessParams.halfResDepth  = m_downsampling.DownsampleDepthTexture(source.width, source.height);

            postProcessParams.width      = source.width;
            postProcessParams.height     = source.height;
            postProcessParams.halfWidth  = source.width / 2;
            postProcessParams.halfHeight = source.height / 2;

            if (prevCamFoV != m_camera.fieldOfView)
            {
                postProcessParams.preCalcValues.tanHalfFoV = Mathf.Tan(m_camera.fieldOfView * 0.5f * Mathf.Deg2Rad);
                prevCamFoV = m_camera.fieldOfView;
            }

            postProcessParams.DoFParams.useMedianFilter = true;             //This could technically be a user choice, but its a lot of quality for a low price

            if (userControlledFocalLength == false)
            {
                postProcessParams.cameraParams.focalLength = ScionUtility.GetFocalLength(postProcessParams.preCalcValues.tanHalfFoV);
            }
            else
            {
                postProcessParams.cameraParams.focalLength = focalLength * 0.001f;              //Millimeter to meter
            }
            postProcessParams.cameraParams.apertureDiameter = ScionUtility.ComputeApertureDiameter(fNumber, postProcessParams.cameraParams.focalLength);

            postProcessParams.cameraParams.fieldOfView = m_camera.fieldOfView;
            postProcessParams.cameraParams.aspect      = m_camera.aspect;
            postProcessParams.cameraParams.nearPlane   = m_camera.nearClipPlane;
            postProcessParams.cameraParams.farPlane    = m_camera.farClipPlane;

            postProcessParams.isFirstRender = m_isFirstRender;
            m_isFirstRender = false;
        }