POV-Ray : Newsgroups : povray.advanced-users : gradient ? Server Time
1 Nov 2024 15:27:47 EDT (-0400)
  gradient ? (Message 1 to 5 of 5)  
From: Jan Walzer
Subject: gradient ?
Date: 20 Jan 2002 10:17:14
Message: <3c4adf7a@news.povray.org>
We have trace(), to find the intersection and the normal of any CSG-Object
with rays ...
Also we can compute the value of any 3D-Pattern at a given 3D-Point ...

What I'm missing, is the ability to compute the gradient of a 3D-Pattern at a
given point.

I know, this is not possible for avery pattern on every point ...

But (concerning Isosurfaces) it's done internally in POV...
I know, its done numerically, and depends on a given accuracy ...

I know, I can do this with a macro (is there one out there ?), taking 4
sample points(depending on accuracy)
around the point in question, and applying some maths to them, and one should
get a vector, showing the
gradient...

My question: Do you see any chance, that we can access the internal (faster)
gradient-function of POV
as it is probably the case for trace(), or at least a simple macro (doing
this in SDL-Space) that comes
with functions.inc in Pov3.5 ? ...

I know, it sounds like a feature-request, but there's probably such a macro
already out there, and
it wouldn't hurt, to put it into functions.inc, would it ?

--
[Talking about cardriving]
"People are opstacles?
Oh...I always treat them as bonus points..." [Ian Burgmyer in p.o-t]
// Jan Walzer <jan### [at] lzernet>


Post a reply to this message

From: Christoph Hormann
Subject: Re: gradient ?
Date: 20 Jan 2002 10:42:53
Message: <3C4AE575.6172DB98@gmx.de>
Jan Walzer wrote:
> 
> [...]
> 
> My question: Do you see any chance, that we can access the internal (faster)
> gradient-function of POV
> as it is probably the case for trace(), or at least a simple macro (doing
> this in SDL-Space) that comes
> with functions.inc in Pov3.5 ? ...

It is possible with type 1 displace warps in megapov, in Povray 3.5 you
can easily make a macro for that (or a function if you only want the
length of the gradient vector), but it would be slower of course, on the
other hand the displace warp code uses 7 evaluations and often 4 would
probably be sufficient.  

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: Jan Walzer
Subject: Re: gradient ?
Date: 20 Jan 2002 11:05:44
Message: <3c4aead8$1@news.povray.org>
"Christoph Hormann" <chr### [at] gmxde> schrieb im Newsbeitrag
news:3C4AE575.6172DB98@gmx.de...
>
>
> Jan Walzer wrote:
> >
> > [...]
> >
> > My question: Do you see any chance, that we can access the internal
(faster)
> > gradient-function of POV
> > as it is probably the case for trace(), or at least a simple macro (doing
> > this in SDL-Space) that comes
> > with functions.inc in Pov3.5 ? ...
>
> It is possible with type 1 displace warps in megapov, in Povray 3.5 you
> can easily make a macro for that (or a function if you only want the
> length of the gradient vector), but it would be slower of course, on the
> other hand the displace warp code uses 7 evaluations and often 4 would
> probably be sufficient.


I haven't read so much 'bout displace-warps, but I'd also like to stay
3.5-compatible.
But currently I've no idea, what I've to do with the 4 samples I took ...

Therefore my question, if there is one macro out there (somewhere), and if it
would be possible,
to include it into functions.inc for one of the following versions ...

I didn't post it to beta-test, becase it's a feature-request,
but probably some of the responsible persons are reading here, too ...

--
[Talking about cardriving]
"People are opstacles?
Oh...I always treat them as bonus points..." [Ian Burgmyer in p.o-t]
// Jan Walzer <jan### [at] lzernet>


Post a reply to this message

From: Christoph Hormann
Subject: Re: gradient ?
Date: 20 Jan 2002 12:12:51
Message: <3C4AFA87.59C54FFB@gmx.de>
Jan Walzer wrote:
> 
> [...]
> Therefore my question, if there is one macro out there (somewhere), and if it
> would be possible,
> to include it into functions.inc for one of the following versions ...
> 

For the length of the gradient try the following:

function {
  sqrt(
    (fn_test(x+DELTA, y, z) - fn_test(x, y, z))^2+
    (fn_test(x, y+DELTA, z) - fn_test(x, y, z))^2+
    (fn_test(x, y, z+DELTA) - fn_test(x, y, z))^2
  )/DELTA
}

Note that Povray right now does not optimize the multiple 'fn_test(x, y,
z)' so there are in fact 6 function evaluations.  

I will see what i can do concerning inclusion of such things into the
include files.

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: Tor Olav Kristensen
Subject: Re: gradient ?
Date: 20 Jan 2002 12:31:54
Message: <3C4AFE75.84074F9D@hotmail.com>
Jan Walzer wrote:
> 
> We have trace(), to find the intersection and the normal of any CSG-Object
> with rays ...
> Also we can compute the value of any 3D-Pattern at a given 3D-Point ...
> 
> What I'm missing, is the ability to compute the gradient of a 3D-Pattern at a
> given point.
> 
> I know, this is not possible for avery pattern on every point ...
> 
> But (concerning Isosurfaces) it's done internally in POV...
> I know, its done numerically, and depends on a given accuracy ...
> 
> I know, I can do this with a macro (is there one out there ?), taking 4
> sample points(depending on accuracy)
> around the point in question, and applying some maths to them, and one should
> get a vector, showing the
> gradient...
> 
> My question: Do you see any chance, that we can access the internal (faster)
> gradient-function of POV
> as it is probably the case for trace(), or at least a simple macro (doing
> this in SDL-Space) that comes
> with functions.inc in Pov3.5 ? ...
> 
> I know, it sounds like a feature-request, but there's probably such a macro
> already out there, and
> it wouldn't hurt, to put it into functions.inc, would it ?

I agree very much with you Jan, it would be very nice
to have a built-in function that would return the
numerically calculated gradient vector for 3D functions
at any point in 3D-space.

If you look into my reply to Barron Gillon's
post to this group 24. Dec. 2001;
"isosurface surface normals",
you'll find such a macro: vGradient()

http://news.povray.org/povray.advanced-users/20922/138919/
news://news.povray.org/3C292BC5.5A6AB4A6%40hotmail.com


Example usage:

#declare WrinkleFn = function { pattern { wrinkles } }

#declare vWrinkleGradient =
vGradient(
  function { WrinkleFn(x, y, z) },
  <3, -2, 1>
)

If you have a closer look at this macro, you'll
probably notice its similarities to the three
functions DerxFn(), DeryFn() and DerzFn() in
my reply to your post 12. Nov. 2001:
"Help on isosurface - distances - other stuff..."

http://news.povray.org/povray.advanced-users/19992/130234
news://news.povray.org/3BF0541A.62BC8C1F%40hotmail.com


Tor Olav


Post a reply to this message

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