POV-Ray : Newsgroups : povray.advanced-users : Making Patterns with functions : Re: Making Patterns with functions Server Time
12 Oct 2024 17:33:53 EDT (-0400)
  Re: Making Patterns with functions  
From: ingo
Date: 23 Aug 2024 01:40:00
Message: <web.66c820a4d81b847917bac71e8ffb8ce3@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> Over the last 2 days, I've fallen down the mathematical pattern rabbit hole, and
> have been experimenting with all manner of what can be done with a simple
> pigment {function {}}
> statement.

An old one by Alex Kluchikov, not a simple function though:

---%<------%<---

// Alex Kluchikov, 2003
// mailto: klk### [at] ukrnet, akl### [at] mailru
// Feel free to modify/use in any form
include "functions.inc"

camera{
 location -5*z
 look_at 0
 }

// we can get angle from gradient
#declare frad=function{
 pattern{radial}
 }

#declare fboz1=function{
 pattern{crackle form <1,0,0> scale 1}
 }

#declare fboz2=function{
 pattern{bumps noise_generator 3 rotate 60 scale 1.2}
 }

#declare fboz3=function{
 (sin(x+23)*sin(y+2)+sin(x*2.33443+11)*sin(y*2.4332+76)+sin(x*1.133443+32)*sin(y*1.234332+8)+3)*1/6
 }

#declare f1=function(x,y,z){
  (sin(fboz1(x,y,z)*24*pi
   +frad(fboz1(x,y,z)-fboz1(x,y-.07,z),0,fboz1(x,y,z)-fboz1(x+.07,y,z))
//gradient calculation
   *2*pi
//   +clock*pi*2 // uncomment to animate
   )+1)*(1/2)
   *(1-fboz1(x,y,z))
 }

#declare f2=function(x,y,z){
  (sin(fboz2(x,y,z)*24*pi
   +frad(fboz2(x,y,z)-fboz2(x,y-.07,z),0,fboz2(x,y,z)-fboz2(x+.07,y,z))
//gradient calculation
   *2*pi
//   +clock*pi*2 // uncomment to animate
   )+1)*(1/2)
 }

#declare f3=function(x,y,z){
  (sin(fboz3(x,y,z)*24*pi
   +frad(fboz3(x,y,z)-fboz3(x,y-.07,z),0,fboz3(x,y,z)-fboz3(x+.07,y,z))
//gradient calculation
   *2*pi
//   +clock*pi*2 // uncomment to animate
   )+1)*(1/2)
 }

#declare curles_1=texture{pigment{
  function{f1(x,y,z)}
  scale .25}
  finish{ambient 1}
  }

#declare curles_2=texture{pigment{
  function{f2(x,y,z)}
  color_map{[.45,color rgb 0][.55,color rgb 1]}
  scale .25}
  finish{ambient 1}
  }

#declare curles_3=texture{pigment{
  function{f3(x,y,z)}
  color_map{[.45,color rgb 0][.55,color rgb 1]}
  scale .25}
  finish{ambient 1}
  }

plane{
 -z,1
  //use curles_1, curles_2 or curles_2
  texture{curles_1}
 }
---%<------%<------
ingo


Post a reply to this message

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