[EFFECT]- webglSphere+Glsl version

Share your Construct 2 effect files

Post » Sun Dec 25, 2016 3:28 pm

MatheusCastellar wrote:@Gigatron

How to fix this? Padding :cry:


its clearly that he did not fixed that one yet, however, if you are looking for collisions because of padding is so big, you can only do 1 thing,which is add 1 more sprite for collision and the sphere above to make it look like a ball or planet, the padding will happen, since im guessing glsphere is using the image in the sprite on its curent size to map a surtain radius, if wold say change the sprite size upon 1st view drop then the glsphere wold adapt again and then shrink and so on till it basically reaches size 0 and then nothing will show... or will go on negative side and give u a error. but i might be wrong :D i have the same issue at this moment, im trying to use the glsphere to fake some 3dish thing, but collisions might create some problems but not something i cant "patch".
B
78
S
23
G
69
Posts: 1,353
Reputation: 44,005

Post » Sun Dec 25, 2016 6:50 pm

I have allready fixed this.. and sent by pm...
B
66
S
24
G
29
Posts: 823
Reputation: 22,644

Post » Sun Dec 25, 2016 9:15 pm

Gigatron wrote:I have allready fixed this.. and sent by pm...


my bad :D im still having a padding, but its not a problem, since physics behavior if you use a circle collision from physics it automatically takes the visible sprite, not the square one. so my issue is fixed here is my pool test , now i have to figure out, how your speed of rotation is moving in comparison with physics velocity :D then il have a perfect fake 3d pool game.

also the one im using is the spheremat? i think, cause glsl wold make a surtain black to be transparent and a surtain red/dark red to be transparent, but i found a % around the transparency in C2 and it worked, however im using spheremat, cause the rotation stop and the ball effect still shows even if no rotation is applied. :D and works perfect for me! :D


many thanks FX Senpai!
B
78
S
23
G
69
Posts: 1,353
Reputation: 44,005

Post » Sun Jan 22, 2017 5:34 pm

Well... the distortion sure does work @Gigatron
The problem is elsewhere. Look at here
Image
Compare how the texture looks and how it looks after shader.
Everything is a bit oversaturated and overexposed (too white/bright).
Why is that? And can you get rid of it? I've noticed its visible on your "mars" example too.
The texture is dark and detailed when the sphere version is bright as sun :)
B
29
S
8
G
7
Posts: 643
Reputation: 6,482

Post » Mon Jan 23, 2017 10:50 pm

irbis wrote:Well... the distortion sure does work @Gigatron

Compare how the texture looks and how it looks after shader.
Everything is a bit oversaturated and overexposed (too white/bright).
Why is that? And can you get rid of it? I've noticed its visible on your "mars" example too.
The texture is dark and detailed when the sphere version is bright as sun :)


It's not hard to correct this , unfortunately i ve done many change on this shader ...So
can you PM me the shader you use ? i will modify this one ...

Thanks
B
66
S
24
G
29
Posts: 823
Reputation: 22,644

Post » Tue Jan 24, 2017 6:25 am

Gigatron wrote:
irbis wrote:Well... the distortion sure does work @Gigatron

Compare how the texture looks and how it looks after shader.
Everything is a bit oversaturated and overexposed (too white/bright).
Why is that? And can you get rid of it? I've noticed its visible on your "mars" example too.
The texture is dark and detailed when the sphere version is bright as sun :)


It's not hard to correct this , unfortunately i ve done many change on this shader ...So
can you PM me the shader you use ? i will modify this one ...

Thanks

