Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Prevent edges on rotated sprites

Author
Message
luskos
19
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 12th Apr 2010 10:48
Hi guys,

i need to know if there is a way to remove edges when my sprite is rotated, because at certain angles it looks really bad.I know anti-aliasing is used but for 3d and there is an example i found in forums how this is achieved drawing a line.Suggestions?

Where there is a will, there is a way.
I often edit my posts, that`s who i am
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 12th Apr 2010 11:12
I think that example would have just been for drawing an anti-aliased line, no way to do the same for sprites.

That's not to say we can't try and fake it though.

Try using an image that is a bit bigger than you need. If your sprite is 128x128, try making it 192x192 and scale it down to 66.666%. That will give it a little extra to blend with when rotating and might improve the jaggies.

Another thing I would suggest is enabling or disabling that flag when loading an image, just to see what difference it makes. If you load your sprite like this:

LOAD IMAGE "mysprite.png",10

Try adding a ,1 at the end...


LOAD IMAGE "mysprite.png",10,1

And vice versa. The 1 flag should load the image with no mipmaps, but that might not be ideal but is worth a shot - loading with no flag should load it in with mipmaps - which often smoothes out the image.


Health, Ammo, and bacon and eggs!
luskos
19
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 12th Apr 2010 13:54
The flag thing did not help, and i can`t use images with this dimensions because i`ll use them with precise collision.Using dimension like 192x192 is no good because there will be too much space that is not needed and also my media is downloaded from the net.It`s not big project, i have no intention of making money on this.

I hope there is no need for my sprites to be power of 2, then maybe i`ll be able to scale them a bit so they can be adjusted like you said, 2/3 of the original image.
Can i get the same result with sprites that have different dimensions?

By the way in the current state i`m using my sprites, they are scaled down, so if it`s possible i`ll find just the best scaling.

Where there is a will, there is a way.
I often edit my posts, that`s who i am
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 12th Apr 2010 14:12
Maybe it would be better to double the resolution of the sprites - then change your collision to only check every other pixel, something along those lines.

I'm thinking that if you have a sprite with a distinct line and it's pixel perfect size, then it has nothing to do but show that line jaggy as hell when it gets rotated. But having the extra resolution might introduce some smoothing, as the image is scaled down.

If that doesn't work, then I have no idea what else to try. It's annoying, and the thing is that there are options for anti-aliasing, but they don't work with sprites. I don't suppose you could do it with 3D plains instead?
I've been doing this recently, using plains in a 2D game, and they rotate much nicer than sprites, they are much more receptive to smoothing. As I said though, I'm not sure if a double resolution sprite would fare better so I would have a think about that - maybe a 2.5D system would be better, allows much more freedom too.


Health, Ammo, and bacon and eggs!
Rich Dersheimer
AGK Developer
17
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 12th Apr 2010 23:22
If you don't need a lot of different angles, then you could draw your graphics at each angle ahead of time, making sure they look good. So, instead of rotating the sprite, change the sprite image to one that is rotated.

luskos
19
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 15th Apr 2010 08:53
The whole thing is about i`m making 2D shooter game, and i have 2 ideas when player hit the bad guy.One is to make effect of ripping the sprite in four directions effect and the other is spin+scale down.

I also think i may use textured plains in 2.5D, but i really wanted to keep everything simple 2D.The game is remake, but actually doing it 3D or 2.5D can be great success.I can do death of bad guys like in some old game i remember, when hit rotate the plain 90 degree.

If i had more free time i may put more effort on doing every single sprite animation with different angles, but the bad guys are a lot arround 30, this will need much time.

Where there is a will, there is a way.
I often edit my posts, that`s who i am
Kevin Picone
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 15th Apr 2010 10:35 Edited at: 15th Apr 2010 10:36
luskos,

Do the sprite images have alpha channel ?

luskos
19
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 15th Apr 2010 18:08
My media is pure BMP so not.Is this related?

Where there is a will, there is a way.
I often edit my posts, that`s who i am

Login to post a reply

Server time is: 2026-07-26 12:34:15
Your offset time is: 2026-07-26 12:34:15