POV-Ray : Newsgroups : povray.macintosh : Is there any way to make a custom pattern? : Re: Is there any way to make a custom pattern? Server Time
16 Jun 2024 13:11:55 EDT (-0400)
  Re: Is there any way to make a custom pattern?  
From: Chris Huff
Date: 23 Mar 2001 10:25:31
Message: <chrishuff-0636E2.10190623032001@news.povray.org>
In article <3ABA191B.A47B8A97@mail.rit.edu>, John Chatham 
<Wyv### [at] mailritedu> wrote:

> I've been using crackle to make randomly placed armor plates, but I also
> need to have one plate in a specific location, and have it not overlap
> any of the random plates.  What I'd like to do is something like this:
> #macro my_pattern (V)
> max( crackle (V), spherical (V) )
> #end
> #declare my_texture = texture{ my_pattern texture_map{...}}
> Is there any way to do something like this?

Using MegaPOV, it's easy...just use a function pattern.

#macro MyPattern()
    #local Crackle =
    function {
        pigment {crackle color_map {[0 rgb 0][1 rgb 1]}}
    }
    function {
        max(Crackle(x, y, z), max(0, 1-sqrt(sqr(x) + sqr(y) + sqr(z)))
    }
#end

#declare MyTexture = texture {MyPattern() texture_map{...}}

You could also declare a spherical pigment function and use that instead 
of "max(0, 1-sqrt(sqr(x) + sqr(y) + sqr(z))", but it wouldn't be as 
flexible, and might be slower. Or it might be faster...
MacMegaPOV is available here:
http://users.skynet.be/smellenbergh/

BTW, it's a good idea to always use at least one capital letter in 
variable/macro names, to avoid interference from a keyword in a future 
version. Keywords will always be lower-case, so it's easy to avoid name 
collisions.

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

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