Last active
September 12, 2026 10:46
-
-
Save mrange/eea04edb4c68ee554395ab6b41c739c2 to your computer and use it in GitHub Desktop.
Custom hydra effect
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 characters
| // https://hydra.ojack.xyz/ | |
| setFunction({ | |
| name: 'truchet', | |
| type: 'src', | |
| inputs: [ | |
| { | |
| type: 'float', | |
| name: 'T', | |
| default: 0., | |
| } | |
| , { | |
| type: 'float', | |
| name: 'Z', | |
| default: 0.125, | |
| } | |
| , { | |
| type: 'float', | |
| name: 'W', | |
| default: 0.02, | |
| } | |
| , { | |
| type: 'float', | |
| name: 'AA', | |
| default: 0.0025, | |
| } | |
| ], | |
| glsl: | |
| ` | |
| vec2 P=_st, N; | |
| P+=sin(vec2(1,sqrt(.5))*T); | |
| N=floor(P/Z+.5); | |
| P-=N*Z; | |
| P.x*=(fract(sin(dot(N ,vec2(12.9898,58.233)))*43758.5453)>.5)?1.:-1.; | |
| return vec4(vec3(smoothstep(AA,-AA,abs(min(length(P-.5*Z)-.5*Z,length(P+.5*Z)-.5*Z))-W*Z)),1); | |
| ` | |
| }) | |
| const ar = window.innerWidth / window.innerHeight; | |
| const pat=osc(17,0.2,0).thresh(0.2,0.2); | |
| truchet(()=>time*0.2,0.125,0.1,0.00125) | |
| .diff(pat) | |
| .invert() | |
| .mult(osc(20,0.1,1).mult(pat)) | |
| .kaleid(20) | |
| .scale(1,1,ar) | |
| .out() | |
| ; |
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 characters
| // https://hydra.ojack.xyz/ | |
| setFunction({ | |
| name: 'truchet', | |
| type: 'src', | |
| inputs: [ | |
| { | |
| type: 'float', | |
| name: 'T', | |
| default: 0., | |
| } | |
| , { | |
| type: 'float', | |
| name: 'Z', | |
| default: 0.125, | |
| } | |
| , { | |
| type: 'float', | |
| name: 'W', | |
| default: 0.02, | |
| } | |
| , { | |
| type: 'float', | |
| name: 'AA', | |
| default: 0.0025, | |
| } | |
| ], | |
| glsl: | |
| ` | |
| vec2 P=_st, N; | |
| P+=sin(vec2(1,sqrt(.5))*T); | |
| N=floor(P/Z+.5); | |
| P-=N*Z; | |
| P.x*=(fract(sin(dot(N ,vec2(12.9898,58.233)))*43758.5453)>.5)?1.:-1.; | |
| return vec4(vec3(smoothstep(AA,-AA,abs(min(length(P-.5*Z)-.5*Z,length(P+.5*Z)-.5*Z))-W*Z)),1); | |
| ` | |
| }) | |
| const ar = window.innerWidth / window.innerHeight; | |
| truchet(()=>time*0.2,0.125,0.1,0.005) | |
| .diff(osc(17,0.2,0).thresh(0.2,0.2)) | |
| .rotate(0,.15) | |
| .invert() | |
| .mult(osc(20,0.1,1)) | |
| .kaleid(17) | |
| .scale(1,1,ar) | |
| .out() | |
| ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment