private static void ConvertDepthOfFieldSettings(PostProcessProfile ppp, DepthOfFieldModel.Settings dof) { var dof2 = ppp.AddSettings <DepthOfField>(); dof2.aperture.overrideState = true; dof2.aperture.value = dof.aperture; dof2.focalLength.overrideState = true; dof2.focalLength.value = dof.focalLength; dof2.focusDistance.overrideState = true; dof2.focusDistance.value = dof.focusDistance; dof2.kernelSize.overrideState = true; switch (dof.kernelSize) { case DepthOfFieldModel.KernelSize.VeryLarge: dof2.kernelSize.value = KernelSize.VeryLarge; break; case DepthOfFieldModel.KernelSize.Large: dof2.kernelSize.value = KernelSize.Large; break; case DepthOfFieldModel.KernelSize.Medium: dof2.kernelSize.value = KernelSize.Medium; break; case DepthOfFieldModel.KernelSize.Small: dof2.kernelSize.value = KernelSize.Small; break; } // Not supported: dof.useCameraFov; }
private void UpdateDOF(float Value) { DepthOfFieldModel.Settings settings = this.Profile.depthOfField.settings; settings.focusDistance = Value; settings.aperture = 5.6f; this.Profile.depthOfField.settings = settings; }
// Update is called once per frame void Update() { DepthOfFieldModel.Settings settings = profile.depthOfField.settings; settings.focusDistance = Vector3.Dot(transform.forward, focusTransform.position - transform.position); profile.depthOfField.settings = settings; }
private void SetDepthOfFieldEnabledInternal(bool enabled, bool animate) { if (depthOfFieldCoroutine_ != null) { depthOfFieldCoroutine_.Cancel(); depthOfFieldCoroutine_ = null; } DepthOfFieldModel.Settings settings = postProcessingProfile_.depthOfField.settings; if (!animate) { settings.focalLength = enabled ? kMaxFocalLength : kMinFocalLength; postProcessingProfile_.depthOfField.settings = settings; postProcessingProfile_.depthOfField.enabled = enabled; } else { postProcessingProfile_.depthOfField.enabled = true; float start = enabled ? kMinFocalLength : kMaxFocalLength; float end = enabled ? kMaxFocalLength : kMinFocalLength; depthOfFieldCoroutine_ = CoroutineWrapper.DoEaseFor(kDepthOfFieldAnimationDuration, EaseType.CubicEaseOut, (float p) => { settings.focalLength = Mathf.Lerp(start, end, p); postProcessingProfile_.depthOfField.settings = settings; }, () => { postProcessingProfile_.depthOfField.enabled = enabled; }); } }
void Start() { cam.enabled = false; startCamPos = cam.transform.position; startCamRot = cam.transform.rotation; cam.transform.position = camStartScreenTransform.position; cam.transform.rotation = camStartScreenTransform.rotation; Player.Instance.AllowInput = false; playSettings = postP.profile.depthOfField.settings; postP.profile.depthOfField.settings = dofSettings; state = State.FadingIn; uiFade.color = new Color(0, 0, 0, 1); fadeInTimer = fadeInTime; uiLogo.color = new Color(0, 0, 0, 0); uiLogo1.color = new Color(0, 0, 0, 0); uiLogo2.color = new Color(0, 0, 0, 0); startButterfly.gameObject.SetActive(true); startButterfly.Perch(butterflyLandTarget); startButterfly.autoStart = false; UiRoot.SetActive(true); AudioListener.volume = 0; }
// Update is called once per frame void Update() { // Linearly update all post processing values which aren't at their target values. lerp += Time.deltaTime / duration; VignetteModel.Settings vignette = profile.vignette.settings; if (vignette.intensity != targetVignette) { vignette.intensity = Mathf.Lerp(fromVignette, targetVignette, lerp); } DepthOfFieldModel.Settings dof = profile.depthOfField.settings; if (dof.aperture != targetDof) { dof.aperture = Mathf.Lerp(fromDof, targetDof, lerp); } ColorGradingModel.Settings cgm = profile.colorGrading.settings; if (cgm.basic.saturation != targetSaturation) { cgm.basic.saturation = Mathf.Lerp(fromSaturation, targetSaturation, lerp); } if (cgm.basic.temperature != targetTemp) { cgm.basic.temperature = Mathf.Lerp(fromTemp, targetTemp, lerp); } profile.vignette.settings = vignette; profile.depthOfField.settings = dof; profile.colorGrading.settings = cgm; }
void Start() { // emJogo = true; vidas = 3; timeFim = 0.0f; larguraBt = 150; alturaBt = 100; if (SceneManager.GetActiveScene().name == "Fase1") { txtVidas.text = vidas.ToString(); } if (SceneManager.GetActiveScene().name != "TelaInicial" && SceneManager.GetActiveScene().name != "GameOver") { //PowerUps// blurProfile = perfil.depthOfField.settings; blurProfile.kernelSize = DepthOfFieldModel.KernelSize.VeryLarge; blurProfile.aperture = 32; blurProfile.focalLength = 0.1f; blurTimer = 0f; perfil.depthOfField.settings = blurProfile; bloomProfile = perfil.bloom.settings; bloomProfile.bloom.threshold = 1f; } }
// 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);*/ }
///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 }
public void UpdatePostProcesing(bool[] p_drunkEffects) { if (p_drunkEffects[(int)Player.DRUNK_EFFECTS.VIGNETTE]) { m_drunkPostProcessingProfile.vignette.enabled = true; VignetteModel.Settings vignetteSettings = m_drunkPostProcessingProfile.vignette.settings; //MOAR MAGIC HERE vignetteSettings.intensity = m_vignetteIntensityDiff * Mathf.Sin(Time.timeSinceLevelLoad * m_vignettePacing) + (m_minVignetteIntensity + m_vignetteIntensityDiff / 2.0f); m_drunkPostProcessingProfile.vignette.settings = vignetteSettings; } else { m_drunkPostProcessingProfile.vignette.enabled = false; } if (p_drunkEffects[(int)Player.DRUNK_EFFECTS.DOF]) { m_drunkPostProcessingProfile.depthOfField.enabled = true; DepthOfFieldModel.Settings DOFSettings = m_drunkPostProcessingProfile.depthOfField.settings; //MOAR MAGIC HERE DOFSettings.focusDistance = m_DOFDistanceDiff * Mathf.Sin(Time.timeSinceLevelLoad * m_vignettePacing) + (m_minDOFDistance + m_DOFDistanceDiff / 2.0f); m_drunkPostProcessingProfile.depthOfField.settings = DOFSettings; } else { m_drunkPostProcessingProfile.depthOfField.enabled = false; } }
// Use this for initialization void Start() { ppEffects = GetComponent <PostProcessingBehaviour>(); if (ppEffects) { depth = ppEffects.profile.depthOfField.settings; } }
void Start() { cameraMain = Camera.main; m_Profile = cameraMain.GetComponent <PostProcessingBehaviour>().profile; dof = m_Profile.depthOfField.settings; dof.focalLength = 60f; m_Profile.depthOfField.settings = dof; }
// Use this for initialization void Start() { instance = this; PPBehaviour = GetComponent <PostProcessingBehaviour>(); settings = PPBehaviour.profile.depthOfField.settings; settings.focalLength = initialFocalLength; PPBehaviour.profile.depthOfField.settings = settings; }
public void InterpolateDOFSettings(PostProcessingProfile stack, DOFInterpolateSettings settings, float deltaTime = 1) { DepthOfFieldModel.Settings DOFNewSettings = stack.depthOfField.settings; DOFNewSettings.aperture = Mathf.Lerp(DOFNewSettings.aperture, settings.aperture, settings.apertureSpeed * deltaTime); DOFNewSettings.focalLength = Mathf.Lerp(DOFNewSettings.focalLength, settings.focalLength, settings.focalLengthSpeed * deltaTime); DOFNewSettings.focusDistance = Mathf.Lerp(DOFNewSettings.focusDistance, settings.focusDistance, settings.focusDistanceSpeed * deltaTime); stack.depthOfField.settings = DOFNewSettings; }
void SetPostProcessing() { DepthOfFieldModel.Settings temp = new DepthOfFieldModel.Settings(); temp = mPostProcessing.depthOfField.settings; temp.focalLength = 35; mPostProcessing.depthOfField.enabled = true; mPostProcessing.depthOfField.settings = temp; mPostProcessing.grain.enabled = false; }
public void changeBlurAmount(float from, float to, float time, LeanTweenType leanTweenType = LeanTweenType.notUsed) { LeanTween.value(from, to, time).setOnUpdate(delegate(float value) { DepthOfFieldModel.Settings Newsettings = depthOfField.settings; Newsettings.focusDistance = value; depthOfField.settings = Newsettings; }).setEase(leanTweenType); }
void Start() { DepthOfFieldModel.Settings settings = postProcessing.depthOfField.settings; settings.focusDistance = .1f; Time.timeScale = 0f; Cursor.lockState = CursorLockMode.None; Cursor.visible = true; postProcessing.depthOfField.enabled = true; postProcessing.depthOfField.settings = settings; }
void SetDepthofFieldFocus() { RaycastHit hit; if (Physics.Raycast(transform.position, transform.forward, out hit, 100f, dofFocusMask)) { DepthOfFieldModel.Settings settings = post.profile.depthOfField.settings; settings.focusDistance = hit.distance; post.profile.depthOfField.settings = settings; } }
private static void WriteDOF(List <string> lines, DepthOfFieldModel.Settings settings) { lines.Append("Depth_Of_Field", 1); lines.Append("{", 1); lines.Append("Focus_Distance = " + settings.focusDistance, 2); lines.Append("Aperture = " + settings.aperture, 2); lines.Append("Use_Camera_FOV = " + settings.useCameraFov.Convert(), 2); lines.Append("Focal_Length = " + settings.focalLength, 2); lines.Append("Kernel_Size = " + (int)settings.kernelSize, 2); lines.Append("}", 1); }
public void BeginInteraction(GameObject go) { if (!IsInteracting) { IsInteracting = true; _startDOFSettings = PostProcess.depthOfField.settings; _lastDOFSettings = PostProcess.depthOfField.settings; _objectInteracting = go.transform; _startRotationZ = go.transform.localEulerAngles.z; } }
// Use this for initialization void Start() { profile = Instantiate(behaviour.profile); behaviour.profile = profile; settings = profile.depthOfField.settings; focusDistance = settings.focusDistance; aperture = settings.aperture; focalLength = settings.focalLength; useCameraFov = settings.useCameraFov; }
private IEnumerator focusPicture(DepthOfFieldModel.Settings _dof, float targetFocalLength, float duration) { while (_dof.focalLength > 2f) { _dof.focalLength = Mathf.Lerp(_dof.focalLength, targetFocalLength, duration * Time.deltaTime); m_Profile.depthOfField.settings = _dof; yield return(null); } _dof.focalLength = targetFocalLength; m_Profile.depthOfField.settings = _dof; print("Reached target."); }
public bool start() { if (m_postProcessing != null) { return(false); } m_postProcessing = m_manager.getComponentPostProcessingBehaviour(); m_postProcessing.profile.depthOfField.enabled = true; m_depthOfFieldModelSettings = m_postProcessing.profile.depthOfField.settings; return(true); }
// Update is called once per frame void Update() { DepthOfFieldModel.Settings dof = ppp.depthOfField.settings; if (dof.focalLength < 300) { dof.focalLength += 10 * Time.deltaTime; if (dof.focalLength > 300) { dof.focalLength = 300; } ppp.depthOfField.settings = dof; } }
IEnumerator Focus() { DepthOfFieldModel.Settings settings = postProcessing.depthOfField.settings; Debug.Log("started"); for (float f = 0.1f; f <= 5.0f; f += 2 * Time.deltaTime) { settings.focusDistance = f; postProcessing.depthOfField.settings = settings; yield return(null); } postProcessing.depthOfField.enabled = false; }
/// <summary> /// Cambia el estado de la camara segun la cantidad de humo que hay en la escena /// </summary> /// <param name="valueD">Efecto Depth</param> /// <param name="valueV">Efecto Vignette</param> public void ChangeSmokeState(float valueD, float valueV) { _profile = _post.profile; _depth = _profile.depthOfField.settings; _vignette = _profile.vignette.settings; _targetDepth = valueD; _targetVignette = valueV; _countDepth = 0; _countVignette = 0; _isLerpDepth = true; _isLerpVignette = true; }
public void SetDOF(float targetAperture, float targetFocusDistance, float speed) { DepthOfFieldModel.Settings dof = postProcessingProfile.depthOfField.settings; float originalfStop = dof.aperture; dof.aperture = Mathf.Lerp(originalfStop, targetAperture, speed * Time.deltaTime); float originalFocusDistance = dof.focusDistance; dof.focusDistance = Mathf.Lerp(originalFocusDistance, targetFocusDistance, speed * Time.deltaTime); postProcessingProfile.depthOfField.settings = dof; }
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; } }
private void Start() { dc = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <DynamicCamera3D>(); //find dynamic camera parentObj = gameObject.GetComponentInParent <Transform>().gameObject; //find reference to parent dc.inInteraction = false; originalCameraRotation = dc.transform.rotation; // save the original position & rotation of the camera originalCameraPosition = dc.transform.position; // Depth of Field defaultDOFVal = postProcProf.depthOfField.settings; // save previous setting dof = defaultDOFVal; //set dof to default isFocusing = false; hasExecutedFocus = false; }
private IEnumerator LerpPostProcessing() { float speed = 5, val = 0, progression = 0; while (val > 47) { yield return(null); progression += speed * Time.deltaTime; val = Mathf.Lerp(147, 47, progression); DepthOfFieldModel.Settings dofm = pProfile.depthOfField.settings; dofm.focalLength = val; pProfile.depthOfField.settings = dofm; } }