x_spite alha problem

Previous topic - Next topic

djtoon

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]

Moru

#1
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.

djtoon

i made i with photoshop and nothing works :) even the pink transperent bmp background comes out ugly like this
any ideas?

10x

Kitty Hello

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.

Moru

Can we mabe have a look at the original PNG that you use to paint the x_sprite?

djtoon


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
  • .spr, horde
  • .x, horde
  • .y, horde
  • .z, horde
  • .s
    NEXT



    X_MAKE2D
    ALPHAMODE -1
    DRAWSPRITE  800,0,20+camY


    SHOWSCREEN
    WEND

    im attaching thre png i use for the xSprite


    [attachment deleted by admin]

Kitty Hello

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.

djtoon

maing it 512 didnt change anything
its like earsing all the sprites once in runs

weird
still no alpha just
transperent

backslider

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... :)

Moru

I can't get the example to run so can't test for myself but try changing the alphamode to .99 or -.99

djtoon


monono

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.

spudgunjake

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

spudgunjake

if you have a example you could send me, with code.

djtoon

here is the project part that dosent do alpha  at all for some reason


[attachment deleted by admin]