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:25:05 EST (-0500)
  Re: Copying pigments with crackle (124k jpg)  
From: Tek
Date: 29 Jul 2008 17:51:17
Message: <488f90d5$1@news.povray.org>
Awesome! I wanted something like that ages ago when I did my procedural 
crackle based city. I couldn't figure out how to do it. Now I'm just trying 
to understand your code!

Is there any way to make it work with metric 1?

-- 
Tek
http://evilsuperbrain.com


"stbenge" <THI### [at] hotmailcom> wrote in message 
news:488e5300@news.povray.org...
> 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.