POV-Ray : Newsgroups : povray.off-topic : Guess the algorithm : Re: Guess the algorithm Server Time
11 Oct 2024 11:11:58 EDT (-0400)
  Re: Guess the algorithm  
From: scott
Date: 21 Nov 2007 09:01:12
Message: <47443a28@news.povray.org>
> Take a look at this:
>
> http://www.nullsoft.com/free/monkey/
>
> Anybody got any ideas what the cave-building algorithm is? (As in, I'd 
> like to copy it...)

How about this?

Thought I'd have a play about at lunch and this is the best I came up with 
(the black hole is a weird error due to a too low max_gradient).

I got some of the ideas form that nVidia presentation I posted, plus some 
random noise.  The core geometry is three "cylinders" that rotate around the 
z-axis in a circle at different rates.

Here's the functions to get the xy coords of the rotating tubes:

#declare fn_P1x = function(z) { 6*cos(z/19) }
#declare fn_P1y = function(z) { 6*sin(z/19) }
#declare fn_P2x = function(z) { 6*sin(z/11.2 + 2.6) }
#declare fn_P2y = function(z) { 6*cos(z/11.2 + 2.6) }
#declare fn_P3x = function(z) { 6*sin(z/17.12 - 8) }
#declare fn_P3y = function(z) { 6*cos(z/17.12 - 8) }

And here's the main isosurface function (it's all a bit messy):

#declare fn_X = function(x,y,z)
{
  6 / sqrt( pow((x)-fn_P1x(z),2) + pow((y+6)-fn_P1y(z),2)  ) - 1
 +4  / sqrt( pow(x-fn_P2x(z),2) + pow(y-fn_P2y(z),2)  ) - 1
 +7 / sqrt( pow(x-fn_P3x(z),2) + pow(y-fn_P3y(z),2)  ) - 1
 -1  *(noise(x/4,y/4,z/4)-.5)
}

Use a contained_by { box { <-20,-20,0>, <20,20,500> } } and view it from -z 
down the z axis.


Post a reply to this message


Attachments:
Download 'rock_tunnel 2.jpg' (77 KB)

Preview of image 'rock_tunnel 2.jpg'
rock_tunnel 2.jpg


 

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