浏览代码

Fixes to the previous commit.

- Added default value 1.0 to the opacity slots.
- Swapped the slot IDs to be compatible with the previous versions.
/main
Keijiro Takahashi 7 年前
当前提交
72b23308
共有 1 个文件被更改,包括 56 次插入56 次删除
  1. 112
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Artistic/Blend/BlendNode.cs

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


static string Unity_Blend_Burn(
[Slot(0, Binding.None)] DynamicDimensionVector Base,
[Slot(1, Binding.None)] DynamicDimensionVector Blend,
[Slot(2, Binding.None)] Vector1 Opacity,
[Slot(3, Binding.None)] out DynamicDimensionVector Out)
[Slot(3, Binding.None, 1, 1, 1, 1)] Vector1 Opacity,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
{
return
@"

static string Unity_Blend_Darken(
[Slot(0, Binding.None)] DynamicDimensionVector Base,
[Slot(1, Binding.None)] DynamicDimensionVector Blend,
[Slot(2, Binding.None)] Vector1 Opacity,
[Slot(3, Binding.None)] out DynamicDimensionVector Out)
[Slot(3, Binding.None, 1, 1, 1, 1)] Vector1 Opacity,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
{
return
@"

static string Unity_Blend_Difference(
[Slot(0, Binding.None)] DynamicDimensionVector Base,
[Slot(1, Binding.None)] DynamicDimensionVector Blend,
[Slot(2, Binding.None)] Vector1 Opacity,
[Slot(3, Binding.None)] out DynamicDimensionVector Out)
[Slot(3, Binding.None, 1, 1, 1, 1)] Vector1 Opacity,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
{
return
@"

static string Unity_Blend_Dodge(
[Slot(0, Binding.None)] DynamicDimensionVector Base,
[Slot(1, Binding.None)] DynamicDimensionVector Blend,
[Slot(2, Binding.None)] Vector1 Opacity,
[Slot(3, Binding.None)] out DynamicDimensionVector Out)
[Slot(3, Binding.None, 1, 1, 1, 1)] Vector1 Opacity,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
{
return
@"

static string Unity_Blend_Divide(
[Slot(0, Binding.None)] DynamicDimensionVector Base,
[Slot(1, Binding.None)] DynamicDimensionVector Blend,
[Slot(2, Binding.None)] Vector1 Opacity,
[Slot(3, Binding.None)] out DynamicDimensionVector Out)
[Slot(3, Binding.None, 1, 1, 1, 1)] Vector1 Opacity,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
{
return
@"

static string Unity_Blend_Exclusion(
[Slot(0, Binding.None)] DynamicDimensionVector Base,
[Slot(1, Binding.None)] DynamicDimensionVector Blend,
[Slot(2, Binding.None)] Vector1 Opacity,
[Slot(3, Binding.None)] out DynamicDimensionVector Out)
[Slot(3, Binding.None, 1, 1, 1, 1)] Vector1 Opacity,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
{
return
@"

static string Unity_Blend_HardLight(
[Slot(0, Binding.None)] DynamicDimensionVector Base,
[Slot(1, Binding.None)] DynamicDimensionVector Blend,
[Slot(2, Binding.None)] Vector1 Opacity,
[Slot(3, Binding.None)] out DynamicDimensionVector Out)
[Slot(3, Binding.None, 1, 1, 1, 1)] Vector1 Opacity,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
{precision}{slot3dimension} result1 = 1.0 - 2.0 * (1.0 - Base) * (1.0 - Blend);
{precision}{slot3dimension} result2 = 2.0 * Base * Blend;
{precision}{slot3dimension} zeroOrOne = step(Blend, 0.5);
{precision}{slot2dimension} result1 = 1.0 - 2.0 * (1.0 - Base) * (1.0 - Blend);
{precision}{slot2dimension} result2 = 2.0 * Base * Blend;
{precision}{slot2dimension} zeroOrOne = step(Blend, 0.5);
Out = result2 * zeroOrOne + (1 - zeroOrOne) * result1;
Out = lerp(Base, Out, Opacity);
}";

[Slot(0, Binding.None)] DynamicDimensionVector Base,
[Slot(1, Binding.None)] DynamicDimensionVector Blend,
[Slot(2, Binding.None)] Vector1 Opacity,
[Slot(3, Binding.None)] out DynamicDimensionVector Out)
[Slot(3, Binding.None, 1, 1, 1, 1)] Vector1 Opacity,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
{
return
@"

static string Unity_Blend_Lighten(
[Slot(0, Binding.None)] DynamicDimensionVector Base,
[Slot(1, Binding.None)] DynamicDimensionVector Blend,
[Slot(2, Binding.None)] Vector1 Opacity,
[Slot(3, Binding.None)] out DynamicDimensionVector Out)
[Slot(3, Binding.None, 1, 1, 1, 1)] Vector1 Opacity,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
{
return
@"

static string Unity_Blend_LinearBurn(
[Slot(0, Binding.None)] DynamicDimensionVector Base,
[Slot(1, Binding.None)] DynamicDimensionVector Blend,
[Slot(2, Binding.None)] Vector1 Opacity,
[Slot(3, Binding.None)] out DynamicDimensionVector Out)
[Slot(3, Binding.None, 1, 1, 1, 1)] Vector1 Opacity,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
{
return
@"

static string Unity_Blend_LinearDodge(
[Slot(0, Binding.None)] DynamicDimensionVector Base,
[Slot(1, Binding.None)] DynamicDimensionVector Blend,
[Slot(2, Binding.None)] Vector1 Opacity,
[Slot(3, Binding.None)] out DynamicDimensionVector Out)
[Slot(3, Binding.None, 1, 1, 1, 1)] Vector1 Opacity,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
{
return
@"

static string Unity_Blend_LinearLight(
[Slot(0, Binding.None)] DynamicDimensionVector Base,
[Slot(1, Binding.None)] DynamicDimensionVector Blend,
[Slot(2, Binding.None)] Vector1 Opacity,
[Slot(3, Binding.None)] out DynamicDimensionVector Out)
[Slot(3, Binding.None, 1, 1, 1, 1)] Vector1 Opacity,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
{
return
@"

static string Unity_Blend_LinearLightAddSub(
[Slot(0, Binding.None)] DynamicDimensionVector Base,
[Slot(1, Binding.None)] DynamicDimensionVector Blend,
[Slot(2, Binding.None)] Vector1 Opacity,
[Slot(3, Binding.None)] out DynamicDimensionVector Out)
[Slot(3, Binding.None, 1, 1, 1, 1)] Vector1 Opacity,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
{
return
@"

static string Unity_Blend_Multiply(
[Slot(0, Binding.None)] DynamicDimensionVector Base,
[Slot(1, Binding.None)] DynamicDimensionVector Blend,
[Slot(2, Binding.None)] Vector1 Opacity,
[Slot(3, Binding.None)] out DynamicDimensionVector Out)
[Slot(3, Binding.None, 1, 1, 1, 1)] Vector1 Opacity,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
{
return
@"

static string Unity_Blend_Negation(
[Slot(0, Binding.None)] DynamicDimensionVector Base,
[Slot(1, Binding.None)] DynamicDimensionVector Blend,
[Slot(2, Binding.None)] Vector1 Opacity,
[Slot(3, Binding.None)] out DynamicDimensionVector Out)
[Slot(3, Binding.None, 1, 1, 1, 1)] Vector1 Opacity,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
{
return
@"

static string Unity_Blend_Screen(
[Slot(0, Binding.None)] DynamicDimensionVector Base,
[Slot(1, Binding.None)] DynamicDimensionVector Blend,
[Slot(2, Binding.None)] Vector1 Opacity,
[Slot(3, Binding.None)] out DynamicDimensionVector Out)
[Slot(3, Binding.None, 1, 1, 1, 1)] Vector1 Opacity,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
{
return
@"

static string Unity_Blend_Overlay(
[Slot(0, Binding.None)] DynamicDimensionVector Base,
[Slot(1, Binding.None)] DynamicDimensionVector Blend,
[Slot(2, Binding.None)] Vector1 Opacity,
[Slot(3, Binding.None)] out DynamicDimensionVector Out)
[Slot(3, Binding.None, 1, 1, 1, 1)] Vector1 Opacity,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
{precision}{slot3dimension} result1 = 1.0 - 2.0 * (1.0 - Base) * (1.0 - Blend);
{precision}{slot3dimension} result2 = 2.0 * Base * Blend;
{precision}{slot3dimension} zeroOrOne = step(Base, 0.5);
{precision}{slot2dimension} result1 = 1.0 - 2.0 * (1.0 - Base) * (1.0 - Blend);
{precision}{slot2dimension} result2 = 2.0 * Base * Blend;
{precision}{slot2dimension} zeroOrOne = step(Base, 0.5);
Out = result2 * zeroOrOne + (1 - zeroOrOne) * result1;
Out = lerp(Base, Out, Opacity);
}

static string Unity_Blend_PinLight(
[Slot(0, Binding.None)] DynamicDimensionVector Base,
[Slot(1, Binding.None)] DynamicDimensionVector Blend,
[Slot(2, Binding.None)] Vector1 Opacity,
[Slot(3, Binding.None)] out DynamicDimensionVector Out)
[Slot(3, Binding.None, 1, 1, 1, 1)] Vector1 Opacity,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
{precision}{slot3dimension} check = step (0.5, Blend);
{precision}{slot3dimension} result1 = check * max(2.0 * (Base - 0.5), Blend);
{precision}{slot2dimension} check = step (0.5, Blend);
{precision}{slot2dimension} result1 = check * max(2.0 * (Base - 0.5), Blend);
Out = result1 + (1.0 - check) * min(2.0 * Base, Blend);
Out = lerp(Base, Out, Opacity);
}

static string Unity_Blend_SoftLight(
[Slot(0, Binding.None)] DynamicDimensionVector Base,
[Slot(1, Binding.None)] DynamicDimensionVector Blend,
[Slot(2, Binding.None)] Vector1 Opacity,
[Slot(3, Binding.None)] out DynamicDimensionVector Out)
[Slot(3, Binding.None, 1, 1, 1, 1)] Vector1 Opacity,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
{precision}{slot3dimension} result1 = 2.0 * Base * Blend + Base * Base * (1.0 - 2.0 * Blend);
{precision}{slot3dimension} result2 = sqrt(Base) * (2.0 * Blend - 1.0) + 2.0 * Base * (1.0 - Blend);
{precision}{slot3dimension} zeroOrOne = step(0.5, Blend);
{precision}{slot2dimension} result1 = 2.0 * Base * Blend + Base * Base * (1.0 - 2.0 * Blend);
{precision}{slot2dimension} result2 = sqrt(Base) * (2.0 * Blend - 1.0) + 2.0 * Base * (1.0 - Blend);
{precision}{slot2dimension} zeroOrOne = step(0.5, Blend);
Out = result2 * zeroOrOne + (1 - zeroOrOne) * result1;
Out = lerp(Base, Out, Opacity);
}

static string Unity_Blend_VividLight(
[Slot(0, Binding.None)] DynamicDimensionVector Base,
[Slot(1, Binding.None)] DynamicDimensionVector Blend,
[Slot(2, Binding.None)] Vector1 Opacity,
[Slot(3, Binding.None)] out DynamicDimensionVector Out)
[Slot(3, Binding.None, 1, 1, 1, 1)] Vector1 Opacity,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
{precision}{slot3dimension} result1 = 1.0 - (1.0 - Blend) / (2.0 * Base);
{precision}{slot3dimension} result2 = Blend / (2.0 * (1.0 - Base));
{precision}{slot3dimension} zeroOrOne = step(0.5, Base);
{precision}{slot2dimension} result1 = 1.0 - (1.0 - Blend) / (2.0 * Base);
{precision}{slot2dimension} result2 = Blend / (2.0 * (1.0 - Base));
{precision}{slot2dimension} zeroOrOne = step(0.5, Base);
Out = result2 * zeroOrOne + (1 - zeroOrOne) * result1;
Out = lerp(Base, Out, Opacity);
}

static string Unity_Blend_Subtract(
[Slot(0, Binding.None)] DynamicDimensionVector Base,
[Slot(1, Binding.None)] DynamicDimensionVector Blend,
[Slot(2, Binding.None)] Vector1 Opacity,
[Slot(3, Binding.None)] out DynamicDimensionVector Out)
[Slot(3, Binding.None, 1, 1, 1, 1)] Vector1 Opacity,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
{
return
@"

正在加载...
取消
保存