WebGL Effects change while scrolling

Report Construct 2 bugs here.

Post » Tue Sep 16, 2014 10:58 am

Problem Description
When objects with applied WebGL effects are on a layout that scrolls they change their look / behavior depending on where the layout is.

Description of Capx
The .capx is made up of simple objects with behaviors, there are no events in the eventsheet

Notice how the waterfall changes it's color / style completely when the layout scrolls also notice how the warp effect on the pink rectangle changes when the layout scrolls...

Steps to Reproduce Bug
  • Add object (sprite, tiledbg etc.)
  • Apply a distortion WebGL-Effect
  • Scroll the layout

Observed Result
WebGL Effects change their look / behavior

Expected Result
WebGL Effects stay how they were designed at 0-layout position no matter where the layout is scrolled / scrolling to

Affected Browsers
  • Chrome: (YES)
  • FireFox: (YES)
  • Internet Explorer: (YES)

Operating System and Service Pack
Windows 7 Pro, latest SP
Windows 8.1 Pro, latest SP

Construct 2 Version ID
180 (happened before too)


At work i have an integrated intel graphics card and at home i have a Radeon 290X with latest drivers, it also happens on a friends pc with nvidia graphicscard

EDIT: Forgot CAPX:
WebGLEffect_WTF.capx
You do not have the required permissions to view the files attached to this post.
B
33
S
6
G
7
Posts: 339
Reputation: 7,426

Post » Sun Sep 21, 2014 9:12 am

Could anyone confirm this please?

Here is how it looks in chrome: http://youtu.be/Q9hsV3h7M7U
B
33
S
6
G
7
Posts: 339
Reputation: 7,426

Post » Mon Sep 22, 2014 1:26 pm

It's working correctly, it's just running the shader in screen space instead of layout co-ordinates. Also looks like a duplicate of https://www.scirra.com/forum/effects-scrolling-scaling_t74041.

The shaders need to be updated, or most likely new ones added to process in layout co-ordinates instead and avoid breaking the old shaders.
Scirra Founder
B
395
S
231
G
88
Posts: 24,367
Reputation: 193,694

Post » Mon Sep 22, 2014 2:05 pm

Can i edit the shaders myself and add / change a line or two to fix this?

If so, what would i need to change to make it work?

Thanks :D
B
33
S
6
G
7
Posts: 339
Reputation: 7,426

Post » Thu Oct 09, 2014 6:30 am

BUMP after ~3 Weeks... i really REALLY need this fixed.

I'd do it myself but i have no idea how the shaders work.
B
33
S
6
G
7
Posts: 339
Reputation: 7,426

Post » Mon Nov 10, 2014 2:28 pm

One month later, any update on this issue? :(
B
33
S
6
G
7
Posts: 339
Reputation: 7,426

Post » Wed Nov 12, 2014 2:19 pm

It's not a current priority, and it has been reported a couple of times before (I think there are some duplicate issues going back in the bugs forum). It's a bit tricky really because it's not just scrolling, it's also getting it to display the same when layer scaling and rotation are applied, which significantly complicates the calculations used in some of the shaders, and that's not necessarily a simple problem to solve.
Scirra Founder
B
395
S
231
G
88
Posts: 24,367
Reputation: 193,694

Post » Wed Nov 12, 2014 5:01 pm

Hey Ize, :)

The color change effect you're seeing in the waterfall is coming from the "Lens" effect on the WaterfallTintParticle object. The Lens zooms the background, but it does so relative to the center of the window area, no matter where the effected object is. As far as I know that is the intended behavior for the Lens shader. It gives you a consistent 3D zoom kind of effect across multiple objects regardless of where they are on the screen.

To your other question, yes, you could modify the shaders yourself to get the behavior your looking for. As Ashley mentioned this can get a little complicated. If you want to counteract layout translation, rotation, and scaling, you'll need to have parameters that allow you to feed the current translation, rotation, and scale info to the shader. Since rotation and scale will have a center point that they are rotating or scaling around, you'll have to have parameters that allow you to feed in those cords as well. But it is doable.

What complicates things is that C2 will sometimes automatically account for the translation, rotation, and scaling of an object when rendering shaders, and other times it won't.

To easily see an example of this,
1. Create a new project.
2. Create a red square, and add the "Scan lines" effect to it.
3. If you rotate the square, you'll notice that the lines rotate with it.
4. Leave the square rotated to a diagonal angle.
5. Now add a "Multiply" effect, and place it *above* the "Scan lines" effect, in the effect list.
6. By being the 2nd item in the effect chain, the "Scan lines" effect no longer rotates or translates with the object.

What you can't see with the "Scan lines" effect is that scale is also no longer driven by the object.

If you want to modify an effect to make it completely immune to those issues, you'll have to account for this sometimes-on sometimes-off behavior in your modification as well, and provide a parameter that allows you to disable some of your translation, rotation, and scaling parameters, so that you don't *double* account for those transformations in cases where C2 is already doing it automatically. Also the Y axis is upside down for effects from slot 2 onwards, so you may need to handle that as well, depending on what kind of directional aspects the effect has.

If you just want to try adding in a pair of translation parameters, which might be enough to solve the translation issue you're seeing in the ripples, parameters are set up in an effect's .xml file. The parameters can then be used as variables in the shader code of the effect's .fx file.

This website http://shdr.bkcore.com/ is an in-browser GLSL editor, and a handy way to test proper compilation of shader code, before trying to open the shader in a project.

One really important thing to know when working in GLSL code, is that, unless you explicitly want a number to be an integer, you must add a decimal point and decimal digit to it, even if the digit is zero. (e.g. Use "27.0" NOT "27") It's weird, but it's one of my most common bugs when I'm coding shaders.

The Construct 2 SDK has a template effect that describes how the various parts of the two effect files work. https://www.scirra.com/manual/15/sdk
B
27
S
18
G
8
Posts: 327
Reputation: 6,154

Post » Thu Nov 13, 2014 2:04 pm

@ashley & @fisholith i appreciate your replies, thanks for answering

i hoped it would be a simple fix that could be done in a short time... i'm no programmer so after checking out the shader example and the website i know that i can't fix the shaders myself :(

i guess i'll just have to wait till someone picks this up or ashley has the time to do it.

it's really annoying for me because i rely on shaders alot.


here is another small part of my game spellbook (foliage) that looks pretty awesome 8-) while you don't move (minus some artifacts) but horrible once you jump or move the character :shock:

http://ize.rocks/c2/sbf/
B
33
S
6
G
7
Posts: 339
Reputation: 7,426

Post » Wed Nov 19, 2014 12:11 pm

@Ize , the effect doesn't look as bad as you describe it. It breaks down when you continuously alternate the player's direction from left to right and so forth. Otherwise, if the direction is constant the effect works (a least in my eyes) as well as it does when the player stays still.

I think that if you reduce the amount of the effect (less wind) the effect will look even better and the problem will be even more subtle.
composer - multimedia artist
www.eli0s.com/en/
B
69
S
26
G
5
Posts: 1,146
Reputation: 9,829

Next

Return to Bugs

Who is online

Users browsing this forum: No registered users and 0 guests