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
Expand Up @@ -109,7 +109,7 @@ public override void Initialize(ProbeVolumeBakingSet bakingSet, NativeArray<Vect
batchResult = new Vector3[k_MaxProbeCountPerBatch];

var computeBufferTarget = GraphicsBuffer.Target.CopyDestination | GraphicsBuffer.Target.CopySource
| GraphicsBuffer.Target.Structured | GraphicsBuffer.Target.Raw;
| GraphicsBuffer.Target.Structured;

// Create acceletation structure
m_AccelerationStructure = BuildAccelerationStructure(voSettings.collisionMask);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,21 +87,22 @@ void RayGenExecute(UnifiedRT::DispatchInfo dispatchInfo)
if (!hit.IsValid() || hit.isFrontFace)
{
validHits++;
continue;
}

float distanceDiff = hit.hitDistance - minDist;
if (distanceDiff < DISTANCE_THRESHOLD)
else if (hit.IsValid())
{
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)
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;
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
16 changes: 11 additions & 5 deletions Packages/com.unity.shadergraph/Documentation~/Lerp-Node.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 &times; (B &minus; 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

Expand Down
2 changes: 2 additions & 0 deletions Packages/com.unity.shadergraph/Documentation~/Node.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

<image>

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.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading