浏览代码

Fix to RandomRangeNode

- Changed the seed input format from Vector1 to Vector2.
- Changed the way of applying Min/Max.
/main
Keijiro Takahashi 7 年前
当前提交
39a5af4a
共有 1 个文件被更改,包括 4 次插入3 次删除
  1. 7
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Range/RandomRangeNode.cs

7
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Range/RandomRangeNode.cs


using UnityEngine;
using System.Reflection;
namespace UnityEditor.ShaderGraph

}
static string Unity_RandomRange(
[Slot(0, Binding.None)] Vector1 Seed,
[Slot(0, Binding.None)] Vector2 Seed,
[Slot(1, Binding.None)] Vector1 Min,
[Slot(2, Binding.None, 1, 1, 1, 1)] Vector1 Max,
[Slot(3, Binding.None)] out Vector1 Out)

{
{precision} randomno = frac(sin(dot({precision}2(Seed, Seed), float2(12.9898, 78.233)))*43758.5453);
Out = floor(randomno * (Max - Min + 1)) + Min;
{precision} randomno = frac(sin(dot(Seed, float2(12.9898, 78.233)))*43758.5453);
Out = lerp(Min, Max, randomno);
}";
}
}
正在加载...
取消
保存