Skip to content

Commit b881bd6

Browse files
authored
Merge pull request #8114 from Unity-Technologies/internal/2021.3/staging
Internal/2021.3/staging
2 parents 3d53173 + 4f918c9 commit b881bd6

File tree

21 files changed

+675
-11
lines changed

21 files changed

+675
-11
lines changed

Packages/com.unity.render-pipelines.core/Documentation~/custom-material-inspector.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Custom Material Inspectors enable you to define how Unity displays properties in
66

77
The implementation for custom Material Inspectors differs between URP and HDRP. For example, for compatibility purposes, every custom Material Inspector in HDRP must inherit from `HDShaderGUI` which does not exist in URP. For information on how to create custom Material Inspectors for the respective render pipelines, see:
88

9-
- **HDRP**: [HDRP custom Material Inspectors](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest?subfolder=/manual/hdrp-custom-material-inspector.html).
9+
- **HDRP**: [HDRP custom Material Inspectors](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest?subfolder=/manual/custom-material-inspectors.html).
1010
- **URP**: [Unity Custom Shader GUI](https://docs.unity3d.com/Manual/SL-CustomShaderGUI.html).
1111

1212
## Assigning a custom Material Inspector

Packages/com.unity.render-pipelines.core/Documentation~/render-graph-writing-a-render-pipeline.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class MyRenderPipeline : RenderPipeline
1515

1616
void InitializeRenderGraph()
1717
{
18-
m_RenderGraph = new RenderGraph(MyRenderGraph);
18+
m_RenderGraph = new RenderGraph("MyRenderGraph");
1919
}
2020

2121
void CleanupRenderGraph()

Packages/com.unity.render-pipelines.high-definition/Documentation~/Frame-Settings-API.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Finally, access the Frame Settings structure itself. This controls the actual va
4444
- **Camera**: `HDAdditionalCameraData.renderingPathCustomFrameSettings`
4545
- **Reflection Probe**: `HDAdditionalReflectionData.frameSettings`
4646

47-
For information on the API available for `FrameSettings`, including how to edit the value of a Frame Setting, see [FrameSettings Scripting API](framesettings-scripting-api).
47+
For information on the API available for `FrameSettings`, including how to edit the value of a Frame Setting, see [FrameSettings Scripting API](#framesettings-scripting-api).
4848

4949
## Frame Setting enumerations
5050

Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Hair/Hair.hlsl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -601,8 +601,9 @@ void GetHairAngleLocal(float3 wo, float3 wi, inout HairAngle angles)
601601

602602
void GetHairAngleWorld(float3 V, float3 L, float3 T, inout HairAngle angles)
603603
{
604-
angles.sinThetaO = dot(T, V);
605-
angles.sinThetaI = dot(T, L);
604+
// It might exceed the range [-1, 1], so explicitly clamp here to prevent nan output from FastASin.
605+
angles.sinThetaO = clamp(dot(T, V), -1.0, 1.0);
606+
angles.sinThetaI = clamp(dot(T, L), -1.0, 1.0);
606607

607608
float thetaO = FastASin(angles.sinThetaO);
608609
float thetaI = FastASin(angles.sinThetaI);

Packages/com.unity.render-pipelines.universal/Documentation~/renderer-features/scriptable-renderer-features/inject-a-pass-using-a-scriptable-renderer-feature.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ This section uses the example `RedTintRenderPass` Scriptable Render Pass from th
9999
material = CoreUtils.CreateEngineMaterial(shader);
100100
redTintRenderPass = new RedTintRenderPass(material);
101101

102-
renderPassEvent = RenderPassEvent.AfterRenderingSkybox;
102+
redTintRenderPass.renderPassEvent = RenderPassEvent.AfterRenderingSkybox;
103103
}
104104
```
105105

Packages/com.unity.render-pipelines.universal/Editor/LightExplorer.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ protected override LightingExplorerTableColumn[] GetReflectionProbeColumns()
4747
new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Enum, Styles.Resolution, "m_Resolution", 100, (r, prop, dep) =>
4848
{
4949
EditorGUI.IntPopup(r, prop, Styles.ReflectionProbeSizeTitles, Styles.ReflectionProbeSizeValues, GUIContent.none);
50+
},
51+
(lhs, rhs) =>
52+
{
53+
return lhs.intValue.CompareTo(rhs.intValue);
5054
}), // 4: Probe Resolution
5155
new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Float, Styles.ShadowDistance, "m_ShadowDistance", 100), // 5: Shadow Distance
5256
new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Float, Styles.NearPlane, "m_NearClip", 70), // 6: Near Plane

Packages/com.unity.shadergraph/Editor/Data/Graphs/GroupData.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace UnityEditor.ShaderGraph
66
{
77
[Serializable]
8-
public class GroupData : JsonObject
8+
public class GroupData : JsonObject, IRectInterface
99
{
1010
[SerializeField]
1111
string m_Title;
@@ -16,6 +16,7 @@ public string title
1616
set { m_Title = value; }
1717
}
1818

19+
1920
[SerializeField]
2021
Vector2 m_Position;
2122

@@ -25,6 +26,16 @@ public Vector2 position
2526
set { m_Position = value; }
2627
}
2728

29+
Rect IRectInterface.rect
30+
{
31+
get => new Rect(position, Vector2.one);
32+
set
33+
{
34+
position = value.position;
35+
}
36+
}
37+
38+
2839
public GroupData() : base() { }
2940

3041
public GroupData(string title, Vector2 position)

Packages/com.unity.shadergraph/Editor/Data/Nodes/Artistic/Normal/NormalFromTextureNode.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ public void GenerateNodeFunction(FunctionRegistry registry, GenerationMode gener
8484
s.AppendLine("$precision2 offsetU = $precision2(UV.x + Offset, UV.y);");
8585
s.AppendLine("$precision2 offsetV = $precision2(UV.x, UV.y + Offset);");
8686

87-
s.AppendLine("$precision normalSample = SAMPLE_TEXTURE2D(Texture, Sampler, UV);");
88-
s.AppendLine("$precision uSample = SAMPLE_TEXTURE2D(Texture, Sampler, offsetU);");
89-
s.AppendLine("$precision vSample = SAMPLE_TEXTURE2D(Texture, Sampler, offsetV);");
87+
s.AppendLine("$precision normalSample = SAMPLE_TEXTURE2D(Texture, Sampler, UV).r;");
88+
s.AppendLine("$precision uSample = SAMPLE_TEXTURE2D(Texture, Sampler, offsetU).r;");
89+
s.AppendLine("$precision vSample = SAMPLE_TEXTURE2D(Texture, Sampler, offsetV).r;");
9090

9191
s.AppendLine("$precision3 va = $precision3(1, 0, (uSample - normalSample) * Strength);");
9292
s.AppendLine("$precision3 vb = $precision3(0, 1, (vSample - normalSample) * Strength);");

Packages/com.unity.shadergraph/Editor/Drawing/Views/MaterialGraphView.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1478,7 +1478,12 @@ internal static void InsertCopyPasteGraph(this MaterialGraphView graphView, Copy
14781478
{
14791479
var nodeList = copyGraph.GetNodes<AbstractMaterialNode>();
14801480

1481-
ClampNodesWithinView(graphView, new List<IRectInterface>().Union(nodeList).Union(copyGraph.stickyNotes));
1481+
ClampNodesWithinView(graphView,
1482+
new List<IRectInterface>()
1483+
.Union(nodeList)
1484+
.Union(copyGraph.stickyNotes)
1485+
.Union(copyGraph.groups)
1486+
);
14821487

14831488
graphView.graph.PasteGraph(copyGraph, remappedNodes, remappedEdges);
14841489

Packages/com.unity.shadergraph/Editor/Drawing/Views/ShaderGroup.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,13 @@ public override bool AcceptsElement(GraphElement element, ref string reasonWhyNo
5353

5454
return true;
5555
}
56+
57+
protected override void SetScopePositionOnly(Rect newPos)
58+
{
59+
base.SetScopePositionOnly(newPos);
60+
61+
userData.position = newPos.position;
62+
}
63+
5664
}
5765
}

0 commit comments

Comments
 (0)