Alpha Blending

AndreRyan

Junior Contributor
Joined
Jan 23, 2002
Messages
366
I've been trying to figure this out but I'm not getting anywhere. How do you set up AlphaBlending AND specify the alpha values to use?

So far I've got:
Visual Basic:
Dev.RenderState.AlphaSourceBlend = Blend.SourceAlpha
        Dev.RenderState.AlphaDestinationBlend = Blend.InvSourceAlpha
        Dev.RenderState.AlphaBlendEnable = True
But I have no idea where to set the alpha property, or whether the declaration is correct anyway, so that the geometry is rendered translucently. I'm using PositionColored primitive squares.
 
I figured it out finally, I found BlendFactor does what I want:
Visual Basic:
        Dev.RenderState.AlphaBlendEnable = True
        Dev.RenderState.SourceBlend = Blend.BlendFactor
        Dev.RenderState.DestinationBlend = Blend.InvBlendFactor
        Dev.RenderState.BlendOperation = BlendOperation.Add

        Dev.RenderState.BlendFactor = Color.FromArgb(127, 255, 255, 255)
This caused the textures to develop a white "distortion" which was countered with:
Visual Basic:
Dev.TextureState(0).AlphaArgument0 = TextureArgument.TextureColor
 
Back
Top