Somebody's Recent Forum Activity

  • All right, after doing some research (basically reading some other posts here) it looks like I managed to make a working version:

    /////////////////////////////////////////////////////////
    // Selection inline effect
    //
    varying lowp vec2 vTex;
    uniform lowp sampler2D samplerFront;
    
    precision lowp float;
    uniform lowp float pixelWidth;
    uniform lowp float pixelHeight;
    uniform lowp float width;
    
    void main(void)
    {
    	lowp float Alpha = texture2D(samplerFront, vTex).a;
    	
        lowp float A = 1.0 - texture2D(samplerFront, vTex + vec2(0.0, pixelHeight*width)).a;
    	lowp float B = 1.0 - texture2D(samplerFront, vTex + vec2(0.0, -pixelHeight*width)).a;
    	lowp float C = 1.0 - texture2D(samplerFront, vTex + vec2(pixelWidth*width, 0.0)).a;
    	lowp float D = 1.0 - texture2D(samplerFront, vTex + vec2(-pixelWidth*width, 0.0)).a;
    	
        lowp float M = clamp(A+B+C+D,0.0,1.0);
        
    	gl_FragColor = vec4(vec3(M,M,M)*Alpha,Alpha);
    }[/code:2iehbb73]
    
    Initially it works just as expected:
    [img="http://i.imgur.com/dd3M4bs.png"]
    
    But should the sprite be moved strange artefacts appear:
    [img="http://i.imgur.com/bicSiUQ.png"]
    
    And if it's rotated forward and back the artefacts get even worse:
    [img="http://i.imgur.com/Rs4NluD.png"]
    
    I tried changing all the precision settings, but it didn't help. Perhaps someone can explain why this is happening? Perhaps that someone could be @Ashley (I realise you are very busy, but I really would like to understand the Shader behaviour). I'm attaching the Shader itself for easier testing if necessary.
  • I managed to work around it by making (or rather borrowing and adapting) my own Hsb shader (in signature).

  • Sounds like a job for shaders. My scale effect is based on the bottom left at the moment, but could be modified to center vertically.

    But if you aim for a mobile platform then shaders aren't reliable.

    Can you share a video of the effect in action in Castle of illusion?

  • Now that's some quality stuff right there. I wish the launch countdown was shorter, though.

    Otherwise an awesome low key graphical style and challenging gameplay.

  • Hi, shaderheads!

    I have been learning my way around shaders, but all this premultiplied alpha business is still going over my head.

    Here's what I want to do - make an "inline" effect - base the brightness of a given pixel on the inverse alpha value of nearby pixels. My code looks like this at the moment:

    /////////////////////////////////////////////////////////
    // Selection inline effect
    //
    varying mediump vec2 vTex;
    uniform lowp sampler2D samplerFront;
    
    precision lowp float;
    uniform lowp float pixelWidth;
    uniform lowp float pixelHeight;
    
    void main(void)
    {
    	lowp vec4 front = texture2D(samplerFront, vTex);
    	
        float A = 1.0 - texture2D(samplerFront, vTex + vec2(0, pixelHeight)).a;
    	float B = 1.0 - texture2D(samplerFront, vTex + vec2(0, -pixelHeight)).a;
    	float C = 1.0 - texture2D(samplerFront, vTex + vec2(pixelWidth, 0)).a;
    	float D = 1.0 - texture2D(samplerFront, vTex + vec2(-pixelWidth, 0)).a;
    	
        float M = clamp(A+B+C+D,0.0,1.0);
    
    	front.rgb = vec3(M,M,M);
        
    	gl_FragColor = front;
    }[/code:a5lwjud4]
    
    But the values don't work out the way one might expect. What needs to be done so we basically keep the same alpha of the original image AND change the pixel colors?
  • Ah ah, add some bouncing metal letters and you're ready for some serious 90's Atari ST demoscene!

    Surely you mean Twisting letters?

    Added to the repo and first post.

    I love the scroll most of them all!

    It's rather neat™ indeed Thanks!

  • Also, since so far it looks like the effect is static - it would be a VERY good idea to do it without shaders as they tend to eat a decent chunk of performance (also possible compatibility problems as we can see here).

  • Depending on how resource intensive your scene is - the easiest way is to make that one dot you have rotating spawn other dots - frequency depends on movement speed.

  • We will streamline this process in future versions, and there is a detailed tutorial on how to use the C2 plugin linked in my signature.

    Hi, lucid! Any, even foggy, idea when that might happen? Guess you are still polishing that reference implementation, but I cannot wait to be able to just drag, drop and forget (any setup for) a Spriter animation into C2

  • Somebody Fantastic! Hail to the shader king! Grabbing this right now : )

    Aw, far from it, but I made another one - it's not quite what I had in mind (will try to make a proportional version), but it's kinda... special... (EPILEPSY WARNING) (this demo uses three of my shaders - Adjust HSB for color cycling, Scroll for the seamless ship movement and RotoScale for the madness):

    https://dl.dropboxusercontent.com/u/132 ... index.html

    The beast is called RotoScale and it can be found in the repo. It actually wasn't meant to be in any way similarish to R0J0's neat Mode7, but if the screen is non-square it just happens. Without the rotation it has a decent amount of interesting uses as well. Enjoy!

  • Your target platform probably doesn't support WebGL effects.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think you are hardly "stuck" with C2 if C3 is like 2 years away - just use what works, finish the game, make a sequel/another game with C3 (if it's out by then).

Somebody's avatar

Somebody

Member since 12 Feb, 2010

Twitter
Somebody has 2 followers

Trophy Case

  • 14-Year Club
  • Email Verified

Progress

15/44
How to earn trophies