Tiger GLSL Drivers

i use the noise2 function in fragment shader. if i do so it looks like a software fallback.

my shader:

uniform sampler2D colorMap;
uniform sampler2D noiseMap;
uniform sampler2D reflektion;

uniform float timer;
varying vec3 lDir;
varying vec3 normal;
varying vec3 halfVector;

void main (void)
{
	vec3 noiseVec;
	vec2 displacement;
	float scaledTimer;
     vec3 halfV;
     float NdotHV;
	float spec = 50.4;
	float ambient = 0.2;

	displacement = gl_TexCoord[0].st * 0.8;

	scaledTimer = timer*0.1;

	displacement.x += scaledTimer;
	displacement.y -= scaledTimer;

// THIS LINE CAUSES SOFTWARE FALLBACK
displacement = noise2(displacement);

	vec4 bumpColor = texture2D(noiseMap, displacement.xy);
	noiseVec = normalize(bumpColor).xyz;
	noiseVec = (noiseVec * 2.0 - 1.0) * 0.035;
	vec3 vNormal = normalize(2.0 * (bumpColor.rgb - 0.5));

	vec3 color = vec3(ambient, ambient, ambient);

	float NDotL = max(dot(lDir, vNormal),0.0);

    if (NDotL > 0.0) 
    {
        color += NDotL;
        
        halfV = normalize(halfVector);
        NdotHV = max(dot(vNormal,halfV),0.0);
        color += 3.0 * (pow(NdotHV,spec));
	   color += 1.0 * NdotHV;
    }

	float a=0.5;
//vec4(20.0/255.0,50.0/255.0,60.0/255.0,1.0);
	vec4 waterColor = vec4(20.0/255.0,50.0/255.0,60.0/255.0,1.0);;//texture2D(colorMap, gl_TexCoord[0].st + noiseVec.xy * 5.0);//vec4(0.0,0.0,1.0,1.0);
	vec4 t = waterColor * (1.0-a) + texture2D(reflektion, gl_TexCoord[0].st + noiseVec.xy * 5.0) * a;

	t.a=1.0;
	
	gl_FragColor = t * vec4(color,1.0);
}

Correct. No shipping hardware supports noise.

As arekkusu said, you just won’t get noise. If you allow Recovery renderers on OS X, you’ll get software fallback. On Windows, I believe ATI will do SW Fallback as well, and NV will return 0.

I suggest manually implementing Simplex noise instead. It can be done on all GLSL capable hardware, provided you are not already near your instruction limit.

http://staffwww.itn.liu.se/~stegu/simplexnoise/index.php

There are 6 total variants in that sample code. Try all 6, and see what works for you. Usually, Simplex noise will be faster.

thanks

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.