• Welcome to Dark Bit Factory & Gravity.
 

GLSL Shader Fragment Editor V0.42 alpha

Started by inc., January 04, 2017

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

inc.

i'm currently programming a Shader Editor Tool to create on the fly own GLSL Shaders. Of course Shaders are moving and been animated in that tool.
It is possible to manipulate or rewrite or start from the scratch with a brand new GLSL Shader.

Shader Tool Screenshot:



Video TUTORIAL:
https://www.youtube.com/watch?v=pcqRxk3kzOU&feature=youtu.be

no helpfile yet. the video should explain the "how to"

after all it is possible to do some pre work for later Demo and Cracktro Coding.
you can write your own GLSL Shader on the fly and export 'em for PureBasic Demo usage as *.PBI include file. 

LATER:
I'll add a  Demo PB Script too, to make things easier, starting over with the demo programming.

so long.

best
inc


if you encounter bugs, please let me know.

thanks
currently coding in PureBasic: GLSL Shader Maker & Editor Tool for further Demo coding usage

OFFLiNE

I have been beta testing this wonderfull glsl tool and it works like a charme and stable inc well done keep up the great work
(¯`·._.·(¯`·._.·currently Building [AM]WEBDEFF_EDiTOR.·._.·´¯)·._.·´¯)

waste

#2
hello ,

very good job inc ! , works perfectly ,  not on an intel NUC i5 with chipset gfx 

' edit '   it's an intel hd graphics 5000, GLSL version 4.30.....it should work  .txt with infos in attachment 

tested with

- Nvidia Geforce 960GTX 2Go => ok 

- Nvidia Geforce GT610 1 Go => ok


ttemper

Awesome stuff inc.

Any tools to help in the process of demo making is a win... and that it exports directly for PureBasic... :)

-ttemper.

OFFLiNE

Quote from: ttemper on January 06, 2017
Awesome stuff inc.

Any tools to help in the process of demo making is a win... and that it exports directly for PureBasic... :)

-ttemper.

Yeah next step is figuring out how to layer this in a demoscreen so we are able to ad scroller gfx framework etc etc imagine the demos and cracktros we can build then wohooo getting exited
(¯`·._.·(¯`·._.·currently Building [AM]WEBDEFF_EDiTOR.·._.·´¯)·._.·´¯)

OFFLiNE

Another interesting way to use these glsl shaders is to use them for some kind of DJ/VJ program.
This is nothing new and already done.
But im sure we can make this way better then the currently programs that are out there.(they are kinda crappy and pretty basic)
Another interesting idea is to intergrate them in a audio player to load as visuals.
Like mediaplayer has winamp and xm player.
sorry for bugging you al with this just brainstorming a bit about this new GLSL intergrating with purebasic scripting.....
Hope to get you al motivated and see what you come up with  ;D
(¯`·._.·(¯`·._.·currently Building [AM]WEBDEFF_EDiTOR.·._.·´¯)·._.·´¯)

waste

#6
i can't make it work with my intel nuc ....though cinebench r15 opengl test succeed..so opengl is supported,

in shadereditor, preview windows stays black when selecting fragment shader from the list   :-\

OpenGLGadget.pb demo file , display is ok

inc.

Quote from: waste on January 09, 2017
i can't make it work with my intel nuc ....though cinebench r15 opengl test succeed..so opengl is supported,

in shadereditor, preview windows stays black when selecting fragment shader from the list   :-\

OpenGLGadget.pb demo file , display is ok

interesting. can you run this demo on that machine:
http://www.dbfinteractive.com/forum/index.php?topic=6547.msg83666#msg83666
currently coding in PureBasic: GLSL Shader Maker & Editor Tool for further Demo coding usage

waste

i've tested this one at home with nvidia gtx and gt => ok

black screen on NUC , music ok

OFFLiNE

Quote from: waste on January 10, 2017
i've tested this one at home with nvidia gtx and gt => ok

black screen on NUC , music ok

Hmm strange situation waste have you tried this one to :

http://www.dbfinteractive.com/forum/index.php?topic=6547.msg83678#msg83678

It has a lighter GLSL code
When i run the egg demo from inc it shows up but runs slow not smooth
(discovered that the GLSL script code for that demo is demanding quite a lot shadersources from the videocard)
(¯`·._.·(¯`·._.·currently Building [AM]WEBDEFF_EDiTOR.·._.·´¯)·._.·´¯)

inc.

Quote from: waste on January 10, 2017
i've tested this one at home with nvidia gtx and gt => ok

black screen on NUC , music ok

very strange. i just calling a OglGadget and view the shader. Need to discover HardWare specs.
reply soon
currently coding in PureBasic: GLSL Shader Maker & Editor Tool for further Demo coding usage

waste

Quote from: WhiteWolf on January 10, 2017
Quote from: waste on January 10, 2017
i've tested this one at home with nvidia gtx and gt => ok

black screen on NUC , music ok

