Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
158 user(s) are online (135 user(s) are browsing Forums)

Members: 0
Guests: 158

more...

Support us!

Headlines

 
  Register To Post  

« 1 (2) 3 4 5 6 »
Re: Warp3DNova shader bugs thread
Home away from home
Home away from home


See User information
@Daniel
Quote:

Then it works.

Yeah indeed !

Quote:

Return values not being even near reliable is a show-stopper. This should have the top priority on the Nova fix list!


As far as i can see Hans already fix some of return values errors already : http://www.amiga.org/developer/bugreports/view.php?id=481. So maybe it fits in already, need to check once beta versions will avail.

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: Warp3DNova shader bugs thread
Not too shy to talk
Not too shy to talk


See User information
@kas1e
Very well, crossing fingers

Go to top
Re: Warp3DNova shader bugs thread
Home away from home
Home away from home


See User information
@All
Another shader to discuss : https://www.shadertoy.com/view/wd2Szm

Code:

#define T iTime
#define R iResolution
#define M iMouse


// magic stuff
#define A(i)(6.283*fract(3.7*sin(i))+.7*mix(-1.,1.,fract(3.7*sin(i)))*T)
#define P(i)vec2(-(step(.5,fract(3.7*sin(i)))-.5)*sin(A(i)),(step(.5,fract(3.7*sin(i)))-.5)*cos(A(i)))

void mainImageout vec4 _FragColorin vec2 _FragCoord )
{
    
// standard uv fixup
    
vec2 p = (2.0*_FragCoord.xy-R.xy)/R.0.5*vec2(sin(0.2*T),sin(0.3*T));
    
    
// get the recursion values
    
float i floor(T-length(p)),
        
i-length(p), 
        
pow(2.718, -log(3.333)*m) * .08,
        
0.;
    
    
// get the zoom position
    
p*zP(i);
    for (
float r 0.9.; ++r)
        
+= (P(i+r+1.) / 3.333) * pow(1. 3.333r);
    
    
// recursion
    
for (float r 0.r<9.; ++r)
    {
        
// rotate
        
= -A(i);
        
p=vec2(p.x*cos(m) - p.y*sin(m), p.x*sin(m) + p.y*cos(m));

        
// yin yang function
        
float b 5.*z/min(R.yR.x),
        
1.0,
        
length(2.0*vec2(01)),
        
l;
        if (
p.0.0)
            
mix(c0.0smoothstep(1.0-b1.0+bl));

        
length(2.0*vec2(01));
        if (
p.0.0)
            
mix(0.0csmoothstep(1.0-b1.0+bl));
        if (
p.0.0)
            
l;

        
mix(cvsmoothstep(1.0-b1.0length(p)));

        if (
.6)
        {
            
// stop if outside
            
mix(step(0.0p.y), vsmoothstep(.6+.12,.6+.12+b,d));

            
// fix color around the edges
            
if (.72+&& p.0.0) ++i;
            break;
        }

        
// which side are we on?
        
p.+= mix(0.5, -0.5,  step(0.0,p.y));

        
// update zoom and position
        
*= 2./.6;
        
*= 2./.6;     
        
        
// unrotate
        
A(i);
        
p=vec2(p.x*cos(m) - p.y*sin(m), p.x*sin(m) + p.y*cos(m));
           ++
i;
    }
    
    
// final coloring
    
_FragColor vec4(v*vec3(1.+sin(i+T+i),1.+sin(i+T+1.),1.+sin(i+T+2.)),1.);
}


Win32 look (open in new tab for fullsize):

Resized Image

Aos4 look (open in new tab for fullsize):

Resized Image


In os4 version we can see some distortion (see green quads and squares), and that one not related to the other issues we reported. That kind of bug i can see also in some other shaders (through happen to be very rare), but worth to invistigate for sure.

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: Warp3DNova shader bugs thread
Not too shy to talk
Not too shy to talk


See User information
@kas1e
That's some new severe bug introduced in Warp3D Nova 1.70. Check it out, with 1.68 it still renders fine.
Apparently the reason now is an "if" not working correctly anymore. In case of this shader it's this one:

// stop if outside
...
if (
.72+&& p.0.0) ++i;


I checked d, b and p.y, they seem to be valid.

Quote:
and that one not related to the other issues we reported.

I'd not be so sure about that. Looking at all those recent bugs the main broken component of Nova seems to be the register allocator which can result in all kinds of funny stuff. I mean, maybe the above "if" is simply comparing the wrong register.


Edited by Daytona675x on 2020/5/30 8:07:54
Edited by Daytona675x on 2020/5/30 13:28:34
Go to top
Re: Warp3DNova shader bugs thread
Home away from home
Home away from home


See User information
@Daniel
Thanks ! Created BZ with your findings: http://www.amiga.org/developer/bugreports/view.php?id=492

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: Warp3DNova shader bugs thread
Home away from home
Home away from home


See User information
@All
Another rendering issue which i find in some shaders, can be called as "colors swapped or reverted". I think (i hope) it can be roots of one single issue, so maybe worth to check them all at the same time. For all images press open in new tab for fullsize. So:

Shader #1:

https://www.shadertoy.com/view/tdjfRt

#define S(a, b, t) smoothstep(a, b, t)

float createTaperBox(vec2 pointfloat bottomWidthfloat topWidthfloat yBottomfloat yTopfloat blur) {
    
// Bottom edge    
    
float m S(-blurblurpoint.yBottom);
    
// Top edge
    
*= S(blur, -blurpoint.yTop);
    
// Sides, mirrored
    
point.abs(point.x);
    
    
float w mix(bottomWidthtopWidth, (point.yBottom) / (yTop yBottom));
    
*= S(blur, -blurpoint.w);
    
    return 
m;
}

