Put together a really simple ISF shader to do this fractal thing. The background of each frame is two rotated copies of the previous frame with the input image overlayed on top with basic alpha blending.
https://youtu.be/O5pmEglsJjU
Fractal ISF Shader
-
Terry Payman
- Posts: 807
- Joined: Sun Sep 14, 2014 8:15 am
- Location: UK
- Contact:
Re: Fractal ISF Shader
Really cool!
Are you willing to share your ISF?
Are you willing to share your ISF?
-
SelfDrivingCarp
- Posts: 20
- Joined: Sat Jan 06, 2024 5:44 am
Re: Fractal ISF Shader
Code: Select all
/*{
"DESCRIPTION": "Fill the bockground with recursive copies of inputImage",
"CREDIT": "@SelfDrivingCarp",
"ISFVSN": "2",
"CATEGORIES": [
"Effect"
],
"INPUTS": [
{
"NAME": "inputImage",
"TYPE": "image"
}
],
"PASSES": [
{
"TARGET":"lastOutput",
"PERSISTENT": true
},
{
"DESCRIPTION": "output"
}
]
}*/
vec4 baseImage(vec2 p) {
// read this pixel from inputImage
vec4 col = IMG_NORM_PIXEL(inputImage, p);
// grab th color that would go under it. If it's on the left side, we'll
// from lastOutput rotated and scaled one way, on the right, the other way
vec2 underCoord;
if (p.x < 0.5) {
underCoord.x = p.y;
underCoord.y = p.x*2.0;
} else {
underCoord.x = 1.0-p.y;
underCoord.y = (1.0-p.x)*2.0;
}
// grab the underneath pixel from lastOutput. Add some transparency
vec4 under = IMG_NORM_PIXEL(lastOutput, underCoord);
under.a *= 0.9;
// combine the input color with the under color according to the alpha
// channel of the input color. For the resulting alpha channel, use the
// higher alpha value of input and under color
col.rgb = (col.rgb * col.a) + (under.rgb * (1.0-col.a));
col.a = max(col.a,under.a);
return col;
}
void main() {
vec4 inputPixelColor;
if (PASSINDEX == 0) {
// Our first pass composites the new input with the previous frame,
// writing the output to the persistent lastOutput buffer
inputPixelColor = baseImage(isf_FragNormCoord.xy);
} else {
// Our second pass copies from the persistent buffer to our output
inputPixelColor = IMG_NORM_PIXEL(lastOutput, isf_FragNormCoord.xy);
}
gl_FragColor = inputPixelColor;
}
This won't do anything interesting without alpha transparency in the input.
Re: Fractal ISF Shader
Lots of fun with different content - thank you for sharing!