POV-Ray : Newsgroups : povray.unofficial.patches : new pattern help Server Time
1 Sep 2024 18:16:11 EDT (-0400)
  new pattern help (Message 1 to 7 of 7)  
From: Tom Melly
Subject: new pattern help
Date: 7 Mar 2001 12:11:43
Message: <3aa66bcf$1@news.povray.org>
I am feeling vaguely inspired to try making a new pattern type.

It would be almost indentical to "average" but would add values rather than
average them.

If I download the source to POV, where would I go looking for the code for
"average"? (I'm afraid this is likely to be the first of many questions, but
it'll do for starters).


Post a reply to this message

From: Christoph Hormann
Subject: Re: new pattern help
Date: 7 Mar 2001 13:20:27
Message: <3AA67BE5.5F77940A@gmx.de>
Tom Melly wrote:
> 
> I am feeling vaguely inspired to try making a new pattern type.
> 
> It would be almost indentical to "average" but would add values rather than
> average them.
> 
> If I download the source to POV, where would I go looking for the code for
> "average"? (I'm afraid this is likely to be the first of many questions, but
> it'll do for starters).

pigment.c:

static void Do_Average_Pigments (...

But 'average' is not a pattern. That's probably also why you did not find
it.   

For patterns look in pattern.c

If you want to create a new pattern, it might be useful to look for all
the changes made with #ifdef for a specific patch like:

#ifdef ObjectPatternPatch

BTW, a tool searching for keywords in all source files is quite practical
for such things.

Christoph

-- 
Christoph Hormann <chr### [at] gmxde>
IsoWood include, radiosity tutorial, TransSkin and other 
things on: http://www.schunter.etc.tu-bs.de/~chris/


Post a reply to this message

From: Christoph Hormann
Subject: Re: new pattern help
Date: 7 Mar 2001 13:31:57
Message: <3AA67E9B.9E86ACBD@gmx.de>
> 
> Tom Melly wrote:
> >
> > I am feeling vaguely inspired to try making a new pattern type.
> >
> > It would be almost indentical to "average" but would add values rather than
> > average them.
> >

I forgot to mention that such a thing is already possible for pigments if
you use pigment functions.  Although it's a bit more complicated, it is
more universal, because you can also use other functions than simple
addition.

try:

#macro Add_Pigment(Pig_1, Pig_2)

  #local fn_1=function { pigment { Pig_1 color_map { [0 rgb 0][1 rgb 1] }
} }
  #local fn_2=function { pigment { Pig_2 color_map { [0 rgb 0][1 rgb 1] }
} }

  function { fn_1(x, y, z) + fn_2(x, y, z) }

#end

#declare Pigm=
pigment {
  Add_Pigment( Pigment_1, Pigment_2 )
  ...
}

(not tested, but it should work)

Christoph

-- 
Christoph Hormann <chr### [at] gmxde>
IsoWood include, radiosity tutorial, TransSkin and other 
things on: http://www.schunter.etc.tu-bs.de/~chris/


Post a reply to this message

From: Ron Parker
Subject: Re: new pattern help
Date: 7 Mar 2001 14:12:53
Message: <slrn9ad21n.65c.ron.parker@fwi.com>
On Wed, 7 Mar 2001 17:11:42 -0000, Tom Melly wrote:
>I am feeling vaguely inspired to try making a new pattern type.
>
>It would be almost indentical to "average" but would add values rather than
>average them.

You could just use average but multiply all of the color values in your
pigments by the number of pigments you're averaging.

-- 
Ron Parker   http://www2.fwi.com/~parkerr/traces.html
My opinions.  Mine.  Not anyone else's.


Post a reply to this message

From: Ron Parker
Subject: Re: new pattern help
Date: 7 Mar 2001 14:22:18
Message: <slrn9ad2jc.65c.ron.parker@fwi.com>
On 7 Mar 2001 14:12:53 -0500, Ron Parker wrote:
>On Wed, 7 Mar 2001 17:11:42 -0000, Tom Melly wrote:
>>I am feeling vaguely inspired to try making a new pattern type.
>>
>>It would be almost indentical to "average" but would add values rather than
>>average them.
>
>You could just use average but multiply all of the color values in your
>pigments by the number of pigments you're averaging.

Here's an example:

#declare pig1 = pigment {bozo color_map {[0 rgb 0][1 red 3]} 
    translate 0 scale .2}
#declare pig2 = pigment {bozo color_map {[0 rgb 0][1 blue 3]} 
    translate 50 scale .2}
#declare pig3 = pigment {bozo color_map {[0 rgb 0][1 green 3]} 
    translate 100 scale .2}
#declare pig4 = pigment {average pigment_map {[1 pig1][1 pig2][1 pig3]}}

sphere {0,2 texture {pigment {pig4} finish {ambient 1}}}
camera {location -5*z look_at 0}

-- 
Ron Parker   http://www2.fwi.com/~parkerr/traces.html
My opinions.  Mine.  Not anyone else's.


Post a reply to this message

From: Tom Melly
Subject: Re: new pattern help
Date: 9 Mar 2001 04:58:46
Message: <3aa8a956$1@news.povray.org>
"Ron Parker" <ron### [at] povrayorg> wrote in message
news:slr### [at] fwicom...

<snip>

Thanks - I'll give this a try. (although I'm still tempted to dip my toes in
the C).


Post a reply to this message

From: Tom Melly
Subject: Re: new pattern help
Date: 9 Mar 2001 04:59:28
Message: <3aa8a980$1@news.povray.org>
"Christoph Hormann" <chr### [at] gmxde> wrote in message
news:3AA67E9B.9E86ACBD@gmx.de...

<snip> thanks, I'll give this a try.


Post a reply to this message

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