vec4 createTree(vec2 uvvec3 colorfloat blur) {
    
    
// --- Trunk ---
    
float m createTaperBox(uv0.030.03, -0.050.25blur);
    
// --- Canopy 1 ---
    
+= createTaperBox(uv0.20.10.250.5blur);
    
// --- Canopy 2 ---
    
+= createTaperBox(uv0.150.050.50.75blur);
    
// --- Top ---
    
+= createTaperBox(uv0.10.00.751.0blur);
    
    
float shadow createTaperBox(uv vec2(0.20.0), 0.10.50.150.25blur);
    
shadow += createTaperBox(uv vec2(0.250.0), 0.10.50.450.5blur);
    
shadow += createTaperBox(uv vec2(0.20.0), 0.10.50.70.75blur);
    
color -= shadow 0.8;
    
//m = 1.0;
    
    
return vec4(colorm);
}

float GetHeight(float x) {
    return 
sin(0.435) + sin(x) * 0.3;
}

vec4 createLayer(vec2 uvfloat blur) {
    
vec4 color vec4(0.0);
    
    
float id floor(uv.x);
    
float n fract(sin(id 256.12) * 6854.3) * 2.0 1.0;
    
float x 0.3;
    
float y GetHeight(uv.x);
    
    
// Ground
    
float ground S(blur, -bluruv.y);
    
color += ground;
    
    
GetHeight(id 0.5 x);
    
    
uv.fract(uv.x) - 0.5;
    
vec4 tree createTree((uv vec2(x, -y)) * vec2(1.01.0 0.25), vec3(1.0), blur);
    
    
color mix(colortreetree.a);
    
color.max(groundtree.a);
    return 
color;
}

float Hash21(vec2 point) {
    
point fract(point vec2(1462.341026.75));
    
point += dot(pointpoint 864.23);
    
    return 
fract(point.point.y);
}

void mainImageout vec4 fragColorin vec2 fragCoord )
{
    
// Normalized pixel coordinates (from 0 to 1)
    // Move origin to the center
    
vec2 uv = (fragCoord 0.5 iResolution.xy) / iResolution.y;
    
vec2 mouse = (iMouse.xy iResolution.xy) * 2.0 1.0;
    
float time iTime 0.3;
    
    
    
//uv.x += iTime * 0.1;
    //uv.y += 0.5;
    //uv *= 5.0;
    
    
float blur 0.005;
    
    
// Initialize color
    
vec4 color vec4(0.0);
    
vec4 layer;
    
    
color *= 0.0;
    
float twinkle dot(length(sin(uv time)), length(cos(uv vec2(22.06.7) - time 3.0)));
    
twinkle sin(twinkle 10.0) * 0.5 0.5 4.5;
    
    
float dawn S(-0.750.4, -uv.y);
    
    
float stars pow(Hash21(uv), 60.0 twinkle);
    
color += stars;
    
color.rgb -= vec3(0.50.90.1);
    
color += dawn;
    
    
//float moon = S(0.01, -0.01, length(uv + vec2(-0.65, -0.275)) - 0.1);
    
float moon S(0.0075, -0.0035length(uv vec2(0.470.29)) - 0.1);
    
moon *= S(-0.0750.005length(uv vec2(0.430.325)) - 0.175);
    
color.rgb += vec3(0.6);
    
color += moon;
    
    for (
float i 0.01.0+= 1.0 7.0) {
        
float scale mix(10.01.0i);
        
blur mix(0.020.005i);
        
layer createLayer(uv scale vec2(time 50.0i) - mouseblur);
        
layer.rgb *= (1.0 i) * vec3(0.30.51.0) * 1.2;
        
color mix(colorlayerlayer.a);
    }
    
    
layer createLayer(uv vec2(time 1.0) - mouseblur 3.0);
    
color mix(colorlayer 0.002layer.a);
    
    
float thickness 1.0 iResolution.y;
    
    
    
    
// See axes
    //if (abs(uv.x) < thickness) { color.g = 1.0; }
    //if (abs(uv.y) < thickness) { color.r = 1.0; }

    // Output to screen
    
fragColor color;
}



WIN version:

Resized Image

AOS4 version:

Resized Image


Shader #2:

https://www.shadertoy.com/view/MsjSW3

// Ether by nimitz 2014 (twitter: @stormoid)
// https://www.shadertoy.com/view/MsjSW3
// License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
// Contact the author for other licensing options

#define t iTime
mat2 m(float a){float c=cos(a), s=sin(a);return mat2(c,-s,s,c);}
float map(vec3 p){
    
p.xz*= m(t*0.4);p.xy*= m(t*0.3);
    
vec3 q p*2.+t;
    return 
length(p+vec3(sin(t*0.7)))*log(length(p)+1.) + sin(q.x+sin(q.z+sin(q.y)))*0.5 1.;
}

void mainImageout vec4 fragColorin vec2 fragCoord ){    
    
vec2 p fragCoord.xy/iResolution.vec2(.9,.5);
    
vec3 cl vec3(0.);
    
float d 2.5;
    for(
int i=0i<=5i++)    {
        
vec3 p vec3(0,0,5.) + normalize(vec3(p, -1.))*d;
        
float rz map(p);
        
float f =  clamp((rz map(p+.1))*0.5, -.11. );
        
vec3 l vec3(0.1,0.3,.4) + vec3(5.2.53.)*f;
        
cl cl*smoothstep(2.5.0rz)*.7*l;
        
+= min(rz1.);
    }
    
fragColor vec4(cl1.);
}


