コード例 #1
0
        static Camera GetRenderCamera()
        {
            if (s_RenderCamera == null)
            {
                var go = GameObject.Find("__Probe Render Camera") ?? new GameObject("__Probe Render Camera");
                go.hideFlags = HideFlags.HideAndDontSave;

                s_RenderCamera = go.GetComponent <Camera>();
                if (s_RenderCamera == null || s_RenderCamera.Equals(null))
                {
                    s_RenderCamera = go.AddComponent <Camera>();
                }

                // We need to setup cameraType before adding additional camera
                s_RenderCamera.cameraType = CameraType.Reflection;

                s_RenderCameraData = go.GetComponent <HDAdditionalCameraData>();
                if (s_RenderCameraData == null || s_RenderCameraData.Equals(null))
                {
                    s_RenderCameraData = go.AddComponent <HDAdditionalCameraData>();
                }

                go.SetActive(false);
            }

            return(s_RenderCamera);
        }
コード例 #2
0
        public void EnablePostProcessing(Camera camera, bool value)
        {
            HDAdditionalCameraData cameraData = camera.GetComponent <HDAdditionalCameraData>();

            if (cameraData == null)
            {
                cameraData = camera.gameObject.AddComponent <HDAdditionalCameraData>();
            }

            cameraData.customRenderingSettings = true;
            FrameSettingsOverrideMask settingsOverride = cameraData.renderingPathCustomFrameSettingsOverrideMask;
            FrameSettings             settings         = cameraData.renderingPathCustomFrameSettings;

            settings.SetEnabled(FrameSettingsField.Postprocess, value);
            settings.SetEnabled(FrameSettingsField.AfterPostprocess, value);
            settings.SetEnabled(FrameSettingsField.TransparentPostpass, value);
            settings.SetEnabled(FrameSettingsField.TransparentPostpass, value);
            settings.SetEnabled(FrameSettingsField.LowResTransparent, value);
            settings.SetEnabled(FrameSettingsField.ShadowMaps, value);
            settings.SetEnabled(FrameSettingsField.ContactShadows, value);
            settings.SetEnabled(FrameSettingsField.ScreenSpaceShadows, value);
            settings.SetEnabled(FrameSettingsField.Transmission, value);
            settings.SetEnabled(FrameSettingsField.ExposureControl, value);
            settings.SetEnabled(FrameSettingsField.ReflectionProbe, value);
            settings.SetEnabled(FrameSettingsField.PlanarProbe, value);
            settings.SetEnabled(FrameSettingsField.ReplaceDiffuseForIndirect, value);
            settings.SetEnabled(FrameSettingsField.SkyReflection, value);
            settings.SetEnabled(FrameSettingsField.DirectSpecularLighting, value);
            settings.SetEnabled(FrameSettingsField.Volumetrics, value);
            settings.SetEnabled(FrameSettingsField.ReprojectionForVolumetrics, value);
            settings.SetEnabled(FrameSettingsField.CustomPostProcess, value);

            settingsOverride.mask[(uint)FrameSettingsField.Postprocess]                = true;
            settingsOverride.mask[(uint)FrameSettingsField.AfterPostprocess]           = true;
            settingsOverride.mask[(uint)FrameSettingsField.TransparentPostpass]        = true;
            settingsOverride.mask[(uint)FrameSettingsField.TransparentPostpass]        = true;
            settingsOverride.mask[(uint)FrameSettingsField.LowResTransparent]          = true;
            settingsOverride.mask[(uint)FrameSettingsField.ShadowMaps]                 = true;
            settingsOverride.mask[(uint)FrameSettingsField.ContactShadows]             = true;
            settingsOverride.mask[(uint)FrameSettingsField.ScreenSpaceShadows]         = true;
            settingsOverride.mask[(uint)FrameSettingsField.SubsurfaceScattering]       = true;
            settingsOverride.mask[(uint)FrameSettingsField.Transmission]               = true;
            settingsOverride.mask[(uint)FrameSettingsField.ExposureControl]            = true;
            settingsOverride.mask[(uint)FrameSettingsField.ReflectionProbe]            = true;
            settingsOverride.mask[(uint)FrameSettingsField.PlanarProbe]                = true;
            settingsOverride.mask[(uint)FrameSettingsField.ReplaceDiffuseForIndirect]  = true;
            settingsOverride.mask[(uint)FrameSettingsField.SkyReflection]              = true;
            settingsOverride.mask[(uint)FrameSettingsField.DirectSpecularLighting]     = true;
            settingsOverride.mask[(uint)FrameSettingsField.Volumetrics]                = true;
            settingsOverride.mask[(uint)FrameSettingsField.ReprojectionForVolumetrics] = true;
            settingsOverride.mask[(uint)FrameSettingsField.CustomPostProcess]          = true;

            cameraData.renderingPathCustomFrameSettingsOverrideMask = settingsOverride;
            cameraData.renderingPathCustomFrameSettings             = settings;

            if (PostProcessingEnabled != null)
            {
                PostProcessingEnabled(camera, value);
            }
        }
