Rotozoomanim changing sprite when it shouldn't

Previous topic - Next topic

FutureCow

I've just found a bug with rotozoomanim when I noticed some of my sprites were slightly wider than they should be. I would expect a sprite rotated 90, 180 or 270 degrees to be identical to the original (but obviously rotated  :) )

However, it's also broken for a non-rotated sprite. The following should output exactly the same image

ROTOZOOMANIM A_Tiles, 1, TX, TY, 0, 1
DRAWANIM A_Tiles, 1, TX, TY

However, the results are shown below, the rotozoom on the left, drawanim on the right - blown up so you can see the extra pixels. You'll notice the rotozoom has got an extra (dark blue) pixel on either side of the black edge pixels.

I tried SMOOTHSHADING FALSE but that didn't do anything.

Yes I know the easy solution is to use drawanim and rotate all the sprites on my spritesheet, however I've got ~90 tiles in an animation image and I'm using rotozoomanim to draw the sprites rotated. Having ~360 sprites on my spritesheet is getting impractical.

I'm also having issues with transparency not working, but that might just be me :D

[attachment deleted by admin]

Kitty Hello

OK, on the bug list. I'm away for the whole weekend due to work. Sorry - will take some time to fix.

FutureCow


Kitty Hello

Hm. I'm having some troubles here. Can you make a small sample project to test that?

FutureCow

I know it's not fixed in the latest release - I've tested it with the game I wrote (a remake of pipe dream) that showed me the problem in the first place and it still appears to have the problem. I can send you the code and graphics if you like.

Kitty Hello

Yes. A small sample project would suffice, though.

FutureCow

#6
One very small very simple project attached  =D
With the small screen resolution (I used 320x240) it blows the images up really big so you can see what it's doing to the colours. After putting a few pixels of another colour on the image, you can see it's not only adding an additional row of pixels, it's also changing the colours of the existing ones.

As per the screenshot you can see the image drawn with drawanim on the left, then with rotozoomanim (0 rotation, no size change) next to it. You'll notice that where a green pixel is next to a red, with rotozoomanim you get a red pixel, then a brown (red crossed with green) then green instead.

[attachment deleted by admin]

Kitty Hello

Ah. I see.
In order to have no garbage border pixels for rotated images, I use the center of each border pixel as a texture coordinate. That looks very good for rotated images, but if you have them not rotated at all, the rectangle drawn is X pixels wide, but the used pixels on the texture are only X-1 pixels wide (0.5 to w-0.5 pixels), Thus, 1 pixel gets "stretched" across the whole image. Nice for rotated images, but blurry for non rotated ones.
You can manually fix this with
SMOOTHSHADING FALSE

FutureCow

SMOOTHSHADING FALSE does fix the problem with that small sample project. My original project still has the problem, and SMOOTHSHADING FALSE isn't helping. I haven't managed to reproduce it yet in a small project unfortunately. If I can reproduce it with a small project I'll post back here.

Thanks as always Gernot.