WIN version:

Resized Image

AOS4 version:

Resized Image

Shader #3:

https://www.shadertoy.com/view/WdSBRG

vec4 rainbowDisk(vec2 o) {
    
// the underlying image
    // source: https://www.shadertoy.com/view/XsSfW1 by Flyguy
    
*= max(iResolution.xiResolution.y);
    
+= .5 iResolution.xy;
    
vec4 c;
    
vec2 r iResolution.xy;
    
vec2(length(-= r/2.) / r..3atan(o.y,o.x));    
    
vec4 s c.yzwx .1*cos(1.6*vec4(0,1,2,3) + iTime o.sin(o.y) * sin(iTime)*2.),
    
min(o.x-sc-o.x);
    return 
dot(40.*(s-c), clamp(f*r.y0.1.)) * (s-.1) - f;
}


void mainImageout vec4 fragColorin vec2 fragCoord) {
    
float t iTime;
    
mod(t30.);
    
float res max(iResolution.xiResolution.y);
    
float maxScale res 9.;
    
// zoom in and out
    
float scale mix(
        
4.,  maxScale,
        
smoothstep(2.15.t) - smoothstep(20.30.t)
    );
    
vec2 off vec2(-.2.1);
    
vec2 uv scale * ((fragCoord .5 iResolution.xy) / res off);
    
float pixel scale res;

    
vec2 pixeluv fract(uv);
    
vec2 imguv = (floor(uv)) / maxScale off;
    
    
vec3 colImg rainbowDisk(imguv).rgb;
    
// make the loop seemless
    
colImg mix(
        
// just something to pseudo random
        
fract(vec3(
            
sin(300.123 imguv.300.123 imguv.y),
            
sin(100.521 imguv.250.2 imguv.x),
            
0.4)),
        
colImgsmoothstep(0..1t) - smoothstep(29.930.t));
    
colImg clamp(colImg.1.9);

    
vec3 col vec3(0.);
    
col.smoothstep(
        
pixel0.,
        
max(
            
pixeluv.colImg.r,
            
pixeluv.0.3333333 pixel
        
)
    );
    
col.smoothstep(
        
pixel0.,
        
max(
            
pixeluv.colImg.g,
            
max(pixeluv.0.666666 pixel,
                
0.333333 pixeluv.pixel)
        )
    );
    
col.smoothstep(
        
pixel0.,
        
max(
            
pixeluv.colImg.b,
            
0.666 pixeluv.pixel
        
)
    );
    
col *= smoothstep(
        
0.4. pixel smoothstep(10.1.scale),
        
min(
            
min(pixeluv.y1. pixeluv.y),
            
min(pixeluv.x1. pixeluv.x)
        )
    );
    
fragColor vec4(col1.0);
}


WIN version:

Resized Image

AOS4 version:

Resized Image

Shader #4:

https://www.shadertoy.com/view/tdjBWm

// Fork of "Menger2D" by EvilRyu. https://shadertoy.com/view/MldXz4
// 2020-05-23 02:26:38

// Created by evilryu
// License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.

float s=0.95,a=0.006,scale=3.;
float d_box(vec2 q){float d=max(abs(q.x+sin(iTime)*0.01),abs(q.y));return smoothstep(s,s+a,d)+smoothstep(s-a,s-a-a,d);}
float d_sph(vec2 q,float s){float d=pow(pow(abs(q.x),3.0)+pow(abs(q.y),3.5),1./3.);return smoothstep(s,s+a,d)+smoothstep(s-a,s-a-a,d);}
void mainImageout vec4 fragColorin vec2 fragCoord )
{
    
vec2 q = (-iResolution.xy 2.0*fragCoord)/iResolution.y;
    
vec3 col=vec3(1.0);//*d_box(q);
    
float iter mod(floor(iTime),7.0);
    for(
int i=0;i<4;++i)
    {
        if(
i<int(iter+0.5))
        {
            
q=abs(q);
            if(
q.x>q.y)q.xy=q.yx;
            
s*=1.0/scale;
            
col*=d_sph(q,s*(1.+tan(iTime)));
            
q-=s*(scale-(1.+cos(iTime)));
            if(
q.x<-0.5*s*(scale-1.0))q.x+=s*(scale-(1.+sin(iTime)));
        }
        else
        {
            
col*=d_sph(q,fract(iTime)*s/scale);
        }
    }
    
fragColor.xyz=col;
}


WIN version:

Resized Image

AOS4 version:

Resized Image


Shader #5:

https://www.shadertoy.com/view/4dXGR4

// based on https://www.shadertoy.com/view/lsf3RH by
// trisomie21 (THANKS!)
// My apologies for the ugly code.

float snoise(vec3 uvfloat res)    // by trisomie21
{
    const 
vec3 s vec3(1e01e21e4);
    
    
uv *= res;
    
    
vec3 uv0 floor(mod(uvres))*s;
    
vec3 uv1 floor(mod(uv+vec3(1.), res))*s;
    
    
vec3 f fract(uv); f*f*(3.0-2.0*f);
    
    
vec4 v vec4(uv0.x+uv0.y+uv0.zuv1.x+uv0.y+uv0.z,
                    
uv0.x+uv1.y+uv0.zuv1.x+uv1.y+uv0.z);
    
    
vec4 r fract(sin(v*1e-3)*1e5);
    
float r0 mix(mix(r.xr.yf.x), mix(r.zr.wf.x), f.y);
    
    
fract(sin((uv1.uv0.z)*1e-3)*1e5);
    
float r1 mix(mix(r.xr.yf.x), mix(r.zr.wf.x), f.y);
    
    return 
mix(r0r1f.z)*2.-1.;
}

