Not sure if this is possible, because i failed so far doing it, but maybe someone has an idea:
I have a model with material type EMT_TRANSPARENT_ALPHA_CHANNEL. My textures have pixels where the r,g,b compontent is set to 0, so only the alpha component should be used. I'd like it to be shown with the color of the current ambient light, but slightly transparent (depending on the value of the alpha channel). Transparence itself does worked and so did ambience on non-transparent areas, but i couldn't get it to use the ambient color at transparent positions. Has someone of you done something similar already and can help me?
Trying to get ambience on purely transparent polygons
-
- Posts: 377
- Joined: Fri Oct 28, 2005 10:28 am
- Contact:
Well, actually this should work with EMT_TRANSPARENT_ALPHA_CHANNEL, Material ambient set to white and the texture set to all white instead of all black.
Else this can be done easily with a pixel shader.
For instance GLSL (from the top of my head, might contain errors):
Maybe I don't just understand you correctly. Provide pictures for what you want and what you get instead.
Else this can be done easily with a pixel shader.
For instance GLSL (from the top of my head, might contain errors):
Code: Select all
uniform sampler2D alpha_tex;
void main()
{
vec4 t = texture2D(alpha_tex, gl_TexCoord[0].st);
gl_FragColor.rgb = gl_LightModel.ambient.rgb;
gl_FragColor.a = t.a
}