POV-Ray : Newsgroups : povray.binaries.images : Copying pigments with crackle (124k jpg) : Re: Copying pigments with crackle (124k jpg) Server Time
4 Nov 2024 13:22:43 EST (-0500)
  Re: Copying pigments with crackle (124k jpg)  
From: Paolo Gibellini
Date: 29 Jul 2008 04:20:43
Message: <488ed2db$1@news.povray.org>
Mmmm...
Interesting pigment: to be evaluated...
;-)
Paolo

 >stbenge  on date 29/07/2008 01:14 wrote:
> Hi everyone,
> 
> Years ago, somebody posted a swirly pigment. It resembled the swirls you 
> see in clouds sometimes. I have tried looking for the code many times, 
> but to no avail. The code has been lost.
> 
> Every once in a while I try to recreate that code using pigment 
> functions. Every time I've tried, I've failed. Until today.
> 
> I based my work on the premise that the target pattern must be 
> translated according to another pattern, in this case crackle form x. 
> What I have arrived at must be different from the aforementioned 
> poster's code, since his tended to have small gray boxes right at the 
> center of each crackle cell. There is no such artifact in my code, and I 
> can't be sure just how close my effect comes to his.
> 
> Here is some code:
> 
> #macro pcc(pgmt, Mod)
>  #local pgmt2=function{pigment{pgmt}}
>  #local pg1=
>  function{
>   pigment{
>    crackle form x
>    scale .25
>   }
>  }
>  pigment_pattern{
>   function{
>    pgmt2(
>     (pow(pg1(x+Mod,y,z).grey,2)-pow(pg1(x-Mod,y,z).grey,2))/(Mod*64),
>     (pow(pg1(x,y+Mod,z).grey,2)-pow(pg1(x,y-Mod,z).grey,2))/(Mod*64),
>     z
>    ).grey
>   }
>  }
> #end
> 
> #declare my_pigment=
> pigment{
>  pcc(
>   pigment{
>    spiral1 1
>    sine_wave frequency 1
>    scale .125
>   }
>   ,.085
>  )
> }
> 
> The macro takes two arguments. The first is the pigment you wish to have 
> copied into each crackle cell. The second indicates how sharp you want 
> the edges to be. Smaller values = sharper edges. The macro returns a 
> pigment_pattern, so it can be used in any pattern block (pigment, 
> normal, texture, etc.)
> 
> I hope some of you find a use for this. I had hoped to use it for making 
> height fields. I'll post any interesting results I might get.
> 
> Sam
> 
> ------------------------------------------------------------------------
>


Post a reply to this message

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