コード例 #3
0
    void SwitchAperture(float aperture)
    {
        DOTween.Kill("Focus");
        HDAdditionalCameraData camData = Camera.main.GetComponent <HDAdditionalCameraData>();

        DOTween.To(() => camData.physicalParameters.aperture, x => camData.physicalParameters.aperture = x, aperture, 0.5f).SetId("Focus");
    }
コード例 #4
0
        IEnumerator FrameRequest()
        {
            yield return(new WaitForEndOfFrame());

            if (currentState == State.WaitingForFirstFrame)
            {
                #if HDRP_AVAILABLE
                if (UnityHelpers.UsingHDRP())
                {
                    Camera[] cams = Camera.allCameras;
                    foreach (var c in cams)
                    {
                        HDCamera hdcam = HDCamera.GetOrCreate(c);
                        HDAdditionalCameraData hdCameraData = c.GetComponent <HDAdditionalCameraData>();
                        if (hdcam != null && hdCameraData != null && hdCameraData.antialiasing == HDAdditionalCameraData.AntialiasingMode.TemporalAntialiasing)
                        {
                            hdcam.Reset();
                        }
                    }
                }
                #endif
                // We need to wait one more frame to overcome the GameView resolution change
                // REC-589
                yield return(new WaitForEndOfFrame());
            }

            FrameReady();

            if (currentState == State.WaitingForFirstFrame)
            {
                EnterRunningState();
            }

            frameProducedCount++;
        }
コード例 #5
0
        // Events from main renderer
        public void OnMainRender()
        {
            // Set up camera for hdrp
#if UNITY_2018_1_OR_NEWER && UNITY_POST_PROCESSING_STACK_V2 && SSAA_HDRP
            if (MadGoatSSAA_Utils.DetectSRP())
            {
                HDAdditionalCameraData data     = GetComponent <HDAdditionalCameraData>();
                HDAdditionalCameraData dataMain = Main.GetComponent <HDAdditionalCameraData>();
                if (data == null)
                {
                    data = Current.gameObject.AddComponent <HDAdditionalCameraData>();
                }
                data.clearColorMode  = HDAdditionalCameraData.ClearColorMode.None;
                data.clearDepth      = true;
                data.volumeLayerMask = 0;
            }
#endif


            // set up command buffers
            if (MadGoatSSAA_Utils.DetectSRP())
            {
                // for SRP
                UpdateCBSRP();
            }
            else
            {
                // for legacy
                UpdateCB();
            }
        }
コード例 #6
0
        static void SetupCameraForRender(Camera camera, HDAdditionalCameraData additionalData, HDAdditionalReflectionData additional, Camera viewerCamera = null)
        {
            float            nearClipPlane, farClipPlane, aspect, fov;
            Color            backgroundColor;
            CameraClearFlags clearFlags;
            Vector3          capturePosition;
            Quaternion       captureRotation;
            Matrix4x4        worldToCamera, projection;

            CalculateCaptureCameraProperties(additional,
                                             out nearClipPlane, out farClipPlane,
                                             out aspect, out fov, out clearFlags, out backgroundColor,
                                             out worldToCamera, out projection,
                                             out capturePosition, out captureRotation, viewerCamera);

            camera.farClipPlane        = farClipPlane;
            camera.nearClipPlane       = nearClipPlane;
            camera.fieldOfView         = fov;
            camera.aspect              = aspect;
            camera.clearFlags          = clearFlags;
            camera.backgroundColor     = camera.backgroundColor;
            camera.projectionMatrix    = projection;
            camera.worldToCameraMatrix = worldToCamera;
            camera.cullingMask         = additional.reflectionProbe.cullingMask;

            additionalData.volumeAnchorOverride = null;

            var ctr = camera.transform;

            ctr.position = capturePosition;
            ctr.rotation = captureRotation;
        }
