POV-Ray : Newsgroups : povray.binaries.images : 'Accidental' isosurface : Re: 'Accidental' isosurface Server Time
23 Jun 2024 15:51:23 EDT (-0400)
  Re: 'Accidental' isosurface  
From: CShake
Date: 13 Dec 2009 16:59:58
Message: <4b2563de$1@news.povray.org>
PM 2Ring wrote:
> Here's my latest Mandelbulb, rendered using the isosurface / df3 method.

> but no radiosity: it was just too slow. This render took over 7 days on my
> 480MHz machine. I was hoping for a more impressive looking result, after all
> that render time. Oh well.
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
Nice.

Here's a 800^3 isosurface/df3, with radiosity and real HDRI, but I can't 
figure out what's wrong with my code, since the shape isn't right. It 
was supposed to be the n=8 shape from <-1.2,-1.2,-1.2> to <1.2,1.2,1.2>.

Time: 26 minutes with max_gradient 200 on a 2.6 GHz quad-core (AMD 
Phenom 9950) for the render, and somewhere around there for the 
generation on an older dual-core linux box.

Here's my c++ code for the iterations if anyone can figure out what is 
wrong, I've gone through it many times and can't figure out what's not 
right...

Chris

--------------------------------------------------------------------------
/* Iterates the formula at a given x,y,z and returns the smoothed number 
of iterations used */
float IteratePoint(double cx, double cy, double cz, double n, double 
bailout, int maxiter){
	double x=0.0,y=0.0,z=0.0;
	double r=0.0,rn=0.0,phin,thetan,sinthetan;
	for(int i=0;i<maxiter;i++){
		r=sqrt(pow(x,2)+pow(y,2)+pow(z,2));
		if(r>bailout){
			rn=pow(r,n);
			thetan=atan2(sqrt(pow(x,2)+pow(y,2)),z)*n;
			phin=atan2(y,z)*n;
			x=rn*sin(thetan)*cos(phin)+cx;
			y=rn*sin(thetan)*sin(phin)+cy;
			z=rn*cos(thetan)+cz;
			r=sqrt(pow(x,2)+pow(y,2)+pow(z,2));
			return (float)i + 1 - (log(log(r)/log(bailout)))/log(n);
		}
		rn=pow(r,n);
		thetan=atan2(sqrt(pow(x,2)+pow(y,2)),z)*n;
		phin=atan2(y,z)*n;
		x=rn*sin(thetan)*cos(phin)+cx;
		y=rn*sin(thetan)*sin(phin)+cy;
		z=rn*cos(thetan)+cz;
	}
	return (float)maxiter;
}

-------------------
and the loop part : (xs/xe are x-start, x-end values, same for y and z)
for (i=0;i<nx;i++){
	for (j=0;j<ny;j++){
	#pragma omp parallel 
shared(df3,nx,ny,nz,xs,xe,ys,ye,zs,ze,bailout,maxiter,n,i,j,chunk) 
private(k,cx,cy,cz)
	{
		#pragma omp for schedule(dynamic,chunk) nowait
		for (k=0;k<nz;k++){
			cx = (((double)i+0.5)/(double)nx)*(xe-xs)+xs;
			cy = (((double)j+0.5)/(double)ny)*(ye-ys)+ys;
			cz = (((double)k+0.5)/(double)nz)*(ze-zs)+zs;
			df3[i][j][k]=IteratePoint(cx,cy,cz,n,bailout,maxiter);
		}
	}
	if(j%2==0)
		ShowStatus(i*nx+j,nx*ny,"Iterating Fractal: ");
	}
}


Post a reply to this message


Attachments:
Download 'mandel_df3.jpg' (69 KB)

Preview of image 'mandel_df3.jpg'
mandel_df3.jpg


 

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