Visible bounding boxes around tiled backgrounds?

Discussion and feedback on Construct 2

Post » Sun Jun 02, 2013 11:39 pm

Ashley answered one of my posts the other day and recommended I use sprites and tiled backgrounds instead of painting a whole detailed level. As per the "not wasting memory" blog.

I've started working on this and have noticed an issue. Tiled background images all end up showing a bounding box around them as per this picture.
Is there a way to get rid of this or have I somehow done something wrong?


(It's a very early test of tiling/sprites btw to see if it'll work for me)
B
14
S
3
G
2
Posts: 59
Reputation: 2,180

Post » Mon Jun 03, 2013 12:02 am

Hmm, it appears to be a bug.

I've worked out that it seems to be replication of roughly half the bottom line of the image. If I remove the bottom row of pixels I can work around it, though that's a bit of a pain.

I suppose it could be a designed in overlap to help with tiling but really if it's pixel perfect, it shouldn't need it.

Having issues with the software crashing too since the recent update, don't recall having issues before.
B
14
S
3
G
2
Posts: 59
Reputation: 2,180

Post » Mon Jun 03, 2013 9:48 am

Hi,

I confirm this bug, been there for at least 5+ beta releases - similar workaround used, I make transparent the topmost row of pixels and the problem disappears.

Greg
B
18
S
3
G
3
Posts: 83
Reputation: 3,736

Post » Mon Jun 03, 2013 10:06 am

Infact this is not a bug.

The texels from the bottom row interpolate with the upper row which in your case is transparent. Since we are talking filtered textures, you will not get rid of this effect unless you switch to point sampling.

rock on,
Michael
B
16
S
6
G
3
Posts: 23
Reputation: 2,758

Post » Mon Jun 03, 2013 11:16 am

Hi Michael

I tried switching sampling methods and turning smoothing on and off, none of this had any effect.

At least it's designed like that and not a bug, is this feature documented anywhere that you know of?

It's a bit of a pain that I can't turn it off for certain textures but I can work around it.
B
14
S
3
G
2
Posts: 59
Reputation: 2,180

Post » Mon Jun 03, 2013 11:44 am

Be sure to use "Fullscreen in browser : Letterbox integer scale" with point sampling this should fix your problem.

Your workaround is a common method to get rid of that nasty half pixels btw.

rock on,
Michael
B
16
S
6
G
3
Posts: 23
Reputation: 2,758

Post » Mon Jun 03, 2013 11:53 am

Here is a post where you can see Ashley's explanation.
http://www.scirra.com/forum/r106-lines-around-tiled-backgrounds_topic58776.html
B
242
S
63
G
33
Posts: 903
Reputation: 40,756

Post » Mon Jun 03, 2013 12:54 pm

It's not a bug, it's the bottom row of pixels wrapping back to the top. It's just how computer graphics work, nothing specific to Construct 2 here.

Workarounds:
- try using Pixel Rounding
- try using Point sampling
- if both the above are on and neither fix it, using Letterbox Integer Scale instead of Letterbox Scale should definitely fix it
- or just add a row of transparent pixels along the bottom of the image, so that transparency rather than image content wraps around to the top

Re: crashes - make sure your graphics drivers are up to date, that's the #1 cause of crashes in C2. If that doesn't fix it, report any reproducible issues to the Bugs forum.Ashley2013-06-03 12:54:50
Scirra Founder
B
403
S
238
G
89
Posts: 24,653
Reputation: 196,143

Post » Mon Jun 03, 2013 1:53 pm

[QUOTE=Ashley] It's not a bug, it's the bottom row of pixels wrapping back to the top. It's just how computer graphics work, nothing specific to Construct 2 here.
[/QUOTE]
Not in a games context but I've been working with computer graphics / images for about 20 years now and I've never come across that before. I'm assuming you mean just in the context of games graphics and tiling images but I'll take your word for it - it's clearly intentional.
The last time I programmed a game and used tiled backgrounds was on the Spectrum 48k iirc, I may have some catching up to do.

[QUOTE=Ashley]The workaround: add an extra row of pixels to the image, or resize the image ever so slightly smaller. For example, make the image 32x33 to add an extra row of pixels along the bottom, and make them the same color. Or, just resize the Tiled Background to be e.g. 64x31, so the last row of pixels doesn't wrap around. Or, just position the other backgrounds to slightly overlap and hide the seams.[/QUOTE]
OK, just to clarify before I start altering all my images then;
Power of two images are recommended for tiling aren't they so if I use a 32x33 image, won't that occupy the space of a 64x64 one being over the 32x32 size?
If I went a little smaller instead, how does that prevent the bottom row from wrapping - does it only wrap with power of two sizes?

Thanks!

Oh - crash wise, drivers are up to date etc. I think it's always when previewing and then switching back to the C2 window but I'll make notes and bug it.

B
14
S
3
G
2
Posts: 59
Reputation: 2,180

Post » Mon Jun 03, 2013 7:28 pm

The tiled image always has a row of anti-aliased pixels along the edge between solid and transparent edges. I doubt Ashley ever wrote anti-aliasing code, I believe it happens in the graphics card. (Anti-aliasing has come a long way since early games.)

Outside the game your image holds the source data to tile. During runtime your image size is a window showing a piece of that infinite tile.
So you have to see that anti-aliased row somewhere, your choice, transparent row at the top, or at the bottom.

If you go over the power of two, the image will be stored in a bigger PNG file to fit the extra row.
B
242
S
63
G
33
Posts: 903
Reputation: 40,756

Next

Return to Construct 2 General

Who is online

Users browsing this forum: FaberCastell and 7 guests