POV-Ray : Newsgroups : povray.newusers : Surface normal in pigment user-function Server Time
26 Dec 2024 10:38:33 EST (-0500)
  Surface normal in pigment user-function (Message 1 to 8 of 8)  
From: avariant
Subject: Surface normal in pigment user-function
Date: 13 Mar 2007 20:05:02
Message: <web.45f74903fde32694bb706900@news.povray.org>
I know you can create a pigment user function that accepts x,y,z,u,v as the
geometric and texture coordinates of the point being evaluated.  My
question is, are there constants that can be set to automatically accept the
normal of the point being evaluated?

I know that I could use the trace method to retrieve it, and if there is no
other way, I'll do that, but it seems redundant.  Likely, when evaluating
the function, trace or some method like it, has been called prior and
calling trace would just duplicate the effort and take longer.


Post a reply to this message

From: avariant
Subject: Re: Surface normal in pigment user-function
Date: 13 Mar 2007 21:05:01
Message: <web.45f757b54f1e00c84bb706900@news.povray.org>
To complicate matters for the trace method, I don't seem to be able to
convert the x, y, z parameters into a vector to pass to trace. :(  Any
ideas?


Post a reply to this message

From: Trevor G Quayle
Subject: Re: Surface normal in pigment user-function
Date: 13 Mar 2007 21:30:29
Message: <45f75e45$1@news.povray.org>
"avariant" <nomail@nomail> wrote in message 
news:web.45f74903fde32694bb706900@news.povray.org...
>I know you can create a pigment user function that accepts x,y,z,u,v as the
> geometric and texture coordinates of the point being evaluated.  My
> question is, are there constants that can be set to automatically accept 
> the
> normal of the point being evaluated?
>
> I know that I could use the trace method to retrieve it, and if there is 
> no
> other way, I'll do that, but it seems redundant.  Likely, when evaluating
> the function, trace or some method like it, has been called prior and
> calling trace would just duplicate the effort and take longer.
>
>
>

If you just want a pigment based on the surface normal, have a look at the 
'slope' pattern type.  For something more complicated, you can look at 
layering it perhaps.

-tgq


Post a reply to this message

From: avariant
Subject: Re: Surface normal in pigment user-function
Date: 13 Mar 2007 22:40:01
Message: <web.45f76e764f1e00c84bb706900@news.povray.org>
Ah CRAP!!!  I feel stupid.  I never even saw that pattern.  That's exactly
what I need.  Thanks Trevor!!


Post a reply to this message

From: Trevor G Quayle
Subject: Re: Surface normal in pigment user-function
Date: 14 Mar 2007 07:45:01
Message: <web.45f7eddc4f1e00c8c150d4c10@news.povray.org>
"avariant" <nomail@nomail> wrote:
> Ah CRAP!!!  I feel stupid.  I never even saw that pattern.  That's exactly
> what I need.  Thanks Trevor!!

No problem.  Just be sure to read carefully, it can be difficult to
understand exactly how the parameters work at first.


-tgq


Post a reply to this message

From: avariant
Subject: Re: Surface normal in pigment user-function
Date: 6 Apr 2007 11:00:02
Message: <web.461660564f1e00c8fdebbbce0@news.povray.org>
Turns out that's not exactly what I need after all...  It's a good solution
and for small, relatively uniform objects it's probably sufficient.  The
problem is that the slope pattern takes a single vector, which can be a
vector from the camera position to the object's center.  But I want to
evaluate the angle between the camera vector and the normal of EACH surface
point which means, based on the point, the vector from the camera is always
changing.

Like I said when I started this post, I know trace would work, but as I've
learned more about POV-Ray, it seems that there isn't a way to include it
in a pigment function because functions don't support vectors.

So, are there any thoughts on how this could be done?  Like I said, slope
pattern can work, but wouldn't be entirely correct for large or complicated
objects.


Post a reply to this message

From: Christian Froeschlin
Subject: Re: Surface normal in pigment user-function
Date: 6 Apr 2007 11:43:42
Message: <46166aae$1@news.povray.org>
avariant wrote:

> vector from the camera position to the object's center.  But I want to
> evaluate the angle between the camera vector and the normal of EACH surface
> point which means, based on the point, the vector from the camera is always
> changing.

I think the "aoi" pattern in MegaPOV would be just what you need.
It is similar to slope, except that instead of a fixed direction
vector, either a reference point or the direction of the incoming
rendering ray is used.


Post a reply to this message

From: avariant
Subject: Re: Surface normal in pigment user-function
Date: 6 Apr 2007 17:10:00
Message: <web.4616b6924f1e00c8fdebbbce0@news.povray.org>
Ok, thanks.  I haven't looked at MegaPOV yet.  I actually went ahead and
modified the source directly to add a reference point tag to the slope
pattern, but it looks like megapov has a lot of other cool things.  I'll
check it out.

Christian Froeschlin <chr### [at] chrfrde> wrote:
> avariant wrote:
>
> > vector from the camera position to the object's center.  But I want to
> > evaluate the angle between the camera vector and the normal of EACH surface
> > point which means, based on the point, the vector from the camera is always
> > changing.
>
> I think the "aoi" pattern in MegaPOV would be just what you need.
> It is similar to slope, except that instead of a fixed direction
> vector, either a reference point or the direction of the incoming
> rendering ray is used.


Post a reply to this message

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