GLBasic forum

Main forum => GLBasic - en => Topic started by: djtoon on 2011-Jan-24

Title: x_spite alha problem
Post by: djtoon on 2011-Jan-24
hi
this is what happens when i use x_sprite with a png

why is the antialias to black? and not to transperent



[attachment deleted by admin]
Title: Re: x_spite alha problem
Post by: Moru on 2011-Jan-24
When you create the PNG, make sure the paint package does proper 8 bit transparency, not 1 bit. If the image you create in the paint package has a black background and you use AA to get a smoth edge, the transparency will have black mixed in it. You need to make a real transparent background, usually visible in the paint program as a light-gray/white checkerboard in the background.

If all this is correct you might want to set alphamode to something else than 0, not sure if this impacts x_sprite though?

edit: Also if you use Photoshop to save the png, make sure you export it for web and select transparency.
Title: Re: x_spite alha problem
Post by: djtoon on 2011-Jan-24
i made i with photoshop and nothing works :) even the pink transperent bmp background comes out ugly like this
any ideas?

10x
Title: Re: x_spite alha problem
Post by: Kitty Hello on 2011-Jan-24
Hm. You should make that image totally green and only control the transparency using the alpha channel (use Photopaint or so). Also, make the texture a power of 2 in sizes, or i'll have to fill the rest with black, internally.
Title: Re: x_spite alha problem
Post by: Moru on 2011-Jan-24
Can we mabe have a look at the original PNG that you use to paint the x_sprite?
Title: Re: x_spite alha problem
Post by: djtoon on 2011-Jan-24

X_MAKE3D 1,1500,45

X_CAMERA camx+offset, 20+camY, -400, camx+offset, 0, 0
X_FOG RGB(255,255,255), FALSE,800, 1000

//draw
ALPHAMODE -1
FOR x=0 TO LEN(horde)-1 STEP 1
X_SPRITE horde
Title: Re: x_spite alha problem
Post by: Kitty Hello on 2011-Jan-24
it's 640 wide. Make the sprite 1024 or 512 pixel wide. Next, the transparent background has a white colour . Make that part yellow as well.
Title: Re: x_spite alha problem
Post by: djtoon on 2011-Jan-24
maing it 512 didnt change anything
its like earsing all the sprites once in runs

weird
still no alpha just
transperent
Title: Re: x_spite alha problem
Post by: backslider on 2011-Jan-24
Use a sprite with the size 512*512 or 256*256 for e.g?!

I don´t know if the power of two is important for x_sprites but you could try it... :)
Title: Re: x_spite alha problem
Post by: Moru on 2011-Jan-24
I can't get the example to run so can't test for myself but try changing the alphamode to .99 or -.99
Title: Re: x_spite alha problem
Post by: djtoon on 2011-Jan-24
noting works :(
Title: Re: x_spite alha problem
Post by: monono on 2011-Jan-24
My first guess would have been to set the alpha to -0.99 or 0.99 as well.
The land.png looks just fine. Works with smooth alpha in my applications.
Pls post the the full (executable) code or zip ur project for more help.
Title: Re: x_spite alha problem
Post by: spudgunjake on 2011-Jan-24
in photoshop, used the magic wand select the area,
invert it and copy, paste the area,
you should now have two images / layers, one been the background, delete the back ground layer, the layer left has a checked background, save that file out as a png, glbasic know what is transperant.  I hope that helps
Title: Re: x_spite alha problem
Post by: spudgunjake on 2011-Jan-24
if you have a example you could send me, with code.
Title: Re: x_spite alha problem
Post by: djtoon on 2011-Jan-25
here is the project part that dosent do alpha  at all for some reason


[attachment deleted by admin]
Title: Re: x_spite alha problem
Post by: backslider on 2011-Jan-25
Huh?
Alpha works, doesn´t it?!

I can only see the grass, no black edges or sth. else.
Title: Re: x_spite alha problem
Post by: djtoon on 2011-Jan-25
is there sometin gim missing in gl basic?
i got the latest update and i tested it on 2 computers even on the iphone same thing :(
Title: Re: x_spite alha problem
Post by: spudgunjake on 2011-Jan-25
Just remming out all the alphas and just adding a single alpha  -0.999 at the start seemed to work, I do like the code. nice affect Matey. 

I all so tried remming the alpha's and got some strange affects depending which alpha I tried remming.

Hope this helps.




[attachment deleted by admin]
Title: Re: x_spite alha problem
Post by: Schranz0r on 2011-Jan-25
http://www.glbasic.com/forum/index.php?topic=3858.msg28153#msg28153
Title: Re: x_spite alha problem
Post by: djtoon on 2011-Jan-25
? dont understand
Title: Re: x_spite alha problem
Post by: djtoon on 2011-Jan-25
Fixed :)
i had to reverse the order of the drawing sprites form top to bottom
Title: Re: x_spite alha problem
Post by: Schranz0r on 2011-Jan-25
yepp thats it!