Another alpha problem

hsv

Newcomer
Joined
Feb 26, 2004
Messages
9
I have a problem with overlapping quads. I've set the colorkey to magenta when loading the texture, and it almost works..
The picture explains it better than I do, i think:
alpha.jpg

I've drawn some black to show you how high the quad is. So it does work, until it gets close to another color! Why is that?

Code:
device.RenderState.AlphaBlendEnable = true;
device.RenderState.SourceBlend = Blend.SourceAlpha;
device.RenderState.DestinationBlend = Blend.InvSourceAlpha;

/h
 
Sounds to me

As if Your Color Key is only set to partially transparrant aka alpha value is not 0 but somewhere between 0 and 255. Cant really tell from the code youve supplied
 
im pretty sure u dont even have to do that,
you could just:

yourTexture = TextureLoader.FromFile(d3ddev, "yourfile.jpg", ImageWidth, ImageHeight, D3DX.Default, 0, Format.Unknown, Pool.Managed, Filter.Triangle, Filter.Triangle, ColorKeyVal.ToArgb) 'use Filter.Default for more detail if u want

and then

device.RenderState.AlphaBlendEnable = true;
device.RenderState.SourceBlend = Blend.SourceAlpha;
device.RenderState.DestinationBlend = Blend.InvSourceAlpha;

'do all ur drawing.. setting texture.. etc

d3ddev.RenderState.AlphaBlendEnable = False 'set it to false to boost performance

hope that helps, becuase im pretty sure u dont even need a bmp
 
ThePentiumGuy said:
you could just:

yourTexture = TextureLoader.FromFile(d3ddev, "yourfile.jpg", ImageWidth, ImageHeight, D3DX.Default, 0, Format.Unknown, Pool.Managed, Filter.Triangle, Filter.Triangle, ColorKeyVal.ToArgb) 'use Filter.Default for more detail if u want

and then

device.RenderState.AlphaBlendEnable = true;
device.RenderState.SourceBlend = Blend.SourceAlpha;
device.RenderState.DestinationBlend = Blend.InvSourceAlpha;

I tried, but it never worked. I assumed it was the compression.. But I'll try again.
/h
 
Back
Top