Set up your OpenGL program to provide position, normal, and texture coordinates to the shader. Make sure that you pass the texture coordinate along to the fragment shader. Set up any uniforms needed to implement the shading model of your choice.
Create a seamless noise texture (see Creating a seamless noise texture), and place it in the appropriate texture channel.
The following uniforms are defined in the fragment shader, and should be set via the OpenGL program:
- NoiseTex: The noise texture
- LowThreshold: Fragments are discarded if the noise value is below this value
- HighThreshold: Fragments are discarded if the noise value is above this value