Why GLSL noise only produces a black color?

Started by
3 comments, last by jusa 13 years, 12 months ago
I have a noob problem with GLSL where I can't seem to figure out why the pixel shader below only renders a black rectangle. I was expecting that it would draw a random-colored one instead. I figured the black color could result from the fact that the noise functions may return a negative value but even using abs() on them doesn't help.

#version 150

out vec4 pixel_color;

void main() {
    float r = abs(noise1(1.0));
    float g = abs(noise1(2.0));
    float b = abs(noise1(3.0));
    pixel_color = vec4(r, g, b, 1.0);
}
Advertisement
I'm pretty sure that implementing noise is optional for the driver/card manufacturers, and most of them simply don't implement it :(
Oh. How sad. At least that explains why it didn't work. Thanks!
According to a German wiki, ATI does implement the noise function in software (slow) and NVidia implements it since OpenGL 2.0 drivers but the function always returns 0.0.

Maybe this simple random number generator helps you.
If I was helpful, feel free to rate me up ;)If I wasn't and you feel to rate me down, please let me know why!
^ Great, that tutorial will be handy later on.

This topic is closed to new replies.

Advertisement