POV-Ray : Newsgroups : povray.binaries.images : Mandelbulb test renders : Re: Mandelbulb test renders Server Time
31 Jul 2024 16:23:07 EDT (-0400)
  Re: Mandelbulb test renders  
From: bugman
Date: 20 Apr 2011 02:25:00
Message: <web.4dae7c201cd673e33931e4fb0@news.povray.org>
The following code is not very inefficient, but it demonstrates how you can
render the Mandelbulb in POV-Ray as an isosurface using recursive functions:

// Quadratic Mandelbulb: runtime: 4.5 minutes
camera{location <-2.5,5,5> look_at <-0.5,0,0.25> up z sky z angle 25}
light_source{20*z,1}
#declare f=function(i,x,y,z,xc,yc,zc) {select(i>0 & x*x+y*y+z*z<4, 0,
sqrt(x*x+y*y+z*z),
f(i-1,(x*x-y*y)*(1-z*z/(x*x+y*y))+xc,2*x*y*(1-z*z/(x*x+y*y))+yc,-2*z*sqrt(x*x+y*y)+zc,xc,yc,zc))};
isosurface{function{f(24,x,y,z,x,y,z)} threshold 2 max_gradient 10
contained_by{sphere{<-0.5,0,0>,2}} pigment{rgb 1}}

// Power Mandelbulb: runtime: 28 minutes
camera{location <1.75,4,5.5> look_at 0 up z sky z angle 25}
light_source{20*z,1}
#declare n=8;
#declare f=function(i,x,y,z,xc,yc,zc) {select(i>0 & x*x+y*y+z*z<4, 0,
sqrt(x*x+y*y+z*z),f(i-1,pow(x*x+y*y+z*z,n/2)*cos(n*atan2(y,x))*cos(n*atan2(z,sqrt(x*x+y*y)))+xc,pow(x*x+y*y+z*z,n/2)*si
n(n*atan2(y,x))*cos(n*atan2(z,sqrt(x*x+y*y)))+yc,-pow(x*x+y*y+z*z,n/2)*sin(n*atan2(z,sqrt(x*x+y*y)))+zc,xc,yc,zc))};
isosurface{function{f(24,0,0,0,x,y,z)} threshold 2 max_gradient 1000
contained_by{sphere{0,1.5}} pigment{rgb 1}}

I also posted this sample code here:
http://www.bugman123.com/Hypercomplex


Post a reply to this message


Attachments:
Download 'mandelbulb.jpg' (47 KB)

Preview of image 'mandelbulb.jpg'
mandelbulb.jpg


 

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.