Sprite Alpha

Blitz3D Forums/Blitz3D Beginners Area/Sprite Alpha

pc_tek(Posted 2008) [#1]
I don't want sprites colours changing when a sprite passes over another. At the moment, I have 2 sprites passing over over each other, but the colors change like its alpha is less than 1, ie, both sprites are blue, but when they pass each other the colours turn lighter blue.

I need to negate this...can anybody help?


olo(Posted 2008) [#2]
Can i see your code please?


pc_tek(Posted 2008) [#3]
Graphics3D 800,600,16,2
SetBuffer BackBuffer()

layer0 = LoadSprite ("layer0.png",1)
layer1 = LoadSprite ("layer1.png",1) ;hexagons
camera = CreateCamera()

ScaleSprite layer0, 1.5,1
ScaleSprite layer1, 3,2

sx#=1
sy#=1

While Not KeyDown(1)
Cls
If KeyDown(203) Then sx=sx-.01
If KeyDown(205) Then sx=sx+.01
If KeyDown(200) Then sy=sy+.01
If KeyDown(208) Then sy=sy-.01

PositionEntity layer0,sx,sy,1
PositionEntity layer1,sx/2,sy/2,1

RenderWorld

VWait:Flip 0
Wend
EndGraphics
End


olo(Posted 2008) [#4]
sorry but i have no idea what is causing the problem :(


Warner(Posted 2008) [#5]
I tried running your example with 2 blue images made in Paint, saved as png. I did move the camera back a bit. Everything looks normally. Maybe your pngs do contain some alpha somehow ? Try running it with other images, or save the images temp. as bitmaps from mspaint, to ensure there is no alpha data in the files.


pc_tek(Posted 2008) [#6]
I changed them to BMP format from MSPaint and got the same result!

AAAAAAAAARRRRGGHHHhhh!


GfK(Posted 2008) [#7]
Try calling ClearTextureFilters first, see if that helps. Any flags you use with LoadSprite, LoadTexture etc, are combined with whatever is set in TextureFilter() - defaults to 1+8 iirc.


pc_tek(Posted 2008) [#8]
Nope...no joy at all.

This must be a tricky thing to do?


GfK(Posted 2008) [#9]
Are you doing anything with EntityBlend or EntityFX?


Ross C(Posted 2008) [#10]
It sounds like the usual sprite behavour. Load a texture specifically only using the colour flag:

Use cleartexturefilters() as Gfk says.

Create your sprite using createsprite(), then apply your loaded texture:

ClearTextureFilters()

texture = loadtexture("my texture.png"+1)
sprite = createsprite()
entitytexture sprite,texture



That will sort it. It's happening because sprite upon creation are alphaed, so, the two sprites are passing over each other, creating a less alphaed overall image.

If your looking for your sprites to be alphaed, i'm afraid you'll have to live with it, cause i don't see any easy way around it tbh.


pc_tek(Posted 2008) [#11]
See link for example of what's happening...

http://www.freewebs.com/jphamilton/example.bmp

...As you can see, the upper right is where both sprites are overlayed...and the blues are brighter. I need the sprites to be flat - not Alpha-ized!


Ross C(Posted 2008) [#12]
That's the smallest picture i've ever seen :oP Any chance of running code? And have you tried what i suggested. That should sort it.


pc_tek(Posted 2008) [#13]
Apologies, Ross...I posted before I re-read the board. Am trying your code now


pc_tek(Posted 2008) [#14]
PERFECT!

Cheers Ross