Rechecked all the shaders which give me errors about "no matching overloaded function found", and for the "min", "max" and "round" they are gone. Through found one shader, which still brings error about "rot": https://www.shadertoy.com/view/3dVyD3
I didn't even know that something like this "rot" function exists in GLSL and I didn't spot it on the official khronos reference pages so far. To me it just looks like a shortcut to create a rotation matrix, so:
rot(X) = mat2(cos(X),-sin(X),sin(X),cos(X)) or #define rot(X) mat2(cos(X),-sin(X),sin(X),cos(X))
And indeed, the shader behaves identical if you replace rot(X) by the equivalent mat2 sequence from above. Therefore, as a simple quick workaround, Capehill could add this define into his constant shader prefix. On the other hand, "rot" sounds like sth. people would use quite often, so that workaround could result in problems with other shaders then. If you add it, maybe better make it a function instead of a define.
Or simply ignore this failing shader and leave everything as is, probably the best idea after all.
@Daniel About "rot": all fine, it was just me who takes a shader containing 3 sub shaders : common (with 'rot' defined), mainiamge one, and bufferA (which both use this 'rot'). But when I check it, I just take the whole common part and put to mainimage shader, and bufferA can't find it of course.
So no worry, that just by an error in the end :)
As for this HW_PERFORMANCE warning. If I just do :
1). dbl-click on image.frag 2). RMB->Channels->BufferA->New 3). drop bufferA.frag to active bufferA tab. 4). RMB->Channels->Load Ichannel0 : set there BufferA 5). RMB->Channels->BufferA->Load Ichannel0: set there BufferA as well.
Now, the effect didn't show as expected. But, if I press "Compile", then it starts to works.
But so far we have "auto-compile" when we add anything to the shaderjoy, right? If so, it may be some unexpected behavior I found and after I set the last settings for BufferA, it should auto-compiles ?
Probably, things should "auto compiles" all the time when you add any channel to any buffer or main image. (at least that will be good, imho)
Another issue is when you create more buffers than just BufferA via "new", then they not auto-active.
I think there isn't any implementation to activate specific tab so it should be the default clicktab.gadget behaviour (first tab activated?). Probably can be improved.
@CApehill Sorry to a bit derailing topic back on first pages from half of year ago, but just want a bit to inform Sonic about his shaders which he uploads before as working/glitched/non_working.
@IamSONIC
I retested all your shaders on Warp3DNova 1.82beta, and there is the result below.
For full images just click on thumbs. I didn't make images for every working shader, just choose a bunch of 25 random.
Working ones: they all work as before
Glitches ones: they all work now as expected and didn't glitch:
Now the big list of previously non-working ones, but working now:
Firstly the bad shaders which broken by design:
256b checkerboard zoom : https://www.shadertoy.com/view/MdXyR8 : works, but broken design of shader: have uninitialized variable inout "c" , so right when main{} starts add "c=vec4(0.0);" and it works (at least on Nova 1.82beta). Amiga ball - globe 2 139 chars: https://www.shadertoy.com/view/XlfBW7: works, but also some hacky shader, also have some uninitialized variables. At least "O=vec4(0.0);" to make it works. Amiga-Style Copper Bars: https://www.shadertoy.com/view/lldXRn : works, but bad code, have uninitialized variable "vec4 o", so initialize it to make it works : "vec4 o = vec4(0.0);" inference jani: https://www.shadertoy.com/view/WlSGDh: works, but uninitialized variable again. Set at top of the mainImage fragColor=vec4(0.0); to make it works. Plasma circles: https://www.shadertoy.com/view/XtXGW2: works, but uninitialized variable again. Set at top of the mainImage fragColor=vec4(0.0); to make it works. Inside an Infinity Mirror: https://www.shadertoy.com/view/Wld3zM: broken shader, Division by zero bug: REPEAT.x component is 0 and passed to mod(). (c) Capehill
Now other working from before non-working shaders:
6. Erikson's Wormhole: https://www.shadertoy.com/view/3djyRR: use for Ichannel2 some "volumes", not implemented in ShaderJoy. 7. Ray tracing polygons: can't find this one on ShaderToy base, but I see it use structs, so 99% will fail currently.
Final words:
@All So on the whole, we can say as of the latest beta of Nova there were made some real kicking progress. Of course, some things are still not implemented (some instructions, better work with structures and arrays, some rendering bugs still here meaning there some flaws to find), but on whole it just day and light if we compare Nova 1.82 with 1.65 (or what public version now is). The amount and quality of the working shaders rise quite a lot. There is also a bunch of newly implemented instructions as well which should help AmiBoing guys and fresh GL4ES builds.
Thanks, Hans to spend time on improving it, Mattew who still pays for it, Capehill who still working on ShaderJoy, and Daniel for his work on ogles2 and very valuable to help with everything I ask him ever!
Edited by kas1e on 2020/12/14 20:40:09 Edited by kas1e on 2020/12/14 20:41:45 Edited by kas1e on 2020/12/14 20:57:27 Edited by kas1e on 2020/12/14 20:58:59 Edited by kas1e on 2020/12/14 21:16:07
If so we can probably make a feature request report, just to not forget about it.
Btw, related to ShaderJoy, is there something you works on for the moment ?:) What I really miss now (after checking a lot of shaders with textures and multipass ones) is some description file that ShaderJoy can handle, in which we can write all the paths and options for all ichannels and buffers.
Without that, it will be pretty hard to distribute textured/multipass shaders as they will not be "Dbl-click and it works". Some multipass ones have 6 shaders (main, common, 4 buffers) which have different settings for textures and buffers, and it sometimes quite hard to even run it one time :)
But will be nice to have something like :
01_multipass_shader.sjfrag (sj - shaderjoy, frag - fragment) together with 01_multipass_shader directory, in which put all the textures, main/common/buffers fragments, and describe it all in this sjfrag file.
Or something of that sort... Just so the final result will be that user see an icon, Dbl-click on it, and it just runs and works.
@Capehill After Hans implemented in 1.82 OpImageSampleExplicitLod/OpImageSampleProjExplicitLod and fixing some bugs, there is some really beautiful shaders work as well (click on tumbs for fullsize):
1). dbl-click on image.frag 2). RMB->Channels->BufferA->New 3). drop bufferA.frag to active bufferA tab. 4). RMB->Channels->Load Ichannel0 : set there BufferA 5). RMB->Channels->BufferA->Load Ichannel0: set there BufferA as well.
Now, the effect didn't show as expected. But, if I press "Compile", then it starts to works.
I think issue is specific to this shader and its way to initialize the buffer:
So, it applies noise only in the very beginning. As one has to setup everything manually in Shaderjoy 1.17, changes are that frame counter is 10 or higher by the time everything has been configured. Shaderjoy initializes frame counter when Image shader is loaded. I think project file helps with this.
However, frame counter in Shaderjoy (or toy) doesn't seem to reset when toggling between window/fullscreen so it's possible to see this shader break also in Shadertoy. It breaks differently on Shaderjoy, I think the reason is that FBO is not copied to a new one when toggling happens.
Need to recheck this one when Shaderjoy 1.18 is done.
JSON would be probably better but I have tried to avoid extra dependencies and binary bloat (if statically linked). Maybe later.
ShaderToy uses JSON for its projects, I'd again recommend to clone and eventually expand its specs. Also, the footprint of a simple JSON parser is neglectable (maybe tiny-json is appropriate / good enough for your purpose).
@kas1e Quote:
Plain text format surely much better than any JSON
Certainly not, especially in this case when ShaderToy already uses JSON for that very same task.
@Daniel All the time i look at json config files, it looks like html mess. Lots of tags, tabs and crap. While the pure text file configs like Capehill do always clean, small, slick and just looks feels and understands very good.
Basically cloning the way how shadertoy handle multpass and texture shaders is of no big way, anyway it not straigh copy, and need manual work. So why use that json stuff, if all can be plain, slick , small and clean as we all love ?:)
@Capehill I didn't find a concrete documentation but I find the format rather self-explaining. If you have an account at ShaderToy you can easily download the JSON for a specific shader that way:
- login - go to your apps, create one if you didnt yet and then grab the App Key - browse to a nice simple shader for a start, e.g. this one - in the URL you'll find the shader's ID, in this case Xt2XzW - use that ID and your key to fill out this URL: https://www.shadertoy.com/api/v1/shaders/ID?key=KEY
There you go:
{
"Shader": {
"ver": "0.1",
"info": {
"id": "Xt2XzW",
"date": "1442017330",
"viewed": 5769,
"name": "Beenox goes BlackOps 3",
"username": "fungos",
"description": "my first shader toying, had nothing to do and wanted to try distance fields. still need improve this a lot, mostly reflection and bo3 logo material (maybe some fire), suggestions? :)\n\nSome machines can't compile the shader, help someone?",
"likes": 15,
"published": 3,
"flags": 0,
"usePreview": 0,
"tags": [
"logo",
"distance",
"geometry",
"beenox",
"blackops3",
"cod"
],
"hasliked": 0
},
"renderpass": [
{
"inputs": [
],
"outputs": [
],
"code": "#define A 3.545\n#define B 1.15\n#define M smoothstep\n\n\/\/ rotate on axis Z\nvec3 Z(vec3 v, float a)\n{\n vec3 vo = v; float c = cos(a); float s = sin(a);\n v.x = c * vo.x - s * vo.y;\n v.y = s * vo.x + c * vo.y;\n return v;\n}\n\n\/\/ Rotate on axis Y\nvec3 Y(vec3 v, float a)\n{\n vec3 vo = v; float c = cos(a); float s = sin(a);\n v.x = c * vo.x - s * vo.z;\n v.z = s * vo.x + c * vo.z;\n return v;\n}\n\n\/\/ Torus82\nfloat T(vec3 p, vec2 t)\n{\n vec2 q = vec2(sqrt(p.x * p.x + p.y * p.y) - t.x, p.z);\n q = q*q; q = q*q; q = q*q;\n return pow(q.x + q.y, 1. \/ 8.) - t.y;\n}\n\n\/\/ Gear\nfloat G(vec3 p, float a, float r)\n{\n float d = 1.;\n for (int i = 0; i < 6; i++)\n {\n vec3 q = abs(Z(p, a) - vec3(.0, r + .25, .0));\n d = min(d, max(q.z - .3, max((q.x * .6 + q.y * .7), q.y) - .25));\n a += 1.03;\n }\n \n return max(-d, T(p, vec2(r, .1)));\n}\n\n\/\/ sdBox\nfloat X(vec3 p, vec3 b)\n{\n vec3 d = abs(p) - b;\n return min(max(d.x, max(d.y, d.z)), .0) + length(max(d, .0));\n}\n\n\/\/ sdHexPrism\nfloat H(vec3 p, vec2 h)\n{\n vec3 q = abs(p);\n return max(q.z - h.y, max((q.x + q.y * .3), q.y) - h.x);\n}\n\n\/\/ smin\nfloat S(float a, float b, float k)\n{\n float h = clamp(.5 + .5 * (b - a) \/ k, 0., 1.);\n return mix(b, a, h) - k * h * (1. - h);\n}\n\n\/\/ Beenox\nfloat BX(float t, vec3 p, float f)\n{\n float s = t*t;\n if (t > A) s \/= 2.;\n p = Y(p, s);\n \n float a = G(p, .6, f * .5);\n float b = length(p) - f * .33;\n return min(b, a);\n}\n\n\/\/ Black Ops 3\nfloat BO(vec3 p, float x, float t)\n{\n vec2 z = vec2(.12, .15);\n vec3 w = vec3(.12, z);\n \n \/\/ 1\n float a = X(p - vec3(x, .0, .0), vec3(.14, .6, .15));\n float b = X(p - vec3(x + .1, .48, .0), w);\n float c = H(Z(p - vec3(x + .065, .32, .0), .8), z);\n float d = X(p - vec3(x + .1, -.49, .0), vec3(.12, .11, .15));\n float e = H(Z(p - vec3(x + .065, -.335, .0), -.75), z);\n a = min(a, min(e, min(d, min(c, b))));\n\n \/\/ 2\n c = mix(.0, .15, M(0., 4.5, t));\n d = mix(.0, .2, M(.7, .8, t));\n b = X(p - vec3(.0, .0, .0), vec3(d, .6, c));\n\n \/\/ 3\n c = X(p - vec3(-x, .0, .0), vec3(.13, .6, .15));\n d = X(p - vec3(-x - .1, .48, .0), w);\n e = H(Z(p - vec3(-x - .065, .32, .0), -.8), z);\n float f = X(p - vec3(-x - .1,-.48, .0), vec3(.12, .12, .15));\n float g = H(Z(p - vec3(-x - .065, -.335, .0), .75), z);\n c = min(c, min(g, min(f, min(e, d))));\n \n return min(c, min(b, a));\n}\n\nfloat map(float t, vec3 p)\n{\n float x = 0.;\n float y = 0.;\n\tfloat d = 0.;\n if (t < A + B)\n\t{\n d = BX(t, p, 1.);\n\t}\n else if (t < 5.)\n\t{\n d = BX(A + B, p, 1.);\n\t}\n else if (t < 7.)\n {\n x = BX(A + B, p, M(1.1, 0., t - 5.));\n y = X(p, vec3(.15, .6 * M(0., 1., t - 5. + .4), .15));\n d = S(y, x, .1);\n }\n else\n {\n t -= 7.;\n x = .2 * pow(M(.0, 1., t), .5);\n y = .25 * pow(M(1.2, 3., t), .5);\n d = BO(p, x + y, t);\n }\n\treturn d;\n}\n\n\/\/ plane - intersection with a predefined plane\nvec3 P(vec3 p, vec3 d) \n{\n vec3 n = vec3(0., 1., 0.);\n float f = dot(-n * .8 - p, n) \/ dot(n, d);\n return p + d * f;\n}\n\n\/\/ Material used for the infinite plane\nvec2 MAT(vec2 uv)\n{\n vec2 uv2 = mod(uv, vec2(2.)) - mod(uv, vec2(1.));\n float d = uv2.x + uv2.y; \n d = pow(d - 1., 2.) * .4;\n \n float s = d;\n d += s * .2;\n\n \/\/d - diffuse, s - specular\n return vec2(d, s * s * .5 + .1);\n}\n\n\/\/ render background layer used for reflection\nvec3 BG(vec3 p, vec3 d, vec3 l)\n{\n \/\/ plane normal\n vec3 n = vec3(0., 1., 0.);\n \n \/\/ diffuse lighting for the plane\n float df = dot(n, l) * .5 + .5; \n \n \/\/ to blend the plane with the sky\n float a = max(0., dot(d, -n)); \/\/ alpha - this coefficient is used\n \n \/\/ get the floor material\n vec2 m = MAT(P(p, d).xz); \/\/ x = diffuse coefficient, y = specular coefficient\n \n \/\/ atmosphere\n vec3 at = vec3(.3, .4, .7) * (1. - abs(d.y)) * 1.5;\n\n \/\/ calculate the planes color\n vec3 c = m.x * vec3(.4) * df + (m.y * .7) * (at * .2);\n \n \/\/ reduce fog\n a = pow(a, .4);\n \n \/\/ mix the plane with the sky\n return mix(at, c, a);\n}\n\n\/\/ Normal\nvec3 N(float t, vec3 p, float e)\n{\n\tfloat d = map(t, p);\n\treturn normalize(\n vec3(\n map(t, p + vec3(e, 0, 0)) - d,\n map(t, p + vec3(0, e, 0)) - d,\n map(t, p + vec3(0, 0, e)) - d\n )\n );\n}\n\nvoid mainImage( out vec4 fragColor, in vec2 fragCoord )\n{\n float t = 0.;\n if (iResolution.x <= 400.0) t = mod(iTime - 6.455, 15.);\n else t = mod(iTime, 15.);\n vec2 uv = fragCoord.xy \/ iResolution.xy - .5;\n uv.x *= iResolution.x \/ iResolution.y; \/\/fix aspect ratio\n if (iResolution.y < 200.0) t = A;\n \n \/\/ ray position\n vec3 p = vec3(0., 0., 2.1); \n \n \/\/ ray direction\n vec3 d = normalize(Y(vec3(uv, 1.), 3.14159));\n \n \/\/ light\n vec3 l = vec3(-.5, 1.2, .5);\n \n \/\/ background\n \/\/vec3 c = vec3(0.);\n vec3 c = BG(p, d, l);\n\n \/\/ raymarching\n float di = 0.;\n for (int i = 0; i < 75; i++)\n {\n \/\/ scene\n di = map(t, p);\n p += d * di * .4;\n\n \/\/ too far away from the object or close enough, stop\n if (di > 5. || di < .03) \n break;\n }\n\n if (di < .03)\n {\n vec3 n = N(t, p, .002);\n\n \/\/ a bit more wierd diffuse lighting, but looks great\n float diffuse = dot(l, n) * .1 + .5;\n diffuse = pow(diffuse, 1.5);\n\n \/\/ object color\n c = mix(vec3(.4, .4, 1.4), vec3(.1), M(B, 7., t));\n\n \/\/ reflection\n c = mix(c * diffuse, BG(p, reflect(d, n), l), (1.0 + dot(d, n)) * .6 + .2);\n\n \/\/ self occlusion\n c *= map(t, p + n) * .5 + .5;\n } \n \n \/\/ fade in\n c = mix(c, vec3(0.), M(3., 0., t));\n\n \/\/ fade out\n c = mix(c, vec3(0.), M(14., 15., t)); \n \n fragColor = vec4(c, 1.);\n}",
"name": "Image",
"description": "",
"type": "image"
}
]
}
}
This should give you a good idea on the most important format details already. From there either take a look at shaders with more inputs etc. or play around with your own shader project.
@kas1e Quote:
All the time i look at json config files, it looks like html mess. Lots of tags, tabs and crap.
That sounds as if you were looking at xml and not json. json can be almost as compact as an ini txt file, in fact, if you want, you can easily mimic that like
Apart from the " I see no bloat or less readability compared to an ini file equivalent. Tabs and stuff are purely optional, of course. But if you want you get objects, arrays, some standard types, etc. in a compact, easy to read and most of all standardized way.
I use JSON for some years now for almost all my "I need some data / config / whatever" files. And I never looked back.
That sounds as if you were looking at xml and not json.
Indeed :)
Quote:
json can be almost as compact as an ini txt file, in fact, if you want, you can easily mimic that like
If it can be _that_ clean, then yeah, looks good.
@Capehill I use it for some ports before tiny-json at which Daniel point out, it straight compiles without needs to touch anything and can be inbuild directly to the binary in a static form with no probs.