scaling is bad

BlitzMax Forums/BlitzMax Programming/scaling is bad

Najdorf(Posted 2005) [#1]
I used scaling for the first time and I'm not very impressed at all... is there some way to obtain better scaling?


Tom(Posted 2005) [#2]
'bad' is not very descriptive, what about it don't you like?


Yan(Posted 2005) [#3]
Are you using the MIPMAPPEDIMAGE and FILTEREDIMAGE flags?


Steve Elliott(Posted 2005) [#4]
Najorf, I use scaling and rotation extensively in my chess program - which I think you've tried - does it look ok on your system?

As TwoEyedPete said you need to add FILTEREDIMAGE and MIPMAPPEDIMAGE when you load an image.

eg) loadimage(<file>,FILTEREDIMAGE|MIPMAPPEDIMAGE)

And remember to setblend(ALPHABLEND) before you draw anything.


(tu) ENAY(Posted 2005) [#5]
Yeah scaling and rotation tends to [be not very good] unless you put a filter and mip mapping on. Don't forgot to mask the image as well as this is normally done by default.

eg) loadimage(<file>,MASKEDIMAGE|FILTEREDIMAGE|MIPMAPPEDIMAGE)


FlameDuck(Posted 2005) [#6]
Yeah scaling and rotation tends to [be not very good] unless you put a filter and mip mapping on.
Depends on which way you're scaling it. If you're only scaling down, there's no reason to use the resource hungry mipmap flag.


Dreamora(Posted 2005) [#7]
ESPECIALLY if you are scaling down you need mipmap. as there isn't a smaller picture to use otherwise which will give you a quite bad result performancewise (compared to the mipmapped one)


Warren(Posted 2005) [#8]
Depends on which way you're scaling it. If you're only scaling down, there's no reason to use the resource hungry mipmap flag.

?? Mipmapping helps going in both directions.


AntonyWells(Posted 2005) [#9]
Flameduck. Wrong. I think I see the four horsemen...


Najdorf(Posted 2005) [#10]
Oh, it's a bug that happens when you use only black and white images! (try the example from "GrabImage" in the docs). If you scale a black and white image it sucks, probably because it uses 1 bit color or something...

The scaling looks actually very good if you use different colors ((255,255,254) is sufficient to make it work properly)


Genexi2(Posted 2005) [#11]
probably because it uses 1 bit color or something...


As far as I know, BMax automatically converts any image to the bit-depth set by the program no?


Dreamora(Posted 2005) [#12]
BlitzMax or the graphic API that is used, yes


Tom(Posted 2005) [#13]
Been doing some bitmap font stuff lately, using the MIPMAPPED flag and scaling down makes them look worse. Just using FILTEREDIMAGE looks fine.


Warren(Posted 2005) [#14]
Yes, mipmapping isn't the hammer for every nail. For things that need to retain their detail as they scale down, like fonts, you shouldn't use it.


FlameDuck(Posted 2005) [#15]
?? Mipmapping helps going in both directions.
Correct me if I'm wrong, but I believe BlitzMAX uses the original image is the highest level?


Warren(Posted 2005) [#16]
Correct me if I'm wrong, but I believe BlitzMAX uses the original image is the highest level?

That sounds logical, meaning it would generate mip levels for the smaller sizes which would be helpful when scaling down.


Dreamora(Posted 2005) [#17]
WarrenM: They won't retain their detail when scaled down anyway because there aren't enough pixels ... otherwise the mipmap wouldn't be generated, don't you think? :-) below a size of width/2^i height/2^i a mipmapp with be faster and have the same quality as the same amount of pixels are present.


flameduck: this is correct. For scaling up, only filteredimage is needed to retain quality. MipMap only generates smaller texture sizes.


Warren(Posted 2005) [#18]
The mipmap, in theory, will look better because it will retain at least some information from the texels that are now gone (blended into the texels that are still remaining). But it doesn't always work out, like with fonts.

Whatever looks best, use it.


FlameDuck(Posted 2005) [#19]
flameduck: this is correct. For scaling up, only filteredimage is needed to retain quality. MipMap only generates smaller texture sizes.
That was what I was thinking too.


Warren(Posted 2005) [#20]
But then why did you say:

"Depends on which way you're scaling it. If you're only scaling down, there's no reason to use the resource hungry mipmap flag."

That implies that you think mipmapping is only useful when scaling up. Or am I interpreting that incorrectly?


FlameDuck(Posted 2005) [#21]
That implies that you think mipmapping is only useful when scaling up. Or am I interpreting that incorrectly?
Nope. Primary thought process. I meant to write "up" - that's how debates get screwed up.


Warren(Posted 2005) [#22]
OK, good, I thought I was losing my mind. :)