You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.1 KiB
42 lines
1.1 KiB
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
// from https://blog.csdn.net/qq_41835314/article/details/127602308 2023.03.14
|
|
[ExecuteInEditMode]
|
|
public class BrightnessSaturationAndContrast : MonoBehaviour
|
|
{
|
|
public Shader briSatConShader;
|
|
public Material briSatConMaterial;
|
|
|
|
[Range(0.0f, 3.0f)]
|
|
public float brightness = 1.0f;
|
|
|
|
[Range(0.0f, 3.0f)]
|
|
public float saturation = 1.0f;
|
|
|
|
[Range(0.0f, 3.0f)]
|
|
public float contrast = 1.0f;
|
|
|
|
|
|
|
|
//运用 OnRenderImage(src, des)
|
|
void OnRenderImage(RenderTexture source, RenderTexture destination)
|
|
{
|
|
if (briSatConMaterial != null)
|
|
{
|
|
briSatConMaterial.SetFloat("_Brightness", brightness);
|
|
briSatConMaterial.SetFloat("_Saturation", saturation);
|
|
briSatConMaterial.SetFloat("_Contrast", contrast);
|
|
Graphics.Blit(source, destination, briSatConMaterial);
|
|
}
|
|
else
|
|
{
|
|
Debug.LogWarning("Please input your Material!");
|
|
Graphics.Blit(source, destination);
|
|
}
|
|
|
|
}
|
|
}
|