Unity 动态修改HDR 的intensity

1 打开一个unity自带的share spirit ,

2 修改color节点为 HDR 模式

------------------------------脚本


public class TestEission : MonoBehaviour
{
    public string property;         // share内部 Color节点的名字
    public MeshRenderer meshRenderer;
    private Material material;

    [Range(0f, 10f)]
    public float intensity;
    private Color c;

    private void Start()
    {
        material = meshRenderer.material;
        c = material.GetColor(property);
    }
    void Update()
    {
        float factor = Mathf.Pow(2, intensity);
        Color color = new Color(c.r * factor, c.g * factor, c.b * factor);
        material.SetColor(property, color);
    }
}

---------------------------------------------效果

Unity 动态修改HDR 的intensity_第1张图片

 

你可能感兴趣的:(Unity引擎,unity)