[Effect] : Bilinear Zoom

Share your Construct 2 effect files

Post » Mon Nov 19, 2012 4:59 pm

Today, HTML5-compatible browsers already provide bilinear filtering on <canvas> and in WebGL for images when you resize the graphics.

However, I encountered a situation in which I need a bilinear resize of a Sprite, on only that one. Javascript is too slow to do it realtime, so I implemented that in a WebGL shader.



This shader is a quick port to C2 of the GLSL shader from there :
http://www.gamerendering.com/2008/10/05/bilinear-interpolation/

The bilinear filter works in both directions (image magnification and shrinking).

It works with 4 parameters :

The Texture Width Size is the new width you want to have, Texture HeightSize is the new height, the X pixel size must be set to 1.0/Texture Width, and the same for Y pixel size (1.0/Texture Height).

You get that kind of after/before effect (however no hope of regrowing your hairs back with a shader...):


The demo : https://dl.dropbox.com/u/1412774/WebGLBilinearEffectDemo/index.html
The effect .zip archive : https://dl.dropbox.com/u/1412774/WebGLBilinearEffectDemo/pode_bilinear_filter.1.0.zip (put it inside the effects folder !
The .capx : https://dl.dropbox.com/u/1412774/WebGLBilinearEffectDemo/WebGLBilinearEffectDemo.capx
B
33
S
9
G
6
Posts: 709
Reputation: 6,704

Post » Mon Nov 19, 2012 8:37 pm

EXCELLENT PODE !!!! ^^
B
159
S
38
G
11
Posts: 229
Reputation: 17,361

Post » Mon Nov 19, 2012 9:46 pm

great effect thanks
B
60
S
9
G
7
Posts: 176
Reputation: 8,799

Post » Fri Mar 01, 2013 8:32 pm

height and width are swapped in the example file.
Great work though!
B
3
Posts: 8
Reputation: 291

Post » Mon Jun 17, 2013 3:43 pm

Ooh!!

Any chance you could repost this? All the links seem broken.

EDIT:
Nevermind, Dropbox seems to get blocked sometimes around here. Great work!ErekT2013-06-17 16:15:46
B
22
S
6
G
1
Posts: 398
Reputation: 3,384

Post » Thu Jun 25, 2015 9:16 am

niftly little thing
B
15
S
7
G
1
Posts: 143
Reputation: 2,379


Return to Effects

Who is online

Users browsing this forum: No registered users and 0 guests