float freqs[4];

void mainImageout vec4 fragColorin vec2 fragCoord )
{
    
freqs[0] = textureiChannel1vec20.010.25 ) ).x;
    
freqs[1] = textureiChannel1vec20.070.25 ) ).x;
    
freqs[2] = textureiChannel1vec20.150.25 ) ).x;
    
freqs[3] = textureiChannel1vec20.300.25 ) ).x;

    
float brightness    freqs[1] * 0.25 freqs[2] * 0.25;
    
float radius        0.24 brightness 0.2;
    
float invRadius     1.0/radius;
    
    
vec3 orange            vec30.80.650.3 );
    
vec3 orangeRed        vec30.80.350.1 );
    
float time        iTime 0.1;
    
float aspect    iResolution.x/iResolution.y;
    
vec2 uv            fragCoord.xy iResolution.xy;
    
vec2 p             = -0.5 uv;
    
p.*= aspect;

    
float fade        powlength2.0 ), 0.5 );
    
float fVal1        1.0 fade;
    
float fVal2        1.0 fade;
    
    
float angle        atanp.xp.)/6.2832;
    
float dist        length(p);
    
vec3 coord        vec3angledisttime 0.1 );
    
    
float newTime1    abssnoisecoord vec30.0, -time * ( 0.35 brightness 0.001 ), time 0.015 ), 15.0 ) );
    
float newTime2    abssnoisecoord vec30.0, -time * ( 0.15 brightness 0.001 ), time 0.015 ), 45.0 ) );    
    for( 
int i=1i<=7i++ ){
        
float power pow2.0float(1) );
        
fVal1 += ( 0.5 power ) * snoisecoord vec30.0, -timetime 0.2 ), ( power * ( 10.0 ) * ( newTime1 1.0 ) ) );
        
fVal2 += ( 0.5 power ) * snoisecoord vec30.0, -timetime 0.2 ), ( power * ( 25.0 ) * ( newTime2 1.0 ) ) );
    }
    
    
float corona        powfVal1 max1.1 fade0.0 ), 2.0 ) * 50.0;
    
corona                += powfVal2 max1.1 fade0.0 ), 2.0 ) * 50.0;
    
corona                *= 1.2 newTime1;
    
vec3 sphereNormal     vec30.00.01.0 );
    
vec3 dir             vec30.0 );
    
vec3 center            vec30.50.51.0 );
    
vec3 starSphere        vec30.0 );
    
    
vec2 sp = -1.0 2.0 uv;
    
sp.*= aspect;
    
sp *= ( 2.0 brightness );
      
float r dot(sp,sp);
    
float f = (1.0-sqrt(abs(1.0-r)))/(r) + brightness 0.5;
    if( 
dist radius ){
        
corona            *= powdist invRadius24.0 );
          
vec2 newUv;
         
newUv.sp.x*f;
          
newUv.sp.y*f;
        
newUv += vec2time0.0 );
        
        
vec3 texSample     textureiChannel0newUv ).rgb;
        
float uOff        = ( texSample.brightness 4.5 time );
        
vec2 starUV        newUv vec2uOff0.0 );
        
starSphere        textureiChannel0starUV ).rgb;
    }
    
    
float starGlow    minmax1.0 dist * ( 1.0 brightness ), 0.0 ), 1.0 );
    
//fragColor.rgb    = vec3( r );
    
fragColor.rgb    vec3* ( 0.75 brightness 0.3 ) * orange ) + starSphere corona orange starGlow orangeRed;
    
fragColor.a        1.0;
}



WIN version:

Resized Image

AOS4 version:

Resized Image


As far as i can see, in all shaders background and color of some objects like swapped. At moment not sure wtf, but probably will be good idea to start from the smallest ones and trying to reduce it, like shader #2 and shader #4

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: Warp3DNova shader bugs thread
Not too shy to talk
Not too shy to talk


See User information
@kas1e
to me this looks like similar issues, I bet it's some register mess up in each case.
Btw.: I played a bit with the previous one.

// original statement which produces pixel garbage here
if (.72+&& p.0.0) ++i;
// same semantic variants which work here
if (.72+b) if(p.0.0) ++i;
if (
.72+bi+=(p.0.0) ? 0;
if (
p.0.0i+=(.72+b) ? 0;
i+=(.72+b) ? (p.0.0) ? 0;



Edited by Daytona675x on 2020/5/30 18:40:24
Go to top
Re: Warp3DNova shader bugs thread
Home away from home
Home away from home


See User information
@Daniel
Can be "&&" thing maybe ?

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: Warp3DNova shader bugs thread
Not too shy to talk
Not too shy to talk


See User information
@kas1e
I guess it's not a general "and" doesn't work but simply depends on situation, which register used when etc. After all an && in this case here will certainly result in two conditional branches, just like at least the 1st working variant. It's worthless to speculate more, if register allocation is messed up everything is possible.

Go to top
Re: Warp3DNova shader bugs thread
Home away from home
Home away from home


See User information
@all
Found 4 more shaders , which we can hope share the same issue. At least i hope its the same issue, because it better to create one bug report with 8 shaders, than 8 bug reprots :)

So, there they are:

Shader #6:

https://www.shadertoy.com/view/3dffz7

//width of lines
#define _Width 0.05    

//width of the borders of the lines
#define _Border 0.003    

//frequency of the noise
#define _NoiseFreq 50.0

//strength of the noise
#define _NoiseStr 0.01    

//speed of the "simulation"
#define _Speed 5.0

//portion of the time(from 0 to 1), that will be spent on "growing" the line
//rest of the time will be spent "widening" the line
#define _GT 0.5    

float hashfloat n )
{
    
mod(n691.564);
    return 
fract(sin(n)*43758.5453);
}

