POV-Ray : Newsgroups : povray.advanced-users : Normal vector deformation Server Time
1 Nov 2024 19:17:08 EDT (-0400)
  Normal vector deformation (Message 1 to 10 of 19)  
Goto Latest 10 Messages Next 9 Messages >>>
From: Rune
Subject: Normal vector deformation
Date: 13 Jan 2001 17:04:27
Message: <3a60d0eb@news.povray.org>
I'm working on some deformation macros that deforms the point vectors and
the normal vectors in a mesh.

Deforming the points is easy. Deforming the normals is a bit more
complicated.
To find a deformed normal I try to find the deformed points very close to
the start point of the normal, and see how the direction changes. However, I
can't figure out quite how to do it.

Say the macro Deform(V) will return a deformed version of V.
If I have the point P I can find the deformed point dP:
#declare dP = Deform(P)

If I have the normal N, how can I find the deformed normal dN?

Rune
--
\ Include files, tutorials, 3D images, raytracing jokes,
/ The POV Desktop Theme, and The POV-Ray Logo Contest can
\ all be found at http://rsj.mobilixnet.dk (updated January 6)
/ Also visit http://www.povrayusers.org


Post a reply to this message

From: Chris Huff
Subject: Re: Normal vector deformation
Date: 13 Jan 2001 17:36:49
Message: <chrishuff-6A6177.17382013012001@news.povray.org>
In article <3a60d0eb@news.povray.org>, "Rune" <run### [at] inamecom> 
wrote:

> Say the macro Deform(V) will return a deformed version of V.
> If I have the point P I can find the deformed point dP:
> #declare dP = Deform(P)
> 
> If I have the normal N, how can I find the deformed normal dN?

Try something like:
#declare SmallValue = 0.01;
#declare dN = vnormalize(Deform(P+V*SmallValue) - dP);

In other words, deform the point and a second point a short distance 
along the normal from it, and use the direction from dP to the new point 
as your normal. This should work in most circumstances, and you could 
decrease SmallValue for more accuracy.

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

From: Rune
Subject: Re: Normal vector deformation
Date: 13 Jan 2001 19:07:50
Message: <3a60edd6@news.povray.org>
"Chris Huff" wrote:
> Try something like:
> #declare SmallValue = 0.01;
> #declare dN = vnormalize(Deform(P+V*SmallValue) - dP);
>
> In other words, deform the point and a second point a short
> distance along the normal from it, and use the direction from
> dP to the new point as your normal. This should work in most
> circumstances, and you could decrease SmallValue for more
> accuracy.

Nope, I've already tried that, and it doesn't work.
Imagine a box deformed by a shearing matrix. The normals on the skewed sides
should change, but they won't using your method. I think I need several
points for reference (two points forming vectors perpendicular to the normal
vector?), but I haven't had any luck so far.

Rune
--
\ Include files, tutorials, 3D images, raytracing jokes,
/ The POV Desktop Theme, and The POV-Ray Logo Contest can
\ all be found at http://rsj.mobilixnet.dk (updated January 6)
/ Also visit http://www.povrayusers.org


Post a reply to this message

From: Chris Huff
Subject: Re: Normal vector deformation
Date: 13 Jan 2001 21:33:46
Message: <chrishuff-DDC14F.21351713012001@news.povray.org>
In article <3a60edd6@news.povray.org>, "Rune" <run### [at] inamecom> 
wrote:

> Nope, I've already tried that, and it doesn't work. Imagine a box 
> deformed by a shearing matrix. The normals on the skewed sides should 
> change, but they won't using your method. I think I need several 
> points for reference (two points forming vectors perpendicular to the 
> normal vector?), but I haven't had any luck so far.

Right, this only approximates, and only "works" for some 
distortions...are you only using matrix transformations? Or were you 
only using shearing matrices as an example?
I'll be thinking about this problem for a while...

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: Normal vector deformation
Date: 13 Jan 2001 21:58:27
Message: <3A61148C.66317755@online.no>
Rune wrote:
> 
> "Chris Huff" wrote:
> > Try something like:
> > #declare SmallValue = 0.01;
> > #declare dN = vnormalize(Deform(P+V*SmallValue) - dP);
> >
> > In other words, deform the point and a second point a short
> > distance along the normal from it, and use the direction from
> > dP to the new point as your normal. This should work in most
> > circumstances, and you could decrease SmallValue for more
> > accuracy.
> 
> Nope, I've already tried that, and it doesn't work.
> Imagine a box deformed by a shearing matrix. The normals on the skewed sides
> should change, but they won't using your method. I think I need several
> points for reference (two points forming vectors perpendicular to the normal
> vector?), but I haven't had any luck so far.

If N is the normal at the point P, then how about trying this ?

#declare dN = vnormalize(Deform(P + 0.01*vnormalize(N)) - Deform(P));


Tor Olav
-- 
mailto:tor### [at] hotmailcom
http://www.crosswinds.net/~tok/tokrays.html


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: Normal vector deformation
Date: 13 Jan 2001 22:02:43
Message: <3A61158D.9D409B1B@online.no>
Rune wrote:
>...
> Imagine a box deformed by a shearing matrix. The normals on the skewed sides
> should change ...

Hmmm ... Are you sure about this ?

If so, then how would you define a 
normal of a surface at a given point ?


Tor Olav
-- 
mailto:tor### [at] hotmailcom
http://www.crosswinds.net/~tok/tokrays.html


