Fractals/Iterations in the complex plane/slope

It is an algorithm for converting 2D image to 3D

Description
"three points are iterated for each pixel and then are used to create a three-dimensional surface. A vector perpendicular to that surface is used as the z variable and is passed to the coloring routine. When a Slope formula is used with the Lighting coloring, the result resembles a fractal surface being illuminated from above and to the side." Kerry Mitchell

names

 * lifted domain coloring
 * Hill-Shading the Mandelbrot Set
 * almondbread
 * Hill-Shading the Mandelbrot Set 29 stycznia 2021 - article
 * How to calculate shaded relief for the entire world with GDAL, fast by Anna Thieme
 * How Hillshade works from ArcGIS Pro 3.1

Differences
 * shaded relief or hill shade: Creates a shaded relief from a surface raster by considering the illumination source angle and shadows
 * Slope = Identifies the slope (gradient or steepness) from each cell of a raster.

slope of the line


In mathematics, the slope or gradient of a line is a number that describes both the direction and the steepness of the line. Slope is often denoted by the letter m; there is no clear answer to the question why the letter m is used for slope,

y = mx + b

Slope of the line through 2 points: (x1,y1) and (x2,y2) is:


 * $$m=\frac{y_2-y_1}{x_2-x_1}.$$

the slope m of a line is related to its angle of inclination θ by the tangent function:


 * $$m = \tan (\theta)$$

Apply to

 * Mandelbrot
 * Julia
 * Newton
 * Kleinian group fractals
 * strange attractors

code

 * Ultrafractal formulas by Damien Jones in dmj.ufm and standard.ufm

matlab
Matlab code by nickspiker

C++
C++ code by LionHeart

GLSL
slope lighting in an OpenGLSL code shader by Softology
 * 1) version 400

//the following uniform values are set by Visions of Chaos prior to shader execution uniform vec2 resolution; uniform vec3 palette[256]; uniform double xmin; uniform double xmax; uniform double ymin; uniform double ymax; uniform double bailout; uniform int maxiters; uniform int samplepixels;

double sqrsamplepixels=double(samplepixels*samplepixels); double bailout_squared=double(bailout*bailout); double magnitude,r1,r2,g1,g2,b1,b2,r,g,b,tweenval; float realiters; vec4 finalcol,col; int superx,supery; double stepx=(xmax-xmin)/resolution.x/double(samplepixels); double stepy=(ymax-ymin)/resolution.y/double(samplepixels); int index,colval,colval2; dvec2 z,c,dc,der,u,v,ctwo; double h2,angle,pi,t;

// // complex number operations dvec2 cadd( dvec2 a, dvec2 b ) { return dvec2( a.x+b.x, a.y+b.y ); } dvec2 csub( dvec2 a, dvec2 b ) { return dvec2( a.x-b.x, a.y-b.y ); } dvec2 cmul( dvec2 a, dvec2 b ) { return dvec2( a.x*b.x - a.y*b.y, a.x*b.y + a.y*b.x ); } dvec2 cdiv( dvec2 a, dvec2 b ) { double d = dot(b,b); return dvec2( dot(a,b), a.y*b.x - a.x*b.y ) / d; } dvec2 csqr( dvec2 a ) { return dvec2(a.x*a.x-a.y*a.y, 2.0*a.x*a.y ); } dvec2 csqrt( dvec2 z ) { double m = length(z); return sqrt( 0.5*dvec2(m+z.x, m-z.x) ) * dvec2( 1.0, sign(z.y) ); } dvec2 conj( dvec2 z ) { return dvec2(z.x,-z.y); } dvec2 cabs( dvec2 c) { return dvec2(sqrt(c.x * c.x + c.y * c.y)); } //

void main(void) {	finalcol=vec4(0,0,0,0); pi=3.14159265359; h2=1.5; // height factor of the incoming light angle=45; // incoming direction of light v=dvec2(exp(float(1.0*angle*2*pi/360)),0.0); // unit 2D vector in this direction ctwo=dvec2(2.0,0.0);

for (supery=0;superybailout_squared) break; // der = der*2*z + dc				der = cadd(cmul(der,cmul(ctwo,z)),dc); }

if (i==maxiters) { col=vec4(0.0,0.0,0.0,1.0); } else { //CPM smooth colors //note that double precision does not support log so it needs to be cast as float realiters=float(i+1-((log(log(sqrt(float(magnitude))))/log(2.0)))); colval=int(mod(realiters,255)); colval2=int(mod(colval+1,255)); tweenval=realiters-int(realiters); r1=palette[colval].r;				g1=palette[colval].g;				b1=palette[colval].b;				r2=palette[colval2].r;				g2=palette[colval2].g;				b2=palette[colval2].b;				r=r1+((r2-r1)*tweenval); g=g1+((g2-g1)*tweenval); b=b1+((b2-b1)*tweenval);

u = cdiv(z,der); u = cdiv(u,cabs(u)); // normal vector: (u.re,u.im,1) t = u.x*v.x + u.y*v.y + h2; // dot product with the incoming light t = t/(1+h2); // rescale so that t does not get bigger than 1 if (t<0) { t=0; } //p.color = linear_interpolation(black,white,t) t=1.0-t; r=r*t; g=g*t; b=b*t;

col=vec4(r,g,b,1.0); }

finalcol+=col; }	}	gl_FragColor = vec4(finalcol/double(sqrsamplepixels)); }

programs

 * ultrafractal
 * directional DE, which can be used for slope colouring

Compare with

 * bumpmaping
 * Derivative