コード例 #7
0
        Camera InitializePreviewCamera(Camera c, Vector2 previewSize)
        {
            Camera previewCamera = null;
            HDAdditionalCameraData previewAdditionalCameraData = null;

            for (int i = 0; i < serializedObject.targetObjects.Length; i++)
            {
                if (serializedObject.targetObjects[i] == c)
                {
                    previewCamera = m_PreviewCameras[i];
                    previewAdditionalCameraData = m_PreviewAdditionalCameraDatas[i];
                    break;
                }
            }

            previewCamera.CopyFrom(c);
            EditorUtility.CopySerialized(c, previewCamera);
            var cameraData = c.GetComponent <HDAdditionalCameraData>();

            EditorUtility.CopySerialized(cameraData, previewAdditionalCameraData);
            // We need to explicitly reset the camera type here
            // It is probably a CameraType.Game, because we copied the source camera's properties.
            previewCamera.cameraType = CameraType.Preview;
            previewCamera.gameObject.SetActive(false);

            var previewTexture = GetPreviewTextureWithSize((int)previewSize.x, (int)previewSize.y);

            previewCamera.targetTexture = previewTexture;
            previewCamera.pixelRect     = new Rect(0, 0, previewSize.x, previewSize.y);

            return(previewCamera);
        }
コード例 #8
0
        public static Camera CreateOrthoCam(Vector3 position, float nearClipping, float farClipping, float size, LayerMask cullingMask)
        {
            //existing ortho cam? Try to recycle
            GameObject gameObject = GameObject.Find("OrthoCaptureCam");

            if (gameObject == null)
            {
                gameObject = new GameObject("OrthoCaptureCam");
            }
            gameObject.transform.position = position;
            //facing straight downwards
            gameObject.transform.rotation = Quaternion.Euler(90f, 0f, 0f);


            //existing Camera? Try to recycle
            Camera cam = gameObject.GetComponent <Camera>();

            if (cam == null)
            {
                cam = gameObject.AddComponent <Camera>();
            }

            //setup camera the way we need it for the ortho bake - adjust everything to default to make sure there is no interference
            cam.clearFlags          = CameraClearFlags.SolidColor;
            cam.backgroundColor     = Color.black;
            cam.cullingMask         = cullingMask;
            cam.orthographic        = true;
            cam.orthographicSize    = size;
            cam.nearClipPlane       = nearClipping;
            cam.farClipPlane        = farClipping;
            cam.rect                = new Rect(0f, 0f, 1f, 1f);
            cam.depth               = 0f;
            cam.renderingPath       = RenderingPath.Forward; //Forward rendering required for orthographic
            cam.useOcclusionCulling = true;

#if HDPipeline
            HDAdditionalCameraData hdData = gameObject.GetComponent <HDAdditionalCameraData>();
            if (hdData == null)
            {
                hdData = cam.gameObject.AddComponent <UnityEngine.Rendering.HighDefinition.HDAdditionalCameraData>();
            }
            hdData.volumeLayerMask    = 0;
            hdData.backgroundColorHDR = Color.black;
            hdData.clearColorMode     = HDAdditionalCameraData.ClearColorMode.Color;

            FrameSettings frameSettings = new FrameSettings();
            frameSettings.lodBiasMode               = LODBiasMode.OverrideQualitySettings;
            frameSettings.lodBias                   = m_HDLODBiasOverride;
            hdData.customRenderingSettings          = true;
            hdData.renderingPathCustomFrameSettings = frameSettings;
            hdData.renderingPathCustomFrameSettingsOverrideMask.mask[0] = true;
            hdData.renderingPathCustomFrameSettingsOverrideMask.mask[(int)FrameSettingsField.LODBiasMode] = true;
            hdData.renderingPathCustomFrameSettingsOverrideMask.mask[(int)FrameSettingsField.LODBias]     = true;
#endif

            m_orthoCamera = cam;
            return(cam);
        }
