diff --git a/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.VirtualOffset.cs b/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.VirtualOffset.cs index 9f9204c4e78..e4cd84ad2d4 100644 --- a/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.VirtualOffset.cs +++ b/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.VirtualOffset.cs @@ -109,7 +109,7 @@ public override void Initialize(ProbeVolumeBakingSet bakingSet, NativeArray DOT_THRESHOLD) + float distanceDiff = hit.hitDistance - minDist; + if (distanceDiff < DISTANCE_THRESHOLD) { - outDirection = ray.direction; - maxDotSurface = dotSurface; - minDist = hit.hitDistance; + UnifiedRT::HitGeomAttributes attributes = UnifiedRT::FetchHitGeomAttributes(hit, UnifiedRT::kGeomAttribFaceNormal); + float dotSurface = dot(ray.direction, attributes.faceNormal); + + // If new distance is smaller by at least kDistanceThreshold, or if ray is at least DOT_THRESHOLD more colinear with normal + if (distanceDiff < -DISTANCE_THRESHOLD || dotSurface - maxDotSurface > DOT_THRESHOLD) + { + outDirection = ray.direction; + maxDotSurface = dotSurface; + minDist = hit.hitDistance; + } } } } diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitProperties.hlsl b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitProperties.hlsl index 6ad0723ef7a..2c17ee4f896 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitProperties.hlsl +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitProperties.hlsl @@ -85,6 +85,7 @@ SAMPLER(sampler_CoatMaskMap); PROP_DECL_TEX2D(_BaseColorMap); PROP_DECL_TEX2D(_MaskMap); PROP_DECL_TEX2D(_BentNormalMap); +PROP_DECL_TEX2D(_BentNormalMapOS); PROP_DECL_TEX2D(_NormalMap); PROP_DECL_TEX2D(_NormalMapOS); PROP_DECL_TEX2D(_DetailMap); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Shadows/ShadowCaster2D.cs b/Packages/com.unity.render-pipelines.universal/Runtime/2D/Shadows/ShadowCaster2D.cs index 6f106123cad..49a28118859 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Shadows/ShadowCaster2D.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/2D/Shadows/ShadowCaster2D.cs @@ -274,9 +274,9 @@ internal bool IsLit(Light2D light) { // Oddly adding and subtracting vectors is expensive here because of the new structures created... Vector3 deltaPos; - deltaPos.x = light.m_CachedPosition.x - boundingSphere.position.x; - deltaPos.y = light.m_CachedPosition.y - boundingSphere.position.y; - deltaPos.z = light.m_CachedPosition.z - boundingSphere.position.z; + deltaPos.x = light.boundingSphere.position.x - boundingSphere.position.x; + deltaPos.y = light.boundingSphere.position.y - boundingSphere.position.y; + deltaPos.z = light.boundingSphere.position.z - boundingSphere.position.z; float distanceSq = Vector3.SqrMagnitude(deltaPos); diff --git a/Packages/com.unity.shadergraph/Documentation~/Lerp-Node.md b/Packages/com.unity.shadergraph/Documentation~/Lerp-Node.md index 90009c2d2f8..47de1677e45 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Lerp-Node.md +++ b/Packages/com.unity.shadergraph/Documentation~/Lerp-Node.md @@ -4,20 +4,26 @@ Returns the result of linearly interpolating between input **A** and input **B** by input **T**. -The output is calculated as `A + T * (B - A)`. The value of input **T** acts as a weight factor applied to the difference between **B** and **A**: +Unity calculates the output as: + +A + T × (B − A) + +The value of input **T** acts as a weight factor applied to the difference between **B** and **A**: - When **T** is `0`, the output equals **A**. - When **T** is `1`, the output equals **B**. - When **T** is `0.5`, the output is the midpoint between **A** and **B**. +The Lerp node uses Dynamic Vector slots, so **A**, **B**, and **T** always resolve to the same component count, which matches the smallest connected vector (larger vectors truncate). Scalars promote to the resolved size by duplicating their value across components. + ## Ports | Name | Direction | Type | Description | |:-----|:----------|:---------------|:------------| -| A | Input | Dynamic Vector | First input value | -| B | Input | Dynamic Vector | Second input value | -| T | Input | Dynamic Vector | Time value. Typical range: 0 to 1. Though you can use values outside of this range they may cause unpredictable results. | -| Out | Output | Dynamic Vector | Output value | +| **A** | Input | Dynamic Vector | First input value | +| **B** | Input | Dynamic Vector | Second input value | +| **T** | Input | Dynamic Vector | Time value. Typical range: 0 to 1. Though you can use values outside of this range they may cause unpredictable results. | +| **Out** | Output | Dynamic Vector | Output value | ## Generated Code Example diff --git a/Packages/com.unity.shadergraph/Documentation~/Node.md b/Packages/com.unity.shadergraph/Documentation~/Node.md index 7ccb65f58a9..8fde6148615 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Node.md +++ b/Packages/com.unity.shadergraph/Documentation~/Node.md @@ -40,3 +40,5 @@ Right clicking on a **Node** will open a context menu. This menu contains many o **Nodes** interact with the Shader Graph Window's Color Modes. Colors are displayed on nodes underneath the text on the node title bar. See [Color Modes](Color-Modes.md) for more information on available colors for nodes. + +Unity applies each component of T as a weight factor to each component to A and B. If T has fewer components than A and B, Unity casts T to the required number of components. Unity copies the values of the original components of T to the added components. diff --git a/Packages/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs b/Packages/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs index 3a36953672f..8051b08f335 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs @@ -1477,6 +1477,7 @@ private VFXGraphCompiledData compiledData [SerializeField] private int m_ResourceVersion; + [NonSerialized] private bool m_GraphSanitized = false; private bool m_ExpressionGraphDirty = true; private bool m_ExpressionValuesDirty = true;