wwwq
05-04-2005, 05:05 AM
I want to get a noise in GLSL
But NVIDIA haven't implment noise() now.
So I want to load a pixel from a noise texture like this
//==========
uniform sampler2D noiseTexture;
uniform float ran1,ran2;
//==========
float mynoise()
{
vec2 rrr = vec2(gl_TexCoord[0].s, gl_TexCoord[0].t);
rrr.x += ran1;
rrr.y += ran2;
if( rrr.x > 1.0 )
rrr.x -= 1.0;
if( rrr.y > 1.0 )
rrr.y -= 1.0;
return vec4(texture2D(noiseTexture, rrr)).x;
}
===============
The ran1 and ran1 are make by main function.
I am sure ran1 and ran2 are diffirent random every time.
But I check the result.
It seems the ran1 and ran2 do not make the result change....anyone some advise ?? thx.
But NVIDIA haven't implment noise() now.
So I want to load a pixel from a noise texture like this
//==========
uniform sampler2D noiseTexture;
uniform float ran1,ran2;
//==========
float mynoise()
{
vec2 rrr = vec2(gl_TexCoord[0].s, gl_TexCoord[0].t);
rrr.x += ran1;
rrr.y += ran2;
if( rrr.x > 1.0 )
rrr.x -= 1.0;
if( rrr.y > 1.0 )
rrr.y -= 1.0;
return vec4(texture2D(noiseTexture, rrr)).x;
}
===============
The ran1 and ran1 are make by main function.
I am sure ran1 and ran2 are diffirent random every time.
But I check the result.
It seems the ran1 and ran2 do not make the result change....anyone some advise ?? thx.