Skip to content

Commit 62027b9

Browse files
Internal/2022.3/staging
Internal/2022.3/staging
2 parents 4b2ab16 + 0214b75 commit 62027b9

File tree

10 files changed

+205
-95
lines changed

10 files changed

+205
-95
lines changed
13.2 KB
Loading

Packages/com.unity.render-pipelines.universal/Editor/2D/Resources/InspectorIcons/PointLight.png.meta

Lines changed: 132 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Packages/com.unity.render-pipelines.universal/Runtime/2D/Passes/Utility/RendererLighting.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ internal static class RendererLighting
5959
private static readonly int k_LightInvMatrixID = Shader.PropertyToID("_LightInvMatrix");
6060
private static readonly int k_InnerRadiusMultID = Shader.PropertyToID("_InnerRadiusMult");
6161
private static readonly int k_OuterAngleID = Shader.PropertyToID("_OuterAngle");
62-
private static readonly int k_InnerAngleMultID = Shader.PropertyToID("_InnerAngleMult");
62+
private static readonly int k_InnerAngleID = Shader.PropertyToID("_InnerAngle");
6363
private static readonly int k_LightLookupID = Shader.PropertyToID("_LightLookup");
6464
private static readonly int k_IsFullSpotlightID = Shader.PropertyToID("_IsFullSpotlight");
6565
private static readonly int k_LightZDistanceID = Shader.PropertyToID("_LightZDistance");
@@ -486,7 +486,7 @@ private static void SetPointLightShaderGlobals(IRenderPass2D pass, CommandBuffer
486486
cmd.SetGlobalMatrix(k_LightInvMatrixID, lightInverseMatrix);
487487
cmd.SetGlobalFloat(k_InnerRadiusMultID, innerRadiusMult);
488488
cmd.SetGlobalFloat(k_OuterAngleID, outerAngle);
489-
cmd.SetGlobalFloat(k_InnerAngleMultID, 1 / (outerAngle - innerAngle));
489+
cmd.SetGlobalFloat(k_InnerAngleID, innerAngle);
490490
cmd.SetGlobalTexture(k_LightLookupID, Light2DLookupTexture.GetLightLookupTexture());
491491
cmd.SetGlobalTexture(k_FalloffLookupID, pass.rendererData.fallOffLookup);
492492
cmd.SetGlobalFloat(k_FalloffIntensityID, light.falloffIntensity);

Packages/com.unity.render-pipelines.universal/Shaders/2D/Light2D-Point-Volumetric.shader

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Shader "Hidden/Light2d-Point-Volumetric"
5353
float4x4 _LightNoRotInvMatrix;
5454
half _LightZDistance;
5555
half _OuterAngle; // 1-0 where 1 is the value at 0 degrees and 1 is the value at 180 degrees
56-
half _InnerAngleMult; // 1-0 where 1 is the value at 0 degrees and 1 is the value at 180 degrees
56+
half _InnerAngle; // 1-0 where 1 is the value at 0 degrees and 1 is the value at 180 degrees
5757
half _InnerRadiusMult; // 1-0 where 1 is the value at the center and 0 is the value at the outer radius
5858
half _InverseHDREmulationScale;
5959
half _IsFullSpotlight;
@@ -88,7 +88,7 @@ Shader "Hidden/Light2d-Point-Volumetric"
8888
half attenuation = saturate(_InnerRadiusMult * lookupValue.r); // This is the code to take care of our inner radius
8989

9090
// Spotlight
91-
half spotAttenuation = saturate((_OuterAngle - lookupValue.g + _IsFullSpotlight) * _InnerAngleMult);
91+
half spotAttenuation = saturate((_OuterAngle - lookupValue.g + _IsFullSpotlight) * (1.0f / (_OuterAngle - _InnerAngle)));
9292
attenuation = attenuation * spotAttenuation;
9393

9494
half2 mappedUV;

Packages/com.unity.render-pipelines.universal/Shaders/2D/Light2D-Point.shader

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Shader "Hidden/Light2D-Point"
6363
float4x4 _LightInvMatrix;
6464
float4x4 _LightNoRotInvMatrix;
6565
half _OuterAngle; // 1-0 where 1 is the value at 0 degrees and 1 is the value at 180 degrees
66-
half _InnerAngleMult; // 1-0 where 1 is the value at 0 degrees and 1 is the value at 180 degrees
66+
half _InnerAngle; // 1-0 where 1 is the value at 0 degrees and 1 is the value at 180 degrees
6767
half _InnerRadiusMult; // 1-0 where 1 is the value at the center and 0 is the value at the outer radius
6868
half _InverseHDREmulationScale;
6969
half _IsFullSpotlight;
@@ -97,7 +97,7 @@ Shader "Hidden/Light2D-Point"
9797
half attenuation = saturate(_InnerRadiusMult * lookupValue.r); // This is the code to take care of our inner radius
9898

9999
// Spotlight
100-
half spotAttenuation = saturate((_OuterAngle - lookupValue.g + _IsFullSpotlight) * _InnerAngleMult);
100+
half spotAttenuation = saturate((_OuterAngle - lookupValue.g + _IsFullSpotlight) * (1.0f / (_OuterAngle - _InnerAngle)));
101101
attenuation = attenuation * spotAttenuation;
102102

103103
half2 mappedUV;
Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,21 @@
1-
# Position Node
1+
# Position node
22

3-
## Description
4-
5-
Provides access to the mesh vertex's or fragment's **Position**, depending on the effective [Shader Stage](Shader-Stage.md) of the graph section that the [Node](Node.md) is part of. Use the **Space** drop-down parameter to select the coordinate space of the output value.
3+
The Position node returns the position of a vertex or fragment of a mesh.
64

75
## Ports
86

9-
| Name | Direction | Type | Binding | Description |
7+
| **Name** | **Direction** | **Type** | **Binding** | **Description** |
108
|:------------ |:-------------|:-----|:---|:---|
11-
| Out | Output | Vector 3 | None | **Position** for the Mesh Vertex/Fragment. |
12-
13-
## Controls
14-
15-
| Name | Type | Options | Description |
16-
|:------------ |:-------------|:-----|:---|
17-
| Space | Dropdown | Object, View, World, Tangent, Absolute World | Selects the coordinate space of **Position** to output. |
18-
19-
## World and Absolute World
20-
The Position Node provides drop-down options for both **World** and **Absolute World** space positions. The **Absolute World** option always returns the absolute world position of the object in the Scene for all Scriptable Render Pipelines. The **World** option returns the default world space of the selected Scriptable Render Pipeline.
21-
22-
The [High Definition Render Pipeline](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest/index.html) uses [Camera Relative](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest?preview=1&subfolder=/manual/Camera-Relative-Rendering.html) as its default world space.
9+
| **Out** | Output | Vector 3 | None | Position of the vertex or fragment of the mesh, depending on the [shader stage](Shader-Stage.md) of the graph section. |
2310

24-
The [Universal Render Pipeline](https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@latest/index.html) uses **Absolute World** as its default world space.
11+
## Space
2512

26-
### Upgrading from previous versions
27-
If you use a Position Node in **World** space on a graph authored in Shader Graph version 6.7.0 or earlier, it automatically upgrades the selection to **Absolute World**. This ensures that the calculations on your graph remain accurate to your expectations, since the **World** output might change.
13+
The **Space** dropdown determines the coordinate space of the output position.
2814

29-
If you use a Position Node in **World** space in the High Definition Render Pipeline to manually calculate [Camera Relative](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest?preview=1&subfolder=/manual/Camera-Relative-Rendering.html) world space, you can now change your node from **Absolute World** to **World**, which lets you use [Camera Relative](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest?preview=1&subfolder=/manual/Camera-Relative-Rendering.html) world space out of the box.
15+
| **Options** | **Description** |
16+
|-|-|
17+
| **Object** | Returns the vertex or fragment position relative to the origin of the object. |
18+
| **View** | Returns the vertex or fragment position relative to the camera, in meters. |
19+
| **World** | Returns the vertex or fragment position in the world, in meters. If you use the High Definition Render Pipeline (HDRP), **World** returns the position [relative to the camera](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest?preview=1&subfolder=/manual/Camera-Relative-Rendering.html). |
20+
| **Tangent** | Returns the vertex or fragment position relative to the tangent of the surface, in meters. For more information, refer to [Normal maps](https://docs.unity3d.com/6000.3/Documentation/Manual/StandardShaderMaterialParameterNormalMapLanding.html). |
21+
| **Absolute World**| Returns the vertex or fragment position in the world, in meters. |
Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
1-
# Remap Node
1+
# Remap node
22

3-
## Description
4-
5-
Returns a value between the x and y components of input **Out Min Max** based on the linear interpolation of the value of input **In** between the x and y components of input **In Min Max**.
3+
The Remap node converts a value from one range to another, which is also known as linear interpolation. For example, you can use the node to convert a value in the range 0 to 1 to the equivalent value in the range 0 to 100.
64

75
## Ports
86

9-
| Name | Direction | Type | Description |
7+
| **Name** | **Direction** | **Type** | **Description** |
108
|:------------ |:-------------|:-----|:---|
11-
| In | Input | Dynamic Vector | Input value |
12-
| In Min Max | Input | Vector 2 | Minimum and Maximum values for input interpolation |
13-
| Out Min Max | Input | Vector 2 | Minimum and Maximum values for output interpolation |
14-
| Out | Output | Dynamic Vector | Output value |
9+
| **In** | Input | Dynamic Vector | The value to convert. |
10+
| **In Min Max** | Input | Vector 2 | The original minimum and maximum range of **In**. |
11+
| **Out Min Max** | Input | Vector 2 | The new minimum and maximum range to use to interpolate **In**. |
12+
| **Out** | Output | Dynamic Vector | The converted value. |
1513

16-
## Generated Code Example
14+
## Generated code example
1715

1816
The following example code represents one possible outcome of this node.
1917

@@ -22,4 +20,4 @@ void Unity_Remap_float4(float4 In, float2 InMinMax, float2 OutMinMax, out float4
2220
{
2321
Out = OutMinMax.x + (In - InMinMax.x) * (OutMinMax.y - OutMinMax.x) / (InMinMax.y - InMinMax.x);
2422
}
25-
```
23+
```

0 commit comments

Comments
 (0)