Last active
May 27, 2025 14:37
-
-
Save Doprez/fade95eeb2ad6a8d5d6cb335c45c7cda to your computer and use it in GitHub Desktop.
Revisions
-
Doprez revised this gist
May 27, 2025 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ // https://www.shadertoy.com/view/ll2GRt shader OilStainPortal : ComputeColor, Texturing { override float4 Compute() { -
Doprez created this gist
May 27, 2025 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,114 @@ // https://www.shadertoy.com/view/ll2GRt shader OilStainPortal<float Frequency, float Amplitude, float Speed> : ComputeColor, Texturing { override float4 Compute() { float2 uv = 1.0 - 2.0 * (streams.TexCoord); float t = Global.Time * 0.6; float2 rv = uv/(length(uv*2.5)*(uv*90.0)); var rot1 = rot2d(0.5*t); // Rotates the texture uv = mul(uv, rot1); float val = 0.5*fbm(uv*2.0*fbmLow(length(uv)+rv-t)); var rot2 = rot2d(-0.*t); uv = mul(uv, rot2); var col1 = 0.5*fbm(uv*val*24.0)+0.01*r(uv.x,uv.y); float4 fragColor = 1.6*float4( float3(col1,col1,col1), 1.0 ); fragColor.rgb *= 3.12; fragColor.rgb = fragColor.rgb/(0.9+fragColor.rgb); fragColor.rgb = smoothstep(0.001, 0.88, fragColor.rgb); //fragColor.rgb = pow(fragColor.rgb, float3(1.0/2.2, 1.0/2.2, 1.0/2.2)); return fragColor; } float2x2 rot2d(float angle) { return float2x2(cos(angle),-sin(angle),sin(angle),cos(angle)); } float r(float a, float b) { return frac(sin(dot(float2(a,b),float2(12.9898,78.233)))*43758.5453); } float h(float a) { return frac(sin(dot(a,dot(12.9898,78.233)))*43758.5453); } float noise(float3 x) { float3 p = floor(x); float3 f = frac(x); f = f*f*(3.0-2.0*f); float n = p.x + p.y*57.0 + 113.0*p.z; return lerp(lerp(lerp( h(n+0.0), h(n+1.0),f.x), lerp( h(n+57.0), h(n+58.0),f.x),f.y), lerp(lerp( h(n+113.0), h(n+114.0),f.x), lerp( h(n+170.0), h(n+171.0),f.x),f.y),f.z); } // https://iquilezles.org/articles/morenoise // http://www.pouet.net/topic.php?post=401468 float3 dnoise2f(float2 p) { float i = floor(p.x), j = floor(p.y); float u = p.x-i, v = p.y-j; float du = 30.*u*u*(u*(u-2.)+1.); float dv = 30.*v*v*(v*(v-2.)+1.); u=u*u*u*(u*(u*6.-15.)+10.); v=v*v*v*(v*(v*6.-15.)+10.); float a = r(i, j ); float b = r(i+1.0, j ); float c = r(i, j+1.0); float d = r(i+1.0, j+1.0); float k0 = a; float k1 = b-a; float k2 = c-a; float k3 = a-b-c+d; return float3(k0 + k1*u + k2*v + k3*u*v, du*(k1 + k3*v), dv*(k2 + k3*u)); } float fbm(float2 uv) { float2 p = uv; float f, dx, dz, w = 0.5; f = dx = dz = 0.0; for(int i = 0; i < 28; ++i) { float3 n = dnoise2f(uv); dx += n.y; dz += n.z; f += w * n.x / (1.0 + dx*dx + dz*dz); w *= 0.86; uv *= float2(1.16, 1.16); var rotation = rot2d(1.25*noise(float3(p*0.1, 0.12*Global.Time))+ 0.75*noise(float3(p*0.1, 0.20*Global.Time))); uv = mul(uv, rotation); } return f; } float fbmLow(float2 uv) { float f, dx, dz, w = 0.5; f = dx = dz = 0.0; for(int i = 0; i < 4; ++i) { float3 n = dnoise2f(uv); dx += n.y; dz += n.z; f += w * n.x / (1.0 + dx*dx + dz*dz); w *= 0.75; uv *= float2(1.5, 1.5); } return f; } };