Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Linq;
using UnityEditor.Graphing;
using UnityEditor.ShaderGraph.Drawing.Controls;
using UnityEditor.ShaderGraph.Internal;
Expand Down Expand Up @@ -138,10 +139,7 @@ public NeededCoordinateSpace RequiresNormal(ShaderStageCapability stageCapabilit

public NeededTransform[] RequiresTransform(ShaderStageCapability stageCapability)
{
return new[]
{
new NeededTransform(conversion.from.ToNeededCoordinateSpace(), conversion.to.ToNeededCoordinateSpace())
};
return spaceTransform.RequiresTransform.ToArray();
}

NeededCoordinateSpace IMayRequirePosition.RequiresPosition(ShaderStageCapability stageCapability)
Expand Down
18 changes: 18 additions & 0 deletions com.unity.shadergraph/Editor/Data/Util/SpaceTransformUtil.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// using System;
using System.Collections.Generic;
using UnityEditor.ShaderGraph.Internal;

namespace UnityEditor.ShaderGraph
Expand Down Expand Up @@ -49,6 +50,9 @@ internal string NormalizeString()
public NeededCoordinateSpace RequiresPosition =>
((type == ConversionType.Position) && ((from == CoordinateSpace.Tangent) || (to == CoordinateSpace.Tangent)) && (from != to)) ?
NeededCoordinateSpace.World : NeededCoordinateSpace.None;

public IEnumerable<NeededTransform> RequiresTransform =>
SpaceTransformUtil.ComputeTransformRequirement(this);
};

static class SpaceTransformUtil
Expand Down Expand Up @@ -371,6 +375,20 @@ public static void AbsoluteWorldToWorld(SpaceTransform xform, string inputValue,
}
};

internal static IEnumerable<NeededTransform> ComputeTransformRequirement(SpaceTransform xform)
{
var func = k_TransformFunctions[(int)xform.from, (int)xform.to];
if (func == ViaWorld || func == ObjectToAbsoluteWorld)
{
yield return new NeededTransform(xform.from.ToNeededCoordinateSpace(), NeededCoordinateSpace.World);
yield return new NeededTransform(NeededCoordinateSpace.World, xform.to.ToNeededCoordinateSpace());
}
else
{
yield return new NeededTransform(xform.from.ToNeededCoordinateSpace(), xform.to.ToNeededCoordinateSpace());
}
}

public static void GenerateTransformCodeStatement(SpaceTransform xform, string inputValue, string outputVariable, ShaderStringBuilder sb)
{
var func = k_TransformFunctions[(int)xform.from, (int)xform.to];
Expand Down
4 changes: 1 addition & 3 deletions com.unity.visualeffectgraph/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Some operators were missing in node search window (gradient for instance)

## [13.1.5] - 2021-12-17

### Fixed
- Enable/disable state of VFX blocks and operators are preserved after copy/paste
- Incorrect behavior of Tangent Space in ShaderGraph [Case 1363279](https://issuetracker.unity3d.com/product/unity/issues/guid/1363279/)

## [13.1.4] - 2021-12-04

### Fixed
- Enable/disable state of VFX blocks and operators are preserved after copy/paste

## [13.1.3] - 2021-11-17

### Fixed
- Gradient field doesn't support HDR values [Case 1381867](https://issuetracker.unity3d.com/product/unity/issues/guid/1381867/)
- Allows for attribute-less systems. [Case 1341789](https://issuetracker.unity3d.com/product/unity/issues/guid/1341789/)
Expand Down