Edwin's Forum Posts

  • 3 posts
  • As far as I can tell, the only way to make the bloom effect is to build upon an edge detection algorithm that's applied to texture2D(samplerFront, vTex). Since you need to apply an extension on the bounding box in the XML file for this effect to be any decent, it makes things a little weird.

    Any extension in the XML file turns the entire screen into normalized texture coordinates. So with an extension, the center of the screen is <0.5, 0.5>, whereas without, the center of the sprite has texture coordinates <0.5, 0.5>.

    Should be looking into it after finals.

  • Joannesalfa Thanks.

    Bug appears to be fixed.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Raicuparta I liked this idea and gave it a shot.

    1) Create an empty sprite.

    2) Scale and position this to the area you want to invert.

    3) Make sure it's z-layer is set to the top.

    4) Add the InvertSection effect.

    5) Bang your head against the desk because something goes terribly wrong when using 'Scale inner'.

    Edit: It should work in full screen if you adjust the window size/layout size of your project to match the aspect ratio of the device screen.

    FX File:

    // invertsection.fx
    precision lowp float;
    
    // User settings:
    uniform float vFlip;
    uniform float hFlip;
    
    // Texturing:
    varying vec2 vTex;
    uniform sampler2D samplerBack;
    uniform vec2 destStart;
    uniform vec2 destEnd;
    
    void main(void)
    {
        vec2 tex = vTex;
        if (1.0 == hFlip) tex.s = 1.0 - tex.s;
        if (1.0 == vFlip) tex.t = 1.0 - tex.t;
        gl_FragColor = texture2D(samplerBack, mix(destStart, destEnd, tex));
    }[/code:3qjc6yk9]
    
    XML File:
    [code:3qjc6yk9]<?xml version="1.0" encoding="UTF-8" ?>
    <c2effect>
         <id>invertsection</id>
         <name>Invert Section</name>
         <category>Distortion</category>
         <description>Invert a subsection of the screen about x-axis or y-axis.</description>
         <author>Edwin</author>
    
         <!-- Settings -->
         <extend-box-horizontal>0</extend-box-horizontal>
         <extend-box-vertical>0</extend-box-vertical>
         <blends-background>true</blends-background>
         <cross-sampling>true</cross-sampling>
         <animated>false</animated>
         
         <!-- Parameters -->
         <parameters>
              <param>
                  <name>Vertical Flip</name>
                  <description>Set to 1 if you want to flip vertically.</description>
                  <type>float</type>
                  <initial>0</initial>
                  <uniform>vFlip</uniform>
              </param>
              <param>
                  <name>Horizontal Flip</name>
                  <description>Set to 1 if you want to flip horizontally.</description>
                  <type>float</type>
                  <initial>0</initial>
                  <uniform>hFlip</uniform>
              </param>
         </parameters>
    </c2effect>[/code:3qjc6yk9]Edwin2013-11-21 04:02:29
  • 3 posts