POV-Ray : Newsgroups : povray.binaries.images : Documenting wrinkles normal pattern bias. v3.7/v3.8. : Re: Documenting wrinkles normal pattern bias. v3.7/v3.8. Server Time
29 Mar 2024 02:32:32 EDT (-0400)
  Re: Documenting wrinkles normal pattern bias. v3.7/v3.8.  
From: Tor Olav Kristensen
Date: 6 May 2021 21:25:00
Message: <web.6094962dc711449a8e52cc8789db30a9@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> William F Pokorny <ano### [at] anonymousorg> wrote:
>
> > :-) Re: "vastly easier" - I had the thought, "not with my C++ skills..."
>
> I was stating that from the perspective that such would be "an algorithmic
> process" rather than a function {}.
>
> What you're proposing seems awfully similar to how slope and aoi already work,
> no?  Perhaps there's a way to piggyback on those in SDL, or repurpose that
> already-written source code for the normal perturbation?
>
> Thinking about this some more today reminded me that I am not at all clear about
> how a scalar function perturbs a normal vector.  Maybe this got covered in the
> quilted pattern thread - I will have to look.  It would be nice if this was
> covered in the docs somehow.
>
> It also caused me to wonder if there is a way to define a pattern in SDL that
> has an rgb output, such that the .r .g and .b could be used.  The average {}
> pattern?
> If so, then could we in theory have "vector functions" by rolling 3 pigment
> {function {}} statements into an average{} block, and then using function
> {pigment{}} ?

Yes, you are right; something like that is possible. But patterns can only
return values from 0 to 1, so it must be done with pigments only.

Here's one way of doing it:

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

#version 3.7;

#include "Gaussian_Blur.inc"

#declare FnX = function { x*z };
#declare FnY = function { y - 0.2 };
#declare FnZ = function { y + z };

#declare Fn = function { FunctionsPigmentRGB(FnX, FnY, FnZ) };

#declare vP = Fn(0.5, 0.6, 0.3);

#debug "\n"
#debug concat("<", vstr(3, vP, ", ", 0, -1), ">")
#debug "\n\n"

#error "Finished"

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

For this be be more useful, one can create one or more functions that one wraps
around the FnX, FnY and FnZ functions in order to map their return values into
the 0 to 1 interval and one or more functions that one applies to the returned
components from the Fn vector function in order to map them from the 0 to 1
interval into one or more desired intervals.

IIRC somebody once made some macros that did something like this.

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


Post a reply to this message

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