float perlin(float x) {
    
float f fract(x);
    
float i floor(x);
    return 
mix(hash(i), hash(i+1.0), smoothstep(0.01.0f));
}

vec2 hash2vec2 p )
{
    
mod(p132.5);
    return 
fract(sin(vec2(dot(p,vec2(127.1,311.7)),dot(p,vec2(269.5,183.3))))*43758.5453);
}

float saturate(float x) {
    return 
clamp(x0.01.0);
}

float drawLine(inout vec2 uvinout float drawfloat ifloat f) {
    
float grow saturate(f/_GT);
    
float widen saturate((f-_GT)/(1.0-_GT))*_Width;

    
vec2 norm hash2(vec2(ii*1.1))-0.5;
    
vec2 nnorm normalize(norm);

    
uv -= norm;

    
uv mat2x2(nnorm.xnnorm.y, -nnorm.ynnorm.x) * uv;
    
float per = (perlin((uv.y+i)*_NoiseFreq)-0.5)*_NoiseStr;

    
uv.+= per;

    
float tx uv.- (step(0.0uv.x)-0.5)*widen;

    
float ans draw*smoothstep(_Border+0.003_Borderabs(tx))*step(uv.ymix(-2.02.0grow));
    
draw saturate(draw step(2.0*abs(uv.x), widen));
    
uv.tx per;

    
uv mat2x2(nnorm.x, -nnorm.ynnorm.ynnorm.x) * uv;
    
uv += norm;

    return 
ans;
}

void mainImageout vec4 fragColorin vec2 fragCoord )
{
    
vec2 uv fragCoord/iResolution.xy;
    
uv -= 0.5;
    
uv.*= iResolution.x/iResolution.y;
    
    
float tim = (iTime)*_Speed;
    
float timei floor(tim);
    
float timef fract(tim);

    
float bord 0.0;
    
float draw 1.0;

    
bord += drawLine(uvdrawtimeitimef);

    
timei -= 1.0;

    for(
float i 0.0500.0i++) {
        
bord += drawLine(uvdrawtimei-i1.0);
        if(
draw 0.5) break;
    }
    
    
fragColor vec4(bordbordbord1.0);
}



WIN version:

Resized Image

AOS4 version:

Resized Image


Shader #7:

https://www.shadertoy.com/view/XtVGDR

const float PI 3.14159265358979//Probably enough precision?
const float TAU 2.0 PI;

//Returns how much coord is within a circle centered at circle_pos. [0, 1]
float circle(vec2 circle_posvec2 coord)
{
    
float circ_rad 70.0;
    
float circ_blur 1.0;
    
float dist distance(circle_poscoord);
    return 
smoothstep(circ_rad circ_blurcirc_rad circ_blurdist); 
}

void mainImageout vec4 fragColorin vec2 fragCoord )
{
    
vec4 black vec4(0.00.00.01.0);
    
vec4 white vec4(1.01.01.01.0);
    
    
vec2 center iResolution.xy vec2(0.5);
    
float t iTime;
    
float d 70.0*sin(t/PI); //Distance of each circle from the center. (Can be pos/neg)
    
    
const float MAX_CIRCLES 9.0//Max number of circles.
    
float num_circles MAX_CIRCLES/2.0 MAX_CIRCLES/2.0*cos(t/PI) + 0.01//Current number of circles.
    
float circles 0.0//The total number of circles this pixel is in.
    
    
for (float f 0.0MAX_CIRCLESf++) {
        if (
num_circles) { //Wish I could have non-const number of loop iterations :(
            
float ap f/num_circles TAU//Angular position of each circle, [0, tau]
            
vec2 newCirclePos center d*vec2(cos(ap), sin(ap));
            
circles += circle(newCirclePosfragCoord); //If this pixel is in the new circle, circles increases.
        
}
    }
    
    
circles = (cos(circles*PI)+1.0)/2.0//Smoothly interpolate between odd and even values.
    
fragColor mix(blackwhitecircles);
}



WIN version:

Resized Image

AOS4 version:

Resized Image


Shader #8:

https://www.shadertoy.com/view/wd2fRW

void mainImageout vec4 fragColorin vec2 fragCoord )
{
    
vec2 uv fragCoord/iResolution.xy;
    
uv.*= iResolution.x/iResolution.y;
    
    
vec3 col;
    
vec2 zuu;
    
float prof 20.;
    
    for(
float i=profi>0. ;i--){
        
zuu..5+cos(uv.x*(5.*i)+sin(iTime*1.2)*4.);
        
zuu..5+cos(uv.y*(5.*i)+cos(iTime*1.6)*4.);
        if (
zuu.>.5 ^^  zuu.>.5){
            
col vec3(1./i,1./i,1./i);
        }
    }

    
fragColor vec4(col,1.0);
}



WIN version:

Resized Image

AOS4 version:

