POV-Ray : Newsgroups : povray.unofficial.patches : Why can't patterns be declared ? : Why can't patterns be declared ? Server Time
1 Sep 2024 16:13:14 EDT (-0400)
  Why can't patterns be declared ?  
From: Rune
Date: 2 Mar 2001 12:15:08
Message: <3a9fd51c@news.povray.org>
I am wondering why it is not possible to declare a pattern. Patterns are
used so many placed, and they could easily be made completely consistent
with the way other things are declared and called in POV-Ray:

#declare MyPattern =
pattern {crackle sine_wave frequency 2 turbulence 0.5 translate 3*y}

#declare MyPigment = pigment {MyPattern color_map {[0,rgb 0.2][1,rgb 1]}}

I think it would be an obvious feature to add, and it would make many things
more simple.

For example you could declare a pattern once and then call this pattern in
both the pigment and the normal.

I have also tried to make pigment_maps where the color_maps for each entry
are different, but the patterns are identical. In such cases it would be
*very* convenient to be able to declare patterns.

Currently if you want to add turbulence or similar to a pattern without it
affecting child patterns you must either use reset_children (which will not
be in 3.5) or use the pattern in a pigment, add turbulence to this pigment,
and then convert the pigment back to a pattern again using pigment_pattern.
It seems to me like an awkward way of doing it. The two conversions could be
avoided if my pattern suggestion was implemented. It would then simply work
like this:

pigment {
   pattern {spotted turbulence 0.8}
   pigment_map {...}
}

In MegaPov there's a pigment function feature which converts a pigment to a
function. However, functions return floats, not vectors, so it really would
be more logic if it took a pattern as input. I suspect that the only reason
it takes a pigment as input is that patterns - for some reason - can't
currently be declared.

So, there a lots of reasons to make it possible to declare patterns.
Is there any specific reason that patterns can't be declared?
It would be *so* useful!

Rune
--
\ Include files, tutorials, 3D images, raytracing jokes,
/ The POV Desktop Theme, and The POV-Ray Logo Contest can
\ all be found at http://rsj.mobilixnet.dk (updated January 28)
/ Also visit http://www.povrayusers.org


Post a reply to this message

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