Hello,
I have this shader and it is turning all of my objects translucent. From the code it looks to me like the color’s alpha value will always be 1, but it is not. If I explicitly set ‘colorVarying.w’ to 1.0 at the end, then the objects appear opaque. Can anyone see how my alpha would be anything but 1 from this code?
Thanks,
Bob
in vec4 position;
in vec3 normal;
in lowp vec4 color;
out lowp vec4 colorVarying;
uniform mat4 modelViewProjectionMatrix;
uniform mat3 normalMatrix;
void main()
{
vec3 eyeNormal = normalize(normalMatrix * normal);
vec3 lightPosition = vec3(0.0, 0.5, 1.0);
float nDotVP = min(1.0,max(0.0, dot(eyeNormal, normalize(lightPosition))));
colorVarying = color * nDotVP; // both of these produce
colorVarying = vec4(0.5, 0.5, 0.5, 1.0) * nDotVP; // translucent objects
gl_Position = modelViewProjectionMatrix * position;
}