void setCameraPostProcessSettings() { state.cameras.ToList().ForEach( obj_state => { // Get object ObjectState_t internal_object_state = internal_state.getWrapperObject(obj_state.ID, camera_template); GameObject obj = internal_object_state.gameObj; // Copy and save postProcessingProfile into internal_object_state. var postBehaviour = obj.GetComponent <PostProcessingBehaviour>(); internal_object_state.postProcessingProfile = Instantiate(postBehaviour.profile); postBehaviour.profile = internal_object_state.postProcessingProfile; // Enable depth if needed. if (obj_state.isDepth) { var debugSettings = internal_object_state.postProcessingProfile.debugViews.settings; debugSettings.mode = BuiltinDebugViewsModel.Mode.Depth; debugSettings.depth.scale = state.camDepthScale; // Save the settings. internal_object_state.postProcessingProfile.debugViews.settings = debugSettings; } else { // Set CTAA settings CTAA_PC AA = obj.GetComponent <CTAA_PC>(); // Check if AA object exists. if (AA != null) { AA.TemporalStability = state.temporalStability; AA.HdrResponse = state.hdrResponse; AA.Sharpness = state.sharpness; AA.AdaptiveEnhance = state.adaptiveEnhance; AA.TemporalJitterScale = state.temporalJitterScale; AA.MicroShimmerReduction = state.microShimmerReduction; AA.StaticStabilityPower = state.staticStabilityPower; AA.enabled = true; } else { // If CTAA is not installed on camera, fallback to PostProcessing FXAA. AntialiasingModel.Settings AASettings = internal_object_state.postProcessingProfile.antialiasing.settings; AASettings.method = AntialiasingModel.Method.Fxaa; AASettings.fxaaSettings.preset = AntialiasingModel.FxaaPreset.ExtremeQuality; // Save the settings. internal_object_state.postProcessingProfile.antialiasing.settings = AASettings; } } }); // }
private void Start() { _pool = FindObjectOfType <ObjPoolManeger>(); _window = FindObjectOfType <TransparentWindow>(); ppl = Camera.main.transform.GetComponent <PostProcessLayer>(); Debug.Assert(ppl != null, $"{typeof(PostProcessLayer)}组件丢失"); _ctaa = FindObjectOfType <CTAA_PC>(); Debug.Assert(_ctaa != null, $"{typeof(CTAA_PC)}组件丢失"); _camera = Camera.main.gameObject; }
void OnEnable() { back1 = new GUIStyle(); back1.normal.background = MakeTex(600, 1, new Color(0.2f, 0.2f, 0.1f, 0.3f)); back2 = new GUIStyle(); back2.normal.background = MakeTex(600, 1, new Color(0.3f, 0.3f, 0.4f, 0.2f)); back3 = new GUIStyle(); back3.normal.background = MakeTex(600, 1, new Color(0.4f, 0.3f, 0.5f, 0.4f)); back4 = new GUIStyle(); back4.normal.background = MakeTex(600, 1, new Color(0.1f, 0.0f, 0.5f, 0.3f)); serObj = new SerializedObject(target); banner = Resources.Load("CTAA_nxt_background", typeof(Texture2D)) as Texture2D; myTarget = (CTAA_PC)target; }