赞
踩
- //所需要的引用
- using UnityEngine.Rendering;
- using UnityEngine.Rendering.PostProcessing;
-
- public class PostProcessingController:MonoBehaviour
- {
- /// <summary>
- /// PP Volume
- /// </summary>
- public PostProcessVolume volume;
-
- /// <summary>
- /// Example示例 打开DOF效果
- /// </summary>
- public void OpenDepthOfField()
- {
- volume.profile.GetSetting<DepthOfField>().active = true;
- }
-
- /// <summary>
- /// 动态调节调色 从黑白变彩色
- /// </summary>
- /// <param name="speed"></param>
- public void SetColorGrading(float speed)
- {
- StartCoroutine(IESetPP(speed));
- }
- public IEnumerator IESetPP(float speed)
- {
- //float currentSaturation = volume.profile.GetSetting<ColorGrading>().saturation.value;
- while (volume.profile.GetSetting<ColorGrading>().saturation.value < 0)
- {
- volume.profile.GetSetting<ColorGrading>().saturation.value += Time.deltaTime * speed;
- yield return 0;
- }
- }
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。