Skip to content
This repository was archived by the owner on Nov 30, 2020. It is now read-only.

Commit 94acfd2

Browse files
authored
Merge pull request #343 from slime73/v2-taa-jitter
Fix shadowmap jitter issues with TAA.
2 parents a9aa22e + b5b444d commit 94acfd2

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

PostProcessing/Runtime/Effects/TemporalAntialiasing.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,11 @@ internal void ResetHistory()
6969

7070
Vector2 GenerateRandomOffset()
7171
{
72+
// The variance between 0 and the actual halton sequence values reveals noticeable instability
73+
// in Unity's shadow maps, so we avoid index 0.
7274
var offset = new Vector2(
73-
HaltonSeq.Get(m_SampleIndex & 1023, 2),
74-
HaltonSeq.Get(m_SampleIndex & 1023, 3)
75+
HaltonSeq.Get((m_SampleIndex & 1023) + 1, 2) - 0.5f,
76+
HaltonSeq.Get((m_SampleIndex & 1023) + 1, 3) - 0.5f
7577
);
7678

7779
if (++m_SampleIndex >= k_SampleCount)

0 commit comments

Comments
 (0)