Search code examples
3dstage3d

tranparent texture looks darker in 3d


this is my experiment on 3d,i use stage 3d ,and i found i can't make the alpha texture looks properly,here's my snap shot

enter image description here

as it shows,the transparent pixel always looks darker in 3d. if i disable this line

context3D.setBlendFactors(Context3DBlendFactor.SOURCE_ALPHA,Context3DBlendFactor.ONE_MINUS_SOURCE_ALPHA)

it would display properly, but lose alpha feature.

i realized the blend factors formula actually made the pixel less color.but how can i fix it?i didn't find a way, please help


Solution

  • set it be

    context3D.setBlendFactors(Context3DBlendFactor.ONE,Context3DBlendFactor.ONE_MINUS_SOURCE_ALPHA)
    

    solved my problem . two difference

    (1,1,1,0.5)(1,1,1,1)+(0,0,0,1)(0.5,0.5,0.5,0.5)=(1,1,1,0.5) correct

    (1,1,1,0.5)(0.5,0.5,0.5,0.5)+(0,0,0,1)(0.5,0.5,0.5,0.5)=(0.5,0.5,0.5,0.75) not correct