WebGL 2 & C2/C3

Discussion and feedback on Construct 2

Post » Tue Nov 17, 2015 5:43 pm

shinkan wrote:What about textures skewing, distortion etc... is this still a thing? if I remember correctly it should be possible only with webgl2, right?

It's possible with webgl now, even C2's webgl renderer can do it, although the canvas render can't as of now. Which is why it's not a feature currently.

I've utilized it in the draw textured quad action of my paster plugin, but had to use a workaround to make it work with canvas.
B
91
S
31
G
103
Posts: 5,238
Reputation: 67,762

Post » Tue Nov 17, 2015 7:33 pm

@R0J0hound yeah, I've been playing around with textured quads in paster... but results are a bit hard to predict. Sometimes it will skew the polygon correctly but other times it will just make a rough visible cut into two triangles (to put it that way shortly) which kind of breaks the flow of the texture :)
ImageImageImageImage
B
157
S
65
G
41
Posts: 2,594
Reputation: 34,748

Post » Tue Nov 17, 2015 8:22 pm

@shinkan
That's when webgl isn't used. The canvas workaround draws as two triangles and the anti-aliasing causes the seam.
B
91
S
31
G
103
Posts: 5,238
Reputation: 67,762

Post » Tue Nov 17, 2015 9:21 pm

@R0J0hound That's interesting. As far as I can remember I've been playing with paster quads only on my desktop and only with webgl on. Just building basic 3d looking-perspective walls when I stumbled across triangles and seams.
ImageImageImageImage
B
157
S
65
G
41
Posts: 2,594
Reputation: 34,748

Post » Tue Nov 17, 2015 10:22 pm

@shinkan
Well, with webgl on it uses the same drawing method that sprites use, and it is two triangles.

Oh wait, if you're trying to do perspective it won't look right because there is no z.
The picture here sums it up:
https://en.wikipedia.org/wiki/Texture_m ... orrectness

So basically the distortion only looks right if opposite sides of the quad are parallel. Something like a skew would work, but not if you do a trapezoid shape.
B
91
S
31
G
103
Posts: 5,238
Reputation: 67,762

Post » Tue Nov 17, 2015 10:57 pm

@R0J0hound Yes, that's the one :)
ImageImageImageImage
B
157
S
65
G
41
Posts: 2,594
Reputation: 34,748

Post » Wed Nov 18, 2015 12:34 pm

Texture distortion is complicated - Classic had a skewing feature, and everyone expected it to affect the collision mask as well. So then you have to take in to account position, rotation, scale and skew in collision testing, and that starts to turn a simple, elegant and fast collision system in to a real mess.
Scirra Founder
B
387
S
230
G
88
Posts: 24,251
Reputation: 192,464

Post » Mon Jan 18, 2016 12:31 am

Do you reckon WebGL 2 will come out by the end of this year or so?

I can't wait to not have to make every sprite power-of-two sized!
B
147
S
74
G
20
Posts: 1,786
Reputation: 22,522

Post » Mon Jan 18, 2016 12:26 pm

You already should ignore the power-of-two sizing for sprites. In fact that's the worst size for sprites, since they assemble the least efficiently on to spritesheets (considering it uses 1px border on to a power-of-two spritesheet). It only makes a moderate quality difference to non-power-of-two sized tiled backgrounds.
Scirra Founder
B
387
S
230
G
88
Posts: 24,251
Reputation: 192,464

Post » Mon Jan 18, 2016 9:06 pm

Yeah it's a shame it's inefficient, but non-power-of-two sprites aren't smooth or render as well as power-of-two when scaled/zoomed out. Sometimes quality matters!
B
147
S
74
G
20
Posts: 1,786
Reputation: 22,522

PreviousNext

Return to Construct 2 General

Who is online

Users browsing this forum: The Mnk and 1 guest