Post a reply to this message

From: Chris Huff
Subject: Re: Normal vector deformation
Date: 13 Jan 2001 22:36:43
Message: <chrishuff-F60238.22381413012001@news.povray.org>
In article <3A61148C.66317755@online.no>, Tor Olav Kristensen 
<tor### [at] onlineno> wrote:

> If N is the normal at the point P, then how about trying this ?
> 
> #declare dN = vnormalize(Deform(P + 0.01*vnormalize(N)) - Deform(P));

That is exactly the same as what I suggested (and which won't work), 
though it is slightly reworded and I assumed the normal was already 
normalized.

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

From: Chris Huff
Subject: Re: Normal vector deformation
Date: 13 Jan 2001 22:42:35
Message: <chrishuff-EE1B2C.22440613012001@news.povray.org>
In article <3A61158D.9D409B1B@online.no>, Tor Olav Kristensen 
<tor### [at] onlineno> wrote:

> Hmmm ... Are you sure about this ?

The normal to the -x side of a box is -x. The top of the box is then 
sheared +x so the -x and +x faces are at a 45 degree angle...but points 
still remain in the same xz plane as they were before, the -y and +y 
faces remain perpendicular to the y axis. The normal should be at a 45 
degree angle now, <-sqrt(2)/2, sqrt(2)/2, 0> to be precise, but since 
the two sample points were in the same xz plane, their position relative 
to each other is the same, and the normal is still -x.


> If so, then how would you define a 
> normal of a surface at a given point ?

The vector perpendicular to the surface at that point.

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: Normal vector deformation
Date: 13 Jan 2001 23:40:11
Message: <3A612C65.7FC6012@online.no>
Chris Huff wrote:
> 
> In article <3A61158D.9D409B1B@online.no>, Tor Olav Kristensen
> <tor### [at] onlineno> wrote:
> 
> > Hmmm ... Are you sure about this ?
> 
> The normal to the -x side of a box is -x. The top of the box is then
> sheared +x so the -x and +x faces are at a 45 degree angle...but points
> still remain in the same xz plane as they were before, the -y and +y
> faces remain perpendicular to the y axis. The normal should be at a 45
> degree angle now, <-sqrt(2)/2, sqrt(2)/2, 0> to be precise, but since
> the two sample points were in the same xz plane, their position relative
> to each other is the same, and the normal is still -x.

I see.

Then would this work ?

#declare dP = Deform(P);
#declare vN = vnormalize(N);

#declare AA = 0.01;
#declare BB = 0.1;

#declare dNpx = vnormalize(Deform(P + AA*(vN + x*BB)) - dP);
#declare dNmx = vnormalize(Deform(P + AA*(vN - x*BB)) - dP);

#declare dNpy = vnormalize(Deform(P + AA*(vN + y*BB)) - dP);
#declare dNmy = vnormalize(Deform(P + AA*(vN - y*BB)) - dP);

#declare dNpz = vnormalize(Deform(P + AA*(vN + z*BB)) - dP);
#declare dNmz = vnormalize(Deform(P + AA*(vN - z*BB)) - dP);

#declare dN = vnormalize(dNpx + dNmx + dNpy + dNmy + dNpz + dNmz);


Regards,

Tor Olav
--
mailto:tor### [at] hotmailcom
http://www.crosswinds.net/~tok/tokrays.html


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: Normal vector deformation
Date: 13 Jan 2001 23:56:11
Message: <3A613022.B2D49A20@online.no>
Tor Olav Kristensen wrote:
> 
> Chris Huff wrote:
> >
> > In article <3A61158D.9D409B1B@online.no>, Tor Olav Kristensen
> > <tor### [at] onlineno> wrote:
> >
> > > Hmmm ... Are you sure about this ?
> >
> > The normal to the -x side of a box is -x. The top of the box is then
> > sheared +x so the -x and +x faces are at a 45 degree angle...but points
> > still remain in the same xz plane as they were before, the -y and +y
> > faces remain perpendicular to the y axis. The normal should be at a 45
> > degree angle now, <-sqrt(2)/2, sqrt(2)/2, 0> to be precise, but since
> > the two sample points were in the same xz plane, their position relative
> > to each other is the same, and the normal is still -x.
> 
> I see.
> 
> Then would this work ?
> 
> #declare dP = Deform(P);
> #declare vN = vnormalize(N);
> 
> #declare AA = 0.01;
> #declare BB = 0.1;
> 
> #declare dNpx = vnormalize(Deform(P + AA*(vN + x*BB)) - dP);
> #declare dNmx = vnormalize(Deform(P + AA*(vN - x*BB)) - dP);
> 
> #declare dNpy = vnormalize(Deform(P + AA*(vN + y*BB)) - dP);
> #declare dNmy = vnormalize(Deform(P + AA*(vN - y*BB)) - dP);
> 
> #declare dNpz = vnormalize(Deform(P + AA*(vN + z*BB)) - dP);
> #declare dNmz = vnormalize(Deform(P + AA*(vN - z*BB)) - dP);
> 
> #declare dN = vnormalize(dNpx + dNmx + dNpy + dNmy + dNpz + dNmz);

I see now that this will probably not work either.

I'll think of it while I sleep.  :)


Goodnight from Tor Olav
-- 
mailto:tor### [at] hotmailcom
http://www.crosswinds.net/~tok/tokrays.html


Post a reply to this message

Goto Latest 10 Messages Next 9 Messages >>>

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