• May 09, 2021, 06:30:14 AM

Login with username, password and session length

 


MetamorphosisDonutsRefracted Apollonian
Donuts
Previous Image | Next Image
Description: Rendition of the "Donuts" algorithm presented here: https://www.shadertoy.com/view/lttcWn
The attached image gives only a brief hint of what this algorithm does.

CPU ------------------------------

control.cx = 5.0431595
control.cy = 0.9600003
control.cz = 2.6700654
control.dx = 0.31000012
control.dy = 0.29999998
control.maxSteps = 4.0
 
GPU ------------------------------

#define MAJOR_RADIUS control.cx
#define MINOR_RADIUS control.cy
#define SCALE        control.cz

float DE(float3 pos, device Control &control, thread float4 &orbitTrap) {
    float3 n = -float3(control.dx,0,control.dy);
    float dis = 1e20;
    float newdis,s = 1.;
    float2 q;    
 
    for (int i=0; i < control.maxSteps; i++) {
        q = float2(length(pos.xz) - MAJOR_RADIUS,pos.y);
       
        newdis = (length(q)-MINOR_RADIUS)*s;
        if(newdis<dis) dis = newdis;
       
        //folding
        pos.xz = abs(pos.xz);                      // fold to positive quadrant
        if(pos.x < pos.z) pos.xz = pos.zx;    // fold 45 degrees
        pos -= 2. * min(0.,dot(pos, n)) * n; // fold 22.5 degrees
       
        //rotation
        pos.yz = float2(-pos.z,pos.y);
       
        //offset
        pos.x -= MAJOR_RADIUS;
       
        //scaling
        pos *= SCALE;
        s /= SCALE;
       
        orbitTrap = min(orbitTrap, float4(abs(pos), dot(pos,pos)));
    }
   
    return dis;
}

Stats:
Views: 68
Total Favorities: 0 View Who Favorited
Filesize: 3.47MB
Height: 1338 Width: 2782
Keywords: stereo 
Posted by: kosalos November 25, 2020, 09:37:45 PM

Rating: ***** by 2 members.
Total Likes: 2

Image Linking Codes
BB Code
BB Thumbnail Image Code
BB Medium Image Code
0 Members and 1 Guest are viewing this picture.

Comments (1)

pauldelbrot
3f
******
Offline Offline

Posts: 2775



View Profile
November 26, 2020, 05:00:56 AM
The Devil's Keyrings.

Return to Gallery


Powered by SMF Gallery Pro