Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add non-time InterleavedGradientNoise #568

Merged
merged 1 commit into from
Sep 28, 2024
Merged
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
9 changes: 7 additions & 2 deletions package/Shaders/Common/Random.hlsli
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,20 @@ uint iqint3(uint2 x)
///////////////////////////////////////////////////////////

// Derived from the interleaved gradient function from Jimenez 2014 http://goo.gl/eomGso
float InterleavedGradientNoise(float2 pxCoord)
{
float3 magic = float3(0.06711056f, 0.00583715f, 52.9829189f);
return frac(magic.z * frac(dot(pxCoord, magic.xy)));
}

float InterleavedGradientNoise(float2 pxCoord, uint frameCount)
{
// Temporal factor
float frameStep = float(frameCount % 16) * 0.0625f;
pxCoord.x += frameStep * 4.7526;
pxCoord.y += frameStep * 3.1914;

float3 magic = float3(0.06711056f, 0.00583715f, 52.9829189f);
return frac(magic.z * frac(dot(pxCoord, magic.xy)));
return InterleavedGradientNoise(pxCoord);
}

// https://extremelearning.com.au/unreasonable-effectiveness-of-quasirandom-sequences/
Expand Down
Loading