Created
February 12, 2023 19:16
-
-
Save nickludlam/477fe527e4cfb0f4bd00245da235e6d8 to your computer and use it in GitHub Desktop.
Function to sample a blue noise texture for use with each screen pixel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Requires NDC from GetVertexPositionInputs() in the vert shader | |
float2 GetNoiseUV(float2 positionNDC) { | |
float2 blueTexSizeMultiplier = _BlueNoise_TexelSize.xy; // i.e. 1/32 | |
float2 screenWidthHeight = _ScreenParams.xy + float2(0.5, 0.5); // i.e. 1920,1080 + half to center | |
return screenWidthHeight * blueTexSizeMultiplier * positionNDC; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment