theme mandelbrot

This commit is contained in:
ntr committed 2022-05-06 16:53:30 +10:00
1 parent 9fea0bdab6
commit 986d37148a
5 files changed
+172 -43

No files matched your search

@@ -11,7 +11,7 @@ Shader "Explorer/Mandelbrot"
_Repeat("Repeat", float) = 1
_Speed("Speed", range(0, 1)) = 0.1
_Symmetry("Symmetry", range(0, 1)) = 0
_EscapeRadius("EscapeRadius", range(0, 50)) = 20
_EscapeRadius("EscapeRadius", range(2, 200)) = 50
_SpectrumTexture("SpectrumTexture", 2D) = "white" {}
_SpectrumSize("SpectrumSize", float) = 16
@@ -80,17 +80,19 @@ Shader "Explorer/Mandelbrot"
c = rot(c, _Area.xy, _Angle);
float2 z; // track pixel jumping across screen
float2 zPrev;
float r = lerp(2.0f, 20.0f, tex2D(_SpectrumTexture, 0.1f));
// float r = _EscapeRadius;
float r = lerp(2.0f, 50.0f, tex2D(_SpectrumTexture, 1.0f));
float r2 = r*r;
float iter; // track current iteration
for (iter = 0; iter < _MaxIter; iter++) {
// update z based on previous z value and add original starting position
//zPrev = z;
// zPrev = z;
zPrev = rot(z, 0, _Time.y);
// zPrev = rot(z, 0, clamp(tex2D(_SpectrumTexture, 0.1f) * 6.28, 1, 6.28));
z = float2(z.x*z.x-z.y*z.y, 2*z.x*z.y) + c;
if (dot(z, zPrev) > r2) {
//if (length(z) > r) {
break;
}
}