POV-Ray : Newsgroups : povray.text.scene-files : Souce code for "The remains of an iso sphere: Take 2 " Server Time
29 Oct 2024 22:47:50 EDT (-0400)
  Souce code for "The remains of an iso sphere: Take 2 " (Message 1 to 9 of 9)  
From: Tor Olav Kristensen
Subject: Souce code for "The remains of an iso sphere: Take 2 "
Date: 28 Dec 2001 20:59:22
Message: <3C2D2372.3E564379@hotmail.com>
Below is the source code for the image that I posted
to povray.binaries.images 28. Dec. 2001. (My PC's month
setting was wrongly set to November, so that message
may appear to be posted in that month.)

Here's links to that thread:
news://news.povray.org/3C04C246.6EF2A5AB%40hotmail.com
http://news.povray.org/povray.binaries.images/20965/


Tor Olav

P.S.:
The code also contains settings for several other
"Sphere Spirals" images.


// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
// Copyright 2001 by Tor Olav Kristensen
// Email: tor### [at] hotmailcom
// http://www.crosswinds.net/~tok
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

#version 3.5; // Beta

#include "colors.inc"
#include "functions.inc"

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

#macro SphereSpiralsFunction(Rmaj, Rmin, PhiFn, NrOfBands, GapRatio)

  #local DivAngle = 2*pi/NrOfBands;
  #local GapAngle = DivAngle*GapRatio;
/*
  #local CosAlpaFn =
    function { x/sqrt(x^2 + z^2) }
  #local SinAlpaFn =
    function { z/sqrt(x^2 + z^2) }
*/
  #local CosBetaFn =
    function { sqrt(x^2 + z^2)/sqrt(x^2 + y^2 + z^2) }
  #local SinBetaFn =
    function { y/sqrt(x^2 + y^2 + z^2) }

  #local AngleFn = function { atan2(z, x) }
  #local AdjAngleFn = function(a) { a + select(a, 2*pi, 0) }

  #local ModAngleFn =
    function {
      mod(AdjAngleFn(AngleFn(x, y, z) - PhiFn(x, y, z)), DivAngle)
    }
  #local Angle0Fn =
    function { AngleFn(x, y, z) - ModAngleFn(x, y, z) }
  #local Angle2Fn = function { Angle0Fn(x, y, z) + GapAngle }

  function {
    select(
      ModAngleFn(x, y, z) - GapAngle,
      select(
        ModAngleFn(x, y, z) - GapAngle/2,
        f_sphere(
          x - Rmaj*CosBetaFn(x, y, z)*cos(Angle0Fn(x, y, z)),
          y - Rmaj*SinBetaFn(x, y, z),
          z - Rmaj*CosBetaFn(x, y, z)*sin(Angle0Fn(x, y, z)),
          Rmin
        ),
        f_sphere(
          x - Rmaj*CosBetaFn(x, y, z)*cos(Angle2Fn(x, y, z)),
          y - Rmaj*SinBetaFn(x, y, z),
          z - Rmaj*CosBetaFn(x, y, z)*sin(Angle2Fn(x, y, z)),
          Rmin
        )
      ),
      abs(f_sphere(x, y, z, Rmaj)) - Rmin
    )
  }

#end // macro SphereSpiralsFunction

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
// Set up different functions to control the twisting of the bands.
// Then call the macro above with these functions as parameters and
// different settings for the number of bands and the ratio between
// the gaps and the bands.

#declare Rmajor = 3.0;
#declare Rminor = 0.2;
// Decrease Rminor above to e.g. 0.02 to see clearer the effect of
// the GapRatio parameter.


#declare PhiFns =
array[6] {
  function { 0 },
  function { y/Rmajor*pi },
  function { exp(y/3) },
  function { y/4 + f_noise3d(0, y, 0) },
  function { y/2 - f_noise3d(x, y, z) }
  function {
    1 - 2*
    f_noise3d(
      Rmajor*x/f_sphere(x, y, z, 0),
      Rmajor*y/f_sphere(x, y, z, 0),
      Rmajor*z/f_sphere(x, y, z, 0)
    )
  }
}


#declare SphereSpiralsFns = array[6]

#declare SphereSpiralsFns[0] = 
SphereSpiralsFunction(
  Rmajor, Rminor, function { PhiFns[0](x, y, z) },  8, 2/3
) 

#declare SphereSpiralsFns[1] = 
SphereSpiralsFunction(
  Rmajor, Rminor, function { PhiFns[1](x, y, z) }, 20, 2/3
) 

#declare SphereSpiralsFns[2] = 
SphereSpiralsFunction(
  Rmajor, Rminor, function { PhiFns[2](x, y, z) },  6, 2/3
) 

#declare SphereSpiralsFns[3] = 
SphereSpiralsFunction(
  Rmajor, Rminor, function { PhiFns[3](x, y, z) }, 12, 3/4
) 

