POV-Ray : Newsgroups : povray.unofficial.patches : Mini-Patch: 'composite', a new pattern. Server Time
3 Sep 2024 00:19:28 EDT (-0400)
  Mini-Patch: 'composite', a new pattern. (Message 1 to 10 of 11)  
Goto Latest 10 Messages Next 1 Messages >>>
From: Michael Andrews
Subject: Mini-Patch: 'composite', a new pattern.
Date: 28 May 1999 13:42:25
Message: <374EC7D3.1A61DEE3@remove-this.reading.ac.uk>
Hi folks,
	While I was building my recent waterscapes, and in the clouds I'm still
working on, I hit a wall with standard blend maps. I simply could not
figure out how to produce an effect I wanted. I'd hit this problem
before, but this time I decided to do something about it ...

Rationale:
---------
	Say I wanted to change from a granite pigment to a gradient, over
another gradient. Fine, you say, you can do this:

pigment {
	gradient y
	pigment_map {
		[0 granite]
		[0.5 gradient x]
	}
}

OK, I say, but I want to colour_map this, say {[0.5 Red][0.5 Green][1
Blue]}.
Now, using:

pigment {
	gradient y
	pigment_map {
		[0 granite colour_map {[0.5 Red][0.5 Green][1 Blue]}]
		[0.5 gradient x colour_map {[0.5 Red][0.5 Green][1 Blue]}]
	}
}

I get smeared mixtures of red, green and blue. What I really wanted to
do was apply the colour_map once to the whole pigment:

pigment {
	gradient y
	pigment_map {
		[0 granite]
		[0.5 gradient x]
	}
	colour_map {[0.5 Red][0.5 Green][1 Blue]}
}

but this, so far as I know, was impossible. So I decided to make this
effect possible, if not this exact syntax.

Result:
------
	What I came up with was this syntax:

	composite { PIGMENT_BODY }

eg

pigment {
	composite {
		gradient y
		pigment_map {
			[0 granite]
			[0.5 gradient x]
		}
	}
	colour_map {[0.5 Red][0.5 Green][1 Blue]}
}

	The composite pattern takes the colour returned by the pigment body,
takes a simple average of the three colours and uses this value to index
the colour_map in this example. This composite pattern can (I believe -
I haven't stringently tested it yet) be used anywhere any other pattern
type can be used. I have tested it using colour_map, pigment_map,
texture_map and density. These all appear to work correctly. One thing
you do have to watch for are non-grayscale default colour_maps, eg
radial.

	Hokay, I guess if anyone has persevered this far they want to know how
I did it.
	The code changes surprised me with their simplicity - eight small code
additions through four files is all it took. I haven't produced a diff
file - the base code I was working with was an already altered version
of Ron's latest superpatch release code - but I hope it is clear from my
notes in the attached text file as to where the code snippets are to be
added. I've also attached an example PoV file which shows the composite
syntax compared to applying the blend maps on a pattern-by-pattern
basis, an image of which I posted on p.b.i.

	As a final note, would the folks who have created similar patches
(Hans-Detlev, Ron and Nathan that I know of, anyone else?) please check
that I'm not doing any architypal Bad Things like not releasing acquired
memory? And, of course, if anyone can think of any changes that should
be made, or any comments on usefulness (or lack thereof) please make
them known, either here or by email.

	Bye for now,
		Mike Andrews.


Post a reply to this message


Attachments:
Download 'us-ascii' (3 KB) Download 'composit.pov.txt' (5 KB)

From: Michael Andrews
Subject: Re: Mini-Patch: 'composite', a new pattern.
Date: 28 May 1999 14:49:33
Message: <374ED78F.18035FE3@remove-this.reading.ac.uk>
Rats - I just read the note on the function { pigment { ... } } addition
to the latest superpatch release. I hadn't noticed this before and it
can probably duplicate my patch's efforts and do more besides. Well, I
suppose the programming practice was good for me, and it forced me to
figure out how to get PoV-Ray compiled with the Cygnus compiler ...

	<grumble ... growl>,
		Mike Andrews.


Post a reply to this message

From: Mick Hazelgrove
Subject: Re: Mini-Patch: 'composite', a new pattern.
Date: 28 May 1999 14:51:32
Message: <374ed7a4.0@news.povray.org>
What latest superpatch release ansd where can I get it!

Mick


Michael Andrews <M.C### [at] remove-thisreadingacuk> wrote in message
news:374ED78F.18035FE3@remove-this.reading.ac.uk...
> Rats - I just read the note on the function { pigment { ... } } addition
> to the latest superpatch release. I hadn't noticed this before and it
> can probably duplicate my patch's efforts and do more besides. Well, I
> suppose the programming practice was good for me, and it forced me to
> figure out how to get PoV-Ray compiled with the Cygnus compiler ...
>
> <grumble ... growl>,
> Mike Andrews.


Post a reply to this message

From: Michael Andrews
Subject: Re: Mini-Patch: 'composite', a new pattern.
Date: 28 May 1999 15:08:20
Message: <374EDBF7.55622CF6@remove-this.reading.ac.uk>
Hi Mick,
	Ron's released his generic superpatch source - he gives the URL in his
second reply to the 'We need Fresnel reflectance.' thread on
povray.programming. The compilation is up to you :-)

	Mike Andrews.