Hmm strange situation waste have you tried this one to :

http://www.dbfinteractive.com/forum/index.php?topic=6547.msg83678#msg83678

It has a lighter GLSL code
When i run the egg demo from inc it shows up but runs slow not smooth
(discovered that the GLSL script code for that demo is demanding quite a lot shadersources from the videocard)

yes i've tried it, black screen too .... the only shader i managed to run is PLASMOID from Inc  => HLSL

inc.

The plasmoid HLSL Shader is based on real directX9. If DX9 is installed on a System, all is working fine.
Glsl Shader do not need DX9.
I'll dig my code and check fallbacks if it's possible.
If you create in PureBasic on that machine a oglgadged and load a Shader,  does it work?
Do you need code or are you able to write one?
currently coding in PureBasic: GLSL Shader Maker & Editor Tool for further Demo coding usage

waste

hello ,

i should be able to write one but it will take me some time i don't have for the moment ....i must look at the documentation ! not used to shaders enough , i have tested on another pc with intel HD graphics , it failed too ,

can you provide a light code with one simple shader ? i can test it

inc.

Yes, i write a plain code with a oglgadged plus a simple  glsl shader.
Seems to be a problem with pc's and Intel gfx chip cards.
currently coding in PureBasic: GLSL Shader Maker & Editor Tool for further Demo coding usage

OFFLiNE

Quote from: inc. on January 13, 2017
Yes, i write a plain code with a oglgadged plus a simple  glsl shader.
Seems to be a problem with pc's and Intel gfx chip cards.

Yep thats for sure nasty crap im sure there is a solution game industry uses these glsl shaders for ages tho
(¯`·._.·(¯`·._.·currently Building [AM]WEBDEFF_EDiTOR.·._.·´¯)·._.·´¯)

inc.

@waste:

pls try this plain glsl code.

currently coding in PureBasic: GLSL Shader Maker & Editor Tool for further Demo coding usage

waste

tested, nothing displayed , black screen,

inc.

then , i think it is a problem with the on board gfx card. very very strange.
i'll discovering more
currently coding in PureBasic: GLSL Shader Maker & Editor Tool for further Demo coding usage

Rbz

Hi inc,

I did some tests with an Intel HD 4600 and using a tool called Bonzomatic - https://github.com/Gargaj/Bonzomatic/releases/latest

I've used "sinwave_blobs" and "techtunnel" shaders and both worked fine on Bonzomatic and on your tool I got a black/white screen :(.

And here are the shaders that I've tested,  just copy and paste in Bonzomatic.

"sinwave_blobs"
#version 430 core

uniform float fGlobalTime; // in seconds
uniform vec2 v2Resolution; // viewport resolution (in pixels)
// by @mnstrmnch (remixed by @mrdoob)

//uniform vec2 resolution;
//uniform float time;

float f(vec3 o)
{
    float a=(sin(o.x)+o.y*.25)*2.35;
    // o=vec3(cos(fGlobalTime+a)*sin(fGlobalTime+o.x)*o.x-sin(fGlobalTime+a)*o.y,sin(a)*sin(fGlobalTime+o.y)*o.x+cos(fGlobalTime+a)*o.y,o.z);
    o=vec3(sin(fGlobalTime+a)*sin(o.x+o.z/3.0)*o.x,sin(fGlobalTime+a)*cos(o.y+o.z/2.0)*o.y,o.z);
    return dot(cos(o)*cos(o),vec3(1))-1.2;
}

vec3 s(vec3 o,vec3 d)
{
    float t=0.0;
    float dt = 0.2;
    float nh = 0.0;
    float lh = 0.0;
    for(int i=0;i<50;i++)
    {
        nh = f(o+d*t);
        if(nh>0.0) { lh=nh; t+=dt; }
    }

    if( nh > 0.0 ) return vec3(1.0,1.0,1.0);

    t = t - dt*nh/(nh-lh);

    vec3 e=vec3(-.1,.0,0.0);
    vec3 p=o+d*t;
    vec3 n=-normalize(vec3(f(p+e),f(p+e.yxy),f(p+e.yyx))+vec3((sin(p*75.)))*.001);

    return vec3( mix( ((max(-dot(n,vec3(0.977)),0.) + 0.125*max(-dot(n,vec3(-.707,-.707,0)),0.)))*(mod

(length(p.xy)*5.,2.)<1.0?vec3(1.0,1.,1.):vec3(.0,.0,.0))
                           ,vec3(1.0,1.0,1.5), vec3(pow(t/10.,1.5)) ) );
}

void main()
{
    vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / v2Resolution.xy;
    gl_FragColor=vec4(s(vec3(0.0,0.0,fGlobalTime), normalize(vec3(p.xy,sin(fGlobalTime/5.0)*0.25+0.75))),1.0);
}


"techtunnel"
#version 430 core

uniform float fGlobalTime; // in seconds
uniform vec2 v2Resolution; // viewport resolution (in pixels)


