浏览代码

Small Node Fixes (#1670)

* unroll simple noise loop and add overwrite blend mode to blend node
* updated changelog
* fixed polygon node caluclations
* put overwrite blend mode at the end of the enum
* updates to changelog
* fixing z calculation on normal strength node
/main
Matt Dean 6 年前
当前提交
91d80f85
共有 6 个文件被更改,包括 38 次插入11 次删除
  1. 4
      com.unity.shadergraph/CHANGELOG.md
  2. 3
      com.unity.shadergraph/Editor/Data/Nodes/Artistic/Blend/BlendMode.cs
  3. 13
      com.unity.shadergraph/Editor/Data/Nodes/Artistic/Blend/BlendNode.cs
  4. 2
      com.unity.shadergraph/Editor/Data/Nodes/Artistic/Normal/NormalStrengthNode.cs
  5. 19
      com.unity.shadergraph/Editor/Data/Nodes/Procedural/Noise/SimpleNoiseNode.cs
  6. 8
      com.unity.shadergraph/Editor/Data/Nodes/Procedural/Shape/PolygonNode.cs

4
com.unity.shadergraph/CHANGELOG.md


- Texture 2D Array and Texture 3D nodes can no longer be used in the vertex shader.
- Shader graphs using alpha clip now generate correct depth and shadow passes.
- `Normal Create` node has been renamed to `Normal From Texture`.
- `Blend` node now supports Overwrite mode.
- `Simple Noise` node no longer has a loop.
- The `Polygon` node now calculates radius based on apothem.
- `Normal Strength` node now calculates Z value more accurately.

3
com.unity.shadergraph/Editor/Data/Nodes/Artistic/Blend/BlendMode.cs


Screen,
SoftLight,
Subtract,
VividLight
VividLight,
Overwrite
}
}

13
com.unity.shadergraph/Editor/Data/Nodes/Artistic/Blend/BlendNode.cs


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

2
com.unity.shadergraph/Editor/Data/Nodes/Artistic/Normal/NormalStrengthNode.cs


return
@"
{
Out = {precision}3(In.rg * Strength, In.b);
Out = {precision}3(In.rg * Strength, lerp(1, In.b, saturate(Strength)));
}
";
}

19
com.unity.shadergraph/Editor/Data/Nodes/Procedural/Noise/SimpleNoiseNode.cs


@"
{
float t = 0.0;
for(int i = 0; i < 3; i++)
{
float freq = pow(2.0, float(i));
float amp = pow(0.5, float(3-i));
t += unity_valueNoise(float2(UV.x*Scale/freq, UV.y*Scale/freq))*amp;
}
float freq = pow(2.0, float(0));
float amp = pow(0.5, float(3-0));
t += unity_valueNoise(float2(UV.x*Scale/freq, UV.y*Scale/freq))*amp;
freq = pow(2.0, float(1));
amp = pow(0.5, float(3-1));
t += unity_valueNoise(float2(UV.x*Scale/freq, UV.y*Scale/freq))*amp;
freq = pow(2.0, float(2));
amp = pow(0.5, float(3-2));
t += unity_valueNoise(float2(UV.x*Scale/freq, UV.y*Scale/freq))*amp;
Out = t;
}
";

8
com.unity.shadergraph/Editor/Data/Nodes/Procedural/Shape/PolygonNode.cs


return
@"
{
{precision} tau = 6.28318530718;
{precision}2 uv = (UV * 2 - 1) / {precision}2(Width, Height);
{precision} pi = 3.14159265359;
{precision} aWidth = Width * cos(pi / Sides);
{precision} aHeight = Height * cos(pi / Sides);
{precision}2 uv = (UV * 2 - 1) / {precision}2(aWidth, aHeight);
{precision} r = tau / Sides;
{precision} r = 2 * pi / Sides;
{precision} distance = cos(floor(0.5 + pCoord / r) * r - pCoord) * length(uv);
Out = saturate((1 - distance) / fwidth(distance));
}

正在加载...
取消
保存