GLSL Alpha Blending

Started by
2 comments, last by adam17 18 years, 2 months ago
is there anyway to do alpha blending within GLSL? i know it requires the GL_SRC_COLOR and GL_DST_COLOR in order to acheive the proper effect but im not sure on how to implement it in shaders. for example: i want to make either a translucent piece of glass or a smoke particle with faded edges. i dont want to use cube maps. it would require way too much processing
Advertisement
if you have glEnable(GL_BLEND); and specify your desired blending function, all you have to do is set gl_FragColor.a to your alpha value and you get proper blending.
Blending is separate from the programmable pipeline. You don't need to do your own in shaders like you would for something that is in the programmable pipeline, such as texture coordinate generation.
w00t!!!! HELL YEAH! thanks guys. i'm using the shader designer from 3dlabs and i looked at the very bottom right of the application and noticed some tabs. under the fragment tab i could adjust the blending.

This topic is closed to new replies.

Advertisement