Logo by bib - 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: Visit us on facebook
 
*
Welcome, Guest. Please login or register. March 29, 2024, 12:26:41 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 [2] 3   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: Where are the realtime GPU mandelboxes?  (Read 43558 times)
0 Members and 3 Guests are viewing this topic.
trafassel
Fractal Bachius
*
Posts: 531


trafassel
« Reply #15 on: July 09, 2010, 12:42:41 PM »

I agree to Trifox – this is a very good example to start a own shading algorithm. It would be cool,  if there is an place in this forum, where users share simple shaders for some of the discussed 3D fractals here.
Logged
trafassel
Fractal Bachius
*
Posts: 531


trafassel
« Reply #16 on: July 12, 2010, 07:48:08 PM »

// I have replaced the Mandelbox Formula by the 3DJulia formula to test the influence of different
// parameters of the strange spirals in real time.

// Distance estimation is removed, so it should be easy to define own fractals in computeDistAndColors().
// This function has only to decide, if a given point is inside or outside to fractal. Additional
// a surface color can be defined.

// You have to save this text in a file with name fragment.glsl and put it in the same directory as
// Boxplorer.exe

// Pressing q or w change a spiral parameter (fine tuning of this parameter is done with a and s).
// All other keys are used like the original shader.


// Mandelbox shader by Rrrola
// Original formula by Tglad
// - http://www.fractalforums.com/3d-fractal-generation/amazing-fractal
// Changed to formula 21 (3DJulia) by trafassel

// Camera position and direction.
varying vec3 eye, dir;

// Interactive parameters.
uniform float scale,  // Fractal scale. Controls the appearance of the Mandelbox.
  min_dist,           // Distance at which sphere tracing stops.
  eps;                // Epsilon for surface normal approximation.
uniform int iters,    // Number of fractal iterations.
  max_steps;          // Maximum sphere tracing steps.

// some parameters to change
// the default formula uses para1 and para2
static float para1;
static float para2;
static float para3;
static float para4;
static float para5;
static float para6;
static float para7;
static float para8;



// Colors.
vec3 backgroundColor = vec3(0.25, 0, 0.5),
  glowColor = vec3(0, 0.75, 1),
  objectColor1 = vec3(1, 0, 0.15),
  objectColor2 = vec3(1, 0.66, 0),
  specularColor = vec3(1, 1, 0.75);


// Compute the "distance" from `pos` to the Mandelbox.
// Because the is no default distance estimation for arbitrary functions,
// this method has only to know, if p is inside or outside the iterative set. 
// retVal[0]>0 outside, retVal[0]<0 inside the fractal
// retVal[1], retVal[2], retVal[3] Components of the surface color
// retVal[1]=red
// retVal[2]=green
// retVal[3]=blue
vec4 computeDistAndColors(vec3 p) {
  // a little bit scaling to get a nice start view
  p=0.4*p;
  vec4 retVal=vec4(0,0,0,0);
  vec3 col=vec3(0,0,0);

  // Preparation:
  float xx=p.x*p.x;
  float yy=p.y*p.y;
  float zz=p.z*p.z;
  float r=sqrt(xx+yy+zz);

  float myI=0.0;
  int myIters=5;
  float lastr=0.0;
  float bailoutr=300.0;
  float myScale=scale/4.0;


  for (int i=0; i<iters; i++) {
    p.x=2.0*p.x*p.y*p.z;
    p.y=yy-para1*(xx+zz);
    p.z=zz-para1*(xx+yy);
    xx=p.x*p.x;yy=p.y*p.y;zz=p.z*p.z;

    p.y=2.0*p.x*p.y*p.z;
    p.x=xx-para1*(yy+zz);
    p.z=zz-para1*(xx+yy);

 // Julia Seed
    p.z+=para2;

    xx=p.x*p.x;yy=p.y*p.y;zz=p.z*p.z;
    float tempDist=xx+yy+zz;

    float r=sqrt(tempDist);

    if(i>2&&i<iters-1) {
        col[0]+=xx/tempDist;
        col[1]+=yy/tempDist;
        col[2]+=zz/tempDist;
     }


    if(r>bailoutr) {
      retVal[0]=1.0;
      if(i>1) // near the surface
        retVal[0]=2.0;
      retVal[1]=col[0];
      retVal[2]=col[1];
      retVal[3]=col[2];
      return retVal;
    }
    lastr=r;
  }
  retVal[0]=-1.0;
  retVal[1]=col[0];
  retVal[2]=col[1];
  retVal[3]=col[2];

  return retVal;
}