コード例 #9
0
    void Render()
    {
        if (targetCam == null)
        {
            targetCam = GetComponent <Camera>();
        }
        if (targetCam == null)
        {
            return;
        }

        if (hdCam == null)
        {
            hdCam = GetComponent <HDAdditionalCameraData>();
        }

        var previousTargetTexture = targetCam.targetTexture;

        targetCam.targetTexture = smallRT;

        var i = 0;

        for (var y = 0; y < tiles.y; ++y)
        {
            for (var x = 0; x < tiles.x; ++x)
            {
                if (i < sets.Length)
                {
                    sets[i].gameObject.SetActive(true);
                }
                if (i < modifiers.Length)
                {
                    modifiers[i].Invoke();
                }

                targetCam.Render();

                Graphics.Blit(smallRT, flipRT); //vertical flip
                Graphics.CopyTexture(flipRT, 0, 0, 0, 0, singleRes.x, singleRes.y, rt, 0, 0, x * singleRes.x, (tiles.y - y - 1) * singleRes.y);

                if (i < sets.Length)
                {
                    sets[i].gameObject.SetActive(false);
                }
                ++i;
            }
        }

        GL.Viewport(new Rect(0f, 0f, 1f, 1f));

        targetCam.targetTexture = previousTargetTexture;

        if (displayObject != null && displayObject.material != null)
        {
            displayObject.material.SetTexture(displayTextureProperty, rt);
            displayObject.transform.localScale = new Vector3((singleRes.x * tiles.x) * 1f / (singleRes.y * tiles.y), 1f, 1f);
        }
    }
コード例 #10
0
ファイル: CameraMipBias.cs プロジェクト: vault51/Graphics
    public void Awake()
    {
        if (m_camData != null)
        {
            return;
        }

        m_camData = GetComponentInParent <HDAdditionalCameraData>();
    }
コード例 #11
0
        internal void SetupRenderPipelinePreviewCamera(Camera camera)
        {
            HDAdditionalCameraData hdCamera = camera.gameObject.AddComponent <HDAdditionalCameraData>();

            hdCamera.clearDepth     = true;
            hdCamera.clearColorMode = HDAdditionalCameraData.ClearColorMode.None;

            hdCamera.GetType().GetProperty("isEditorCameraPreview", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance).SetValue(hdCamera, true, null);
        }
コード例 #12
0
ファイル: Recorder.cs プロジェクト: ubisoft/vrtist
 private void OnActiveCameraChanged(GameObject oldCamera, GameObject newCamera)
 {
     if (null != activeCamera)
     {
         HDAdditionalCameraData camData = activeCamera.gameObject.GetComponent <HDAdditionalCameraData>();
         camData.flipYMode = HDAdditionalCameraData.FlipYMode.Automatic;
     }
     activeCamera = CameraManager.Instance.GetActiveCameraComponent();
 }
コード例 #13
0
    private void OnEnable()
    {
        m_cam    = GetComponent <Camera>();
        m_hdData = GetComponent <HDAdditionalCameraData>();

        //Render nothing
        m_cam.clearFlags  = CameraClearFlags.Nothing;
        m_cam.cullingMask = 0;
        m_hdData.fullscreenPassthrough = true;
        m_hdData.customRender         += BlitRenderStreamingRT;
    }
コード例 #14
0
        public void SetBackgroundColor(Camera camera, Color color)
        {
            HDAdditionalCameraData data = camera.GetComponent <HDAdditionalCameraData>();

            if (data == null)
            {
                data = camera.gameObject.AddComponent <HDAdditionalCameraData>();
            }
            data.backgroundColorHDR = color;
            data.clearColorMode     = HDAdditionalCameraData.ClearColorMode.Color;
        }
