Logo by yv3 - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Support us via Flattr FLATTR Link
 
*
Welcome, Guest. Please login or register. January 25, 2020, 09:07:52 PM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: [1]   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: 3D Anti-buddhabrot  (Read 1043 times)
0 Members and 1 Guest are viewing this topic.
ker2x
Fractal Molossus
**
Posts: 795


WWW
« on: July 28, 2014, 08:59:51 PM »

Awefull processing code  :smiley

10 millions point at 30fps, video incoming  grin

Code:
import javax.media.opengl.GL2;
import java.nio.*;
 
int nvert = 10000000;
int SIZEOF_INT = Integer.SIZE / 8;
int SIZEOF_FLOAT = Float.SIZE / 8;

final int MINITER = 20;
final int MAXITER = 400;
final float P_ALPHA = 0.1;
final float p = 2.0;

int step, oldstep = 0;

float[][] pts = new float[MAXITER+1][3];
 
PGL pgl;
 
IntBuffer vboName;
FloatBuffer vertData;
 
void setup() {
  size(1600, 1200, P3D);
  frameRate(2000);
 
  createGeometry();
  initVBO();
}
 
void draw() {
  background(0);
 
  translate(width/2, height/2,-1000);
  rotateY(frameCount * 0.001);
  
  pgl = beginPGL();
  GL2 gl2 = ((PJOGL)pgl).gl.getGL2();
 
  pgl.bindBuffer(PGL.ARRAY_BUFFER, vboName.get(0));
  gl2.glEnableClientState(GL2.GL_VERTEX_ARRAY);
  gl2.glEnableClientState(GL2.GL_COLOR_ARRAY);
 
  gl2.glVertexPointer(3, PGL.FLOAT, 7 * SIZEOF_FLOAT, 0);
  gl2.glColorPointer(4, PGL.FLOAT, 7 * SIZEOF_FLOAT, 3 * SIZEOF_FLOAT);
 
  pgl.drawArrays(PGL.POINTS, 0, nvert);
 
  gl2.glDisableClientState(GL2.GL_VERTEX_ARRAY);
  gl2.glDisableClientState(GL2.GL_COLOR_ARRAY);
  pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
 
  endPGL();
 
  if (frameCount % 60 == 0) println("fps: " + frameRate);
}
 
void createGeometry() {
  float[] temp = new float[nvert * 7];
 
  for (int n = 0; n < nvert; n++) {

    boolean needrefresh = false;

    while(!needrefresh) {
    float x,y,z,nx,ny,nz,r,r2p,th,ph = 0.0;  
    int iter = 0;

    x = random(-2.0,2.0);
    y = random(-2.0,2.0);
    z = random(-2.0,2.0);

    iter = 0;
    r = 0.0;
    nx = x;
    ny = y;
    nz = z;
    r=sqrt(x*x+y*y+z*z);
    th=atan(y/x)*p;
    ph=asin(z/r)*p;
  
    while(iter<MAXITER && r<2.0 && nx!=0.0 && r!=0.0 && nx!=-0.0 && r!=-0.0) {
      r2p = pow(r,p);
      th=atan(ny/nx)*p;
      ph=asin(nz/r)*p;
      
      nx=r2p*cos(ph)*cos(th)+x;
      ny=r2p*cos(ph)*sin(th)+y;
      nz=r2p*sin(ph)+z;
      
      pts[iter][0] = nx;
      pts[iter][1] = ny;
      pts[iter][2] = nz;
      r=sqrt(nx*nx+ny*ny+nz*nz);
      iter++;
    }
    
    if(r<2.0 && iter > MINITER) {
      for(int i = MINITER; i < iter && n < nvert-1 ; i++) {
        if(pts[i][0]*pts[i][0] + pts[i][1]*pts[i][1] + pts[i][2]*pts[i][2] < 4) {
          // position
          temp[n * 7 + 0] = pts[i][0]*(width/2.0);
          temp[n * 7 + 1] = pts[i][1]*(width/2.0);
          temp[n * 7 + 2] = pts[i][2]*(width/2.0);
 
          // color
          temp[n * 7 + 3] = abs(pts[0][0]);
          temp[n * 7 + 4] = abs(pts[0][1]);
          temp[n * 7 + 5] = abs(pts[0][2]);
          temp[n * 7 + 6] = 0.8;
          n++;
        }
      }
      needrefresh = true;      
    }
    }        
  }
 
  vertData = allocateDirectFloatBuffer(nvert * 7);
  vertData.rewind();
  vertData.put(temp);
  vertData.position(0);
}
 
void initVBO() {
  vboName = allocateDirectIntBuffer(1);
  pgl = beginPGL();
  pgl.genBuffers(1, vboName);
  pgl.bindBuffer(PGL.ARRAY_BUFFER, vboName.get(0));
  pgl.bufferData(PGL.ARRAY_BUFFER, nvert * 7 * SIZEOF_FLOAT, vertData, PGL.STATIC_DRAW);
  pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
  endPGL();
}
 
IntBuffer allocateDirectIntBuffer(int n) {
  return ByteBuffer.allocateDirect(n * SIZEOF_INT).order(ByteOrder.nativeOrder()).asIntBuffer();
}
 
FloatBuffer allocateDirectFloatBuffer(int n) {
  return ByteBuffer.allocateDirect(n * SIZEOF_FLOAT).order(ByteOrder.nativeOrder()).asFloatBuffer();
}
Logged