// Gets the distance from pos to the fractal.
// <0, if pos is inside
float d(vec3 pos) {
  return computeDistAndColors(pos)[0];
}



// Get true, if the point p is element of the fractal.
bool isInSet(vec3 p) {
  return (d(p)<=0.0);
}


// Moves p in direction, such that p is near the surface.
// Distance ist the maximal distance from p to the surface of the fractal.
vec3 fix(vec3 p,vec3 direction,float distance) {
  float myDist=distance;
  float minDist=0.000001;
  bool inSet=true;
  float mult=1.0;
  while(myDist>minDist) {
   inSet=isInSet(p);
   if(inSet)
   mult=-myDist;
   else mult=myDist;
   p+=mult*direction;
   myDist*=0.5;
  }
  return p;
}


// Gets the normal of the surface on point p.
// using: eps,dir
vec3 getNormal(vec3 p,float dist) {
  vec3 dp = normalize(dir);
  vec3 tempVec=vec3(dir.y,-dir.z,dir.x);
  vec3 dir1=normalize(cross(dir,tempVec));
  vec3 dir2=normalize(cross(dir,dir1));
  vec3 p1=fix(p+20.0*eps*dir1,dp,dist);
  vec3 p2=fix(p+20.0*eps*dir2,dp,dist);
  return normalize(cross(p1-p,p2-p));
}


// custom function to set the type of the changable parameter.
// The color of the background shows the type of parameters.
// To change the tape, the user has to press 'c' or 'v'.
void setPara() {
  backgroundColor = vec3(0, 0, 0);
  //int dType=(max_steps-50);
int add=180;
int dType=(max_steps-add);
if(dType<0)
 dType=-1;
if(dType>add)
 dType=-2;

switch(dType) {
case -1:
para1=1;
para2=1;
para3=1;
para4=1;
para5=1;
para6=1;
para7=1;
para8=1;
backgroundColor = vec3(1, 0, 0);
break;

case -2:
para1=1;
para2=1;
para3=1;
para4=1;
para5=1;
para6=1;
para7=1;
para8=1;
backgroundColor = vec3(1, 1, 1);
break;


case 0:
para1=0.17*(scale+min_dist);
backgroundColor = vec3(0, 0, 0);
glowColor = vec3(0, 0, 0);
break;

case 1:
para1=0.17*(scale+min_dist);
backgroundColor = vec3(0.25, 0, 0);
break;

case 2:
para1=0.3*scale;
para2=min_dist;
backgroundColor = vec3(0, 0.25, 0);
break;

case 3:
para4=scale+min_dist;
backgroundColor = vec3(0.25, 0.25, 0);
break;

case 4:
para5=scale+min_dist;
backgroundColor = vec3(0, 0.25, 0.25);
break;

case 5:
para6=scale+min_dist;
backgroundColor = vec3(0.25, 0,0.25);
break;

case 6:
para7=scale+min_dist;
backgroundColor = vec3(0.25, 0.25, 0.25);
break;

case 7:
para8=scale+min_dist;
backgroundColor = vec3(0.5, 0.5, 0);
break;

}

}


// This method is called for each pixel in the output bitmap.
void main() {
 
  setPara();
  vec3 p = eye, dp = normalize(dir);

  // Using different accuracy for forground and background.
  float dist = 0.03;
  float mainDist=0.02;
  float frontDist=0.01;
  float backDistMult=1.05;
  int steps;
  int my_max_steps=160;
  int front_steps=20;
  int background_steps=110;
  bool isOutside=true;
  float estimatedDist=dist;

  // Intersect the view ray with the Fractal.
  for (steps=0; steps<my_max_steps; steps++) {
    if(isOutside) {
      if (steps<front_steps)
         dist=frontDist;
      else
       if (steps<background_steps)
         dist=mainDist;
       else
         dist*=backDistMult;     
    }
    if (isInSet(p)) {
      if(dist>mainDist) {
         p -= dist * dp;
         isOutside=false;
         my_max_steps+=10;
         dist=mainDist;
      } else {
        isOutside=false;
        break;
        }
     }
    p += dist * dp;
  }

 
  // Moves p to the surface of the fractal.
  p=fix(p,dp,dist);
  vec3 normal=getNormal(p,dist);

  // Draw the surface.
  vec3 color = specularColor;
  if (!isOutside) {
    // This time, we need the surface color.
    vec4 mycol=computeDistAndColors(p);
    normal=normalize(normal);
    float frontLight=dot(normal,dp);
    frontLight*=frontLight;
    color[0]=mycol[1];   color[1]=mycol[2];   color[2]=mycol[3];
    color=normalize(color);
    color=frontLight*(0.5*color+vec3(0.5,0.5,0.5));
    }

  if(steps>my_max_steps)
    steps=my_max_steps;
  if(isOutside)
    gl_FragColor = vec4(backgroundColor, 1);
  else // surface gets a 'glow', if the corresponding points are far away.
    gl_FragColor = vec4(mix(color, glowColor, float(steps)/float(my_max_steps)), 1);
}


