This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
user:mgough:mandelbulbs-povray [2010/05/19 14:45] – mgough | user:mgough:mandelbulbs-povray [2010/05/19 15:04] (current) – mgough | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Povray Mandelbulbs ====== | ||
+ | ===== Overview ===== | ||
+ | Rendering 3d Mandelbulbs with povray. | ||
+ | Drawing Mandelbrot Fractals is mighty interesting and will wow your friends, but why stop there. | ||
+ | |||
+ | http:// | ||
+ | |||
+ | ===== Requirements ===== | ||
+ | |||
+ | 1) GCC development environment.\\ | ||
+ | 2) Povray installation.\\ | ||
+ | 3) Mandelbulb povray script. - http:// | ||
+ | |||
+ | ===== Povray Installation ===== | ||
+ | |||
+ | 1. Open a shell\\ | ||
+ | 2. create a temporary directory somewhere to unpack the POV-Ray distribution\\ | ||
+ | for example: | ||
+ | \\ | ||
+ | user@machine: | ||
+ | \\ | ||
+ | 3. Get the POV-Ray for GNU/Linux binary package from the POV-Ray website\\ | ||
+ | This can be done by right clicking on the following link and choosing 'Save Link As.../Save Link Target As...': | ||
+ | \\ | ||
+ | http:// | ||
+ | \\ | ||
+ | Save this package in the new directory you just created, for example / | ||
+ | \\ | ||
+ | 4. switch back to the shell\\ | ||
+ | \\ | ||
+ | 5. change into the directory where you just saved the package:\\ | ||
+ | For example\\ | ||
+ | \\ | ||
+ | user@machine: | ||
+ | \\ | ||
+ | 6. unpack the distribution: | ||
+ | \\ | ||
+ | user@machine: | ||
+ | \\ | ||
+ | You should get a long listing of all files extracted from the package.\\ | ||
+ | \\ | ||
+ | 7. change into the distribution directory: | ||
+ | \\ | ||
+ | user@machine: | ||
+ | \\ | ||
+ | 8. become root:\\ | ||
+ | \\ | ||
+ | user@machine: | ||
+ | Password: <enter root password> | ||
+ | \\ | ||
+ | 9. run the install script:\\ | ||
+ | \\ | ||
+ | root@machine:/ | ||
+ | \\ | ||
+ | If you previously had no other POV-Ray version installed the installation should run without interruptions. Otherwise there might be additional decisions required.\\ | ||
+ | \\ | ||
+ | Check if the install script reports any problems. At the end you will be asked if you want to do a test render. This test render will be without display when run as root.\\ | ||
+ | \\ | ||
+ | 10. leave the root environment: | ||
+ | \\ | ||
+ | root@machine:/ | ||
+ | \\ | ||
+ | 11. if you had previously installed POV-Ray or if you want to be able to customize your configuration independently from other users:\\ | ||
+ | \\ | ||
+ | user@machine: | ||
+ | \\ | ||
+ | This will update the user configuration files in ~/ | ||
+ | \\ | ||
+ | 12. to test if installation was successful you can run a short test render:\\ | ||
+ | \\ | ||
+ | user@machine: | ||
+ | \\ | ||
+ | If this fails there probably was some problem during the install that required manual action. Check the messages printed by the install script and try to run the install again.\\ | ||
+ | |||
+ | ===== Mandelbulb Scripts ===== | ||
+ | |||
+ | mbsdl.inc\\ | ||
+ | <file bash mbsdl.inc> | ||
+ | // Persistence of Vision Ray Tracer Scene Description File | ||
+ | |||
+ | // File: mbsdl.inc | ||
+ | |||
+ | // Vers: 3.6.1, 3.7 | ||
+ | |||
+ | // Desc: Mandelbulb Functions in POV-Ray Scene Description Language | ||
+ | |||
+ | // Date: 12/18/09 | ||
+ | |||
+ | // Auth: David Wagner | ||
+ | |||
+ | // Cite: http:// | ||
+ | |||
+ | |||
+ | |||
+ | // WARNING: Include this file first in a scene. | ||
+ | |||
+ | // WARNING: This recursive function is invalid SDL and can crash POV-Ray. | ||
+ | |||
+ | |||
+ | |||
+ | #declare mbsdl_recurse = function( mbsdl_r_p_r, | ||
+ | |||
+ | | ||
+ | |||
+ | mbsdl_recurse( mbsdl_r_p_r, | ||
+ | |||
+ | | ||
+ | |||
+ | x + pow(pow(mbsdl_r_x, | ||
+ | |||
+ | * sin( atan2( sqrt(pow(mbsdl_r_x, | ||
+ | |||
+ | * cos( atan2(mbsdl_r_y, | ||
+ | |||
+ | | ||
+ | |||
+ | y + pow(pow(mbsdl_r_x, | ||
+ | |||
+ | * sin( atan2( sqrt(pow(mbsdl_r_x, | ||
+ | |||
+ | * sin( atan2(mbsdl_r_y, | ||
+ | |||
+ | |||
+ | |||
+ | z + pow(pow(mbsdl_r_x, | ||
+ | |||
+ | * cos( atan2( sqrt(pow(mbsdl_r_x, | ||
+ | |||
+ | ), | ||
+ | |||
+ | 1/( mbsdl_r_i+log(log(mbsdl_r_r2_bailout) / log((mbsdl_r_i> | ||
+ | |||
+ | | ||
+ | |||
+ | }; | ||
+ | |||
+ | |||
+ | |||
+ | #declare f_mandelbulb = function(x, | ||
+ | |||
+ | mbsdl_recurse( mbsdl_f_p_r, | ||
+ | |||
+ | } | ||
+ | </ | ||
+ | mbsdl_basic.pov\\ | ||
+ | <file bash mbsdl_basic.pov> | ||
+ | // Persistence of Vision Ray Tracer Scene Description File | ||
+ | |||
+ | // File: mbsdl_basic.pov | ||
+ | |||
+ | // Vers: 3.6, 3.7 | ||
+ | |||
+ | // Desc: Basic Scene Example | ||
+ | |||
+ | // Date: 12/18/09 | ||
+ | |||
+ | // Auth: David Wagner | ||
+ | |||
+ | // Cite: http:// | ||
+ | |||
+ | |||
+ | |||
+ | #version 3.6; | ||
+ | |||
+ | |||
+ | |||
+ | #include " | ||
+ | |||
+ | #include " | ||
+ | |||
+ | |||
+ | |||
+ | global_settings { | ||
+ | |||
+ | assumed_gamma 1.0 | ||
+ | |||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | // ---------------------------------------- | ||
+ | |||
+ | |||
+ | |||
+ | camera { | ||
+ | |||
+ | location | ||
+ | |||
+ | direction 1.5*z | ||
+ | |||
+ | right | ||
+ | |||
+ | look_at | ||
+ | |||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | sky_sphere { | ||
+ | |||
+ | pigment { | ||
+ | |||
+ | gradient y | ||
+ | |||
+ | color_map { | ||
+ | |||
+ | [0.0 rgb < | ||
+ | |||
+ | [0.7 rgb < | ||
+ | |||
+ | } | ||
+ | |||
+ | } | ||
+ | |||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | light_source { | ||
+ | |||
+ | <0, 0, 0> // light' | ||
+ | |||
+ | color rgb <1, 1, 1> // light' | ||
+ | |||
+ | translate <-30, 30, -30> | ||
+ | |||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | // ---------------------------------------- | ||
+ | |||
+ | |||
+ | |||
+ | plane { | ||
+ | |||
+ | y, -1 | ||
+ | |||
+ | pigment { color rgb < | ||
+ | |||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | isosurface { | ||
+ | |||
+ | function {f_mandelbulb(x, | ||
+ | |||
+ | threshold 1/3 | ||
+ | |||
+ | max_gradient 20 | ||
+ | |||
+ | accuracy 0.001 | ||
+ | |||
+ | contained_by {sphere{< | ||
+ | |||
+ | texture { | ||
+ | |||
+ | pigment { | ||
+ | |||
+ | function { f_mandelbulb(x, | ||
+ | |||
+ | scale 1.05 | ||
+ | |||
+ | frequency 8 | ||
+ | |||
+ | color_map { | ||
+ | |||
+ | [0.00 color rgb < | ||
+ | |||
+ | [0.33 color rgb < | ||
+ | |||
+ | [0.66 color rgb < | ||
+ | |||
+ | [1.00 color rgb < | ||
+ | |||
+ | } | ||
+ | |||
+ | } | ||
+ | |||
+ | finish{ | ||
+ | |||
+ | specular 0.6 | ||
+ | |||
+ | } | ||
+ | |||
+ | } | ||
+ | |||
+ | } | ||
+ | |||
+ | </ | ||
+ | |||
+ | ===== Running the Scripts ===== | ||
+ | Running povray to render the mandelbulbs is quite easy.\\ | ||
+ | \\ | ||
+ | povray mbsdl_basic.pov | ||
+ | \\ | ||
+ | The program will now open an x-window and render the mandelbulb line by line.\\ | ||
+ | \\ | ||
+ | The terminal will show render staticsics and any options you may have used to perform the raytrace. | ||
+ | \\ | ||
+ | The final render will be saved in the current directory as mbsdl_basic.png\\ | ||
+ | \\ | ||
+ | And here is the result! | ||
+ | {{: | ||
+ | |||
+ | There are many options you can play with to get differing results, it's up to your imagination!\\ |