コード例 #15
0
        void OnEnable()
        {
            m_SerializedCamera = new SerializedHDCamera(serializedObject);

            m_PreviewCamera               = EditorUtility.CreateGameObjectWithHideFlags("Preview Camera", HideFlags.HideAndDontSave, typeof(Camera)).GetComponent <Camera>();
            m_PreviewCamera.enabled       = false;
            m_PreviewCamera.cameraType    = CameraType.Preview; // Must be init before adding HDAdditionalCameraData
            m_PreviewAdditionalCameraData = m_PreviewCamera.gameObject.AddComponent <HDAdditionalCameraData>();
            // Say that we are a camera editor preview and not just a regular preview
            m_PreviewAdditionalCameraData.isEditorCameraPreview = true;
        }
コード例 #16
0
        void OnEnable()
        {
            m_SerializedCamera = new SerializedHDCamera(serializedObject);
            m_UIState.Reset(m_SerializedCamera, Repaint);

            m_PreviewCamera = EditorUtility.CreateGameObjectWithHideFlags("Preview Camera", HideFlags.HideAndDontSave, typeof(Camera)).GetComponent <Camera>();
            m_PreviewAdditionalCameraData = m_PreviewCamera.gameObject.AddComponent <HDAdditionalCameraData>();
            m_PreviewPostProcessLayer     = m_PreviewCamera.gameObject.AddComponent <PostProcessLayer>();
            m_PreviewCamera.enabled       = false;
            m_PreviewHDCamera             = new HDCamera(m_PreviewCamera);
            m_PreviewHDCamera.Update(m_PreviewPostProcessLayer, m_PreviewAdditionalCameraData.GetFrameSettings());
        }
コード例 #17
0
        public static void RemoveCamera(HDAdditionalCameraData camera)
        {
            if (s_Cameras == null)
            {
                s_Cameras = new List <HDAdditionalCameraData>();
            }

            if (s_Cameras.Contains(camera))
            {
                s_Cameras.Remove(camera);
            }
        }
コード例 #18
0
        void Awake()
        {
            tag                     = "MainCamera";
            camera                  = gameObject.GetComponent <Camera>();
            camerahddata            = gameObject.GetComponent <HDAdditionalCameraData>();
            transform.localPosition = new Vector3(0, 0, -1001);
            camera.nearClipPlane    = 1;
            camera.farClipPlane     = 2001;
            netmanager              = FindObjectOfType <NetManager>();
#if COMMAND
            OnCameraChange += netmanager.uicontroller.viewpanel.UpdateViewport;
#endif
        }
コード例 #19
0
        public bool IsPostProcessingEnabled(Camera camera)
        {
            HDAdditionalCameraData cameraData = camera.GetComponent <HDAdditionalCameraData>();

            if (cameraData == null)
            {
                return(false);
            }

            FrameSettings settings = cameraData.renderingPathCustomFrameSettings;

            return(settings.IsEnabled(FrameSettingsField.Postprocess));
        }
コード例 #20
0
ファイル: Recorder.cs プロジェクト: ubisoft/vrtist
 public void StopRecording()
 {
     if (null != activeCamera)
     {
         HDAdditionalCameraData camData = activeCamera.gameObject.GetComponent <HDAdditionalCameraData>();
         camData.flipYMode = HDAdditionalCameraData.FlipYMode.Automatic;
     }
     if (encoder != null)
     {
         encoder.Release();
         encoder = null;
     }
     recording = false;
 }
コード例 #21
0
        public static void AddCamera(HDAdditionalCameraData camera)
        {
            if (s_Cameras == null)
            {
                s_Cameras = new List <HDAdditionalCameraData>();
            }

            if (!s_Cameras.Contains(camera))
            {
                s_Cameras.Add(camera);
            }

            Get <HDRPCameraOption>().Apply();
        }
コード例 #22
0
        public override void ConnectUI()
        {
            cameraData = Camera.main.GetComponent <HDAdditionalCameraData>();

            var aaUI = AntiAliasingUI.Instance;

            // init UI values
            cameraData.antialiasing = Main.settings.settingsData.AA_MODE;
            aaUI.dropdown.SetValueWithoutNotify((int)Main.settings.settingsData.AA_MODE);

            // add listeners
            aaUI.dropdown.onValueChanged.AddListener(new UnityAction <int>(value => {
                cameraData.antialiasing = Main.settings.settingsData.AA_MODE = (HDAdditionalCameraData.AntialiasingMode)value;
            }));
        }
