...Create a WebGL effect?

Get help using Construct 2

Post » Wed Aug 14, 2013 3:45 pm

Hello! I was curious if there is some kind of guide to creating effects for Construct? I've been really curious in learning GLSL to do this, but I looked in the effects folder and it looks like there are XML files that look like they were generated in a way ("Don't change the id, change the name instead"), although I could be mistaken. If I am mistaken, then this is really confusing.

I've also tried copying a certain effect that wasn't built for C2 and changing the XML manually to fit it, but when I applied it in C2 I get all sorts of errors...

Any tips or guides to lead me in the right direction is severely appreciated. Thank you :)
B
28
S
7
G
5
Posts: 202
Reputation: 5,285

Post » Wed Aug 14, 2013 4:47 pm

Nothing's generated, all the files are hand-written. You can copy-paste an existing effect and just tweak the files to make new ones, e.g. changing the name and id and changing the shader code.

The shader language is WebGL's shading language. This is slightly different variant of GLSL that you traditionally get on desktop - it's based on GLSL ES, which is the mobile variant, plus the fact it's run in a browser and is often re-compiled behind the scenes for security reasons. This means desktop GLSL basically never copy-pastes and works - you'll need to carefully port it based on the limitations of WebGL shaders.
Scirra Founder
B
399
S
236
G
89
Posts: 24,529
Reputation: 195,390

Post » Wed Aug 14, 2013 5:59 pm

[QUOTE=Ashley] Nothing's generated, all the files are hand-written. You can copy-paste an existing effect and just tweak the files to make new ones, e.g. changing the name and id and changing the shader code.

The shader language is WebGL's shading language. This is slightly different variant of GLSL that you traditionally get on desktop - it's based on GLSL ES, which is the mobile variant, plus the fact it's run in a browser and is often re-compiled behind the scenes for security reasons. This means desktop GLSL basically never copy-pastes and works - you'll need to carefully port it based on the limitations of WebGL shaders.[/QUOTE]

Ah, thank you. I was originally trying to see if I could get shurcooL's Motion Blur Demo (WebGL based, but I had thought GLSL was used in WebGL. Silly me ^^') to work in Construct. I wasn't gonna use it without permission, but I wanted to see how well it would work in-game. He wrote two separate scripts (One for fragment shading, one for vertex shading.), so I have no idea how I would get those two to work together, even though I don't know how to use the language anyways...

I'll certainty look into the language a bit more and see what kind of neat things I can create on my own, though. Thanks again!
B
28
S
7
G
5
Posts: 202
Reputation: 5,285

Post » Sun Dec 07, 2014 6:41 am

hi @Phobos002 did you have any luck with your Motion Blur effect? I'm looking to do something similar..
B
100
S
33
G
16
Posts: 1,204
Reputation: 16,865

Post » Sun Dec 07, 2014 4:53 pm

Not as an effect, but very recently I made a very decent Motion Blur using R0J0's paster object. The problem is that it's currently a CPU hog and I'm not sure in what ways I can optimize it. I am going to make a thread about it and give the capx for it and see what ideas the community might have. :)

You can see it right now here: https://dl.dropboxusercontent.com/u/214 ... index.html

There are a a few artifacts (Transparancy and rounded pixels) but I'm sure there's a way around it. Let me know what you think!
B
28
S
7
G
5
Posts: 202
Reputation: 5,285

Post » Sun Dec 07, 2014 9:26 pm

I'm really excited to see this Motion blur effect with more optimization.
B
22
S
6
Posts: 244
Reputation: 2,700

Post » Sun Dec 07, 2014 9:53 pm

Wisdoms wrote:I'm really excited to see this Motion blur effect with more optimization.


I am going to try to do the same thing with only sprites and see if it runs any faster. Hopefully it does and we will all have a happy ending :)

EDIT: It's a LOT faster, but it uses a LOT of objects. (25% CPU with 12 entities (24*12 = 288 objects) instead of 50% CPU with 9 entities) Need to find a way to use less objects ._.
B
28
S
7
G
5
Posts: 202
Reputation: 5,285


Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider], Lancifer and 21 guests