[EFFECT]- webglSphere+Glsl version

Share your Construct 2 effect files

Post » Mon Oct 17, 2016 11:57 pm

Today I had to finish a fx for savvy001 sorry ...
So @irbis it took me 2.30h to make this on shadertoy .. https://www.shadertoy.com/view/llyGDK
it's not depending on timer
so you can rotate with value like exactly you want..
So let's see demo... i will finish it this week...
Based on iq primitives and some other rotation function from Shadertoy;

http://gigatron3k.free.fr/html5/C2/FX/sphmap
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
56
S
20
G
29
Posts: 797
Reputation: 21,930

Post » Tue Oct 18, 2016 6:09 am

Gigatron wrote:Today I had to finish a fx for savvy001 sorry ...
So @irbis it took me 2.30h to make this on shadertoy .. https://www.shadertoy.com/view/llyGDK
it's not depending on timer
so you can rotate with value like exactly you want..
So let's see demo... i will finish it this week...
Based on iq primitives and some other rotation function from Shadertoy;

http://gigatron3k.free.fr/html5/C2/FX/sphmap

Almost perfect! Just without that lightning/shading effect please. Just the distortion.
Image
Also, I think I've finaly found a way to pay you back, for all you did for me and all of us. I'll write you a PM :)
B
28
S
8
G
7
Posts: 643
Reputation: 6,457

Post » Tue Oct 18, 2016 2:14 pm

if i remove specular ... http://gigatron3k.free.fr/html5/C2/FX/sphmap

I can't send Mars map to the server !!
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
56
S
20
G
29
Posts: 797
Reputation: 21,930

Post » Sun Nov 06, 2016 3:30 pm

Hey Gigatron, did you ever update that "glsphere" effect to be timer independent? I tried the latest upload but no matter what I do I can't seem to pause/unpause without the effect somehow bugging out.
B
37
S
18
G
18
Posts: 151
Reputation: 11,939

Post » Mon Nov 07, 2016 9:05 pm

@purplemonkey
sorry I saw the message later.. yes i finished it and sent to irbis...
wait a second ... will send via PM to you...
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
56
S
20
G
29
Posts: 797
Reputation: 21,930

Post » Tue Nov 08, 2016 7:14 am

Thanks Gigatron! I tried it and it doesn't seem to be working with transparent sprites. Actually it kind of doesn't seem to work at all, a sphere is created but it doesn't seem to be mapping the sprite in 3D around it like it should be.

//////////////////////////////////
//GlslSphere effect
//webgl sphere mapping for chrisbrobs .. Gigatron
//

precision mediump float;
varying mediump vec2 vTex;
uniform lowp sampler2D samplerFront;
uniform mediump float pixelWidth;
uniform mediump float pixelHeight;
vec2 iResolution = vec2( 1./pixelWidth, 1./pixelHeight);
uniform float seconds;
uniform float RotSpeed,xx,yy,zz;


#define PI 3.14159265358979
#define rotate(point,axiss,angle) vec3 axis = normalize(axiss);float s = sin(angle);float c = cos(angle);float oc = 1.0 - c; mat4 rot = mat4(oc * axis.x * axis.x + c,oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c,oc * axis.y * axis.z - axis.x * s, 0.0,oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c,0.0, 0.0,0.0,0.0,1.0); vec3 rotpoint = (vec4(point,1.)*rot).xyz
vec2 uv (vec3 p) {
float x = p.x;
float y = p.y;
float z = p.z;
float u = atan(x, z) / (2. * PI) + .5;
float v = asin(y) / (PI) + .5;
return vec2(u,v);
}
float map(vec3 r) {
rotate(r,vec3(0,1,0),seconds*RotSpeed);
return length(r)-(3.);
}

vec3 march(vec3 ro, vec3 rd ) {
vec3 r=ro;
vec3 bg=vec3(0.,0.,0.);
for (int i = 0; i < 32; i++) {
float df = map(r);
vec3 nr = normalize(r);
if (df<.01) {
rotate(nr,vec3(yy,xx,zz),seconds*RotSpeed);
vec3 val = texture2D(samplerFront,uv(normalize(rotpoint))).rgb;
return vec3(val);
}
r+=rd*df;
}
// return vec3(vec3(0, rd)*-2.0);
// to do bg color mix !
return vec3(bg);
}


void main(void)
{
vec2 uv = vTex-vec2(0.0,-0.25);
vec3 bgcol=vec3(0.,0.0,0.0);
uv.x =1.-uv.x;
uv.y *=0.65;


vec3 mc = march(vec3(0,0,-20),vec3(uv-.5,1.0) );

if (mc.g>0.05) gl_FragColor = vec4( mc, 1.0);
else
gl_FragColor =vec4(bgcol,0.0);

//fragColor = mix(texcolor, color, color.a*alpha);

}


This one works well with transparent sprites but if I change speed to 0 it turns invisible (and yet still somehow rotates). If there only was a way to make this one fully controllable in speed + x/y/z rotation :(
B
37
S
18
G
18
Posts: 151
Reputation: 11,939

Post » Tue Nov 08, 2016 11:55 am

@purplemonkey
This code above is different ... the fx i ve sent is the best way to do the sphere map..
Dear purplemonkey.. can you explain basically the problem... ?
You want transparent sprite ?? send me picture please .. In most case i use google translator
and not really understand what exactly people wants... google not translate well ...

Is this new demo working for you ??

http://gigatron3k.free.fr/html5/C2/FX/sphmap

The mapped image of mars i used :
Image
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
56
S
20
G
29
Posts: 797
Reputation: 21,930

Post » Tue Nov 08, 2016 1:02 pm

@Gigatron

I hope this image explains my issue.

Image

Thank you again for all your hard work!
B
37
S
18
G
18
Posts: 151
Reputation: 11,939

Post » Tue Nov 08, 2016 1:12 pm

Just made some modification..
try to download again at the same location i ve sent yesterday..
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
56
S
20
G
29
Posts: 797
Reputation: 21,930

Post » Tue Nov 08, 2016 1:18 pm

Gigatron wrote:Just made some modification..
try to download again at the same location i ve sent yesterday..

It's working! Thanks again! <3
B
37
S
18
G
18
Posts: 151
Reputation: 11,939

PreviousNext

Return to Effects

Who is online

Users browsing this forum: No registered users and 0 guests