您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

33 行
891 B

using System.Reflection;
using UnityEngine;
namespace UnityEditor.ShaderGraph
{
[Title("Artistic", "Adjustment", "Saturation")]
public class SaturationNode : CodeFunctionNode
{
public SaturationNode()
{
name = "Saturation";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Saturation", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_Saturation(
[Slot(0, Binding.None)] Vector3 In,
[Slot(1, Binding.None, 1, 1, 1, 1)] Vector1 Saturation,
[Slot(2, Binding.None)] out Vector3 Out)
{
Out = Vector3.zero;
return @"
{
{precision} luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
Out = luma.xxx + Saturation.xxx * (In - luma.xxx);
}
";
}
}
}