[DISCUSSION] my shader effect is broken, but only on export?

0 favourites
  • 5 posts
From the Asset Store
Wind effect
$1.87 USD
25% off
Animated wind effect for objects, grass, trees, etc.
  • Hi!

    So recently I've tried to learn GLSL and I managed to put together a shader for the finish screen in Airscape. It works totally fine in preview, but weirdly enough on export it's slightly broken.

    It seems to be independent of export platform and browser.

    Here's the project that demonstrates the brokenness

    Here's the shader itself.

    (The shader is in two parts, but both share the same bug so I thought I'd provide the one part).

    In preview, it looks like this:

    Exported, it looks like this.

    I briefly tested it on a Mac and it looked even worse in export, with weird pixel glitching etc. No idea if it's related, or a separate problem.

    Does anyone have any idea what's going on? I'm assuming the problem lies in the shader data being added to c2runtime.js on export. The problem happens with or without minification though.

    Thanks!

  • I've had some issues with shaders not working properly after sprite-sheeting, try setting downscaling to LOW on the project properties, see if it has any effect.

  • thank you! That was the problem. I managed to work around it by making the source image 30x30px, I guess because that's a power of 2 with a 1px margin on each side.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Cool, glad i could help.

  • In your case you must declare this variable ;

    vec2 resolution = vec2( 1./pixelWidth, 1./pixelHeight);[/code:21jdqc20]
    
    and inside main code ;
    vec2 uv = vec2(vTex.x * resX, vTex.y * resY); <--- your code
    
    this is the same  but easy ...
    try  : 
    [code:21jdqc20]
    void main()
    {
    vec2 uv = (1.*vTex)*  resolution.xy ;     // this will center correctly the sun 
    .
    .
    .
    }
    [/code:21jdqc20]
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)