[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]]};

B
69
S
24
G
29
Posts: 829
Reputation: 22,751

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
29
S
8
G
4
Posts: 206
Reputation: 5,029

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
41
S
16
G
7
Posts: 1,750
Reputation: 9,963

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
137
S
31
G
87
Posts: 5,562
Reputation: 60,468

Post » Sat Sep 02, 2017 10:16 pm

Hi nice people
Played with the new Color picker on C3 shader very basic shader...
Here a quick made fx for C3 .. My first one..
Install it into C3with addon manager... read the content to learn how to start shader with C3.
This fx take 3 colors parameters and divide sprite area in 3 zone with 3 colors..

http://gigatron3k.free.fr/html5/C3/FX/3colors.c3addon

Regards
B
69
S
24
G
29
Posts: 829
Reputation: 22,751

Post » Sun Sep 03, 2017 9:56 pm

The next fx is 8 layer amiga style starfield...

http://gigatron3k.free.fr/html5/C3/FX/starfield.c3addon
B
69
S
24
G
29
Posts: 829
Reputation: 22,751

Post » Wed Sep 06, 2017 2:19 pm

Salut,
Nouvel utilisateur de construct 3 et ancien, ancien possesseur d'Amiga 500, merci pour ce starfield :D
B
2
Posts: 1
Reputation: 152

Post » Wed Sep 06, 2017 3:28 pm

kenafred wrote:Salut,
Nouvel utilisateur de construct 3 et ancien, ancien possesseur d'Amiga 500, merci pour ce starfield :D

@kenafred

This is an English forum, moderated and searched in English.

Please ensure all posts are in English or provide an English translation, as stipulated in the Forum Rules.

Thank you.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
137
S
31
G
87
Posts: 5,562
Reputation: 60,468

Post » Fri Sep 08, 2017 2:42 am

@Gigatron Can you convert the Skend effect, please?

https://drive.google.com/file/d/0Bx7w7uKTaGzOeGdGUDlCOHdOUTQ/view?usp=sharing
B
74
S
36
G
41
Posts: 444
Reputation: 26,317

Post » Sat Sep 09, 2017 1:37 pm

B
69
S
24
G
29
Posts: 829
Reputation: 22,751

Next

Return to Plugin SDK

Who is online

Users browsing this forum: No registered users and 0 guests