/// <summary>
 /// Applies the post processing settings
 /// </summary>
 public void ApplyPostProcessing()
 {
     //Check if all profiles exist
     if (m_settings.m_profiles != null && m_settings.m_selectedPostProcessingProfileIndex >= 0)
     {
         //Update post processing
         PostProcessingUtils.SetFromProfileIndex(m_settings.m_profiles, m_settings.m_selectedPostProcessingProfile, m_settings.m_selectedPostProcessingProfileIndex, false, m_updateAO, m_updateAutoExposure, m_updateBloom, m_updateChromatic, m_updateColorGrading, m_updateDOF, m_updateGrain, m_updateLensDistortion, m_updateMotionBlur, m_updateSSR, m_updateVignette, m_updatePanini, m_updateTargetPlaform);
     }
 }
Example #2
0
            /// <summary>
            /// Generates a jittered projection matrix for a given camera.
            /// </summary>
            /// <param name="camera">The camera to get a jittered projection matrix for.</param>
            /// <returns>A jittered projection matrix.</returns>
            public Matrix4x4 GetJitteredProjectionMatrix(Camera camera, Func <Vector2, Matrix4x4> jitteredFunc)
            {
                AntialiasingModel.TaaSettings taaSettings = model.settings.taaSettings;
                Matrix4x4 cameraProj;

                jitterVector  = GenerateRandomOffset();
                jitterVector *= taaSettings.jitterSpread;

                if (jitteredFunc != null)
                {
                    cameraProj = jitteredFunc(jitterVector);
                }
                else
                {
                    cameraProj = camera.orthographic
                        ? PostProcessingUtils.GetJitteredOrthographicProjectionMatrix(camera, jitterVector)
                        : PostProcessingUtils.GetJitteredPerspectiveProjectionMatrix(camera, jitterVector);
                }

                jitterVector = new Vector2(jitterVector.x / camera.pixelWidth, jitterVector.y / camera.pixelHeight);
                return(cameraProj);
            }
Example #3
0
            /// <summary>
            /// Prepares the jittered and non jittered projection matrices for stereo rendering.
            /// </summary>
            /// <param name="context">The current post-processing context.</param>
            // TODO: We'll probably need to isolate most of this for SRPs
            public void ConfigureStereoJitteredProjectionMatrices(Func <Vector2, Matrix4x4> jitteredFunc)
            {
                AntialiasingModel.TaaSettings taaSettings = model.settings.taaSettings;
                var camera = context.camera;
                var eye    = (Camera.StereoscopicEye)camera.stereoActiveEye;

                jitterVector  = GenerateRandomOffset();
                jitterVector *= taaSettings.jitterSpread;

                // This saves off the device generated projection matrices as non-jittered
                context.camera.CopyStereoDeviceProjectionMatrixToNonJittered(eye);
                var originalProj = context.camera.GetStereoNonJitteredProjectionMatrix(eye);

                // Currently no support for custom jitter func, as VR devices would need to provide
                // original projection matrix as input along with jitter
                var jitteredMatrix = PostProcessingUtils.GenerateJitteredProjectionMatrixFromOriginal(context, originalProj, jitterVector);

                context.camera.SetStereoProjectionMatrix(eye, jitteredMatrix);

                // jitter has to be scaled for the actual eye texture size, not just the intermediate texture size
                // which could be double-wide in certain stereo rendering scenarios
                jitterVector = new Vector2(jitterVector.x / context.width, jitterVector.y / context.height);
                camera.useJitteredProjectionMatrixForTransparentRendering = false;
            }