POV-Ray : Newsgroups : povray.general : eval_pigment? : Re: eval_pigment? Server Time
26 Nov 2022 03:49:27 EST (-0500)
  Re: eval_pigment?  
From: Tor Olav Kristensen
Date: 20 Nov 2022 20:05:00
Message: <web.637acddc287863e9d3631ec089db30a9@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> "Tor Olav Kristensen" <tor### [at] TOBEREMOVEDgmailcom> wrote:
>
> > Naming functions is often problematic.
>
> It is.   But masking the true nature of what the macro does, and probably
> slowing down the scene seems (to me) to be far worse.

I don't think that what I suggesting is trying to mask anything. It is just an
attempt to make robust macros that doesn't create strange problems for the
users.

And understanding how to pass arguments to macros and functions is something
that I think a lot of POV-Ray users will benefit from understanding. (Sorry,
that was probably not good English language.)


> Would not a simple one line
>
> function {pigment { Pigment }}
>
> be perfectly adequate, easily enough understood, and encourage greater education
> and understanding about how _so many_ thing in POV-Ray really work?

Yes, in user created code, like the code you just posted, I think it is all ok
to name functions. I think your code was relatively easy to understand. But in
include files for use by many others I think we should be careful.


> I learned so much, and understood so much more, when I made all the connections
> between functions, pigment patterns, isosurfaces, parametrics, and uv-mapping.
>
> Even the recent question about interpolating color_map values is something I
> would have never been able to adequately answer, if at all, only a few years
> ago.

Yes it's hard work and takes a lot of reading and experimenting.

Today, after you posted your code in the "colors map interpolation" thread, I
learnt a new thing about splines. I was about to suggest that this code be used
to return color vectors corresponding to the colors in the color map:

#declare VectorSpline =
    spline {
        linear_spline
        0.00, <1.00, 0.00, 0.00>,
        0.50, <1.00, 1.00, 0.00>,
        1.00, <0.00, 0.00, 1.00>
    }

But I found that the interpolation in splines, does not happen in the same way
as in color maps.

This spline:

#declare VectorSpline =
    spline {
        linear_spline
        0.00, <1.00, 0.00, 0.00>,
        0.50, <1.00, 1.00, 1.00>,
        0.50, <1.00, 1.00, 0.00>,
        1.00, <0.00, 0.00, 1.00>
    }

- results in different colors than this color map:

color_map {
    [ 0.00 rgb < 1.00, 0.00, 0.00> ]
    [ 0.50 rgb < 1.00, 1.00, 1.00> ]
    [ 0.50 rgb < 1.00, 1.00, 0.00> ]
    [ 1.00 rgb < 0.00, 0.00, 1.00> ]
}

It seems that splines can only deal with one value or vector for each "knot".

--
Tor Olav
http://subcube.com
https://github.com/t-o-k


Post a reply to this message

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