Smooth edges

BlitzMax Forums/BlitzMax Beginners Area/Smooth edges

Josepho(Posted 2006) [#1]
I've recently bought Bmax, so I'm still not very skillful, so I have some questions about the usage of the language: Is it possible to enable sprite border antialiasing? If it's possible, how?

-Thanks


Dreamora(Posted 2006) [#2]
Yes and no.
BM does not allow you to set hardware antialiasing as it used OpenGL and DX versions that are far older than cards that support FSAA and the like.


1. When loading set the image filtering flag
2. Instead of using masking, using true alpha information and the alpha blend mode might further enhance the "smooth" border effect.


Josepho(Posted 2006) [#3]
Oops sorry but i think i forget something becasuse i dont see any change -_-

I make this

SetBlend ALPHABLEND
image = LoadImage(url_img,FILTEREDIMAGE)

DrawImage image,x,y

Can you make me a little example please?


ImaginaryHuman(Posted 2006) [#4]
You might want to also try Grey Alien's idea .... give your sprite image a small border around it of a couple of pixels of empty space. Set the filtering to FILTEREDIMAGE, then the edge pixels of your object will be antialiased.


assari(Posted 2006) [#5]
see this tutorial on how to use the Max2D Image functions (link) which is part of a beginner tutorial http://www.blitzmax.com/Community/posts.php?topic=59509


Josepho(Posted 2006) [#6]
Can anybody make a little tutorial of how making this?

Angeldaniel can you show me an example of that kind of image?

Assari I think your tutorial doesnt help with this -_-


bradford6(Posted 2006) [#7]
josepho, it is pretty simple.

1. open your image in your editor (ex. photoshop)
2. resize the image so that it is 3-5 pixels smaller than the canvas size. for instance a 256X256 image would be sized down to 252X252 with the remaining border being the background color.
3 save the image (as .PNG) and load into your program using the FILTEREDIMAGE flag

local myimage = LoadImage("Whatever.png", FILTEREDIMAGE )




Grey Alien(Posted 2006) [#8]
My idea will only work if drawn at floating point coords. If drawn at integer coords and the sprite has no real anti-aliased edge (done in a professional paint program), it will still look jagged.


ImaginaryHuman(Posted 2006) [#9]
Josepho. Make an image that is, say, 32x32, then paste your game character/object onto it taking up only 28x28 pixels with 2x2 gap around it. That's all.


Josepho(Posted 2006) [#10]
Thank you! I think i know how i will do it