POV-Ray : Newsgroups : povray.unofficial.patches : slope question Server Time
2 Sep 2024 14:18:27 EDT (-0400)
  slope question (Message 1 to 3 of 3)  
From: Tom Melly
Subject: slope question
Date: 17 Jan 2000 06:39:05
Message: <3882ff59@news.povray.org>
Hi, just started using megapov and have a few questions due to some
unexpected results of trying out "slope".

1. If I have "slope y", is the following correct?
    normal vector <  0, -1, 0 > returns 0.0
    normal vector <  1,  0, 0 > returns 0.5
    normal vector < -1,  0, 0 > returns 0.5
    normal vector <  0,  0, 1 > returns 0.5
    normal vector <  1,  0, 1 > returns 0.5
    normal vector <  1,  1, 1 > returns 0.75 (?)

2. Is there a formula for calculating the return from any particular normal
for a specified slope value?

3. Since scaling an object unevenly will modify surface normals, presumably
slope y pigments are affected by whether they are before or after such
scaling?

Many thanks.


Post a reply to this message

From: Hans-Detlev Fink
Subject: Re: slope question
Date: 18 Jan 2000 05:21:38
Message: <38843D90.493555A2@pecos.no-spam.de>
Hi Tom,

Tom Melly wrote:
> 
> Hi, just started using megapov and have a few questions due to some
> unexpected results of trying out "slope".
> 
> 1. If I have "slope y", is the following correct?
>     normal vector <  0, -1, 0 > returns 0.0
>     normal vector <  1,  0, 0 > returns 0.5
>     normal vector < -1,  0, 0 > returns 0.5
>     normal vector <  0,  0, 1 > returns 0.5
>     normal vector <  1,  0, 1 > returns 0.5
>     normal vector <  1,  1, 1 > returns 0.75 (?)

Yes, except the last one which yields ~0.85 ( (1/sqrt(2) + 1) * 0.5 ).
And <0, 1, 0> would return 1.0.

> 
> 2. Is there a formula for calculating the return from any particular normal
> for a specified slope value?

It's the dot product of the normal vector and the normal specified
in the slope statement (in your example <0, 1, 0>) plus 1.0 divided
by two: (vnormal.slopevect + 1.0 ) * 0.5.
(Note: the result is not proportional to the included angle.)
This holds only for the simple slope statements (slope <vector>).
For the other variants the formula is more complex, you may
want to have a look at the docs for that.

> 
> 3. Since scaling an object unevenly will modify surface normals, presumably
> slope y pigments are affected by whether they are before or after such
> scaling?

Can't comment on this as I'm not familiar with the other
modifications in megapov. But a simple test scene (sphere
scaled in y direction) should do.

Hans


Post a reply to this message

From: Hans-Detlev Fink
Subject: Re: slope question
Date: 19 Jan 2000 03:49:19
Message: <3885796F.4CA0CB26@pecos.no-spam.de>
Hans-Detlev Fink wrote:
> 
> Hi Tom,
> 
> Tom Melly wrote:
> >
> > Hi, just started using megapov and have a few questions due to some
> > unexpected results of trying out "slope".
> >
> > 1. If I have "slope y", is the following correct?
> >     normal vector <  0, -1, 0 > returns 0.0
> >     normal vector <  1,  0, 0 > returns 0.5
> >     normal vector < -1,  0, 0 > returns 0.5
> >     normal vector <  0,  0, 1 > returns 0.5
> >     normal vector <  1,  0, 1 > returns 0.5
> >     normal vector <  1,  1, 1 > returns 0.75 (?)
> 
> Yes, except the last one which yields ~0.85 ( (1/sqrt(2) + 1) * 0.5 ).

Which of course should read "... ~0.79 ( (1/sqrt(3) + 1) * 0.5 )".
Too bad I use to think in 2 dimensions only ;-)

Hans


Post a reply to this message

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