PDA

View Full Version : Draw ALpha Texture Problem



pongkm
08-21-2002, 12:42 AM
I want render Texture with Alpha blending
Twice Time and Result is similar
Alpha Chanal x 2
Ex. Texture Alpha chanal is 0.3 and render
Result likes Texture Alpha chanal is 0.6f

How I do this?

Robbo
08-21-2002, 04:50 AM
Are you modulating with diffuse on base fragment or what? Give us some code!!!

AdrianD
08-21-2002, 11:10 AM
use multitexturing. u need 2 tmus. both have to access the same texture with the same uv-coords. add the result of this units together, and you will get 0.6 everywhere where the texture has 0.3.

other option: use Register Combiners.
other option: depending on you rendering pipeline you could also add your texels in framebuffer.

pongkm
08-21-2002, 07:04 PM
glEnable(GL_BLEND)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)

glBindTexture(GL_TEXTURE_2D, "my texture");
glBegin(GL_QUAD)
DrawPlane with texture RGBA
glEnd()

glBegin(GL_QUAD)
DrawPlane with texture RGBA
glEnd()

Assume my texture is All White 64x64 pixel and have Alpha chanal
circle hole value 0.3 and Alpha chanal out circle value is 0.
i want result output same i render circle hole alpha chanal 0.6 in 1 times.
Can I do it?.

vshader
08-23-2002, 12:48 AM
use additive blending ie glBlendFunc(GL_ONE,GL_ONE)
if i understand what you are trying to do correctly, that will add your two alpha values of 0.3 to get 0.6.

if you don't want to use additive blending on the color, you need GL_EXT_BLEND_FUNC_SEPARATE , which lets you set different blend funcs for color and alpha. or do two passes, one with color-only write mask, second alpha only with additive blending.

[This message has been edited by vshader (edited 08-23-2002).]