POV-Ray : Newsgroups : povray.binaries.scene-files : Julia fractal with a twist Server Time
23 Nov 2024 20:35:01 EST (-0500)
  Julia fractal with a twist (Message 1 to 1 of 1)  
From: scam
Subject: Julia fractal with a twist
Date: 22 Jul 2007 01:45:01
Message: <web.46a2eebf2f52a678bcbc0e870@news.povray.org>
See binaries.images.

I use an 'Angle of Incidence' color map from MegaPOV, so you'll need the
latest version of megapov to generate the scene exactly.



#version unofficial megapov 1.1;

#include "rand.inc"
#include "colors.inc"
#include "rad_def.inc"



#declare do_rad = 1;  // 1 for radiosity.
#declare do_effect_number = 3; // 1 for just the red media, 2 for the red
media plus flying chunks, 3 for the spikes

//Radiosity

#if (do_rad = 1)
 global_settings { radiosity {
                    pretrace_start 0.06
                    pretrace_end   0.01
                    normal on
                    media on
                   }
                  max_trace_level 26
 }
#end

// White sky sphere for radiosity

sky_sphere {
 pigment { rgb <1,1,1>}
}


// Some textures

#declare shinyblack  =  texture {
    pigment {color Black}
    normal { agate 0.03 agate_turb 1 scale 0.1 }
    finish { ambient 1.2 diffuse 0.0 }
    finish { reflection { 0.06, 0.5 }}
}


#macro mblood3(tran)
texture {
    pigment {
       aoi
       color_map {[0 rgb <145,5,3>/855 transmit tran]
                  [.2 rgb  <145,5,3>/455 transmit tran]
                  [.4 rgb  <145,5,3>/200 transmit tran]
                  [.5 rgb  <1,1,.75> transmit tran]}
    }
    finish { ambient 1.0 diffuse 0.2 }
}
#end

#macro mblack(tran)
texture {
    pigment {rgbt<0,0,0,tran>}
    normal { agate 0.03 agate_turb 1 scale 0.1 }
    finish { ambient 1.2 diffuse 0.0 }
}
#end

#declare juliafractal = object {
  julia_fractal {
  <-0.293,0.29,-0.73,-0.025>
  quaternion
  sqr
  max_iteration 7
  precision 120
  slice <-0.5,0,1,1>,0.1
 }
}

// Geometry

#declare thing = object {juliafractal
texture { shinyblack}
}


#macro thing2(tex)
object {juliafractal
texture{tex}
}
#end

#macro thing2black(tran)
object { juliafractal
mblack(tran)
}
#end


#macro thingblood(tran)
object {juliafractal
mblood3(tran)
}
#end


//Here two macros for the debrees are defined

#macro bit(inter,dir,siz,rot,dis,tran)
object{ intersection{object{thingblood(tran)} object { thing2black(tran)
scale 0.035 rotate 360*rand_dir translate inter}} scale siz rotate rot
translate (dir ) *dis}
#end

#macro blurbits(inter,dir,siz,rot,dis,num,blur_length)
 #local cnt2 = 0;
 #merge{
 #while (cnt2 <= num)
  object{bit(inter,dir,siz,rot,dis,pow((1-cnt2/num),0.25)) translate
(blur_length*cnt2/(num)) * dir}
  #declare cnt2 = cnt2 + 1;
 #end
 }
#end

// This is the main loop, where trace is used to calculate the position of
the divots and the
// local_normal for use in the debrees or cylinder spikes effects

#declare rotseed=seed(23451532);   //For positioning of divots
#declare rotseed2=seed(23451541);  // For debrees size, rotation,
displacement

#declare divots_destination = <0.5,0.5,0.5>; //The center of the object is
actually <0,0,0>

#declare number_divots =160; // Could get away with less.

#declare cnt = 0;

#declare local_normal = <0,0,0>;

#declare divots = sphere {-1000,0.1};  //Just to initilaise divots with
something


#while ( cnt < number_divots)
  #declare divots_origin =
135*<RRand(0,0.05,rotseed)-0.025,RRand(0,0.05,rotseed)-0.025,RRand(0,0.05,rotseed)-0.025>;
  #declare rand_dir =
35*<RRand(0,0.05,rotseed)-0.025,0,RRand(0,0.05,rotseed)-0.025>;

  #declare inter =  trace(thing,
divots_origin,divots_destination-divots_origin+rand_dir, local_normal);

  #macro newparams(nothing) // Little macro to initialise various parameters
for the debrees/ black spikes
    #declare dir = local_normal + RRand(-0.05,0.05,rotseed2);
    #declare siz = RRand(0,1,rotseed2);
    #declare rot = RRand(0,360,rotseed2);
    #declare dis = RRand(0,2,rotseed2);
    #declare num = 120*dis;
    #declare blur_length = 0.35*dis;
  #end

  newparams(1)

  #if (local_normal.x = 0 & local_normal.y = 0 & local_normal.z = 0 ) //Test
to see if traced ray intersected object
  #else

    // Here the divots are calculated

    #declare divot = object { thing2(mblood3(0)) scale 0.05 rotate
360*rand_dir translate inter};

    #declare divots = merge{object{divots} divot};

    // Here the red media is calculated

    cone{inter + 10*local_normal,0.5
         inter,0.025
         pigment{rgbt <1,0,0,1>} hollow
                 interior { media {
                  emission rgb<3,0,0> samples 10
                  //absorption 1
                  density
                   { spherical density_map
                   { [0 rgb 0]
                     [0.2 rgb <0.25,0,0>]
                     [0.4 rgb <0.5,0,0>]
                     [0.8 rgb <0.75,0,0>]
                     [1 rgb 5]
                   }
                   scale 0.75
                   translate inter
                   }
                   }}
         finish {ambient 1 diffuse 0}
         }


    //Here the debrees or black rods are calculated

    #switch (do_effect_number)
      #case (2) //Debrees

        newparams(1)
        blurbits(inter,dir,siz,rot,dis,num,0.25)
        newparams(1)
        blurbits(inter,dir,siz,rot,dis,num,0.25)

      #break
      #case (3) //Black Rods
        cylinder{inter, inter+2*blur_length*local_normal,max(0.3/50,siz/50)
                 mblack(0)
                }
      #break
      #else
    #end


  #end

  #declare cnt = cnt + 1;
#end


difference {object{thing} divots}



plane { y, -0.5 texture {pigment {color rgb <1,1,1>} }}



 camera {location <4,3,2>
        look_at <2,1,0>
       // focal_point <0,0,0>
       // aperture 0.1
       // blur_samples 200
        }


Post a reply to this message

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