Resized Image


Shader #9:

https://www.shadertoy.com/view/Xt23z3

#define ANTI_ALIAS

#define NUM_FACES 4
#define IN_RADIUS 0.25
#define OUT_RADIUS 0.70
#define SCROLL_SPEED -0.9

#define COLOR_1 0.50, 0.90, 0.95
#define COLOR_2 0.95, 0.60, 0.10

float tau atan(1.0) * 8.0;
float pi atan(1.0) * 4.0;
float aaSize 0.0;

vec4 slice(float x0float x1vec2 uv)
{
    
float u = (uv.x0)/(x1 x0);
    
float w = (x1 x0);
    
vec3 col vec3(0);
    
    
//Gradient
    
col mix(vec3(COLOR_1), vec3(COLOR_2), u);
    
    
//Lighting 
    
col *= sqrt(2.0 IN_RADIUS*IN_RADIUS * (1.0 cos(tau float(NUM_FACES))));
    
    
//Edges
    
col *= smoothstep(0.050.10u) * smoothstep(0.950.90u) + 0.5;
    
    
//Checker board
    
uv.+= iTime SCROLL_SPEED//Scrolling
    
    #ifdef ANTI_ALIAS
        
col *= (-1.0 2.0 smoothstep(-0.030.03sin(u*pi*4.0) * cos(uv.y*16.0))) * (1.0/16.0) + 0.7;
    
#else
        
col *= sign(sin(pi 4.0) * cos(uv.16.0)) * (1.0/16.0) + 0.7;
    
#endif
    
    
float clip 0.0;
    
    
#ifdef ANTI_ALIAS
        
clip = (1.0-smoothstep(0.5 aaSize/w0.5 aaSize/wabs(0.5))) * step(x0x1);
    
#else
        
clip float((>= 0.0 && <= 1.0) && (x0 x1));
    
#endif
    
    
return vec4(colclip);
}

void mainImageout vec4 fragColorin vec2 fragCoord )
{
    
aaSize 2.0 iResolution.y//Scale anti aliasing with resolution
    
vec2 res iResolution.xy iResolution.y;
    
vec2 uv fragCoord.xy iResolution.y;
    
uv -= res 2.0;
    
uv *= 2.0;
    
    
//Polar coordinates
    
vec2 uvr vec2(length(uv), atan(uv.yuv.x) + pi);
    
uvr.-= OUT_RADIUS;
    
    
vec3 col vec3(0.05);
    
    
//Twisting angle
    
float angle uvr.2.0*iTime sin(uvr.y) * sin(iTime) * pi;
    
    for(
int i 0;NUM_FACES;i++)
    {
        
float x0 IN_RADIUS sin(angle tau * (float(i) / float(NUM_FACES)));
        
float x1 IN_RADIUS sin(angle tau * (float(1) / float(NUM_FACES)));
        
        
vec4 face slice(x0x1uvr);
        
        
col mix(colface.rgbface.a); 
    }
    
    
//col = (abs(uv.x) > 1.0) ? vec3(1) : col;
    
    
fragColor vec4(col1.0);
}



WIN version:

Resized Image

AOS4 version:

Resized Image


Question is : is that the same issue everywhere, or they different ones ? Did anyone can see in code of whose 8 shaders something common maybe ? Just the more info we find, the faster/easy it will be to fix for Hans.

At least shaders 4,6 and 7 (those black and white swapped colors) looks very much the same issue at least visually, but it can be of course different issues, just by some luck it looks like swapped.



Edited by kas1e on 2020/6/2 11:23:50
Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: Warp3DNova shader bugs thread
Just can't stay away
Just can't stay away


See User information
@kas1e

Nova 1.68 notes:

Quote:

Bap: initializing vec3 col = vec3(0.0) seems to make it work. By default there are no layers at all.


Go to top
Re: Warp3DNova shader bugs thread
Home away from home
Home away from home


See User information
@Capehill
Quote:

Bap: initializing vec3 col = vec3(0.0) seems to make it work. By default there are no layers at all.


Yeah, same on 1.71.

Is it mean that Nova need to deal with unitialized variables again ? Like, "vec3 col;" is unitialized, and optimizer fail to see that it used in the "if" later? But then, if should't work at all then, but it works. Just live vec3 have different value ?

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: Warp3DNova shader bugs thread
Home away from home
Home away from home


See User information
@kas1e

Quote:
Is it mean that Nova need to deal with unitialized variables again ? Like, "vec3 col;" is unitialized, and optimizer fail to see that it used in the "if" later? But then, if should't work at all then, but it works. Just live vec3 have different value ?

Not in the case of that shader. Try setting col = vec3(1.0) on Windows, and see what happens.

The shader is taking advantage of GLSL implementations zeroing uninitialized variables. section 5.9 of the GLSL spec (using version 4.50) says: Reading a variable before writing (or initializing) it is legal, however the value is undefined.

At present, I have no intention of setting uninitialized variables to 0. I'll consider it if too many programs need it.

Hans

Join Kea Campus' Amiga Corner and support Amiga content creation
https://keasigmadelta.com/ - see more of my work
Go to top
Re: Warp3DNova shader bugs thread
Just can't stay away
Just can't stay away


See User information
@Hans

Oh, I missed the "if" totally.

It would be nice to get a warning from compiler about potentially uninitialized variables in cases like this.

Go to top
Re: Warp3DNova shader bugs thread
Home away from home
Home away from home


See User information
@Hans
Quote:

Not in the case of that shader. Try setting col = vec3(1.0) on Windows, and see what happens.