often times... there are other approaches which are kinda crappy until you put them in the context of parallel machines
(en) http://www.blog-gpgpu.com/ , (fr) http://www.keru.org/ ,
Sysadmin & DBA @ http://www.over-blog.com/
ker2x
Fractal Molossus
**
Posts: 795


WWW
« Reply #1 on: July 28, 2014, 09:06:48 PM »

Here it is :
<a href="http://www.youtube.com/v/0d7J1nwja4k&rel=1&fs=1&hd=1" target="_blank">http://www.youtube.com/v/0d7J1nwja4k&rel=1&fs=1&hd=1</a>

Enjoy 1440p smiley
« Last Edit: July 28, 2014, 09:42:25 PM by ker2x » Logged

often times... there are other approaches which are kinda crappy until you put them in the context of parallel machines
(en) http://www.blog-gpgpu.com/ , (fr) http://www.keru.org/ ,
Sysadmin & DBA @ http://www.over-blog.com/
kram1032
Fractal Senior
******
Posts: 1863


« Reply #2 on: July 28, 2014, 09:34:18 PM »

Pretty cheesy
This could easily be some system of bloodvessels or a connectome image (an image of the connections in a brian)
This actually looks much closer to what you might think of as a 3D mandlebrot set "holygrail" than most other works I've seen thus far. Very fine and spindly. I suppose those fine hair basically are the equivalent of whipped cream surfaces though.
I'd love to see one with more details. But I'm assuming this is a beast to render.
Btw, if you want it embedded instead of just linked, do the expanded link. The plugin this forum is using somehow doesn't recognize shortened YouTube links.
Logged
ker2x
Fractal Molossus
**
Posts: 795


WWW
« Reply #3 on: July 28, 2014, 09:47:18 PM »

Pretty cheesy
This could easily be some system of bloodvessels or a connectome image (an image of the connections in a brian)
This actually looks much closer to what you might think of as a 3D mandlebrot set "holygrail" than most other works I've seen thus far. Very fine and spindly. I suppose those fine hair basically are the equivalent of whipped cream surfaces though.
I'd love to see one with more details. But I'm assuming this is a beast to render.
Btw, if you want it embedded instead of just linked, do the expanded link. The plugin this forum is using somehow doesn't recognize shortened YouTube links.

Thx for the tips (it doesn't like https too) smiley
Yes, the algorithm is a good old one, nothing new here.
It's a beast to render indeed. I think i can do some improvements however.

The older version used ~6GB of memory  huh?
The new version use less memory ("only" 600MB) but it's rendered in one step (a few mn)... not fun at all  snore
Logged

often times... there are other approaches which are kinda crappy until you put them in the context of parallel machines
(en) http://www.blog-gpgpu.com/ , (fr) http://www.keru.org/ ,
Sysadmin & DBA @ http://www.over-blog.com/
ker2x
Fractal Molossus
**
Posts: 795


WWW
« Reply #4 on: July 28, 2014, 09:58:07 PM »

The (anti-anti) buddhabrot version :

<a href="http://www.youtube.com/v/iPp781NtSFQ&rel=1&fs=1&hd=1" target="_blank">http://www.youtube.com/v/iPp781NtSFQ&rel=1&fs=1&hd=1</a>
Logged

often times... there are other approaches which are kinda crappy until you put them in the context of parallel machines
(en) http://www.blog-gpgpu.com/ , (fr) http://www.keru.org/ ,
Sysadmin & DBA @ http://www.over-blog.com/
kram1032
Fractal Senior
******
Posts: 1863


« Reply #5 on: July 29, 2014, 12:32:02 PM »

what do you mean by "Anti-anti-buddhabrot"?
Looks nice too
Logged
ker2x
Fractal Molossus
**
Posts: 795


WWW
« Reply #6 on: July 29, 2014, 03:50:36 PM »

a regular buddhabrot, where you plot the orbit that escape smiley
Logged

often times... there are other approaches which are kinda crappy until you put them in the context of parallel machines
(en) http://www.blog-gpgpu.com/ , (fr) http://www.keru.org/ ,
Sysadmin & DBA @ http://www.over-blog.com/
knighty
Fractal Iambus
***
Posts: 819


« Reply #7 on: July 29, 2014, 06:57:45 PM »

 head batting Obviously... LOL!  rolling on floor laughing
Impressive work BTW!
Logged
Pages: [1]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Low iteration anti-buddhabrot Mandelbrot & Julia Set ker2x 1 1351 Last post December 30, 2009, 03:51:32 AM
by ker2x
Orbit density map (aka anti-buddhabrot) rotation Movies Showcase (Rate My Movie) aluminumstudios 5 3597 Last post September 17, 2013, 06:06:28 PM
by Alef
partial anti-buddhabrot Images Showcase (Rate My Fractal) Freakadella 6 1478 Last post December 21, 2012, 06:05:13 PM
by Alef
To anti-alias, or not to anti-alias? Hit the button or leave it alone? Sterlingware « 1 2 » chaos_crystal 18 3852 Last post December 19, 2012, 08:01:11 PM
by chaos_crystal
Anti-Gravity Antennae anti-attract an anti-gravity sphere Mandelbulber Gallery mclarekin 0 748 Last post August 31, 2014, 01:15:13 AM
by mclarekin

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.132 seconds with 27 queries. (Pretty URLs adds 0.012s, 2q)