Looking to implement a fragment shader within a WebGPU application to generate a black and white image noise effect. For more information on white noise, you can refer to White noise (wikipedia).
The goal is for each pixel to have a random color value. I've attempted the following approach:
[[stage(fragment)]]
fn main() -> [[location(0)]] vec4<f32> {
let color: f32 = random();
return vec4<f32>(color, color, color, 1.0);
}
However, it seems that WGSL does not offer a built-in function to generate random numbers, as indicated in the specifications. Is there a workaround or alternative method to incorporate random number generation within the fragment shader for each fragment?