I was wondering if anyone could help me with a problem I'm having with my GLSL shaders. I'm trying to make certain vertices in my geometry (a skydome) partially transparent. The intent being to create a day/night transition by having an outer skydome to represent space beyond the atmosphere, as well as an inner skydome to model the clouds.
I'm running into a problem before I even get off the ground though; I can't actually get any of the pixels to be tranparent. The way I've tried it so far is as follows (this is for the clouds)...
Vertex shader...
varying vec2 texCoords_Clouds;
void main(void)
{
texCoords_Clouds = gl_MultiTexCoord0.st;
gl_Position = ftransform();
}
Fragment shader...
uniform sampler2D cloudsTexture;
varying vec2 texCoords_Clouds;
void main (void)
{
vec3 color_Clouds = vec3(texture2D(cloudsTexture, texCoords_Clouds));
float alphaFade = color_Clouds.r / 256.0;
gl_FragColor = vec4(color_Clouds,alphaFade);
}
I'm using Java3D, and the texture being passed in is a BufferedImage.TYPE_BYTE_GRAY if that makes any difference.
The idea behind my fragment shader is that the grey value determines the transparency of a pixel (black pixels being totally transparent, white pixels being totally opaque).
It makes sense to me in theory to approach it like this, but when I run the program, all the pixels are totally opaque. Even when I just use an artificial value of say... "gl_FragColor = vec4(color_Clouds,0.1);", I still get all pixels being totally opaque!!
Does anyone have any idea what the problem might be here? Am I even using the fourth value in the vec4 correctly?
Thanks for any advice you can give.











