Tiled Backgrounds are deformed

Just started using Construct 2? Post your questions here

Post » Mon Aug 28, 2017 1:53 am

Hi!
I'm using Tiled Backgrounds on my upcoming game.
They look good when WebGL is turned off -- but completely deformed when it's on.
It only happens with the tiled backgrounds (sprites look good no matter if WebGL is turned on or off).

WebGL off (NW.js):
Image

WebGL on (NW.js):
Image

When I test the game on Google Chrome it looks good even with WebGL turned on. However I need to make it run properly on NW.js (it will be an .EXE desktop app).
Image

Is there anything I can do to make the tiled backgrounds look good when using WebGL + NW.js??
I want to turn WebGL on to make it run faster/better. Thanks in advance!
B
23
S
7
G
1
Posts: 71
Reputation: 2,077

Post » Wed Aug 30, 2017 6:37 am

Hi could you post a capx with the error on and I'll check it out for you.
Image
B
30
S
8
G
1
Posts: 120
Reputation: 2,862

Post » Wed Aug 30, 2017 6:41 am

Also try setting 'Point' sampling in Project Properties
Image
B
30
S
8
G
1
Posts: 120
Reputation: 2,862

Post » Sat Sep 02, 2017 3:20 pm

jaytrott86 wrote:Hi could you post a capx with the error on and I'll check it out for you.

Wow, thank you so much for offering your help!
I'm attaching a smaller CAPX where the same error happens: https://www.dropbox.com/s/a53df6cn0rnlj ... .capx?dl=0

Apparently it happens because I'm applying a 2x zoom to the layer - and somehow tiledbackgrounds gets deformed when zoom is active.

I'll appreciate if someone finds a way to fix this *without turning zoom off* -- because I want to make the main game running in a low-res layer while messages and a few other things would run into a hi-res layer.

Thanks again and sorry for my bad English!

EDIT:

I've tested my game on my father's PC... And it's running perfectly with WebGL on.
My video card is an Nvidia (GTX 450) and his is an AMD (Radeon HD 6450).
I still don't understand what's going on.

WebGL on (AMD):
Image
B
23
S
7
G
1
Posts: 71
Reputation: 2,077

Post » Mon Sep 04, 2017 8:55 am

@Macbee There doesn't seem to be any problem when I preview it, I'm using a surface pro 2, have you tried updating your video card drivers. Maybe send a screenshot of the error you're getting with the capx you've provided so I can see your problem :)
Image
B
30
S
8
G
1
Posts: 120
Reputation: 2,862

Post » Mon Sep 04, 2017 9:02 am

@Macbee also these are the settings I have in all my games, could you try these and see if this helpsImage
Image
B
30
S
8
G
1
Posts: 120
Reputation: 2,862

Post » Mon Sep 04, 2017 10:00 am

The problem is WebGL 1 cannot tile non-power-of-two textures, so C2 stretches them to a power-of-two size (e.g. 32x32, 64x64, 128x128 etc) before making a tiling texture. This is lossy and causes a slightly distorted texture sometimes. However WebGL 2 can tile any size texture, so it doesn't happen if the system supports WebGL 2. NW.js should support WebGL 2, providing you're up-to-date and not sticking to an old version.

Probably the best workaround is to make sure all your tiled backgrounds are a power-of-two size.
Scirra Founder
B
408
S
242
G
92
Posts: 24,888
Reputation: 198,582

Post » Wed Sep 06, 2017 11:56 pm

Thank you so much Ashley! It's perfect now! :D
B
23
S
7
G
1
Posts: 71
Reputation: 2,077


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 2 guests