### Author Topic: GLSL Shader Fragment Editor V0.42 alpha  (Read 5920 times)

0 Members and 1 Guest are viewing this topic.

#### OFFLiNE

• ZX 81
• Posts: 23
• Karma: 1
##### Re: GLSL Shader Fragment Editor V0.42 alpha
« Reply #20 on: January 22, 2017 »
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"
Code: [Select]
`#version 430 coreuniform float fGlobalTime; // in secondsuniform 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"
Code: [Select]
`#version 430 coreuniform float fGlobalTime; // in secondsuniform vec2 v2Resolution; // viewport resolution (in pixels)//uniform float time;//uniform vec2 mouse;//uniform vec2 resolution;#define PI 3.1415926535897932384626433832795#define ITER 12vec2 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); }`

Thanx for sharing this RBZ this explains a lot and i think :

### Libraries and other included software Bonzomatic
- Scintilla editing component by the Scintilla Dev Team (http://www.scintilla.org/)
- OpenGL Extension Wrangler Library by Nigel Stewart (http://glew.sourceforge.net/)
- BASS.DLL by Ian Luck (http://www.un4seen.com/)
- STB Image and Truetype libraries by Sean Barrett (http://nothings.org/)
- Simple DirectMedia Layer by the SDL dev team (https://www.libsdl.org/)
- JSON++ by Hong Jiang (https://github.com/hjiang/jsonxx)

The Shadereditor by inc doesnt use Java DirectX or SDL and is capable to run without any of them on most gfx card platforms.
But to make his editor also work on the intels gfx platforms you have pointed out the right solution and way to go.
Greets Wolf
« Last Edit: January 22, 2017 by WhiteWolf »
(¯`·._.·(¯`·._.·currently Building [AM]WEBDEFF_EDiTOR.·._.·´¯)·._.·´¯)

#### inc.

• Contact me @ skype: a5recordings
• Amiga 1200
• Posts: 260
• Karma: 18
• I SPEAK ENGLISH & GERMAN as good as i can :D
##### Re: GLSL Shader Fragment Editor V0.42 alpha
« Reply #21 on: January 23, 2017 »
Thanks RbZ.

This will help to make some minor changes in my PB code. It's good to have a look in the Sourcecode by this tool. Will check this on weekend
currently coding in PureBasic: GLSL Shader Maker & Editor Tool for further Demo coding usage

#### Omnikam

• Atari ST
• Posts: 101
• Karma: 4
##### Re: GLSL Shader Fragment Editor V0.42 alpha
« Reply #22 on: April 12, 2017 »
Fantastic tool inc, could you please post a Pb sample of pbi output integration..please

#### inc.

• Contact me @ skype: a5recordings
• Amiga 1200
• Posts: 260
• Karma: 18
• I SPEAK ENGLISH & GERMAN as good as i can :D
##### Re: GLSL Shader Fragment Editor V0.42 alpha
« Reply #23 on: April 17, 2017 »
will. do. need to finish the whole tool

here is another example what is possible later then. you can add many shader into one exe file with sound and gfx. switching between the shaders very fast to create cool shader effects.

this is a test file: multishaderdemoTest
« Last Edit: April 17, 2017 by inc. »
currently coding in PureBasic: GLSL Shader Maker & Editor Tool for further Demo coding usage

#### Omnikam

• Atari ST
• Posts: 101
• Karma: 4
##### Re: GLSL Shader Fragment Editor V0.42 alpha
« Reply #24 on: April 17, 2017 »

Very Nice work inc.
It`s almost like magic what you can do with shader`s. Im studying the therory behind then atm, but my Linear Algebra is lets say Rusty    I can still remember telling my math teacher  that ill never need Algebra in the real world lol he showed me

#### inc.

• Contact me @ skype: a5recordings
• Amiga 1200
• Posts: 260
• Karma: 18
• I SPEAK ENGLISH & GERMAN as good as i can :D
##### Re: GLSL Shader Fragment Editor V0.42 alpha
« Reply #25 on: April 17, 2017 »

Very Nice work inc.
It`s almost like magic what you can do with shader`s. Im studying the therory behind then atm, but my Linear Algebra is lets say Rusty    I can still remember telling my math teacher  that ill never need Algebra in the real world lol he showed me

let's keep in touch.
i need a translator who translate shaders from https://www.shadertoy.com/ to glsl shaders that work in my tool later then i don't have time to do all that work
currently coding in PureBasic: GLSL Shader Maker & Editor Tool for further Demo coding usage

#### Omnikam

• Atari ST
• Posts: 101
• Karma: 4
##### Re: GLSL Shader Fragment Editor V0.42 alpha
« Reply #26 on: April 17, 2017 »
If you use http://glslsandbox.com/  then you wont need to
They are already in the right format, just copy and paste, but it shoulnt be too hard to convert Toyshader, i hope