With vec3(1.0) it the same on os4 and on win32 then : the same effect, with "white" color in. With vec3(0.0), all fine on both win32 and aos4, and with how it originally, we have that difference on os4.

I not sure what is it mean : that unitialized variables on win32 are always set to 0.0 but on os4 random values ?

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: Warp3DNova shader bugs thread
Home away from home
Home away from home


See User information
@All
Another shader with wrong-colors issues:

Shader #10

https://www.shadertoy.com/view/WdlBWH

// --- Fractal noise simulating heterogeneous density in galactic clouds
// ---   -> help from Fabrice Neyret, https://www.shadertoy.com/user/FabriceNeyret2
// ---   -> noise functions from Inigo Quilez, https://www.shadertoy.com/view/XslGRr


// Number of computed scales
#define NbScales 22.

// Id of the lowest displayed scale (debug)
#define FirstScale 0.

// Anti aliasing
#define LimitDetails 2.5
#define SmoothZone 99.

// Manual Zoom / Auto Zoom
#define Anim 1

// Colormap
#define ClampLevel 1.

#define ZoomDistance 10.

// Size of the first Perlin Noise grid (debug)
#define FirstDivision 8.


// 0 : multiplicative
// 1 : additive
#define Mode 0

#define GazConcentration 0.

// Caracteristic ratio of the frequencies (0.5 for octaves)
#define fRatio 0.0314



bool keyToggle(int ascii) {
    return !(
texture(iChannel2,vec2((.5+float(ascii))/128.,0.3751)).0.);
}

// --- noise functions from https://www.shadertoy.com/view/XslGRr
// Created by inigo quilez - iq/2013
// License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.

vec2 hashvec2 p ) {                          // rand in [-1,1]
    
vec2dot(p,vec2(128.1,311.7)),
              
dot(p,vec2(269.5,183.3)) );
    return -
1. 2.*fract(sin(p+20.)*53758.5453123);
}
float noisein vec2 p ) {
    
vec2 i floor(p), fract(p);
    
vec2 u f*f*(3.-2.*f);
    return 
mixmixdothashvec2(0.,0.) ), vec2(0.,0.) ), 
                     
dothashvec2(1.,0.) ), vec2(1.,0.) ), u.x),
                
mixdothashvec2(0.,1.) ), vec2(0.,1.) ), 
                     
dothashvec2(1.,1.) ), vec2(1.,1.) ), u.x), u.y);
}


// -----------------------------------------------

vec3 colormap(float value) {
    
float maxv ClampLevel;
    
vec3 c1,c2;
    
float t;
    if (
value maxv 3.) {
        
c1 vec3(1.);          c2 vec3(1.1..5);
        
=  1./3.;
    } else if (
value maxv 2. 3.) {
        
c1 vec3(1.1..5); c2 vec3(1.0,  0.);
        
=  2./3. ;
    } else {
        
c1 vec3(1.0.0.); c2 vec3(0.);
        
=  1.;
    }
    
= (t*maxv-value)/(maxv/3.);
    return 
t*c1 + (1.-t)*c2;
}

void mainImageout vec4 fragColorin vec2 fragCoord ) { // --------------------------------------
    
    
float t iTime;
    
    
vec2 uv fragCoord.xxiResolution.x;

    
float d 1.// initial density
    
 #if Anim
    
float cycle cos(mod(-t,100.)/100.*2.*3.14);
    
float n_tiles_level_1 exp(cycle*cycle*ZoomDistance)*pow(2.,FirstDivision);
#else
    
float n_tiles_level_1 exp(iMouse.x/iResolution.x*ZoomDistance)*pow(2.,FirstDivision);
#endif
    
    // zoom and centering
    
uv = (uv vec2(.9,.5))*n_tiles_level_1 vec2(.9,.5);
    
    
float theta 4.+.008*t// some rotations, not necessary
    
mat2 m fRatio*mat2cos(theta),sin(theta), 
                     -
sin(theta),cos(theta) );
        
    
// computation of the multiplicative noise
    
float q 1.;
    for (
float i 0.NbScalesi++) {
        if (
d<1e-2) continue;
        
        
// multiply the amplitude to maintain the total density
        
float c = (i+1.NbScales) ? 2. 1.;
        
        
float nn noise(uv 10.7*i*i);

        for (
float j 0.GazConcentrationj++) {
            
nn sin(nn*3.14159265359/2.);
        }
            
#if Mode == 0
        
float n c0.5*(1.+nn);
#else
        
float n nn;
#endif    
        
        // compute only the visible scales
        
float crit n_tiles_level_1 *iResolution.x/LimitDetails;
        if (
crit SmoothZone && >= FirstScale) {
            if (
crit>0.) {  // avoid aliasing
                
float t crit/SmoothZone;                
                
n*(1.-t);
#if Mode == 0
                
+= t;
#endif
            
}
            
#if Mode == 0
            
*= n;
#else
            
+= n*(0.5);
#endif            
            
            
        
}
    
        
uv m*uvq*= fRatio// go to the next octave
    
}
    
    
clamp(d,0.0,d);
    
fragColor.xyz = (keyToggle(67)) ? vec3(exp(-d)) :colormap(exp(-d));
}


WIN version:

Resized Image

AOS4 version:

Resized Image


I start to think, that it's all different bugs all the time. I.e. bug the same : wrong content in registers, and their wrong compare/use , and it didn't looks like some single particular issue. Just visually it looks pretty much the same like colors swapped, but it all can be different..

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: Warp3DNova shader bugs thread
Just can't stay away
Just can't stay away