Mick Hazelgrove wrote:
> 
> What latest superpatch release ansd where can I get it!
> 
> Mick


Post a reply to this message

From: Ron Parker
Subject: Re: Mini-Patch: 'composite', a new pattern.
Date: 28 May 1999 15:16:19
Message: <374edd73.0@news.povray.org>
On Fri, 28 May 1999 18:51:11 +0100, Michael Andrews wrote:
>and it forced me to
>figure out how to get PoV-Ray compiled with the Cygnus compiler ...

I won't tell you about the makefile and code patches I posted
to povray.binaries.programming a few days ago to do just that,
because it might upset you even more.  Though, to be fair, 
those were for a console-mode version.  If you have a GUI-version
makefile for Cygwin, I'd be interested in seeing it.


Post a reply to this message

From: Ron Parker
Subject: Re: Mini-Patch: 'composite', a new pattern.
Date: 28 May 1999 15:19:00
Message: <374ede14.0@news.povray.org>
On Fri, 28 May 1999 19:09:59 +0100, Michael Andrews wrote:
>	Ron's released his generic superpatch source - he gives the URL in his
>second reply to the 'We need Fresnel reflectance.' thread on
>povray.programming. The compilation is up to you :-)

I'm not sure "released" is the right word.  They've been there for a 
long time now.  I just finally told the world where to find them.

The good news is, we have a long weekend approaching and I might be
able to find a large enough block of time to finish the documentation
and put the binaries online at last.  My documentation guy seems to 
have disappeared, so it won't be as nice as I had hoped, but it will
at least be there.  And, by popular request, I have thrown MS Word in
the trash.


Post a reply to this message

From: Mick Hazelgrove
Subject: Re: Mini-Patch: 'composite', a new pattern.
Date: 28 May 1999 15:19:56
Message: <374ede4c.0@news.povray.org>
Hi Ron

As I neither have the facilities or the knowledge to complile my own copy I
would love to know if you are planning to produce a windows compile as you
did before?

ATB

Mick
Ron Parker <par### [at] fwicom> wrote in message
news:374edd73.0@news.povray.org...
> On Fri, 28 May 1999 18:51:11 +0100, Michael Andrews wrote:
> >and it forced me to
> >figure out how to get PoV-Ray compiled with the Cygnus compiler ...
>
> I won't tell you about the makefile and code patches I posted
> to povray.binaries.programming a few days ago to do just that,
> because it might upset you even more.  Though, to be fair,
> those were for a console-mode version.  If you have a GUI-version
> makefile for Cygwin, I'd be interested in seeing it.


Post a reply to this message

From: Ron Parker
Subject: Re: Mini-Patch: 'composite', a new pattern.
Date: 28 May 1999 15:25:09
Message: <374edf85.0@news.povray.org>
On Fri, 28 May 1999 18:22:29 +0100, Mick Hazelgrove wrote:
>As I neither have the facilities or the knowledge to complile my own copy I
>would love to know if you are planning to produce a windows compile as you
>did before?

Of course.  In fact, I have one already, except for the splash screen.  
I don't have the 3.1e GUI source yet, but this one might work with the 
3.1e editor anyway (no guarantees, though.  It works for me, so far.)  
I just need to add a splash screen, rewrite some parts of the docs, 
and make a web page to put it on now that twysted.net is down.  That
part is the hard part, because I'm such a perfectionist that I won't
be able to abide a simple white-background-black-text-no-graphics
webpage.


Post a reply to this message

From: Mick Hazelgrove
Subject: Re: Mini-Patch: 'composite', a new pattern.
Date: 28 May 1999 16:04:59
Message: <374ee8db.0@news.povray.org>
> and make a web page to put it on now that twysted.net is down.  That
> part is the hard part, because I'm such a perfectionist that I won't
> be able to abide a simple white-background-black-text-no-graphics
> webpage.

I know what you mean I tend to have the same problem - but I also lazy so
life is a battle between getting it done well and getting it done at all!

I look forward to the update of superpatch it has become indispensible to
me. Most of the pics I have done recently have used it extensively and would
not have been either possible or as good without it.

Keep up the great work

Mick


Post a reply to this message

From: Juha Leppälä
Subject: Re: Mini-Patch: 'composite', a new pattern.
Date: 28 May 1999 19:36:01
Message: <374F1A92.29C0DCFB@kolumbus.fi>
> And, by popular request, I have thrown MS Word in
> the trash.

That's kinda good. So what format are they in now? .txt? .html?



Post a reply to this message

Goto Latest 10 Messages Next 1 Messages >>>

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