POV-Ray : Newsgroups : povray.binaries.images : Fleur-de-lis-esque wallpaper : Re: Fleur-de-lis-esque wallpaper Server Time
20 May 2024 03:16:01 EDT (-0400)
  Re: Fleur-de-lis-esque wallpaper  
From: Mike Miller
Date: 6 Aug 2023 10:20:00
Message: <web.64cfab124ac30d20c9deb24ddabc9342@news.povray.org>
"Samuel B." <stb### [at] hotmailcom> wrote:
> // +fn +f +a0.3 +am2 +r3
>
> #version 3.7;
> global_settings{
>  assumed_gamma 1.0
> }
> #default{ finish{emission 0 ambient 0} }
>
> camera{
>  orthographic
>  right x*2 up y*2
>  location -2*z
>  look_at 0
>  scale 2
>  aperture .001 focal_point 0 blur_samples 4 variance 0
> }
>
> light_source{
>  <4, -1, -.25>, srgb 8*<1, .8, .6>
>  fade_distance 1 fade_power 2
>  #if(1)
>   #declare ALRes = 2;
>   #declare ALSize = .4;
>   area_light x*ALSize, y*ALSize, ALRes, ALRes
>   jitter
>   adaptive 1
>   area_illumination
>  #end
> }
>
> // environment
> #if(1)
>  plane{z, .001}
>  plane{y, -4 pigment{granite scale 20}}
>  union{
>   plane{z, -16}
>   plane{y, 4}
>   plane{x, 5}
>   plane{x, -23}
>   pigment{granite scale 20 poly_wave .1}
>  }
> #end
>
> // better than mod(x, 1)
> #declare Fract = function(x){ x-floor(x) }
>
> // circle function
> #declare F_Cir =
>  function(x, y, R){
>   min(1, max(0, -sqrt(pow(x, 2)+pow(y, 2))+R))
>  }
>
> // fleur-de-lis
> #declare F =
>  function{
>   max(
>    2*F_Cir(x+.3, y-.15, .5),
>    1.13*min(
>     F_Cir(x-.09, y+.1, .25),
>     1-F_Cir(x-.29, y+.35, .2+1)
>    )
>   )
>  }
>
> // repeat the fleur-de-lis
> #declare FRep = function{F(abs(Fract(x)-.5), (Fract(y/2)*2-.35), 0)}
>
> // combine two tild flue-de-lis patterns, one offset
> #declare FPattern =
>  function{
>   max(
>    FRep(x, y, 0),
>    FRep(x-.5, y-1, 0)
>   )
>  }
>
> // fancy background pattern
> #declare FPattern2 =
>  function{
>   pattern{
>    pigment_pattern{
>     pigment_pattern{
>      crackle
>      turbulence .2
>      lambda 3
>      #for(I, 0, 12)
>       rotate z*38*I
>       translate I*<.9, 1, .620>
>       scale .9
>       warp{repeat x flip x}
>       warp{repeat y*4}
>      #end
>      scale .5
>     }
>     pigment_map{
>      [.2 rgb 0]
>      [.3 pigment_pattern{gradient y triangle_wave scale 2} poly_wave 2]
>     }
>    }
>   }
>  }
>
> #declare FNoise =
>  function{
>   pattern{
>    granite
>    scale 7
>    turbulence .3
>    lambda 2.5
>    frequency 8
>    triangle_wave
>   }
>  }
>
> // combine the functions
> #declare FFinal =
>  function{
>   pow(
>    max(
>     FPattern(x, y, 0)-.005*FNoise(x, y, 0),
>     max(
>      .00027*FPattern2(x, y, 0),
>      .00027*FPattern2(x+.5, y+1, 0)
>     )
>    ),
>    .5
>   )
>  }
>
> height_field{
>
>  function
>   //.3*image_width, .3*image_height{
>   //.7*image_width, .7*image_height{
>   image_width, image_height{
>   FFinal(x*4, -y*4, 0)
>  }
>
>  smooth
>
>  rotate x*270
>  translate -.5*(x+y)
>  scale <4, 4, .02>
>
>  texture{
>   function{FFinal(x, y, 0)}
>   texture_map{
>    [0
>     pigment{rgb .035 * <1, .5, .2>}
>     finish{
>      diffuse .7
>      specular 1 metallic 1 roughness .01
>      reflection{
>       .3
>       metallic 1
>      }
>     }
>     normal{granite .07 scale .001}
>    ]
>    [.02
>     pigment{rgb .35 * <1, .5, .75>}
>     finish{
>      diffuse .7
>      specular 1 metallic .5 roughness .01
>      reflection{
>       .3
>       metallic 1
>      }
>     }
>     normal{
>      average
>      normal_map{
>       [1 function{FFinal(x, y, 0)} 5 accuracy .001]
>       [1 granite .07 scale .001]
>      }
>     }
>    ]
>    [.03
>     pigment{rgb <1, .7, .3>}
>     finish{
>      diffuse .3
>      specular 1 metallic .5 roughness .01
>      brilliance 1.3
>      reflection{
>       1
>       metallic .8
>      }
>     }
>     normal{
>      average
>      normal_map{
>       [1 function{FFinal(x, y, 0)} accuracy .007]
>       [1 granite .07 scale .001]
>      }
>     }
>    ]
>   }
>  }
> }
>
> //rotate(p, a) vec2(p.x*cos(a)-p.y*sin(a), p.x*sin(a)+p.y*cos(a))
>
> #if(0)
>  union{
>   //torus{1, LT rotate x*90}
>   cylinder{-8*x, 8*x, LT}
>   cylinder{-8*y, 8*y, LT}
>   pigment{rgb .25*<1, .3, .1>}
>  }
> #end

That's some amazing work. Thanks for sharing. I need to study your functions
closer to try to begin to understand this. haha ...no joke.
Good stuff.
Mike.


Post a reply to this message

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