View Full Version : Uniform problem in Shader Designer

05-06-2005, 12:52 AM

I couldn't find any Typhoonlabs Shader Designer specific discussion forum, so I'm going to post this here for now.

My problem is: one of the uniforms, named SpecExp, does not work in my Blinn shader. I have added it to Uniform Variables panel (Id: 1, Type: float, Name: SpecExp, Values: 32.0) and it's checked. When I run the shader, the model ends up being white as if SpecExp was zero, although it is NOT. Here's my shader code:

uniform sampler2D TextureUnit0;
uniform float SpecExp;

varying vec4 Cs;

varying vec4 V_eye;
varying vec4 L_eye;
varying vec4 N_eye;

void main(void)
vec3 V = normalize(vec3(V_eye));
vec3 L = normalize(vec3(L_eye));
vec3 N = normalize(vec3(N_eye));
vec4 Cd = texture2D(TextureUnit0, gl_TexCoord[0].xy);

float diffuse = clamp(dot(L, N), 0.0, 1.0);

vec3 H = normalize(L + V);
float specular = clamp(pow(dot(N, H), SpecExp), 0.0, 1.0);

gl_FragColor = Cd*0.5 + (Cd*diffuse)*0.5 + (Cs*specular);
}If I change the SpecExp within pow() statement to a float value such as 32.0, it works without problems. I have Windows XP SP2, ATI Radeon 9700 with drivers installed.


05-06-2005, 01:19 AM
Hello Arkion,
I'm the Shader Designer's writter (next time mail directly to me instead of use this forums :) ).
Your problem happens with all ATI Radeon cards when using the Shader Designer. I think that is caused by I bug in the ATI driver. Yesterday I've started a thread in this form related with this issue. I finally was able to reproduce the problem with a "minimal" application and I've posted it ( http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=11;t=000736 )
in order to see if somebody could check that code and see if I'm making something wrong (I really doubth it). I already sent a bugreport to ATI with this sample application, so I'm waiting for the reply.

When I get confirmed that is a driver bug (or a bug in my code) I'll build a new version that fixes it (if is my fault) and introduces some little improvements.