#declare SphereSpiralsFns[4] = 
SphereSpiralsFunction(
  Rmajor, Rminor, function { PhiFns[4](x, y, z) }, 20, 3/5
) 

#declare SphereSpiralsFns[5] = 
SphereSpiralsFunction(
  Rmajor, Rminor, function { PhiFns[5](x, y, z) }, 20, 1/2
) 

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
// Define the iso-surface and texture it.

#declare FnChoice = 2; // Also try the other values; from 0 to 5

#declare SphereRemainsIso =
isosurface {
  function { SphereSpiralsFns[FnChoice](x, y, z) }
//  max_gradient 10
  contained_by { sphere { <0, 0, 0>, Rmajor + Rminor } }
}

object {
  SphereRemainsIso
  texture {
    pigment { color Blue + White }
    finish {
    	ambient 0
    	diffuse 1
    	specular 1
    	roughness 0.02
    	brilliance 2
    }
  }
}

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

background { color (Blue + Cyan)/4 }

light_source {
  <-2, 3, -2>*100 // *0
  color White
  shadowless
}

camera {
  location <-9, 0, -5>
  look_at <0, 0, 0>
}

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
/*
// For the curious:
// Try to replace the function returned in the SphereSpiralsFunction
// macro with this code and then render with FnChoice set to 0.

  #local Angle1Fn =
    function {
      Angle0Fn(x, y, z) +
      select(ModAngleFn(x, y, z) - DivAngle/2, 0, DivAngle)
    }

  function {
    min(
      f_sphere(
        x - Rmaj*CosBetaFn(x, y, z)*cos(Angle1Fn(x, y, z)),
        y - Rmaj*SinBetaFn(x, y, z),
        z - Rmaj*CosBetaFn(x, y, z)*sin(Angle1Fn(x, y, z)),
        Rmin
      ),
      f_sphere(
        x - Rmaj*CosBetaFn(x, y, z)*cos(Angle2Fn(x, y, z)),
        y - Rmaj*SinBetaFn(x, y, z),
        z - Rmaj*CosBetaFn(x, y, z)*sin(Angle2Fn(x, y, z)),
        Rmin
      )
    )
  }

*/
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7


Post a reply to this message

From: Michael Andrews
Subject: Code for my variant: peel.pov
Date: 3 Jan 2002 05:18:32
Message: <3C343147.3000300@reading.ac.uk>
// Here's the code for my variant on the 'peel' sphere ...

// peel.pov by Mike Andrews 2002-01-03

#include "functions.inc"

// +w320 +h240 +a0.3 +fn

global_settings {
   max_trace_level 20
   assumed_gamma 1
   ambient_light 1
   #if (0)
       radiosity {
       pretrace_start 16/image_width
       pretrace_end 4/image_width
       count 50
       nearest_count 6
       error_bound 0.25
       recursion_limit 1
       low_error_factor .2
       gray_threshold 0.0
       minimum_reuse 0.01
       brightness 1

       adc_bailout 0.01/2
     }
   #end
}

#declare BC = <7/4,7/5.5,1>^(-4);

sky_sphere {
   pigment {
     gradient y
     colour_map {[0 color rgb 0.5*(1+BC)][1 rgb 0.5*BC]}
   }
}

fog {
	fog_type 2
	colour rgb BC*0.3
	distance 100
	fog_alt 6
	fog_offset -7
}

fog {
	fog_type 2
	colour rgb (1-BC)*0.5
	distance 500
	fog_alt 15
	fog_offset -7
}

camera {
   up y
   right x*image_width/image_height
   direction 3.5*z
   location <-1,1.5,-10>
   look_at 0
}

light_source {
   0*x
   color rgb 1-0.1*BC
   translate 50*vnormalize(<1,2,-2>)
   scale 400
}

#declare fn_Rad = function {
   (1-5*abs(f_r(x,y,z)-1))
   * abs(sin(2*f_th(x,y,z)+3*(f_ph(x,y,z)-pi/2)*(1+abs(f_r(x,0,z)-1))))
}

#declare fn_Peel = function {
   ((0.6-fn_Rad(x,y,z)) + 0.2*max(0, min(1, 1-f_r(x,0,z))))
   * max(0, min(1, f_r(x,0,z)))
   - 0.01*(1-100*abs(f_r(x,y,z)-1))
}

isosurface {
   function { fn_Peel(x, y, z) }
   max_gradient 6
   accuracy 0.00002
   contained_by { sphere { 0, 1.3 } }
   pigment { spherical colour_map {[0 rgb 1][0.001 rgb x]} }
   rotate -30*x
}


Post a reply to this message

From: Ryan Mooney
Subject: Re: Code for my variant: peel.pov
Date: 3 Jan 2002 23:12:40
Message: <3C352BBA.AE1EF1EA@earthlink.net>
Where is the functions.inc...???