//uniform float time;
//uniform vec2 mouse;
//uniform vec2 resolution;

#define PI 3.1415926535897932384626433832795

#define ITER 12

vec2 rotate(vec2 p, float a)
{
return vec2(p.x * cos(a) - p.y * sin(a), p.x * sin(a) + p.y * cos(a));
}

vec2 circuit(vec2 p)
{
p = fract(p);
float r = 0.123;
float v = 0.0, g = 0.0;
float test = 0.0;
r = fract(r * 9184.928);
float cp, d;

d = p.x;
g += pow(clamp(1.0 - abs(d), 0.0, 1.0), 160.0);
d = p.y;
g += pow(clamp(1.0 - abs(d), 0.0, 1.0), 160.0);
d = p.x - 1.0;
g += pow(clamp(1.0 - abs(d), 0.0, 1.0), 160.0);
d = p.y - 1.0;
g += pow(clamp(1.0 - abs(d), 0.0, 1.0), 160.0);

for(int i = 0; i < ITER; i ++)
{
cp = 0.5 + (r - 0.5) * 0.9;
d = p.x - cp;
g += pow(clamp(1.0 - abs(d), 0.0, 1.0), 160.0);
if(d > 0.0)
{
r = fract(r * 4829.013);
p.x = (p.x - cp) / (1.0 - cp);
v += 1.0;
test = r;
}
else
{
r = fract(r * 1239.528);
p.x = p.x / cp;
test = r;
}
p = p.yx;
}
v /= float(ITER);
return vec2(v, g);
}

float box(vec2 p, vec2 b, float r)
{
return length(max(abs(p) - b, 0.0)) - r;
}

float rand(float p)
{
return fract(sin(p * 591.32) * 43758.5357);
}

float rand2(vec2 p)
{
return fract(sin(dot(p.xy, vec2(12.9898, 78.233))) * 43758.5357);
}

vec2 rand2(float p)
{
return fract(vec2(sin(p * 591.32), cos(p * 391.32)));
}

vec3 sky(vec3 rd, float t)
{
float u = atan(rd.z, rd.x) / PI / 2.0;
float v = rd.y / length(rd.xz);
float fg = exp(-0.04 * abs(v));
vec2 ca = circuit(vec2(u, (v - t * 25.0) * 0.03));
vec2 cb = circuit(vec2(-u, (v - t * 50.0) * 0.06));
float c = (ca.x - ca.y * 0.2) + cb.y * 0.7;
vec3 glow = pow(vec3(c), vec3(5.18, 0.8, 0.6) * 3.0);
vec2 cr = vec2(u, (v - t * 25.0) * 0.03);
float crFr = fract(cr.y);
float r = smoothstep(0.8, 0.82, abs(crFr * 2.0 - 1.0));
float vo = 0.0, gl = 0.0;
for(int i = 0; i < 6; i ++)
{
float id = float(i);
vec2 off = rand2(id);
vec2 pp = vec2(fract(cr.x * 5.0 + off.x + t * 8.0 * (0.5 + rand(id))) - 0.5, fract(cr.y * 12.0 + off.y * 0.2) - 0.5);
float di = box(pp, vec2(0.2, 0.01), 0.02);
vo += smoothstep(0.999, 1.0, 1.0 - di);
gl += exp(max(di, 0.0) * -60.0);
}
vo = pow(vo * 4.4, 2.0);
vec3 qds = vec3(1.0);
vec3 col = mix(glow, qds, clamp(vo, 0.0, 6.0)) + vec3(0.0, 0.0, 0.0) * gl * 0.5;
return col + (1.0 - fg);
}

vec3 colorset(float v)
{
return pow(vec3(v), vec3(6.2, 0.4, 1.0) * 4.0);
}



vec3 pixel(vec2 uv)
{
uv /= v2Resolution.xy;
uv = uv * 2.0 - 1.0;
uv.x *= v2Resolution.x / v2Resolution.y;
vec3 ro = vec3(0.0, 0.0, -0.0);
vec3 rd = normalize(vec3(uv, 1.6));
float t = fGlobalTime;
rd.yz = rotate(rd.zy, sin(t) * 0.8 + PI * 0.5);
rd.yz = rotate(rd.yz, t * 0.25);
rd.yx = rotate(rd.xy, sin(t) * 0.1);
rd.yx = rotate(rd.yx, t * 0.1);
vec3 col = sky(rd, t * 0.25);
return pow(col, vec3(1.5)) * 1.3;
}



void main()
{
vec2 uv = gl_FragCoord.xy;
vec3 col;
vec2 h = vec2(0.5, 0.0);
uv += rand2(fGlobalTime) * 6.0;
col = pixel(uv);
col += pixel(uv + h.xy);
col += pixel(uv + h.yx);
col += pixel(uv + h.xx);
col /= 4.0;
gl_FragColor = vec4(col, 0.0);
}
Challenge Trophies Won: