예제 #1
0
 private void SetupPostProcessParameters(PostProcessParameters postProcessParams, RenderTexture source)
 {
     this.focalDistance = ((this.focalDistance >= this.m_camera.nearClipPlane + 0.3f) ? this.focalDistance : (this.m_camera.nearClipPlane + 0.3f));
     postProcessParams.halfResSource = null;
     postProcessParams.halfResDepth  = this.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 (this.prevCamFoV != this.m_camera.fieldOfView)
     {
         postProcessParams.preCalcValues.tanHalfFoV = Mathf.Tan(this.m_camera.fieldOfView * 0.5f * 0.0174532924f);
         this.prevCamFoV = this.m_camera.fieldOfView;
     }
     postProcessParams.DoFParams.useMedianFilter = true;
     if (!this.userControlledFocalLength)
     {
         postProcessParams.cameraParams.focalLength = ScionUtility.GetFocalLength(postProcessParams.preCalcValues.tanHalfFoV);
     }
     else
     {
         postProcessParams.cameraParams.focalLength = this.focalLength * 0.001f;
     }
     postProcessParams.cameraParams.apertureDiameter = ScionUtility.ComputeApertureDiameter(this.fNumber, postProcessParams.cameraParams.focalLength);
     postProcessParams.cameraParams.fieldOfView      = this.m_camera.fieldOfView;
     postProcessParams.cameraParams.aspect           = this.m_camera.aspect;
     postProcessParams.cameraParams.nearPlane        = this.m_camera.nearClipPlane;
     postProcessParams.cameraParams.farPlane         = this.m_camera.farClipPlane;
     postProcessParams.isFirstRender = this.m_isFirstRender;
     this.m_isFirstRender            = false;
 }
예제 #2
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;
        }