Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
169 user(s) are online (129 user(s) are browsing Forums)

Members: 0
Guests: 169

more...

Headlines

Forum Index


Board index » All Posts (Daytona675x)




Re: OS4 UPDAAAATEE !!! BANANA !!
Not too shy to talk
Not too shy to talk


Great stuff and a big "eat that" to all the nay-sayers and those oh-so-well informed people who repeatedly claimed that there was no activity
Thanks to all involved!

Go to top


Re: Shaderjoy 1.17
Not too shy to talk
Not too shy to talk


@Capehill
Quote:
y flipping in FBO cases because otherwise FBO textures are upside down for the reasons I don't know

That's because the first FB pixel is at the bottom-left, much in contrast to most textures that come from files where the first pixel is at the top-left.

@kas1e
Quote:
Btw, is it expected, that when I set for textures "VFLIP texture vertically", then for some shaders rendering starts to be visibly slower.

And for others it will become visibly faster
That's because some such textures' values are not meant to be interpreted as pure colors but are actually texture-encoded input parameters to the shader's logic and thus may influence its runtime.


Edited by Daytona675x on 2020/12/22 9:51:58
Go to top


Re: The OpenGL ES 2.0 thread
Not too shy to talk
Not too shy to talk


@Capehill
Most likely you got confused with your UVs somewhere. It's a very common mistake when it comes to FBOs being used as textures. Although I have to admit that I'm not immune to such confusion and to be honest:
the primary reason why I think that you and not I got confused here is that IIRC Entwickler-X used FBO textures for cross-platform projects already and I heard no complains
In short: yes, usually you'd use flipped Vs for FBO-textures (where the first pixel is bottom-left) compared to lets-call-it file-textures (where the first texel is usually top-left in memory).

Therefore: please doublecheck your code (if possible run the critical stuff on a non-Amiga machine). If you still think that there's an issue then please upload test-code / exe to my FTP.


Edited by Daytona675x on 2020/12/22 9:31:01
Go to top


Re: Shaderjoy 1.17
Not too shy to talk
Not too shy to talk


@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
{
    
"ini-field1""bla",
    
"ini-field2""blurp",
    
"ini-field3""blorp"
}

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.

Go to top


Re: Shaderjoy 1.17
Not too shy to talk
Not too shy to talk


@Capehill
Quote:
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.

Go to top


Re: Warp3DNova shader bugs thread
Not too shy to talk
Not too shy to talk


@all
as soon as we find a Windows system which produces the same weird / undesired behaviour we should ignore the issue, especially if a Radeon is involved.

@Capehill
Yes, I'd also expect floor(3.0/3.0) to result in 1, at least for IEEE 754 floats where X / X should result in 1.0. However, that's only the case if the two numbers are truely identical. In practice you have to deal with intermediate results etc. so what we might think is 3.0/3.0 is just almost 3.0/3.0, so the division may result in sth slightly below 1. And a == comparison doesn't necessarily have the expected outcome with floats neither.

To illustrate this, with a bit of tweaking you can get the expected result (looks identical on my X5000 and my Win10 NVidia setup now )

void mainImageout vec4 fragColorin vec2 fragCoord )
{
  
vec2 uv floor(fragCoord/iResolution.xy 5.0);
    
uv.x+=0.0000001;
    
uv.y+=0.00000001;
  
vec3 col vec3(floor(uv.x/max(uv.y+0.000010.001)));
  if (
col.== 0.0 && uv.== 3.0 && uv.== 3.0col.1.0;
  
fragColor vec4col1.0 );
}


All in all: nothing we should worry about, this is apparently a Radeon float precision issue.

Go to top


Re: Warp3DNova shader bugs thread
Not too shy to talk
Not too shy to talk


@kas1e
What about this? Here I replaced floor by a simplified self-made variant (only valid for >= 0 inputs, but that's fine here).

If this renders okay then this is proof that floor and trunc (and maybe also fract) are broken.

float floor_repl(float v) {
  
int i=int(v);
  return 
float(i);
}

vec2 floor_repl(vec2 v) {
  return 
vec2(floor_repl(v.x),floor_repl(v.y));
}

void mainImageout vec4 fragColorin vec2 fragCoord )
{
    
vec2 uv floor_repl(fragCoord/iResolution.xy 5.0);
    
vec3 col vec3(floor_repl(uv.x/max(uv.y0.000001)));
    
fragColor vec4col1.0 );
}

