浏览代码

Color Mask Node

/main
Matt Dean 7 年前
当前提交
b48cb4c9
共有 4 个文件被更改,包括 56 次插入0 次删除
  1. 8
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Artistic/Mask.meta
  2. 37
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Artistic/Mask/ColorMaskNode.cs
  3. 11
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Artistic/Mask/ColorMaskNode.cs.meta

8
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Artistic/Mask.meta


fileFormatVersion: 2
guid: cdb8c403de0823942a95a464c32ad0f0
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

37
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Artistic/Mask/ColorMaskNode.cs


using System.Reflection;
using UnityEngine;
namespace UnityEditor.ShaderGraph
{
[Title("Artistic/Mask/Color Mask")]
public class ColorMaskNode : CodeFunctionNode
{
public ColorMaskNode()
{
name = "Color Mask";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_ColorMask", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_ColorMask(
[Slot(0, Binding.None)] Vector3 In,
[Slot(1, Binding.None)] Color MaskColor,
[Slot(2, Binding.None)] Vector1 Range,
[Slot(3, Binding.None)] out Vector3 Out)
{
Out = Vector2.zero;
return
@"
{
{precision}3 col = {precision}3(0, 0, 0);
{precision} Distance = distance(MaskColor, In);
if(Distance <= Range)
col = {precision}3(1, 1, 1);
Out = col;
}";
}
}
}

11
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Artistic/Mask/ColorMaskNode.cs.meta


fileFormatVersion: 2
guid: 19255c24842f72c4c94c21b682a3e170
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存