コード例 #23
0
ファイル: Recorder.cs プロジェクト: ubisoft/vrtist
        private void OnFrameChanged(int frame)
        {
            if (!recording)
            {
                return;
            }

            if (null != activeCamera)
            {
                HDAdditionalCameraData camData = activeCamera.gameObject.GetComponent <HDAdditionalCameraData>();
                camData.flipYMode = HDAdditionalCameraData.FlipYMode.ForceFlipY;
            }

            StartCoroutine(Capture());
        }
コード例 #24
0
        static void SetupCameraForRender(Camera camera, HDAdditionalCameraData additionalData, PlanarReflectionProbe probe, Camera viewerCamera = null)
        {
            float            nearClipPlane, farClipPlane, aspect, fov;
            Color            backgroundColor;
            CameraClearFlags clearFlags;
            Vector3          capturePosition;
            Quaternion       captureRotation;
            Matrix4x4        worldToCamera, projection;

            CalculateCaptureCameraProperties(probe,
                                             out nearClipPlane, out farClipPlane,
                                             out aspect, out fov, out clearFlags, out backgroundColor,
                                             out worldToCamera, out projection,
                                             out capturePosition, out captureRotation, viewerCamera);

            camera.clearFlags      = clearFlags;
            camera.backgroundColor = backgroundColor;
            camera.aspect          = aspect;

            additionalData.backgroundColorHDR = probe.captureSettings.backgroundColorHDR;
            additionalData.clearColorMode     = probe.captureSettings.clearColorMode;
            additionalData.clearDepth         = probe.captureSettings.clearDepth;
            camera.cullingMask                  = probe.captureSettings.cullingMask;
            additionalData.volumeLayerMask      = probe.captureSettings.volumeLayerMask;
            additionalData.volumeAnchorOverride = viewerCamera != null ? viewerCamera.transform : probe.captureSettings.volumeAnchorOverride;
            camera.useOcclusionCulling          = probe.captureSettings.useOcclusionCulling;
            camera.orthographic                 = probe.captureSettings.projection == CameraProjection.Orthographic;
            camera.farClipPlane                 = farClipPlane;
            camera.nearClipPlane                = nearClipPlane;
            camera.fieldOfView                  = fov;
            camera.orthographicSize             = probe.captureSettings.orthographicSize;

            //additionalData.aperture = additional.captureSettings.aperture;
            //additionalData.shutterspeed = additional.captureSettings.shutterspeed;
            //additionalData.iso = additional.captureSettings.iso;

            additionalData.renderingPath = probe.captureSettings.renderingPath;

            SetupFrameSettings(additionalData, probe);

            camera.projectionMatrix    = projection;
            camera.worldToCameraMatrix = worldToCamera;

            var ctr = camera.transform;

            ctr.position = capturePosition;
            ctr.rotation = captureRotation;
        }
コード例 #25
0
        /// <summary>
        /// Gets or creates HD camera data
        /// </summary>
        /// <param name="camera"></param>
        /// <returns></returns>
#if HDPipeline
        public static HDAdditionalCameraData GetHDCameraData(Camera camera)
        {
            if (camera == null)
            {
                return(null);
            }

            HDAdditionalCameraData cameraData = camera.gameObject.GetComponent <HDAdditionalCameraData>();

            if (cameraData == null)
            {
                cameraData = camera.gameObject.AddComponent <HDAdditionalCameraData>();
            }

            return(cameraData);
        }
コード例 #26
0
        static void RemoveCamera(MenuCommand menuCommand)
        {
            GameObject go = ((Camera)menuCommand.context).gameObject;

            Assert.IsNotNull(go);

            Camera camera = go.GetComponent <Camera>();
            HDAdditionalCameraData cameraAdditionalData = go.GetComponent <HDAdditionalCameraData>();

            Assert.IsNotNull(camera);
            Assert.IsNotNull(cameraAdditionalData);

            Undo.SetCurrentGroupName("Remove HD Camera");
            Undo.DestroyObjectImmediate(camera);
            Undo.DestroyObjectImmediate(cameraAdditionalData);
        }
