R102 - Crop transparent area issue

Bugs will be moved here once resolved.

Post » Sun Sep 09, 2012 5:08 pm

It's explained on the video.

[tube]http://www.youtube.com/watch?v=hKPRbnc3Xwk[/tube]

Thank you!
ImageImageImageImageImageImage
B
92
S
19
G
12
Posts: 1,192
Reputation: 18,276

Post » Sun Sep 09, 2012 10:19 pm

This is by design. It is to help soften the edges of sprites, and ensure edges are blended the same way as transparency inside the image. See this image:



The left images are cropped with no border, and the right images are cropped with a 1px transparent border. The top image is a tiny 6x6 sprite scaled up large, and the bottom image is just an ordinary 32x32 sprite rotated slightly.

Notice with no border two problems occur:
- top image: transparency inside the image blends smoothly, but the edges are hard, which is inconsistent. With the 1px transparent border it is treated the same way over the whole image.
- bottom image: edges appear 'hard'. With a 1px transparent border the image has 'soft' edges which looks better quality, because it allows the edges to linear blend to transparency.

When cropping the origin, image points and collision poly are also offset by 1px so it should realistically have no impact on the behavior of the game.

Does this really cause any practical difficulties? I think it's a nice tweak to ensure the best quality display of graphics, especially on rotated sprites.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Sun Sep 09, 2012 10:45 pm

@Ashley, by learning it, I might ask: - The imported images with no transparent offsets would have the issue about blending?
ImageImageImageImageImageImage
B
92
S
19
G
12
Posts: 1,192
Reputation: 18,276

Post » Sun Sep 09, 2012 10:46 pm

Imported images don't have a 1px border added automatically so will display like the left column. I've had it on my todo list to auto-crop imported images so it always displays like the right column.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Sun Sep 09, 2012 10:59 pm

I hope that any sort of 1px auto-crop never comes to C2. If it means that when I import background picture of 256x256 it will be turned into 257x257 picture.
B
40
S
5
G
5
Posts: 405
Reputation: 5,657

Post » Sun Sep 09, 2012 11:22 pm

@Ashley

I was playing with it, and when I did a small image with 2x2 pixels of size, and re-sized it to be a mask (with the transparent area around), but it blurred very much around the image. It maybe an issue if made automatically.



The blue horizontal mask is blurred, but it should appear like the vertical bar. And for tiled background, it will not happen, right?

Instead of using sprites I should used tiled background, but didn't because of the origin points issue of the R100.

Well, it's really hard to resolve, because it's very complex to make the engine place a frame around the images to blur, but if you place the image on the canvas and re-size, it will always blur proportional to the original size, re-sizing the transparent edge too.

It's not possible to make the transparent offsets only on the exported mosaics?

Also, thank you for the information, I'll workaround it by using tiled background if you make it automatic.TELLES08082012-09-09 23:23:46
ImageImageImageImageImageImage
B
92
S
19
G
12
Posts: 1,192
Reputation: 18,276

Post » Mon Sep 10, 2012 4:34 pm

@nemo - why is that a bad thing? Especially if it improves the quality of rotation?

I'll see about adding a ctrl+crop shortcut which does not add 1 px transparent border, so you can get it either way.Ashley2012-09-10 16:34:59
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Mon Sep 10, 2012 11:22 pm

Thank you very much @Ashley !!
ImageImageImageImageImageImage
B
92
S
19
G
12
Posts: 1,192
Reputation: 18,276

Post » Tue Sep 11, 2012 4:33 pm

Added Control+Crop in r103 to remove 1px border. Closing as hopefully this solves it now!
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 1 guest