POV-Ray : Newsgroups : povray.beta-test : isosurface MegaPov conversion to POV3.5 : isosurface MegaPov conversion to POV3.5 Server Time
5 Nov 2024 03:20:29 EST (-0500)
  isosurface MegaPov conversion to POV3.5  
From: smellenbergh
Date: 9 Sep 2001 16:43:31
Message: <1ezhnxz.1xl4pg916b2xyyN%smellenbergh@skynet.be>
Here are some hints to convert syntax of MegaPov isosurface to 3.5 

* braces {} are required with functions
  "function x+y"
should be
  "function {x+y}"


* parameters of a declared function must be specified when called
  #declare FUNC = function {x+y+z}
  isosurface { function {FUNC} }
should be
  isosurface { function {FUNC(x,y,z)} }


* using internal functions (See 7.7 functions.inc)
  all internal functions are included in the functions.inc and start
with
"f_xxx". Parameters are set between ( ) braces and begin with the x,y,z
parameters)
   So, MegaPov's "sphere",<0.8> 
becomes 
  #include "functions.inc"
  f_sphere(x,y,z,0.8)
or, when declaring the function directly, without using the include
file:
  #declare MySphere = function { internal(61) }
  isosurface{ function{ MySphere(x,y,z,0.8) } }


* noise3d
  in 3.5 noise3d is treated as an internal function: use the
function.inc and
  f_noise3d(x*4,y*4,z*4)/5
Note that the noise uses pov's noise generator set in the global
settings:
global_settings{
  noise_generator 1 //old 3.1g plateaud noise
  noise_generator 2 //MegaPov 0.5 noise
  noise_generator 3 //New 3.5 perlin noise
}
...or use
  f_noise_generator(x,y,z, P0)
    * P0 : Noise generator number

*The func_ names have been renamed
  func_0  >  f_ellipsoid
  func_1  >  f_blob
  func_2  >  f_flange_cover
  func_2b  >  f_blob2
  func_3  >  f_cross_ellipsoids
  func_4  >  f_isect_ellipsoids
  func_5  >  f_spikes
  func_9  >  f_poly4
  func_10  >  f_spikes_2d
  func_11  >  f_quantum
  func_12  >  f_helical_torus
  func_13  >  f_comma
  func_16  >  f_polytubes
And the duplicate functions have been removed
  helix1 / func_6  >  f_helix1
  helix2 / func_7  >  f_helix2
  spiral / func_8  >  f_spiral
  mesh1 / func_14  >  f_mesh1



* using function { pigments } in isosurfaces
  the pigment must be declared. When calling it, the dot notation must
be used: FUNC(x,y,z).x
This allows to use the channels of the color vector in a controlled way
Allowed are:
  .x .u .red, .y .v .green, .z .t .blue, .filter, .transmit for the
separate channels
  .gray or .grey for the gray value of the color vector
  .hf for the height_field value of the color vector (this was the
method used in MegaPov)
  #declare Granny = function{
    pigment{
      granite scale 3
      color_map { [0 rgb 0] [1 rgb 1] }
    }
  }
  isosurface{function{f_sphere(x,y,z,1)+Granny(x,y,z).hf*0.2}}


* sign is no longer used in 3.5 isosurface
to switch inside/outside, turn the whole function negative:
  #declare Landscape = function { f_ridged_mf(x,y,z,1,2,10,1.1,2) }
  isosurface{function{ Landscape(x,0,z)-y }
becomes
  isosurface{function{ -(Landscape(x,0,z)-y) }


* sqr and cub no longer supported
  use ^2 and ^3 ,or pow(A,2) and pow(A,3)


* sqrt x^y and ln are used in the mathematical form in 3.5
  Isosurface     MegaPov internal   3.5 internal
  ----------     ---------------    ------------
  sqrt(x)     =  sqrt(abs(x))       =sqrt(x)
  x^y         =  abs(x)^y           =x^y
  ln(x)       =  ln(abs(x))         =ln(x)
So, these MegaPov functions might need to be written as they have been
used internally in MegaPov to get the same results in 3.5


* if(A,B,C)
  has been replaced by select (A,C,B)
MegaPov
  isosurface {function {if(-x, abs(x)+abs(y)-0.5, sqrt(z^2+y^2)-0.5)}
becomes in 3.5
  isosurface{function{select(-x, sqrt(z^2+y^2)-0.5, abs(x)+abs(y)-0.5)}


* method 1 and method 2
  keywords no longer used in 3.5: a method 2-ish method is standard


* eval
  eval becomes evaluate and *requires* 3 parameters without the vector
braces: evaluate A,B,0.99 which is the same as MegaPov's eval <A,B,0.99>


I think these are the main changes, but I probably forgot some :-)



-- 
e-mail:sme### [at] skynetbe

http://users.skynet.be/smellenbergh


Post a reply to this message

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