Sign in to follow this  
adam23

2D Sprite Question

Recommended Posts

Sprite Graphics Question I am working on a 2D DirectX RPG game. I download most of my sprites from: http://reinerstileset.4players.de/englisch.htm I must say he does a really good job on his sprites, but the problem I have is with transparency. For example I have a castle.bmp with a transparency of 108, 76, 47. This removes all of the pixels of that color, but it leaves a small line of slightly different pixels around the castle. The shade must change slightly as it approaches the building. I am using Textures in DirectX to display these images. Is there an easier way to fix that other than changing one pixel at a time? I have Adobe Photoshop CS2. Any advice would be greatly appreciated. I apologize if I posted this in the wrong place. __________________ Programming video games is my life.

Share this post


Link to post
Share on other sites
im currently having this problem too, as long as you dont resize it you wont get the edges blended with pixles that should be trasparent, if you need to resize it you could try masking or a format with a aplha channle like a tga, this way you can make the areas around the sprite the same color as the sprite itself but this transparent

Share this post


Link to post
Share on other sites
I don't think using a mask will work with DirectX will it?
I've done that using WIN32 before but never DirectX.

Share this post


Link to post
Share on other sites
well it happens becouse when you resize it the image blends with neiboring pixles so its not blocky but when you blend with the edges you get the transparent color blended with the image

Share this post


Link to post
Share on other sites
Quote:
Original post by adam23
I don't think using a mask will work with DirectX will it?
I've done that using WIN32 before but never DirectX.

there should be some way to make it work in directx, im using gl so unfortunatly i dont know but you could try asking in the directx forum about masking, or directx can load .tga

Share this post


Link to post
Share on other sites
I actually had the same problem with Reiner's graphics (amazing for being free) as well. The transperency color is slightly altered if you resize the image causing one or two lines of pixel color that show up. I use Paint Shop Pro and just decrease the color count. You can then resize the image and the trans. color stays the same. After you are finished just increase the color count back to the original. I have done this on virtually every image from his site that I have used and there is usually very little color disturbance in the actual image after changing the color counts.
Hope it helps.

Edit: This is only works when you resize the image before using in it your game. If DirectX alters the size of the image then this will probably not work. Sorry.

Share this post


Link to post
Share on other sites
Quote:
Original post by shadowcomplex
Edit: This is only works when you resize the image before using in it your game. If DirectX alters the size of the image then this will probably not work. Sorry.

this is where the x^2 textures become a pain

Share this post


Link to post
Share on other sites
I have been resizing the image before using it in code, if you don't mind i'm new at Paint Shop Pro. Could you briefly walk me through how I need to resize the image? Thanks again for all the help

Share this post


Link to post
Share on other sites
Sure.
Choose 'Colors' from the top menu bar. The second to last menu item is 'Decrease Color Depth. Choose this and select '8 bit' (I think, I can't remember off of the top of my head).
After this go to 'Image' from the top menu bar. Then select 'Resize' and work your magic here.
Finally, go back to 'Colors' and choose 'Increase Color Depth' now. Choose 24 bit and you will be ready to go.

Also, I have an older version of PSPro so it might be a little different on a newer version.

-Coby

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this