See User information
@kas1e

Try:

fragColor.xyz = vec3(exp(-d));

Then try:

fragColor.xyz = colormap(exp(-d));

On Windows I get red colors when in colormap branch. I guess keyToggle function return different result on AmigaOS but didnt' really debug it yet.

keyToggle() is sampling iChannel2.

Go to top
Re: Warp3DNova shader bugs thread
Home away from home
Home away from home


See User information
@Capehill
Quote:

keyToggle() is sampling iChannel2.


How interesting .. On the the page of that shader i didn't see that iChannel2 is used at all, but, if i start to set there different textures, then i also may have or white, or red colors , depends on texture.

Can it be that implementation of iChannel on our side, somehow different when it come to "iChannel used in the code, but not actually set". Maybe it again some sort of unitialized default values ?

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: Warp3DNova shader bugs thread
Not too shy to talk
Not too shy to talk


See User information
@Capehill
Quote:
It would be nice to get a warning from compiler about potentially uninitialized variables in cases like this.

This behaviour is not just allowed but also not considered to be worth a warning. Nova is not buggy here, so I have to second Hans that there is no action to be taken. Yes, it would be nice but on the other hand it also will result in unnecessary warnings. And such a analysis is not trivial and not for free. After all there are very valid reasons - unlike in those broken shaders - not to initialize a variable right upon declaration.

@kas1e
Quote:
I not sure what is it mean : that unitialized variables on win32 are always set to 0.0 but on os4 random values ?

No, it's just that some (maybe even most, or even all, doesn't matter) Windows OpenGL drivers apparently set uninitialized variables to 0 even though the standard explicitly does not require it. Or to put it simple: the respective shaders are buggy, not Nova. Those shaders rely on something they simply must not rely on.
However, since real-life shaders often seem to falsely rely on this behaviour, maybe a Nova feature request for an init-vars-to-zero-toggle (default off like now) is a good compromise.

Quote:
Question is : is that the same issue everywhere, or they different ones ?

Novas register handling is still broken and therefore all sorts of fun can happen. You or I cannot say for sure which exact issue it is. We cannot even say for sure if it has to do with the register allocator, it's likely but we cannot be sure. Maybe it's a different bug with familiar looking symptoms. The thing is: with those Shaderjoy shaders it is natural that whatever is the problem results in pixels being falsely colored, simply because Shadertoy is all about pixel colors and nothing else ;)
Anyway, either create one bug-report named "All sorts of pixel garbage" and then extend it with more and more links to shadertoy-shaders - or create one report for each buggy shader, maybe with a not that you somewhat guess that it may be related to bug or report xyz. But don't try to be smart and to categorize further After all you are a reporter. It's Hans job to fix that stuff and it's also his job to analyse and eventually merge or split your bug reports.

Quote:
I start to think, that it's all different bugs all the time. I.e. bug the same : wrong content in registers, and their wrong compare/use , and it didn't looks like some single particular issue. Just visually it looks pretty much the same like colors swapped, but it all can be different.

IMHO a rewrite of the register allocator is due. From what I see things get fixed in lib release A only to reappear in a slightly different form or the fixes cause other problems as sideeffects. And then there is also the missing register spilling etc.
For the upcoming ogles2 lib version I threw away and rewrote the whole program introspection system Yes, certainly no fun but sometimes you have to admit to yourself that what you did before was no good and that a rewrite with a fresh head is the far better choice, instead of putting even more patchs on that old rag rug.
In my experience this always pays off.

Go to top
Re: Warp3DNova shader bugs thread
Home away from home
Home away from home


See User information
@Daniel
Quote:

However, since real-life shaders often seem to falsely rely on this behaviour, maybe a Nova feature request for an init-vars-to-zero-toggle (default off like now) is a good compromise.


Imho also not worth , because it mean take manual actions. But then in just case, shader can be changed and that all. From another side, question is : can be unitialized variable set to 0 cause any issues in compare with being random as it now ? I mean, of course, shaders can be buggy and rely on undifened behaviours, but will setting unitialized value to 0 , cause any problems for any other possible shaders ? Imho no ? Then if no, why not have it the same just to cope with some buggy shaders ?:)

Quote:

But don't try to be smart and to categorize further After all you are a reporter. It's Hans job to fix that stuff and it's also his job to analyse and eventually merge or split your bug reports.


Indeed, just tring to help Hans to make less work :) But in end you (and Hans as well answer the same) seems right, it better to made reports for each shader differently. Just there currently :

11 shaders with wrong/swapped colors
15 shaders giving black/white/grey screen
30 shaders with wrong rendering (some with very little issues, some with major ones).

So in summ it mean about 50 bug-reports will be :)

Quote:

IMHO a rewrite of the register allocator is due. From what I see things get fixed in lib release A only to reappear in a slightly different form or the fixes cause other problems as sideeffects. And then there is also the missing register spilling etc.


There were some regression since 1.68 yes, and all probabaly indeed related to registers stuff which need rewriting with having in mind spiling as well.

Quote:

For the upcoming ogles2 lib version I threw away and rewrote the whole program introspection system


Is it that beta of 3.0 version which i had ? Because in that one remaining bugs of 2.11 were fixied, so if it just "proper rewrite" made it better in end, then yeah, that way to go.

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top

  Register To Post
« 1 (2) 3 4 5 6 »

 




Currently Active Users Viewing This Thread: 2 ( 0 members and 2 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project