* juli3d.jpg (62.33 KB, 800x600 - viewed 540 times.)
Logged
Rrrola
Alien
***
Posts: 23


« Reply #17 on: July 21, 2010, 06:23:35 PM »

Boxplorer 1.02 released.
http://www.ms.mff.cuni.cz/~kadlj3am/big/boxplorer/

What's new: speedups, parameter files, screenshots, fullscreen mode, ambient occlusion, anti-aliasing, better controls, user parameters, Linux compatibility and colors that don't hurt your eyes. ;-)

I'll post some high-quality screenshots later.
Logged
paolo
Explorer
****
Posts: 50


« Reply #18 on: July 21, 2010, 07:42:52 PM »

I have used Boxplorer and it is amazingly fast. However when I use it with a bigger window than the default, malware has been detected by my AVG internet security program. Details of what AVG detected are enclosed in the attached JPG file. What is causing AVG to detect a malware threat? It it possible to use Boxplorer without the malware? Are there any other programs which render the Mandelbox using the GPU?


* Boxplorer.jpg (109.33 KB, 623x765 - viewed 551 times.)
Logged
Rrrola
Alien
***
Posts: 23


« Reply #19 on: July 22, 2010, 12:36:40 AM »

What is causing AVG to detect a malware threat? It it possible to use Boxplorer without the malware?

- Shadows a system executable: That's probably because of the name (it's similar to Explorer.exe).
- Small executable: It's small because it uses the Windows C runtime, SDL and OpenGL - most of the functionality is provided from outside. (And I would argue that a 29 kB exe isn't small at all. wink)
- Executes from the filesystem: Probably because it doesn't need to be installed in Program Files.
- Injects code: I don't know what this means. Do the previous versions of Boxplorer cause this too?

This is a false alarm (AVG is known to cause these on intro-like programs). All in all, if you don't trust this exe, the full source code is available in the directory /src and you can compile it yourself (I'm using MinGW, a Windows port of the GCC compiler).
Logged
Rrrola
Alien
***
Posts: 23


« Reply #20 on: July 22, 2010, 12:54:47 PM »

OK, here are the promised screenshots. More are on my page (http://rrrola.wz.cz/downloads.html#effects) or my deviantART account (http://rrrola.deviantart.com/).


* 20100717_144833.jpg (69.95 KB, 512x384 - viewed 516 times.)

* 20100722_091152.jpg (93.52 KB, 512x384 - viewed 484 times.)

* 20100720_091715.jpg (76.01 KB, 512x384 - viewed 491 times.)

* 20100722_090721.jpg (59.07 KB, 512x384 - viewed 495 times.)
Logged
Rathinagiri
Fractal Fertilizer
*****
Posts: 374


« Reply #21 on: July 22, 2010, 02:59:58 PM »

Very promising. smiley Thanks man.
Logged
marius
Fractal Lover
**
Posts: 206


« Reply #22 on: September 02, 2010, 08:54:06 AM »

Boxplorer 1.02 released.
http://www.ms.mff.cuni.cz/~kadlj3am/big/boxplorer/

What's new: speedups, parameter files, screenshots, fullscreen mode, ambient occlusion, anti-aliasing, better controls, user parameters, Linux compatibility and colors that don't hurt your eyes. ;-)

I'll post some high-quality screenshots later.

Sweet little program!  smiley

I've hacked it up a bit to add a form of stereoscopic rendering and path recording/playback+save imgs.
(http://www.fractalforums.com/mandelbulb-renderings/46-inch-stereoscopic-display/msg21092/#msg21092)

Would you care for diffs back or do you have a svn/git repository somewhere?
Also made it compile using the free (yay!) visual C++ 10 express, mostly a bunch of project/solution setup pain  undecided
Logged
cbuchner1
Fractal Phenom
******
Posts: 443


« Reply #23 on: September 02, 2010, 04:43:03 PM »

Very promising. smiley Thanks man.

And very cool that it builts on Linux. Only -lm -lglut -lSDL need to be specified to link against.
You will need freeglut and the SDL devel headers.
Logged
marius
Fractal Lover
**
Posts: 206


« Reply #24 on: September 02, 2010, 11:51:05 PM »

Boxplorer 1.02 released.
http://www.ms.mff.cuni.cz/~kadlj3am/big/boxplorer/

What's new: speedups, parameter files, screenshots, fullscreen mode, ambient occlusion, anti-aliasing, better controls, user parameters, Linux compatibility and colors that don't hurt your eyes. ;-)

