///Call this anywhere to change the Focus Distance of the Depth of Field effect. public static void SetDepthOfField_FocusDistance(float val, Camera cam = null) { #if HAZE_POSTPROCESSING if (cam == null) { cam = Camera.main; } PostProcessingBehaviour ppBehaviour = cam.GetComponent <PostProcessingBehaviour>(); if (ppBehaviour) { PostProcessingProfile profile = ppBehaviour.profile; if (profile != null) { DepthOfFieldModel dof = profile.depthOfField; if (dof != null && dof.enabled) { DepthOfFieldModel.Settings settings = dof.settings; //Set focus distance. settings.focusDistance = val; dof.settings = settings; } } } #endif }
// Use this for initialization void Start() { cgm = postProcessingBehaviour.profile.colorGrading; cgms = cgm.settings; dofm = postProcessingBehaviour.profile.depthOfField; dofms = dofm.settings; if (QualitySettings.GetQualityLevel() <= 2) { postProcessingBehaviour.enabled = false; } /*TerrainData tData = terrain.terrainData; * float[,,] alphaData = tData.GetAlphamaps(0, 0, tData.alphamapWidth, tData.alphamapHeight); * * float percentage = 0.2f; * for(int y=0; y<tData.alphamapHeight; y++){ * for(int x = 0; x < tData.alphamapWidth; x++){ * float swap = alphaData[x, y, 1]; * alphaData[x, y, 1] = alphaData[x, y, 2]; * alphaData[x, y, 2] = swap; * } * } * * tData.SetAlphamaps(0, 0, alphaData);*/ }
IEnumerator ShowEndingTrainSceneCoroutine() { iTween.FadeTo(m_CameraFadePanel, 1f, m_CameraFadeDuration + 3.5f); m_PlayerSpeechBubble.SetActive(false); yield return(new WaitForSeconds(m_CameraFadeDuration + 4f)); VignetteModel.Settings vignetteSettings = m_PostProcessingProfile.vignette.settings; vignetteSettings.intensity = 0f; m_PostProcessingProfile.vignette.settings = vignetteSettings; GrainModel grainModel = m_PostProcessingProfile.grain; grainModel.enabled = true; DepthOfFieldModel dofModel = m_PostProcessingProfile.depthOfField; dofModel.enabled = true; m_GirlfriendMeetingPanel.SetActive(false); m_EndingPanel.SetActive(true); m_BGMPlayer.PlayEndingSong(); iTween.FadeTo(m_CameraFadePanel, 0f, m_CameraFadeDuration + 2f); yield return(new WaitForSeconds(m_CameraFadeDuration + 4f)); //m_CinematicScript.ShowNextButton (MoveToCredits); yield return(new WaitForSeconds(3f)); yield return(ShowCreditsCoroutine()); }
public void Awake() { postProcessVolume = this.GetComponent <PostProcessingBehaviour>(); depthOfField = postProcessVolume.profile.depthOfField; Focus(); if (instance == null) { instance = this; } }
public void Update() { if (strategy != null) { strategy.UpdateStrategy(); UpdateTransform(); DepthOfFieldModel dof = postProfile.depthOfField; DepthOfFieldModel.Settings s = dof.settings; s.focusDistance = EvaluateTargetFocalDistance(); dof.settings = s; postProfile.depthOfField = dof; } }
void Awake() { VignetteModel.Settings vignetteSettings = m_PostProcessProfile.vignette.settings; vignetteSettings.intensity = 0f; m_PostProcessProfile.vignette.settings = vignetteSettings; GrainModel grainModel = m_PostProcessProfile.grain; grainModel.enabled = false; DepthOfFieldModel dofModel = m_PostProcessProfile.depthOfField; dofModel.enabled = false; m_AudioSource = GetComponent <AudioSource> (); }
IEnumerator save_DepthOfField() { yield return(new WaitForEndOfFrame()); for (int a = 0; a < pb.Length; a++) { DepthOfFieldModel m = pb [a].profile.depthOfField; if (depthOfField.value == 0) { m.enabled = false; PlayerPrefs.SetString("DOF", "Off"); } if (depthOfField.value == 1) { m.enabled = true; PlayerPrefs.SetString("DOF", "On"); } pb [a].profile.depthOfField = m; } }
// Use this for initialization public void Initialize() { _rotationIntensity = cameraManager.rotationIntensity; _translateIntensity = cameraManager.translationIntensity; cameraParent = transform.GetChild(0); apertureIntense = cameraManager.apertureIntense; throttleGuider = transform.GetComponentInChildren <CameraThrottler>(); throttleGuider.translationIntensity = _translateIntensity; throttleGuider.cameraBrother = this; throttleGuider.Initialize(); switch (cameraType) { case CameraControllerType.Tripod: break; case CameraControllerType.AimLocked: InitializeTargets(); break; case CameraControllerType.AnimationTargetedRoutine: InitializeTargets(); throttleGuider.activated = true; break; case CameraControllerType.AnimationFreeAimRoutine: throttleGuider.activated = true; break; default: break; } _postFxs = FindObjectOfType <PostProcessingBehaviour>().profile; _DoF = _postFxs.depthOfField; _focusDistanceDefault = _postFxs.depthOfField.settings.focusDistance; _apertureDefault = _postFxs.depthOfField.settings.aperture; }
private void Awake() { dofModel = postProcess.profile.depthOfField; dofSetting = dofModel.settings; }