I've played a bit with Chris's 2nd version and somehow made that one work hehe ^^
But holy cow - working with C2 shaders is no fun :(
At least I've learned how to modify any shader to enable/add more options
B
29
S
8
G
7
Posts: 643
Reputation: 6,482

Post » Tue Jan 24, 2017 6:31 am

I've played a bit with Chris's 2nd version and somehow made that one work hehe ^^
But holy cow - working with C2 shaders is no fun :(
At least I've learned how to modify any shader to enable/add more options

Be sure it's really easy ... after long time study ;)
For online test use shadertoy if it's ok .. convert it to C2 ... etc
B
66
S
24
G
29
Posts: 823
Reputation: 22,644

Post » Sat Jan 28, 2017 11:18 am

Gigatron wrote:
I've played a bit with Chris's 2nd version and somehow made that one work hehe ^^
But holy cow - working with C2 shaders is no fun :(
At least I've learned how to modify any shader to enable/add more options

Be sure it's really easy ... after long time study ;)
For online test use shadertoy if it's ok .. convert it to C2 ... etc

no idea how to convert/import those to C2 :(
B
29
S
8
G
7
Posts: 643
Reputation: 6,482

Post » Sat Jan 28, 2017 9:29 pm

@irbis
Select a shader , and i will try to explain step by step to Convert that to C2 ..

Regards
B
66
S
24
G
29
Posts: 823
Reputation: 22,644

Post » Sun Jan 29, 2017 9:31 am

Gigatron wrote:@irbis
Select a shader , and i will try to explain step by step to Convert that to C2 ..

Regards

hah! easy to say! If I would have a magic lamp with a genie inside - I would ask him for ALL of shadertoy's shaders to get ported to C2 :D

Lets try with something funky, I would kill to get a C2 version of this!~ <3
https://www.shadertoy.com/view/lsfGD2
or is it too advanced for me? :(

Code: Select all
float sat( float t ) {
   return clamp( t, 0.0, 1.0 );
}

vec2 sat( vec2 t ) {
   return clamp( t, 0.0, 1.0 );
}

//remaps inteval [a;b] to [0;1]
float remap  ( float t, float a, float b ) {
   return sat( (t - a) / (b - a) );
}

//note: /\ t=[0;0.5;1], y=[0;1;0]
float linterp( float t ) {
   return sat( 1.0 - abs( 2.0*t - 1.0 ) );
}

vec3 spectrum_offset( float t ) {
   vec3 ret;
   float lo = step(t,0.5);
   float hi = 1.0-lo;
   float w = linterp( remap( t, 1.0/6.0, 5.0/6.0 ) );
   float neg_w = 1.0-w;
   ret = vec3(lo,1.0,hi) * vec3(neg_w, w, neg_w);
   return pow( ret, vec3(1.0/2.2) );
}

//note: [0;1]
float rand( vec2 n ) {
  return fract(sin(dot(n.xy, vec2(12.9898, 78.233)))* 43758.5453);
}

//note: [-1;1]
float srand( vec2 n ) {
   return rand(n) * 2.0 - 1.0;
}

float trunc( float x, float num_levels )
{
   return floor(x*num_levels) / num_levels;
}
vec2 trunc( vec2 x, float num_levels )
{
   return floor(x*num_levels) / num_levels;
}

void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
   vec2 uv = fragCoord.xy / iResolution.xy;
    uv.y = 1.0 - uv.y;
   
   float time = mod(iGlobalTime, 32.0); // + modelmat[0].x + modelmat[0].z;

   float GLITCH = 0.1 + iMouse.x / iResolution.x;
   
   float gnm = sat( GLITCH );
   float rnd0 = rand( trunc( vec2(time, time), 6.0 ) );
   float r0 = sat((1.0-gnm)*0.7 + rnd0);
   float rnd1 = rand( vec2(trunc( uv.x, 10.0*r0 ), time) ); //horz
   //float r1 = 1.0f - sat( (1.0f-gnm)*0.5f + rnd1 );
   float r1 = 0.5 - 0.5 * gnm + rnd1;
   r1 = 1.0 - max( 0.0, ((r1<1.0) ? r1 : 0.9999999) ); //note: weird ass bug on old drivers
   float rnd2 = rand( vec2(trunc( uv.y, 40.0*r1 ), time) ); //vert
   float r2 = sat( rnd2 );

   float rnd3 = rand( vec2(trunc( uv.y, 10.0*r0 ), time) );
   float r3 = (1.0-sat(rnd3+0.8)) - 0.1;

   float pxrnd = rand( uv + time );

   float ofs = 0.05 * r2 * GLITCH * ( rnd0 > 0.5 ? 1.0 : -1.0 );
   ofs += 0.5 * pxrnd * ofs;

   uv.y += 0.1 * r3 * GLITCH;

    const int NUM_SAMPLES = 10;
    const float RCP_NUM_SAMPLES_F = 1.0 / float(NUM_SAMPLES);
   
   vec4 sum = vec4(0.0);
   vec3 wsum = vec3(0.0);
   for( int i=0; i<NUM_SAMPLES; ++i )
   {
      float t = float(i) * RCP_NUM_SAMPLES_F;
      uv.x = sat( uv.x + ofs * t );
      vec4 samplecol = texture2D( iChannel0, uv, -10.0 );
      vec3 s = spectrum_offset( t );
      samplecol.rgb = samplecol.rgb * s;
      sum += samplecol;
      wsum += s;
   }
   sum.rgb /= wsum;
   sum.a *= RCP_NUM_SAMPLES_F;

   fragColor.a = sum.a;
   fragColor.rgb = sum.rgb; // * outcol0.a;
}
B
29
S
8
G
7
Posts: 643
Reputation: 6,482

PreviousNext

Return to Effects

Who is online

Users browsing this forum: No registered users and 0 guests