浏览代码

Revert "added sphere mask node"

This reverts commit 8e71abaf5cc697787f4dc4c4e2c6d59eeb30d093.
/main
Alex Lindman 7 年前
当前提交
37dd4a52
共有 4 个文件被更改,包括 0 次插入58 次删除
  1. 5
      com.unity.shadergraph/CHANGELOG.md
  2. 3
      com.unity.shadergraph/.data/sphereMask.PNG
  3. 39
      com.unity.shadergraph/Editor/Data/Nodes/Math/Vector/SphereMaskNode.cs
  4. 11
      com.unity.shadergraph/Editor/Data/Nodes/Math/Vector/SphereMaskNode.cs.meta

5
com.unity.shadergraph/CHANGELOG.md


This adds gradient functionality via two new nodes. The Sample Gradient node samples a gradient given a Time parameter. You can define this gradient on the Gradient slot control view. The Gradient Asset node defines a gradient that can be sampled by multiple Sample Gradient nodes using different Time parameters.
### Sphere Mask Node
![](.data/sphereMask.png)
This adds sphere mask functionality via one new node. Given a starting coordinate and center point, you can create a sphere mask using the Radius and Hardness parameters. Will function in 2d or 3d space, based on the vector coordinates given in the Coords and Center input.
### Show generated code

3
com.unity.shadergraph/.data/sphereMask.PNG


version https://git-lfs.github.com/spec/v1
oid sha256:8df3a610b0b2a3f8d3b6a2b9ddb563c3a74e682055b53bc728ac7f795870d9ad
size 91474

39
com.unity.shadergraph/Editor/Data/Nodes/Math/Vector/SphereMaskNode.cs


using System.Reflection;
using UnityEngine;
namespace UnityEditor.ShaderGraph
{
[Title("Math", "Vector", "Sphere Mask")]
public class SphereMaskNode : CodeFunctionNode
{
public SphereMaskNode()
{
name = "Sphere Mask";
}
public override string documentationURL
{
get { return "https://github.com/Unity-Technologies/ShaderGraph/wiki/Sphere-Mask-Node"; }
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("SphereMask", BindingFlags.Static | BindingFlags.NonPublic);
}
static string SphereMask(
[Slot(0, Binding.None)] DynamicDimensionVector Coords,
[Slot(1, Binding.None, 0.5f, 0.5f, 0.5f, 0.5f)] DynamicDimensionVector Center,
[Slot(2, Binding.None, 0.1f, 0.1f, 0.1f, 0.1f)] Vector1 Radius,
[Slot(3, Binding.None, 0.8f, 0.8f, 0.8f, 0.8f)] Vector1 Hardness,
[Slot(4, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
Out = 1 - saturate((distance(Coords, Center) - Radius) / (1 - Hardness));
}
";
}
}
}

11
com.unity.shadergraph/Editor/Data/Nodes/Math/Vector/SphereMaskNode.cs.meta


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