Michael Andrews wrote:

> // Here's the code for my variant on the 'peel' sphere ...
>
> // peel.pov by Mike Andrews 2002-01-03
>
> #include "functions.inc"
>
> // +w320 +h240 +a0.3 +fn
>
> global_settings {
>    ............


Post a reply to this message

From: Ken
Subject: Re: Code for my variant: peel.pov
Date: 3 Jan 2002 23:56:40
Message: <3C353610.70E7433B@pacbell.net>
Ryan Mooney wrote:
> 
> Where is the functions.inc...???

Included with the distribution of POV-Ray v3.5.

-- 
Ken Tyler


Post a reply to this message

From: Ryan Mooney
Subject: Re: Code for my variant: peel.pov
Date: 4 Jan 2002 21:52:58
Message: <3C366A8F.1CFB667@earthlink.net>
3.5 crashes on my computer... Where can i dl just specific files...???
ill look around...

Ken wrote:

> Ryan Mooney wrote:
> >
> > Where is the functions.inc...???
>
> Included with the distribution of POV-Ray v3.5.
>
> --
> Ken Tyler


Post a reply to this message

From: Ken
Subject: Re: Code for my variant: peel.pov
Date: 4 Jan 2002 22:12:36
Message: <3C366F2E.51DF6EC0@pacbell.net>
Ryan Mooney wrote:
> 
> 3.5 crashes on my computer... Where can i dl just specific files...???
> ill look around...

Won't work without 3.5 as it relies on internal functions built into
the program.

-- 
Ken Tyler


Post a reply to this message

From: Ron Parker
Subject: Re: Code for my variant: peel.pov
Date: 4 Jan 2002 23:15:54
Message: <slrna3cvfq.ju.ron.parker@fwi.com>
On Fri, 04 Jan 2002 19:53:03 -0700, Ryan Mooney wrote:
> 3.5 crashes on my computer... Where can i dl just specific files...???
> ill look around...

Which version crashes?  Have you tried the latest beta?  If so, have you
posted a report in beta-test?

-- 
plane{-z,-3normal{crackle scale.2#local a=5;#while(a)warp{repeat x flip x}rotate
z*60#local a=a-1;#end translate-9*x}pigment{rgb 1}}light_source{-9red 1rotate 60
*z}light_source{-9rgb y rotate-z*60}light_source{9-z*18rgb z}text{ttf"arial.ttf"
"RP".01,0translate-<.6,.4,.02>pigment{bozo}}light_source{-z*3rgb-.2}//Ron Parker


Post a reply to this message

From: Ryan Mooney
Subject: Re: Code for my variant: peel.pov
Date: 5 Jan 2002 02:13:53
Message: <3C36A7B5.6C126063@earthlink.net>
ill try again to make sure... using mega 0.7 cuz it has always worked fine... =]

Ron Parker wrote:

> On Fri, 04 Jan 2002 19:53:03 -0700, Ryan Mooney wrote:
> > 3.5 crashes on my computer... Where can i dl just specific files...???
> > ill look around...
>
> Which version crashes?  Have you tried the latest beta?  If so, have you
> posted a report in beta-test?
>
> --
> plane{-z,-3normal{crackle scale.2#local a=5;#while(a)warp{repeat x flip x}rotate
> z*60#local a=a-1;#end translate-9*x}pigment{rgb 1}}light_source{-9red 1rotate 60
> *z}light_source{-9rgb y rotate-z*60}light_source{9-z*18rgb z}text{ttf"arial.ttf"
> "RP".01,0translate-<.6,.4,.02>pigment{bozo}}light_source{-z*3rgb-.2}//Ron Parker


Post a reply to this message

From: Ryan Mooney
Subject: Re: Code for my variant: peel.pov
Date: 5 Jan 2002 02:15:38
Message: <3C36A81E.F24EF553@earthlink.net>
by the sound of it i might not like it any better can you edit your own templates
and include files... im so lazy i could look all this up... nity nite... =]

Ron Parker wrote:

> On Fri, 04 Jan 2002 19:53:03 -0700, Ryan Mooney wrote:
> > 3.5 crashes on my computer... Where can i dl just specific files...???
> > ill look around...
>
> Which version crashes?  Have you tried the latest beta?  If so, have you
> posted a report in beta-test?
>
> --
> plane{-z,-3normal{crackle scale.2#local a=5;#while(a)warp{repeat x flip x}rotate
> z*60#local a=a-1;#end translate-9*x}pigment{rgb 1}}light_source{-9red 1rotate 60
> *z}light_source{-9rgb y rotate-z*60}light_source{9-z*18rgb z}text{ttf"arial.ttf"
> "RP".01,0translate-<.6,.4,.02>pigment{bozo}}light_source{-z*3rgb-.2}//Ron Parker


Post a reply to this message

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