[C3][Effects]

For discussion and help with the Construct 3 Plugin SDK

Post » Thu May 04, 2017 8:46 pm

@Ashley
It take me 5 minutes to convert the basic Shadertoy shader to C3 ... it's long !! And what about the \n for every lines ??... the C3 fx is unreadable ... or effects sdk will simple ? The only advantage is the removed .xml file.
I have quickly madea converter :(

http://gigatron3k.free.fr/html5/C3/FX/sttc3/

Thanks

Here is a simple conversion :

Shadertoy ;
Code: Select all
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
   vec2 uv = fragCoord.xy / iResolution.xy;
   fragColor = vec4(uv,0.5+0.5*sin(iGlobalTime),1.0);
}


C3 shader :

Code: Select all

cr.shaders = {};
cr.shaders ["myfx"] = {"src":"#ifdef GL_ES
precision mediump float;\n
#endif

// Construct base uniforms .........

uniform mediump sampler2D samplerFront;\n
varying mediump vec2 vTex;\n
uniform mediump float seconds;\n
uniform mediump float date;\n
uniform mediump float pixelWidth;\n
uniform mediump float pixelHeight;\n
vec2 iResolution = vec2( 1./pixelWidth, 1./pixelHeight);\n
uniform mediump float speed;\n
void main()\n
{\n
   vec2 uv = vTex;\n
   gl_FragColor = vec4(uv,0.5+0.5*sin(seconds*speed),1.0);\n
}","extendBoxHorizontal":0,"extendBoxVertical":0,"crossSampling":false,"preservesOpaqueness":false,"animated":true,"parameters":[["speed",0,1]]};

http://gigatron3k.free.fr/Intro/

https://www.shadertoy.com/user/gigatron

https://twitter.com/realistquantum

Ezekiel 1-4 ; ufo landing explanation ..

CONSTRUCT 2 THE ONLY FAST WAY TO HTML5

Image
B
57
S
20
G
29
Posts: 804
Reputation: 21,969

Post » Mon May 22, 2017 11:33 am

Great job! How can one then add these shaders to the Effects though? Sorry I'm a noob.
B
26
S
7
G
4
Posts: 204
Reputation: 4,783

Post » Sun Jul 30, 2017 12:49 pm

how can i use this shadertoy with construct 2??

Code: Select all
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
   
   
    vec2 position = ( fragCoord.xy - iResolution.xy*.5 ) / iResolution.x;

        // 256 angle steps
        float angle = atan(position.y,position.x)/(1.*2.14159265359);
        angle -= floor(angle);
        float rad = length(position);
       
        float color = 0.0;
        for (int i = 0; i < 2; i++) {
            float angleFract = fract(angle*36.);
            float angleRnd = floor(angle*360.)+1.;
            float angleRnd1 = fract(angleRnd*fract(angleRnd*.7)*45.1);
            float angleRnd2 = fract(angleRnd*fract(angleRnd*.97)*13.724);
            float t = iGlobalTime+angleRnd1*10.;
            float radDist = sqrt(angleRnd2+float(i));
           
            float adist = radDist/rad*.1;
            float dist = (t*.2+adist);
            dist = abs(fract(dist)-.2);
            color += max(0.,.5-dist*50./adist)*(.5-abs(angleFract-.1))*1./adist/radDist;
           
            angle = fract(angle);
        }
   
   
   
   
   
   
   fragColor = vec4(color,color,color,1.0);
}
B
36
S
13
G
7
Posts: 1,648
Reputation: 9,323

Post » Sun Jul 30, 2017 1:00 pm

imothep85 wrote:how can i use this shadertoy with construct 2??

Code: Select all
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
   
   
    vec2 position = ( fragCoord.xy - iResolution.xy*.5 ) / iResolution.x;

        // 256 angle steps
        float angle = atan(position.y,position.x)/(1.*2.14159265359);
        angle -= floor(angle);
        float rad = length(position);
       
        float color = 0.0;
        for (int i = 0; i < 2; i++) {
            float angleFract = fract(angle*36.);
            float angleRnd = floor(angle*360.)+1.;
            float angleRnd1 = fract(angleRnd*fract(angleRnd*.7)*45.1);
            float angleRnd2 = fract(angleRnd*fract(angleRnd*.97)*13.724);
            float t = iGlobalTime+angleRnd1*10.;
            float radDist = sqrt(angleRnd2+float(i));
           
            float adist = radDist/rad*.1;
            float dist = (t*.2+adist);
            dist = abs(fract(dist)-.2);
            color += max(0.,.5-dist*50./adist)*(.5-abs(angleFract-.1))*1./adist/radDist;
           
            angle = fract(angle);
        }
   
   
   
   
   
   
   fragColor = vec4(color,color,color,1.0);
}


@imothep85

This section is for C3 effects.

C2 effects discussions and creations should go HERE.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
132
S
29
G
81
Posts: 5,329
Reputation: 56,657


Return to Plugin SDK

Who is online

Users browsing this forum: No registered users and 0 guests