I'll post some high-quality screenshots later.

Sweet little program!  smiley

I've hacked it up a bit to add a form of stereoscopic rendering and path recording/playback+save imgs.
(http://www.fractalforums.com/mandelbulb-renderings/46-inch-stereoscopic-display/msg21092/#msg21092)

Would you care for diffs back or do you have a svn/git repository somewhere?
Also made it compile using the free (yay!) visual C++ 10 express, mostly a bunch of project/solution setup pain  undecided

Find attached changes i made to add two forms of stereoscopic rendering.
Add --overunder or --xeyed to the commandline.
Make sure to use the provided vertex.glsl since i added some parameters to pass to the videocard..

btw, does anyone have a regular mandelbulb.glsl that works nicely with boxplorer? Other interesting fragment.glsl types?

* boxplorer-stereo.zip (8.44 KB - downloaded 227 times.)
Logged
cbuchner1
Fractal Phenom
******
Posts: 443


« Reply #25 on: September 06, 2010, 11:09:44 AM »

And very cool that it builts on Linux. Only -lm -lglut -lSDL need to be specified to link against.
You will need freeglut and the SDL devel headers.

This weekend I ran this on a Geforce GTX 460 on OpenSuSE Linux 11.2 and it was quite a sight.
To get the resolution to 1920x1200 (that of my LCD monitor), I edited the last.cfg file and
passed last.cfg as a command line argument on each successive start.

It delivered quite good frame rates still, enough for interactive navigation.

Christian
Logged
knighty
Fractal Iambus
***
Posts: 819


« Reply #26 on: September 08, 2010, 01:23:03 AM »

Nice software and clever optimization to the distance estimation formula. smiley Thanks Rrrola.
Logged
Rrrola
Alien
***
Posts: 23


« Reply #27 on: September 09, 2010, 06:09:08 AM »

Mandelbox with {scale~-1.1, minRad~0} is really interesting. The number or iterations must be about 100.

The secondary branch count follows the Fibonacci sequence:


Kleinian group:


Trees with Menger sponges:


Hyperbolic circle packing (sort of):


And the corner of the box:


I'm uploading hi-res images (8192x6144) to http://www.ms.mff.cuni.cz/~kadlj3am/big/boxplorer/screenshots/hires/ if anyone is interested.
Logged
marius
Fractal Lover
**
Posts: 206


« Reply #28 on: September 09, 2010, 06:14:15 AM »

Mandelbox with {scale~-1.1, minRad~0} is really interesting. The number or iterations must be about 100.
..
I'm uploading hi-res images (8192x6144) to http://www.ms.mff.cuni.cz/~kadlj3am/big/boxplorer/screenshots/hires/ if anyone is interested.

very nice indeed! <me starting up other computer to start exploring/>
Logged
Jesse
Download Section
Fractal Schemer
*
Posts: 1013


« Reply #29 on: September 09, 2010, 02:50:43 PM »

Very nice indeed!
Thank you also for the formula improvements, the minmax clipping works with SSE very good too  smiley

I avoided scalings near to +/-1 because of inaccuracies, but with a minimum iterationcount of 20 and a maximum of 160 or so it works also with M3D   angel
Logged
Pages: 1 [2] 3   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Different mandelbulbs and mandelboxes 3D Fractal Generation paolo 1 1743 Last post July 29, 2010, 11:12:58 PM
by cKleinhuis
Dusty power -1.5 Mandelboxes Movies Showcase (Rate My Movie) nameinuse2 3 1391 Last post November 08, 2010, 06:10:00 PM
by kon16ov
gallery #5 - Mandelbox - MarkJBee, Videos, Realtime chaosTube - Gallery cKleinhuis 0 3332 Last post February 15, 2015, 03:17:48 PM
by cKleinhuis
Mandelbulb in 3d realtime for VR The 3D Mandelbulb Chillheimer 0 4817 Last post January 08, 2016, 06:40:38 PM
by Chillheimer
GeoKone.NET :: Realtime Recursive Geometry Generator Multi Platform inDigiNeous 4 10235 Last post April 24, 2016, 08:29:56 AM
by inDigiNeous

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.197 seconds with 27 queries. (Pretty URLs adds 0.009s, 2q)