浏览代码

Fix Blend node naming conventions

/main
Matt Dean 7 年前
当前提交
bcfd7b47
共有 2 个文件被更改,包括 116 次插入116 次删除
  1. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Artistic/Blend/BlendMode.cs
  2. 230
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Artistic/Blend/BlendNode.cs

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Artistic/Blend/BlendMode.cs


Lighten,
LinearBurn,
LinearDodge,
LinearLight_AddSub,
LinearLightAddSub,
Multiply,
Negation,
Overlay,

230
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Artistic/Blend/BlendNode.cs


protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod(string.Format("Unity_Blend{0}", GetCurrentBlendName()),
return GetType().GetMethod(string.Format("Unity_Blend_{0}", GetCurrentBlendName()),
static string Unity_BlendBurn(
[Slot(0, Binding.None)] DynamicDimensionVector top,
[Slot(1, Binding.None)] DynamicDimensionVector bottom,
[Slot(2, Binding.None)] out DynamicDimensionVector result)
static string Unity_Blend_Burn(
[Slot(0, Binding.None)] DynamicDimensionVector A,
[Slot(1, Binding.None)] DynamicDimensionVector B,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
result = 1.0 - (1.0 - bottom)/top;
Out = 1.0 - (1.0 - B)/A;
static string Unity_BlendDarken(
[Slot(0, Binding.None)] DynamicDimensionVector top,
[Slot(1, Binding.None)] DynamicDimensionVector bottom,
[Slot(2, Binding.None)] out DynamicDimensionVector result)
static string Unity_Blend_Darken(
[Slot(0, Binding.None)] DynamicDimensionVector A,
[Slot(1, Binding.None)] DynamicDimensionVector B,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
result = min(bottom, top);
Out = min(B, A);
static string Unity_BlendDifference(
[Slot(0, Binding.None)] DynamicDimensionVector top,
[Slot(1, Binding.None)] DynamicDimensionVector bottom,
[Slot(2, Binding.None)] out DynamicDimensionVector result)
static string Unity_Blend_Difference(
[Slot(0, Binding.None)] DynamicDimensionVector A,
[Slot(1, Binding.None)] DynamicDimensionVector B,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
result = abs(bottom-top);
Out = abs(B - A);
static string Unity_BlendDodge(
[Slot(0, Binding.None)] DynamicDimensionVector top,
[Slot(1, Binding.None)] DynamicDimensionVector bottom,
[Slot(2, Binding.None)] out DynamicDimensionVector result)
static string Unity_Blend_Dodge(
[Slot(0, Binding.None)] DynamicDimensionVector A,
[Slot(1, Binding.None)] DynamicDimensionVector B,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
result = bottom / (1.0 - top);
Out = B / (1.0 - A);
static string Unity_BlendDivide(
[Slot(0, Binding.None)] DynamicDimensionVector top,
[Slot(1, Binding.None)] DynamicDimensionVector bottom,
[Slot(2, Binding.None)] out DynamicDimensionVector result)
static string Unity_Blend_Divide(
[Slot(0, Binding.None)] DynamicDimensionVector A,
[Slot(1, Binding.None)] DynamicDimensionVector B,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
result = bottom / (top + 0.000000000001);
Out = B / (A + 0.000000000001);
static string Unity_BlendExclusion(
[Slot(0, Binding.None)] DynamicDimensionVector top,
[Slot(1, Binding.None)] DynamicDimensionVector bottom,
[Slot(2, Binding.None)] out DynamicDimensionVector result)
static string Unity_Blend_Exclusion(
[Slot(0, Binding.None)] DynamicDimensionVector A,
[Slot(1, Binding.None)] DynamicDimensionVector B,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
result = bottom + top - (2.0 * bottom * top);;
Out = B + A - (2.0 * B * A);
static string Unity_BlendHardLight(
[Slot(0, Binding.None)] DynamicDimensionVector top,
[Slot(1, Binding.None)] DynamicDimensionVector bottom,
[Slot(2, Binding.None)] out DynamicDimensionVector result)
static string Unity_Blend_HardLight(
[Slot(0, Binding.None)] DynamicDimensionVector A,
[Slot(1, Binding.None)] DynamicDimensionVector B,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
{precision}{slot2dimension} result1 = 1.0 - 2.0 * (1.0 - top) * (1.0 - bottom);
{precision}{slot2dimension} result2 = 2.0 * top * bottom;
{precision}{slot2dimension} zeroOrOne = step(top, 0.5);
result = result2 * zeroOrOne + (1 - zeroOrOne) * result1;
{precision}{slot2dimension} result1 = 1.0 - 2.0 * (1.0 - A) * (1.0 - B);
{precision}{slot2dimension} result2 = 2.0 * A * B;
{precision}{slot2dimension} zeroOrOne = step(A, 0.5);
Out = result2 * zeroOrOne + (1 - zeroOrOne) * result1;
static string Unity_BlendHardMix(
[Slot(0, Binding.None)] DynamicDimensionVector top,
[Slot(1, Binding.None)] DynamicDimensionVector bottom,
[Slot(2, Binding.None)] out DynamicDimensionVector result)
static string Unity_Blend_HardMix(
[Slot(0, Binding.None)] DynamicDimensionVector A,
[Slot(1, Binding.None)] DynamicDimensionVector B,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
result = step(1-top, bottom);
Out = step(1 - A, B);
static string Unity_BlendLighten(
[Slot(0, Binding.None)] DynamicDimensionVector top,
[Slot(1, Binding.None)] DynamicDimensionVector bottom,
[Slot(2, Binding.None)] out DynamicDimensionVector result)
static string Unity_Blend_Lighten(
[Slot(0, Binding.None)] DynamicDimensionVector A,
[Slot(1, Binding.None)] DynamicDimensionVector B,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
result = max(bottom, top);
Out = max(B, A);
static string Unity_BlendLinearBurn(
[Slot(0, Binding.None)] DynamicDimensionVector top,
[Slot(1, Binding.None)] DynamicDimensionVector bottom,
[Slot(2, Binding.None)] out DynamicDimensionVector result)
static string Unity_Blend_LinearBurn(
[Slot(0, Binding.None)] DynamicDimensionVector A,
[Slot(1, Binding.None)] DynamicDimensionVector B,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
result = top + bottom - 1.0;
Out = A + B - 1.0;
static string Unity_BlendLinearDodge(
[Slot(0, Binding.None)] DynamicDimensionVector top,
[Slot(1, Binding.None)] DynamicDimensionVector bottom,
[Slot(2, Binding.None)] out DynamicDimensionVector result)
static string Unity_Blend_LinearDodge(
[Slot(0, Binding.None)] DynamicDimensionVector A,
[Slot(1, Binding.None)] DynamicDimensionVector B,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
result = top + bottom;
Out = A + B;
static string Unity_BlendLinearLight_AddSub(
[Slot(0, Binding.None)] DynamicDimensionVector top,
[Slot(1, Binding.None)] DynamicDimensionVector bottom,
[Slot(2, Binding.None)] out DynamicDimensionVector result)
static string Unity_Blend_LinearLightAddSub(
[Slot(0, Binding.None)] DynamicDimensionVector A,
[Slot(1, Binding.None)] DynamicDimensionVector B,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
result = bottom + 2.0 * top - 1.0;
Out = B + 2.0 * A - 1.0;
static string Unity_BlendMultiply(
[Slot(0, Binding.None)] DynamicDimensionVector top,
[Slot(1, Binding.None)] DynamicDimensionVector bottom,
[Slot(2, Binding.None)] out DynamicDimensionVector result)
static string Unity_Blend_Multiply(
[Slot(0, Binding.None)] DynamicDimensionVector A,
[Slot(1, Binding.None)] DynamicDimensionVector B,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
result = top * bottom;
Out = A * B;
static string Unity_BlendNegation(
[Slot(0, Binding.None)] DynamicDimensionVector top,
[Slot(1, Binding.None)] DynamicDimensionVector bottom,
[Slot(2, Binding.None)] out DynamicDimensionVector result)
static string Unity_Blend_Negation(
[Slot(0, Binding.None)] DynamicDimensionVector A,
[Slot(1, Binding.None)] DynamicDimensionVector B,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
result = 1.0 - abs(1.0 - bottom - top);;
Out = 1.0 - abs(1.0 - B - A);
static string Unity_BlendScreen(
[Slot(0, Binding.None)] DynamicDimensionVector top,
[Slot(1, Binding.None)] DynamicDimensionVector bottom,
[Slot(2, Binding.None)] out DynamicDimensionVector result)
static string Unity_Blend_Screen(
[Slot(0, Binding.None)] DynamicDimensionVector A,
[Slot(1, Binding.None)] DynamicDimensionVector B,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
result = 1.0 - (1.0-bottom) * (1.0 - top);
Out = 1.0 - (1.0 - B) * (1.0 - A);
static string Unity_BlendOverlay(
[Slot(0, Binding.None)] DynamicDimensionVector top,
[Slot(1, Binding.None)] DynamicDimensionVector bottom,
[Slot(2, Binding.None)] out DynamicDimensionVector result)
static string Unity_Blend_Overlay(
[Slot(0, Binding.None)] DynamicDimensionVector A,
[Slot(1, Binding.None)] DynamicDimensionVector B,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
{precision}{slot2dimension} result1 = 1.0 - 2.0 * (1.0 - top) * (1.0 - bottom);
{precision}{slot2dimension} result2 = 2.0 * top * bottom;
{precision}{slot2dimension} zeroOrOne = step(bottom, 0.5);
result = result2 * zeroOrOne + (1 - zeroOrOne) * result1;
{precision}{slot2dimension} result1 = 1.0 - 2.0 * (1.0 - A) * (1.0 - B);
{precision}{slot2dimension} result2 = 2.0 * A * B;
{precision}{slot2dimension} zeroOrOne = step(B, 0.5);
Out = result2 * zeroOrOne + (1 - zeroOrOne) * result1;
static string Unity_BlendPinLight(
[Slot(0, Binding.None)] DynamicDimensionVector top,
[Slot(1, Binding.None)] DynamicDimensionVector bottom,
[Slot(2, Binding.None)] out DynamicDimensionVector result)
static string Unity_Blend_PinLight(
[Slot(0, Binding.None)] DynamicDimensionVector A,
[Slot(1, Binding.None)] DynamicDimensionVector B,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
{precision}{slot2dimension} check = step (0.5, top);
{precision}{slot2dimension} result1 = check * max(2.0*(top - 0.5), bottom);
result = result1 + (1.0 - check) * min(2.0 * top, bottom);
{precision}{slot2dimension} check = step (0.5, A);
{precision}{slot2dimension} result1 = check * max(2.0 * (A - 0.5), B);
Out = result1 + (1.0 - check) * min(2.0 * A, B);
static string Unity_BlendSoftLight(
[Slot(0, Binding.None)] DynamicDimensionVector top,
[Slot(1, Binding.None)] DynamicDimensionVector bottom,
[Slot(2, Binding.None)] out DynamicDimensionVector result)
static string Unity_Blend_SoftLight(
[Slot(0, Binding.None)] DynamicDimensionVector A,
[Slot(1, Binding.None)] DynamicDimensionVector B,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
{precision}{slot2dimension} result1= 2.0 * bottom * top +bottom*top - 2.0 * bottom*bottom*top;
{precision}{slot2dimension} result2= 2.0* sqrt(bottom) * top - sqrt(bottom) + 2.0 * bottom - 2.0 * bottom*top;
{precision}{slot2dimension} zeroOrOne = step(0.5, top);
result = result2 * zeroOrOne + (1 - zeroOrOne) * result1;
{precision}{slot2dimension} result1 = 2.0 * B * A + B * A - 2.0 * B * B * A;
{precision}{slot2dimension} result2 = 2.0 * sqrt(B) * A - sqrt(B) + 2.0 * B - 2.0 * B * A;
{precision}{slot2dimension} zeroOrOne = step(0.5, A);
Out = result2 * zeroOrOne + (1 - zeroOrOne) * result1;
static string Unity_BlendVividLight(
[Slot(0, Binding.None)] DynamicDimensionVector top,
[Slot(1, Binding.None)] DynamicDimensionVector bottom,
[Slot(2, Binding.None)] out DynamicDimensionVector result)
static string Unity_Blend_VividLight(
[Slot(0, Binding.None)] DynamicDimensionVector A,
[Slot(1, Binding.None)] DynamicDimensionVector B,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
{precision}{slot2dimension} result1 = 1.0-(1.0-bottom)/(2.0*top);
{precision}{slot2dimension} result2 = bottom/(2.0*(1.0-top));
{precision}{slot2dimension} zeroOrOne = step(0.5, top);
result = result2 * zeroOrOne + (1 - zeroOrOne) * result1;
{precision}{slot2dimension} result1 = 1.0 - (1.0 - B) / (2.0 * A);
{precision}{slot2dimension} result2 = B / (2.0 * (1.0 - A));
{precision}{slot2dimension} zeroOrOne = step(0.5, A);
Out = result2 * zeroOrOne + (1 - zeroOrOne) * result1;
static string Unity_BlendSubtract(
[Slot(0, Binding.None)] DynamicDimensionVector top,
[Slot(1, Binding.None)] DynamicDimensionVector bottom,
[Slot(2, Binding.None)] out DynamicDimensionVector result)
static string Unity_Blend_Subtract(
[Slot(0, Binding.None)] DynamicDimensionVector A,
[Slot(1, Binding.None)] DynamicDimensionVector B,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
result = bottom - top;
Out = B - A;
}
";
}
正在加载...
取消
保存