matriax's Forum Posts

  • Is for drawing purposes, no colissions needed.

    Here the main idea:

    cdn.pbrd.co/images/HTWNHMh.gif

    (This is from some animation graph program)

    But imagine you start with a square, triangle,etc.. and you add/remove/edit vertices. Between each vertice there is a tension point to generate the curves

  • Is possible create some shader to do this?

    Start with a Triangle, Square,etc... and then edit the vertices position, and between each vertice a tension point for curves.

    cdn.pbrd.co/images/HWgs3EX.png

    Tried with canvas plugin but, or can't be done or to make this needs lots of math skills i not have :(

    Any idea?

  • I see, but is a normal mag generation only, the other by gameswrap add the normal map to the sprite is the FX in real time, btw looks interesting i will take a look too, thanks!

  • I have the donelwero one that i did time ago an extended version with 3 lights a lots of variables.

    In discord one sentme the GamesWarp one, thats seems is the right one i was looking for, still not sure.

    Can you post a link to the ChrisbRobs one please?

  • Time ago looking for normal maps FX found one that no needs another image with the normals, there was a .FX that applied to an image just adds normals and seems even some specular, but can't find it now.

    Anybody know or have it? Tried to look in the forum but always get a 404 not found and via google only can find my own one i did time ago that requieres a separate image and the C2 default, the bumpmapping.

  • Time ago looking for normal maps FX found one that no needs another image with the normals, there was a .FX that applied to an image just adds normals and seems even some specular, but can't find it now.

    Anybody know or have it? Tried to look in the forum but always get a 404 not found and via google only can find my own one i did time ago that requieres a separate image and the C2 default, the bumpmapping.

  • Ok, so DIstace Blur with much better perfomance:

    Distance BLur

    FX = pastebin.com/Vtub5adK

    XML = pastebin.com/ZvaqCb6Q

    THis time the .XML includes the parameters for Strenght and Radial to set for much 100% focus distance from center.

  • Found a new and more simple shader, due the previous one get 15% of the GPU, very heavy. Again this one converted with the Gigatron tool, no errors, but only affects to sprites and seems blur too much at100% my sprites are 12x12 with HD scale, on Layout/layer not works ¿?, how to fix ? Based on this one: shadertoy.com/view/MsffDl .

    #ifdef GL_ES
    precision mediump float;
    #endif
    
    #extension GL_OES_standard_derivatives : disable
    
    //// START C2 UNIFORMS HEADER ////
    
    uniform sampler2D samplerBack;
    uniform sampler2D samplerFront;
    varying vec2 vTex;
    uniform vec2 destStart;
    uniform vec2 destEnd;
    uniform float pixelWidth;
    uniform float pixelHeight;
    vec2 iResolution = vec2( 1./pixelWidth, 1./pixelHeight);
    
    //// END C2 HEADER ////
    
    
    
    void main()
    {
    	vec2 uv = gl_FragCoord.xy / iResolution.xy;
     float r = iResolution.y / iResolution.x;
     vec2 m = vec2(iResolution.x/2.0,iResolution.y/2.0) / iResolution.xy;
     vec2 coord = uv - 0.5;
    	gl_FragColor = texture2D(samplerFront, uv, m.x* 10.0 * sqrt(dot(coord * 1.0, coord)) * 1.0);
    }
    

    Any idea how to fix?

  • On this line:

    "float sigma2 = max(sigma - 1.0, 0.0);"

    Change X to make the focus zone more o less big

    "float sigma2 = max(sigma - X.0, 0.0);"

    And here:

    "const int filterSize = 15;"

    Set how much intensity for the blur.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Based on this one: shadertoy.com/view/MdtXWr , and with help of one on my twitter folllowers i achieved it, shared here in text format, so always will be available :P .

    DistanceBlur.FX

    #ifdef GL_ES
    precision mediump float;
    #endif
    
    #extension GL_OES_standard_derivatives : disable
    
    //// START C2 UNIFORMS HEADER ////
    
    uniform sampler2D samplerBack;
    uniform sampler2D samplerFront;
    varying vec2 vTex;
    uniform vec2 destStart;
    uniform vec2 destEnd;
    uniform float seconds;
    uniform float pixelWidth;
    uniform float pixelHeight;
    vec2 iResolution = vec2( 1./pixelWidth, 1./pixelHeight);
    
    //// END C2 HEADER ////
    
    
    
    const int filterSize = 15; // must be odd
    const float texture2DSize = 512.0;
    
    const int halfFilterSize = filterSize / 2;
    const float pixelSize = (1.0 / texture2DSize);
    
    float Gaussian (float x, float sigma)
    {
     return exp(-(x*x) / (2.0 * sigma*sigma));
    }
    
    vec3 BlurredPixel (in vec2 uv)
    {
     float sigma = 5.0 * length(vec2(iResolution.x/2.0,iResolution.y/2.0)/ iResolution.xy - uv);
     
     float sigma2 = max(sigma - 1.0, 0.0);
     
     float total = 0.0;
     vec3 ret = vec3(0);
     
     for (int iy = 0; iy < filterSize; iy++)
     {
     float fy = Gaussian (float(iy) - float(halfFilterSize), sigma2);
     float offsety = float(iy-halfFilterSize) * pixelSize;
     
     for (int ix = 0; ix < filterSize; ix++)
     {
     float fx = Gaussian (float(ix) - float(halfFilterSize), sigma2);
     float offsetx = float(ix-halfFilterSize) * pixelSize;
     
     float f = fx*fy;
     total += f;
     ret += texture2D(samplerFront, uv + vec2(offsetx, offsety)).rgb * f;
     }
     }
     return ret / total;
    }
    
    void main()
    {
    	vec2 uv = gl_FragCoord.xy / iResolution.xy;
    	gl_FragColor = vec4(BlurredPixel(uv), 1.0);
    }

    DistanceBlur.xml

    <?xml version="1.0" encoding="UTF-8" ?>
    <c2effect>
    
    <id>DistanceBlur</id>
    <name>DistanceBlur</name>
    <category>Distortion</category>
    <description>DistanceBlur</description>
    <author>DavitMasia</author>
    
    <extend-box-horizontal>0</extend-box-horizontal>
    <extend-box-vertical>0</extend-box-vertical>
    <blends-background>false</blends-background>
    <cross-sampling>false</cross-sampling>
    <preserves-opaqueness>false</preserves-opaqueness>
    <animated>false</animated>
    
    <parameters>
    
    
    <param>
    <name>Param Name</name>
    <description>Param Description</description>
    <type>float</type>
    <initial>Param Initial Value</initial>
    <uniform>Param Uniform</uniform>
    </param>
    
    <param>
    <name>Param Name</name>
    <description>Param Description</description>
    <type>float</type>
    <initial>Param Initial Value</initial>
    <uniform>Param Uniform</uniform>
    </param>
    
    <param>
    <name>Param Name</name>
    <description>Param Description</description>
    <type>float</type>
    <initial>Param Initial Value</initial>
    <uniform>Param Uniform</uniform>
    </param>
    
    <param>
    <name>Param Name</name>
    <description>Param Description</description>
    <type>float</type>
    <initial>Param Initial Value</initial>
    <uniform>Param Uniform</uniform>
    </param>
    
    </parameters>
    
    </c2effect>
  • I tried the blur mask effect trick from some tutorials and not bad but not que final quality i'm looking.

    Actually doing by distance using sprites and giving more o less and looks great. But to optimize instead of each sprite want to do in a tilemap and for that needs to be something applied like the blur mask globally.

    Tried looking on shadertoy and saw various Blur shaders but are applied to all the image. I'm looking a blur distance that applied in a layout from center to corners with some intensity parameter.

  • Working on a 2D platformer, Megaman Style, using my own 16 color palette.

    Subscribe to Construct videos now

    You can follow all the process and step by step on my twitter

    https://twitter.com/DavitMasia

  • Working on a 2D platformer, Megaman Style, using my own 16 color palette.

    Trying to upload an image using the img tag and the forum thing and nothings works :S

    So well, you can follow all the process and step by step on my twitter

    https://twitter.com/DavitMasia

  • Hi Gigatron ,

    This shader can be done in COnstruct2?

    shadertoy.com/view/lsGBRK

    If i remember well, contruct 2 is not able to work with shaders with multiple channels/images as far as i know, i guess you told me the same but not sure now.

    What this shaders does is what we tried months ago, apply a color palete based on a texture to an image.

    Is possible?

    Also maybe R0J0hound , Ashley know if is possible?

    I tried with the Gigatron converter that gives me this:

    #ifdef GL_ES
    precision mediump float;
    #endif
    
    #extension GL_OES_standard_derivatives : disable
    
    //// START C2 UNIFORMS HEADER ////
    
    uniform sampler2D samplerBack;
    uniform sampler2D samplerFront;
    varying vec2 vTex;
    uniform vec2 destStart;
    uniform vec2 destEnd;
    uniform float seconds;
    uniform float pixelWidth;
    uniform float pixelHeight;
    vec2 iResolution = vec2( 1./pixelWidth, 1./pixelHeight);
    
    //// END C2 HEADER ////
    
    
    
    // samplerFront = source image
    // iChannel1 = palette image (should be 1-dimensional)
    
    #define BRIGHTNESS 1.0
    #define NUMCOLORS 16.0
    
    vec3 find_closest (vec3 ref) {	
    	vec3 old = vec3 (100.0*255.0);		
    	#define TRY_COLOR(new) old = mix (new, old, step (length (old-ref), length (new-ref)));	
     for (float i = 0.0; i < 1.0; i+=1.0/NUMCOLORS) {
     TRY_COLOR(texture2D(iChannel1, vec2(i,0.4)).rgb * BRIGHTNESS);
     }
     
    	return old ;
    }
    
    
    void main()
    {
    	vec2 uv = gl_FragCoord.xy / iResolution.xy;
    	vec3 tc = texture2D(samplerFront, uv).xyz;
    	gl_FragColor = vec4(find_closest(tc),1.0);		
    
    

    But lots of erros i can't solve :S

  • Just change the Pixelation H and W in the General properties. When the image gets exported you will have a version at real 1x1 scale.

    I mean, a 512x512 image with 4x pixelation will be exported as 128x128 ready to be used in any game,etc... without need to do a resize or whatever to get the real aspect ratio or 1:1 pixels.