コード例 #27
0
 private void InitializeCameraData()
 {
     //Check if we have the HD camera data component cached.
     if (hdAdditionalCameraData == null)
     {
         //If we don't find it on our game object.
         HDAdditionalCameraData hdCameraData = GetComponent <HDAdditionalCameraData>();
         //if it doesn't exist.
         if (hdCameraData == null)
         {
             //Add it to our object.
             hdCameraData = gameObject.AddComponent <HDAdditionalCameraData>();
         }
         //Assign the new value
         hdAdditionalCameraData = hdCameraData;
     }
 }
コード例 #28
0
    /// <summary>
    /// 修改摄像头抗锯齿
    /// </summary>
    /// <param name="antialiasingEnum"></param>
    /// <param name="qualityLevel"></param>
    public void ChangeAntialiasing(AntialiasingEnum antialiasingEnum, int qualityLevel = 1)
    {
        HDAdditionalCameraData hdAdditionalCamera = manager.mainCamera.GetComponent <HDAdditionalCameraData>();

        HDAdditionalCameraData.AntialiasingMode antialiasingMode = HDAdditionalCameraData.AntialiasingMode.None;
        switch (antialiasingEnum)
        {
        case AntialiasingEnum.None:
            break;

        case AntialiasingEnum.FXAA:
            antialiasingMode = HDAdditionalCameraData.AntialiasingMode.FastApproximateAntialiasing;
            break;

        case AntialiasingEnum.TAA:
            antialiasingMode = HDAdditionalCameraData.AntialiasingMode.TemporalAntialiasing;
            break;

        case AntialiasingEnum.SMAA:
            antialiasingMode = HDAdditionalCameraData.AntialiasingMode.SubpixelMorphologicalAntiAliasing;
            break;
        }
        hdAdditionalCamera.antialiasing = antialiasingMode;
        switch (qualityLevel)
        {
        case 0:
            hdAdditionalCamera.SMAAQuality = HDAdditionalCameraData.SMAAQualityLevel.Low;
            hdAdditionalCamera.TAAQuality  = HDAdditionalCameraData.TAAQualityLevel.Low;
            break;

        case 1:
            hdAdditionalCamera.SMAAQuality = HDAdditionalCameraData.SMAAQualityLevel.Medium;
            hdAdditionalCamera.TAAQuality  = HDAdditionalCameraData.TAAQualityLevel.Medium;
            break;

        case 2:
            hdAdditionalCamera.SMAAQuality = HDAdditionalCameraData.SMAAQualityLevel.High;
            hdAdditionalCamera.TAAQuality  = HDAdditionalCameraData.TAAQualityLevel.High;
            break;

        default:
            hdAdditionalCamera.SMAAQuality = HDAdditionalCameraData.SMAAQualityLevel.Low;
            hdAdditionalCamera.TAAQuality  = HDAdditionalCameraData.TAAQualityLevel.Low;
            break;
        }
    }
コード例 #29
0
        static void SetupFrameSettings(HDAdditionalCameraData additionalData, HDProbe probe)
        {
            HDRenderPipelineAsset hdrp = GraphicsSettings.renderPipelineAsset as HDRenderPipelineAsset;

            if (probe.mode == ReflectionProbeMode.Realtime)
            {
                hdrp.GetRealtimeReflectionFrameSettings().CopyTo(additionalData.GetFrameSettings());
            }
            else
            {
                hdrp.GetBakedOrCustomReflectionFrameSettings().CopyTo(additionalData.GetFrameSettings());
            }
            if (probe.captureSettings.renderingPath == HDAdditionalCameraData.RenderingPath.Custom)
            {
                probe.frameSettings.Override(additionalData.GetFrameSettings()).CopyTo(additionalData.GetFrameSettings());
            }
        }
コード例 #30
0
        private void OnEnable()
        {
            m_cam = GetComponent <Camera>();
            //Render nothing
            m_cam.clearFlags  = CameraClearFlags.Nothing;
            m_cam.cullingMask = 0;

#if URS_USE_HDRP_RUNTIME
            m_hdData = GetComponent <HDAdditionalCameraData>();
            m_hdData.fullscreenPassthrough = true;
            m_hdData.customRender         += BlitRenderStreamingRT;
#elif URS_USE_URP_RUNTIME
            UnityEngine.Rendering.RenderPipelineManager.endCameraRendering += OnEndCameraRendering;
#else
            Camera.onPreRender += BlitTexture;
#endif
        }