Page 1 of 2

Rotated images are Fuzzy

Posted: Wed Jun 05, 2013 6:14 pm
by EvilSheepLord
Hi All,

I just stumbled across this little engine the other day and I have started playing around with it. I apologize in advance if this has been asked, I did search the topics and couldn't find anything relative.

Using love.graphics.draw(ImageObject,x,y, math.rad(45)) produces are very fuzzy image, whereas love.graphics.draw(ImageObject,x,y, math.rad(90)) produces are nice clean image.

The image I am using is a 32x32 png file.

It seems like a bug in the draw the rotation code. Is there any way to achieve clean rotated images without needing an image for every rotation?

Thanks!

Re: Rotated images are Fuzzy

Posted: Wed Jun 05, 2013 6:35 pm
by Plu
You could try setting the filtermode on the image, although I'm not sure if it's used for rotating as well.

http://love2d.org/wiki/(Image):setFilter

You'd need to set it to 'nearest'.

If that doesn't work, you'll have to wait for one of the more experienced guys to show up :P

Re: Rotated images are Fuzzy

Posted: Wed Jun 05, 2013 6:45 pm
by EvilSheepLord
I will give that a try and see if it helps. I'll post my findings.

Thanks!

Re: Rotated images are Fuzzy

Posted: Wed Jun 05, 2013 6:57 pm
by EvilSheepLord
I tried the setFilter method. setFilter("nearest","nearest") took the outside fuzz away but it distorted the colors inside the image.
It almost looks as if the rotated image on a non N,S,W,E direction is being anti-aliased.

Re: Rotated images are Fuzzy

Posted: Wed Jun 05, 2013 8:06 pm
by Boolsheet
Can you post the code and the image and then tell us what you see and what you were expecting?

Re: Rotated images are Fuzzy

Posted: Wed Jun 05, 2013 8:14 pm
by EvilSheepLord
The code is in my original post. It's two lines of code. If you use that code and load an image it won't look clean when it is rotated. This should be very easy to reproduce. My exact code is a little convoluted as I have positions stored on an object. None of this is relevant however as the issue is with the draw function and not my image or the preceding code. This is proven by rotating the image at 90 and 45 and getting varying results in the visual impact of the image.

Re: Rotated images are Fuzzy

Posted: Wed Jun 05, 2013 8:38 pm
by EvilSheepLord
Ok. This is interesting. I tried a different image and it looks correct. It must be something to do with the image itself that causes the distortion.
This post can be ignored for now :P

Re: Rotated images are Fuzzy

Posted: Wed Jun 05, 2013 8:42 pm
by Boolsheet
EvilSheepLord wrote:It must be something to do with the image itself that causes the distortion.
That's why I specifically asked for the image. The whole graphics pipeline has a lot of details and can have certain effects on special data. Some of them may be outside of your expectations and look "wrong".

Re: Rotated images are Fuzzy

Posted: Wed Jun 05, 2013 8:49 pm
by EvilSheepLord
Boolsheet wrote:
EvilSheepLord wrote:It must be something to do with the image itself that causes the distortion.
That's why I specifically asked for the image. The whole graphics pipeline has a lot of details and can have certain effects on special data. Some of them may be outside of your expectations and look "wrong".
Gotcha. It was a spaceship I found online that I was using to try out the engine. When I get a chance I will post a link to the image I was using.

Thanks!

Re: Rotated images are Fuzzy

Posted: Thu Jun 06, 2013 2:09 am
by substitute541
It isn't a bug, it's rather a limitation in the filters. If you rotate any image in a graphics program, it will look fuzzy (unless that graphics program has a super-awesome filter we don't know about >_>*.) Same is true for scaling images. To fix this, either use a higher resolution image and scale it down, or use separate images for each rotation.

Edit: *or if the image you are rotating is a high resolution image.