POV-Ray : Newsgroups : povray.advanced-users : Function logic? : Re: Function logic? Server Time
28 Jul 2024 16:27:25 EDT (-0400)
  Re: Function logic?  
From: Mike Williams
Date: 6 Dec 2004 11:28:02
Message: <NWhr5BAxhItBFw36@econym.demon.co.uk>
Wasn't it Tim Nikias who wrote:

>Now to the problem: Why is it that I have to put a ".x" after the function
>the first time I use it, but not afterwards?

There are two sorts of functions, ordinary functions and pigment
functions. When you evaluate a pigment function you get a colour rather
than a value. 

POV doesn't currently allow you to perform arithmetic on pigment
functions, but you can choose one of the components of the pigment
function, by adding ".red" (or, equivalently ".x") to convert it into an
ordinary function.

Somewhere outside your macro you must have declared SnowFunction to
initially be a pigment function, but when you redeclare it you are
making it into an ordinary function.

Once you've performed that conversion, you've not got a pigment function
any more, so appending ".x" to the result is wrong.

What you need to change is the original declaration of Snowfunction,
which is somewhere outside your macro. Stick a ".x" on that declaration
and you'll be working with non-pigment functions throughout.


To make things even better, you could try rewriting the whole thing to
use patterns instead of pigments. The code will probably be simpler and
the processing more efficient without those unwanted .blue and .green
channels.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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