Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
88 user(s) are online (68 user(s) are browsing Forums)

Members: 0
Guests: 88

more...

Support us!

Recent OS4 Files
OS4Depot.net

Report message:*
 

Re: Warp3DNova shader bugs thread

Subject: Re: Warp3DNova shader bugs thread
by kas1e on 2020/6/3 21:27:37

@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..

Powered by XOOPS 2.0 © 2001-2016 The XOOPS Project