gibbon's Forum Posts

  • Thanks Nepeo,

    I have actually already tried that and although the "distorting" works there is some stange things happening when you scroll on layout or move the sprite.

    And the depending on the "amount" of distorting you set seems to effect the overall size/zoom of the sprite.

    //effect.fx
    precision mediump float;
    
    varying mediump vec2 vTex;
    uniform lowp sampler2D samplerFront;
    
    uniform mediump float scale;
    
    uniform mediump vec2 srcStart;
    uniform mediump vec2 srcEnd;
    
    void main(void)
    {
     mediump vec2 n = (vTex - srcStart) / (srcEnd - srcStart);
     	
     vec2 st = n - 0.5;
     float theta = atan(st.x, st.y);
     float rad = sqrt(dot(st, st));
     rad *= 1.0 + scale * pow(rad, 2.0);
    
     gl_FragColor = texture2D(samplerFront, vec2( 0.5 + sin(theta) * rad, n.y));
     
    }
    

    Andy

  • I am still battling this. The only issue I see is that i cannot workout how to bring through from construct the "resolution" or the sprite size in pixels.

    Based on the following simple method which works on shadertoy (https://www.shadertoy.com/view/3d3SW4)

    the following line:

    vec2 uv = gl_FragCoord.xy/iResolution.xy;

    using a uniform input called iResolution which according to shadertoy is the following:

    uniform vec3 iResolution; //viewport resolution (in pixels)

    How do i get that in C3?

    Thanks

    Andy

  • Thanks Nepeo,

    I am in the same boat as you, its very frustrating as I just cannot get it to work in c3.

    Hoping someone comes along who can get it to work.

    I have managed to put it into shadertoy making it much simpler and using an image.

    however i still cant get it to work in C3??

    shadertoy.com/view/3d3SW4

    Andy

  • > I have found this but cannot get it to not not effect Y shift.

    >

    > thebookofshaders.com/edit.php

    >

    > Hope this helps.

    >

    > Thanks

    You mean like this?

    > 	// Author: Florian Morel
    // Title: glsl-barrel-pincushion example
    
    #ifdef GL_ES
    precision mediump float;
    #endif
    
    uniform vec2 u_resolution;
    uniform vec2 u_mouse;
    uniform float u_time;
    
    float rectangle(vec2 st, vec2 size, vec2 aastep) {
    size = vec2(0.5) - size * 0.5;
    vec2 uv = vec2(smoothstep(size.x - aastep.x, size.x, st.x), smoothstep(size.y - aastep.y, size.y, st.y));
    uv *= vec2(smoothstep(size.x - aastep.x, size.x, 1.0 - st.x), smoothstep(size.y - aastep.y, size.y, 1.0 - st.y));
    
    return uv.x * uv.y;
    }
    
    float lines(vec2 pos, vec2 axis, float gridSize, vec2 aastep) {
    float lineWidth = 1.0;
    vec2 gridPos = pos / gridSize;
    vec2 gridFrac = abs(fract(gridPos) - 0.5);
    vec2 g = clamp((gridFrac - aastep * (lineWidth - 1.0)) / aastep, 0.0, 1.0);
    float c = g.x * g.y;
    return 1.0 - c;
    }
    
    vec2 barrelPincushion(vec2 uv, float k) {
    vec2 st = uv - 0.5;
    float theta = atan(st.x, st.y);
    float radius = sqrt(dot(st, st));
    radius *= 1.0 + k * pow(radius, 2.0);
    
    // return 0.5 + vec2(sin(theta), cos(theta)) * radius;
    
    return vec2(
    0.5 + sin(theta) * radius,
    uv.y
    
    );
    }
    
    void main() {
    vec2 st = gl_FragCoord.xy/u_resolution.xy;
    st.x *= u_resolution.x/u_resolution.y;
    
    vec2 aastep = 2.0 / u_resolution;
    float k = sin(u_time);
    st = barrelPincushion(st, k);
    
    float shape = rectangle(st, vec2(0.5), aastep);
    shape -= rectangle(st, vec2(0.49), aastep);
    
    vec3 color = vec3(1.0);
    float mask = rectangle(st, vec2(0.5), aastep);
    	color += -mask * lines(st, vec2(0.0), 0.05, aastep * 10.0);
    
    gl_FragColor = vec4(color, 1.0 - shape);
    }
    

    The magic is in the barrelPincushion function, the rest is basically for generating and drawing the rectangle. Previously it was taking an input co-ord, transforming it and returning the result. I modified the output to return the new co-ordinate for the X position, and the old for the Y.

    Hi Nepeo, that is spot on, I will have to try and get this into a C3 effect now. Unless you can trim this down for me to make it easier to implement?

    Edit: Im not having much luck due to my lack of knoweldge with C3 and Shaders, anyone like to try and put the above magic function into something that will work with c3?

    Thanks

  • Hi thanks, its sort of what I want but not.

    Ideally I want the shader to act on the sprite its self and not have to have another sprite act as a lens.

    Also i want it to only effect the X axis and not shift Y axis.

    I have attached the shape which I am trying to get back to as near rectangle as possible.

    I think actually what i am looking for is more a pincushion effect?

    I have found this but cannot get it to not not effect Y shift.

    https://thebookofshaders.com/edit.php?log=180726191628

    Hope this helps.

    Thanks

  • Hi, I am trying to find an effect that will remove (or add) barrel distortion along the Y axis.

    Does anyone know of an effect or know how to create/edit an effect to do this?

    Thanks

    Andy

  • Sorry but there are many forum posts asking the same so i would rather it be public for others to see.

    Please post here, for iOS what is required to change the construct splash screen to a custom one.

    It does not need to be done over skype.

  • I still get the feeling that you too don't have experience in changing the splash screen in Xcode, otherwise you would have explained this is in one of your many replies.

    If you do know then please explain, otherwise you are simply guessing with basic answeres that I have already tried, as said in my original post.

    I have experience with xcode and have changed and lanuchimage set, but it is as if the cordova project ignores the lanuchimage set and still uses its own. I have even created a new launchimage set in xcode and assigned it to my project, yet the construct launch image still shows up.

    I appreciate your willingness to help, so please feel free to try it yourself, find the answer and let us all know how its done.

  • Ok, you either doing it on purpose, or something?

    Please please read my original post!!!

    Everything you are suggesting is mentioned in my OP.

  • Thanks, not sure how i missed that one!

  • I really feel like your posting without reason as your not reading my original posts...

    I will repeat again, I have tried changing them in xcode but the C3 splash STILL shows...

    If you specifically know the steps in xcode (that I haven't already done) then please explain.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I am wanting to refrain from having 2 source files for my game (ios and android) as that defeats the whole idea of cross platform and efficient development.

    Admob requires to be platform specific, and has different ID's depending on the platform. Therefore I need to check which platform is being used in order to choose which ID's it uses.

    How do i do this?

    Note: I have seen the browser lets you "compare" the platform, but as the documentation only mentions "Win32 for windows" and nothing else its a guessing game to find out what it will return on iOS and Android?

    Andy

  • Hi, as I said in my original post, I have all my splash screens and icon images.

    Its getting them into C3 / iOS build is the issue...

  • Ashley Any chance of sharing how this can be done?

    I have sieved the forums and only found people asking the same without any answers?

    All i want to do is replace the "construct 3 splash" loader style to an image of my own, which apparently can be done using the paid version which I have.

    The "Use Load Layout" simply shows a black screen, then the layout, where as your construct 3 splash shows instantly.

    I feel this has never been properly explained...

    Andy

  • Is there any up to date documentation on changing the icons and loading / splash screen for iOS builds?

    I have tried and tried with no success.

    Setting the icons in c3 does nothing.

    Have the loading screen set to c3 and then changing all loading images in Xcode does nothing.

    Have loading screen set to nothing in c3 but set the loading images in Xcode shows white screen & no splash.

    I just don’t get what you have to do? I have my icons & splash screen set to all sizes ready, just don’t understand how to get them in & working?

    Thanks