Go to top


Re: Warp3DNova shader bugs thread
Not too shy to talk
Not too shy to talk


@kas1e
As far as I can see the parameters to floor are always non-negative here. Therefore: what happens if you replace every "floor" by "trunc"?

If the output then looks like it should then this is proof that "floor" is broken.
If the output is still broken in the same way then this either means that "trunc" is as broken as "floor" or that the problem is elsewhere.

Go to top


Re: Warp3DNova shader bugs thread
Not too shy to talk
Not too shy to talk


@kas1e
my bet is that both are broken, but you can do something like the following to check it out:

void mainImageout vec4 fragColorin vec2 fragCoord )
{
  
fragColor=vec4(0.0);

  
// uncomment one of those value pairs to test
  
uint i=0x3F800000ufloat f=1.0;
  
//uint i=0x40000000u; float f=2.0;
  //uint i=0x3FC00000u; float f=1.5;

  // uncomment one of those functions to check
   
if(floatBitsToUint(f)==i)
  
// if(uintBitsToFloat(i)==f)

  
fragColor.g=1.0;
  else 
fragColor.r=1.0;
}


If the screen is green, then all good.
If the screen is red, then the currently selected test failed, at least with the selected values.

Go to top


Re: Warp3DNova shader bugs thread
Not too shy to talk
Not too shy to talk


@kas1e
You should be able to rule in / out whether the floatBitsToUint etc. are broken by taking almost any shader and then add the following as last line:

{uint n=floatBitsToUint(fragColor.r); fragColor.r=uintBitsToFloat(n); n=floatBitsToUint(fragColor.g); fragColor.g=uintBitsToFloat(n); n=floatBitsToUint(fragColor.b); fragColor.b=uintBitsToFloat(n);}


If the shader output looks different all of a sudden then those bit/float functions are most likely broken.

Go to top


Re: Shaderjoy 1.17
Not too shy to talk
Not too shy to talk


@kas1e
@Capehill
Quote:
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.

Go to top


Re: Shaderjoy 1.17
Not too shy to talk
Not too shy to talk


@kas1e
Quote:
Warning : 40:1: 'preprocessor evaluation': undefined macro in expression not allowed in es profile HW_PERFOMANCE:
That one harmless, things works after it show ups, but still maybe worth to look at. There is test ones with this warning


This is no bug on our side, neither in ogles2.lib nor in ShaderJoy. The picky GLSL preprocessor simply warns you that the #if condition cannot really be evaluated as the author probably intended because the preprocessor value to be tested doesn't exist in the first place.
Note that those two shaders in question were made by the same guy This define HW_PERFORMANCE is something he invented himself for his shaders. Unfortunately he forgot to place something like

#ifndef HW_PERFORMANCE
#define HW_PERFORMANCE 0
#endif

on top of his shaders so that his toggle is actually defined if you as the user didn't add an explicit #define HW_PERFORMANCE X on top by yourself.
So, no action to be taken on our side.

Go to top


Re: Company<->User communication...Is it still a thing today?
Not too shy to talk
Not too shy to talk


@Raziel
Why not watch the stream before, which you obviously didn't, to inform yourself instead of "assuming" and ranting?

Go to top


Re: Kensington SlimBlade Trackball
Not too shy to talk
Not too shy to talk


I ended up with the Logitech MX Ergo, a thumb controlled mouse like trackball. Love it! It took me almost no time to get used to it. One drawback (which I could workaround though and which likely applies to most such devices): it uses a custom software which doesn't work with my KVM switch (for the switch it's just a mouse). So to make it feel right I had to significantly exceed the max. mouse speed of Windows by registry hacking. Works just fine on AOS4 too (here the built in prefs speeds are good). Another nice feature is that it can connect to a 2nd device via bluetooth, it has an extra device toggle button for that. So I can also control my laptop with it in parallel.

Go to top


