POV-Ray : Newsgroups : povray.general : Praise POV-Ray 3.5 ! : Re: Praise POV-Ray 3.5 ! Server Time
7 Aug 2024 15:20:24 EDT (-0400)
  Re: Praise POV-Ray 3.5 !  
From: Warp
Date: 5 Sep 2001 14:46:26
Message: <3b967302@news.povray.org>
One if the nicest new features which I personally really like is that
now you can create your own patterns from existing patterns and your own
functions. This is a feature which I have been desiring for long time.
  Of course it was possible at some extent with MegaPov by using pigment
functions, but it's more straigthforward now as there are now directly
pattern functions. You can write, for example:

#declare MyPattern = function { pattern { wood turbulence 1 } }

  Now you have created a completely new pattern which is made by applying
turbulence 1 to the original wood pattern.
  Of course this is not all. You can combine patterns and modify them with
functions, eg:

#declare MyPattern2 = function { pattern { granite scale <2,1,.5> } }

#declare Combined =
  function { MyPattern(x,y,z)*MyPattern2(x,y,z)*exp(-x^2-z^2) }

  Now 'Combined' is a new pattern which has been created with the combination
of two other patterns and a mathematical function. Now you can use it as
any other pattern like:

pigment
{ function { Combined(x,y,z) }
  color_map { ... }
}

and so on.

  Another nice enhancement to function is that they can use any number of
parameters. So now you can write, for example:

#declare Inv = function(a) { 1/a }

and now you can call it just like: Inv(5). What makes this wonderful compared
to macros is that you can do this inside another function at render time.

  By the way, when using functions as pattern, you can easily use all kinds of
"warps" defined by yourself. For example, if you want to apply a "planar warp"
to the 'Combined' pattern above, you would just use it like:

pigment
{ function { Combined(x,0,z) }
  color_map { ... }
}

  You just can imagine how versatile this is, as you can use it like
Combined(x^2, y*z, sqrt(z)) and so on.

-- 
#macro N(D,I)#if(I<6)cylinder{M()#local D[I]=div(D[I],104);M().5,2pigment{
rgb M()}}N(D,(D[I]>99?I:I+1))#end#end#macro M()<mod(D[I],13)-6,mod(div(D[I
],13),8)-3,10>#end blob{N(array[6]{11117333955,
7382340,3358,3900569407,970,4254934330},0)}//                     - Warp -


Post a reply to this message

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