Re: The OpenGL ES 2.0 thread
Not too shy to talk
Not too shy to talk


@Capehill
@kas1e
It should be "int iFrame". At least that's what the web client uses. Go to https://www.shadertoy.com/view/3lBfzz and expand the "Shader Inputs" panel on top of the GLSL source code.

Go to top


Re: The MiniGL thread
Not too shy to talk
Not too shy to talk


@Raziel
Note that those modified shaders will work on other platforms as well! What I did is not amiga specific at all. The int-instead-of-bool uniforms are good for all.

But if you want to keep bools for the other platforms, you could make the change to compat_shaders.cpp which I outlined above.
Then enrich each shaders which contains uniform bools with some #ifdef __amigaos4__, e.g. like this:

1. Put this on top of each such shader:

#ifdef __amigaos4__
#define BOOL int
#define IS_TRUE(v) (v)!=0
#define IS_FALSE(v) (v)==0
#else
#define BOOL bool
#define IS_TRUE(v) (v)
#define IS_FALSE(v) !(v)
#endif

2. Change every
uniform bool
to
uniform BOOL

3. And finally replace sth. like

if(textured)
if(!textured)

to

if(IS_TRUE(textured))
if(IS_FALSE(textured))


Go to top


Re: Announcing David Pleasance to speak at Amiwest 2020
Not too shy to talk
Not too shy to talk


@tekmage
Great news! Thanks for all the effort, highly appreciated! Of course, nothing beats the real thing, but I'm looking forward to some nice tele-cheers

Go to top


Re: The MiniGL thread
Not too shy to talk
Not too shy to talk


@Raziel
Quote:
Are shaders usable like c/c++ source files

Yes and no
In the context of the shader language GLSL and when looking at the .fragment / .vertex files, then yes, those are very much like C source files and when they are compiled they will also run through a C-like pre-processor with ifdef support.
However, in the context of this ScummVM source pile, they are not precompiled when you do a "make" but are loaded and compiled during runtime, so in this case they are just text assets which end up in some char array.

Quote:
so f.e. could I ifdef those changes for amigaos4

Right now this means:
no, you cannot place sth. like #ifdef __amigaos4__ or whatever inside such a shader and expect it to work. While the GLSL (pre)compiler understands #ifdef, it doesn't have anything like __amigaos4__ predefined, your #ifdef __amigaos4__ would always evaluate to #if 0 and the enclosed block will be ignored.

Quote:
or do I have to apply them every time I compile a new build?

I don't get that. You only have to make sure that you change the shader files in the way I explained before.


Anyway, if you want you can change ScummVM to support your "#ifdef __amigaos4__" from inside those shader files:

1. open the file "graphics/opengl/compat_shaders.cpp"
2. locate lines 30 and 44
3. right below those lines insert the following (and don't forget the " and the \n):

#ifdef __amigaos4__
"#define __amigaos4__\n"
#endif

so that you end up with

const char *compatVertex =
#ifdef __amigaos4__
"#define __amigaos4__\n"
#endif
"#if defined(GL_ES)\n"
...

const char *compatFragment =
#ifdef __amigaos4__
"#define __amigaos4__\n"
#endif
"#if defined(GL_ES)\n"
...

Now something like #ifdef __amigaos4__ will work from inside the #?.fragment and #?.vertex files (as always: untested. I chose __amigaos4__ because it's being used in the ScummVM sources).

Go to top


Re: Kensington SlimBlade Trackball
Not too shy to talk
Not too shy to talk


@Capehill
Oh, I have no problem with rather loud clicking / wheel sounds. That way people outside the buro already hear that you're busy
What I meant was if you find it hard or uncomfortable to reach those buttons / wheel. After all it's quite different compared to the common mouse.

Go to top


Re: The MiniGL thread
Not too shy to talk
Not too shy to talk


@kas1e
Hm, of course we don't really need the Tabor binaries right now. You can leave them out for now, they aren't essential at the moment. On the other hand, the only "problem" with these builds is that they blow up the archive size.
Dunno
I'd say: do as you feel

Go to top



TopTop
« 1 (2) 3 4 5 ... 23 »




Powered by XOOPS 2.0 © 2001-2023 The XOOPS Project