Re: [script] Normals - not understanding
| Date : Thu, 19 Oct 2006 08:35:15 +1000 |
| To : XSI(at)Softimage.COM |
| From : "Aloys Baillet" <aloys.baillet(at)gmail.com> |
| Subject : Re: [script] Normals - not understanding |
Normals are not points, they are vectors. You can't transform them from object to world space using the same operations as for point positions.
You can read there for more info:
http://www.unknownroad.com/rtfm/graphics/rt_normals.html
Cheers,
Aloys
On 10/19/06, Mathieu Leclaire <
mleclair(at)hybride.com> wrote:
Of course... cross products... the cross product of 2 vectors will give you
the perpendicular vector. 2 vectors will form a plane unless they are both
aligned (pointing in the same direction or in exact opposite directions). So
doing the cross product will give you the normal of that plane. So I assign
vY towards the global Y axis and I do the cross product of it with the
normal vector giving me the correct vX vector. Then I do the cross product
of that vX vector with the vZ (the normal) to get the correct vY. So
basically, vY(0,1,0) acts like an up vector. vZ will point towards the
normal and vY will be aligned with the up-vector. Normalize them and place
them in the Rotation from axis and there you go. Does that make sense to
you?
Mathieu
-----Original Message-----
From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM]On Behalf
Of Bernard Lebel
Sent: Wednesday, October 18, 2006 3:53 PM
To: XSI(at)Softimage.COM
Subject: Re: [script] Normals - not understanding
Nope, you are spot on Mathieu. That's exactly what I was trying to do.
In hopes of understanding this more......
Do you mind explaining why you did this?
vZ = ovGlobalNormal;
vY.Set(0, 1, 0);
vX.Cross(vY, vZ);
vY.Cross(vZ, vX);
Thanks
Bernard
On 10/18/06, Mathieu Leclaire <mleclair(at)hybride.com> wrote:
> I'm sorry... I'm not sure I understand what you are looking for... did I
> anwser your question on my last reply or did I miss the point?
>
> -----Original Message-----
> From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM]On Behalf
> Of Bernard Lebel
> Sent: Wednesday, October 18, 2006 3:11 PM
> To: XSI(at)Softimage.COM
> Subject: Re: [script] Normals - not understanding
>
>
> I should add that the actual null rotation values correspond to the
> normal values. However, the normal values are, from what I see, very
> strange. For instance, to match a normal of a certain vertex of values
> 40.0, 0.0, 40.0, I would have to use a rotation value of 0.0, 45.0, 0.
>
>
> Bernard
>
>
>
> On 10/18/06, Bernard Lebel <3dbernard(at)gmail.com> wrote:
> > Hi,
> >
> > I'm writing a script that extracts the normal vector of every point of
> > a mesh. Then these vectors are mapped to world space. Finally, for
> > each point, a null is created and the world vector is applied to its
> > rotation.
> >
> > For a minority of normals, it works well, the null ends up with the
> > right orientation. But for a majority of them, the null has an
> > orientation that I have a hard time to figure out.
> >
> > If you create a sphere and run the code below, you'll see what I mean:
> >
> >
> > import win32com
> >
> > xsi = Application
> > xsimath = win32com.client.Dispatch( 'XSI.Math' )
> >
> > oMesh = xsi.selection(0)
> > oMeshTransform = oMesh.kinematics.local.transform
> >
> > for oPoint in oMesh.activeprimitive.geometry.points:
> >
> > # Get global point normal direction
> > ovGlobalNormal = xsimath.mapobjectorientationtoworldspace (
> > oMeshTransform, oPoint.normal )
> >
> > # Get New point position
> > ovGlobalPosition = xsimath.mapobjectpositiontoworldspace(
> > oMeshTransform, oPoint.position )
> >
> > # create null
> > >> >
> > oNull.kinematics.local.rotx.value = xsimath.radianstodegrees(
> > ovGlobalNormal.x )
> > oNull.kinematics.local.roty.value = xsimath.radianstodegrees(
> > ovGlobalNormal.y )
> > oNull.kinematics.local.rotz.value = xsimath.radianstodegrees(
> > ovGlobalNormal.z )
> >
> > oNull.kinematics.local.posx.value = ovGlobalPosition.x
> > oNull.kinematics.local.posy.value = ovGlobalPosition.y
> > oNull.kinematics.local.posz.value = ovGlobalPosition.z
> >
> >
> >
> > Any idea?
> >
> >
> > Using XSI 5.11
> >
> >
> > Thanks
> > Bernard
> >
> ---
> Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
> unsubscribe xsi
>
>
>
> ---
> Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
> unsubscribe xsi
>
---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi
---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi
--
Aloys Baillet - XSI Technical Director
Character Dpt - Animal Logic
--
- Follow-Ups:
- Re: [script] Normals - not understanding
- From: "Bernard Lebel" <3dbernard(at)gmail.com>
- Re: [script] Normals - not understanding
- References:
- Re: [script] Normals - not understanding
- From: "Bernard Lebel" <3dbernard(at)gmail.com>
- RE: [script] Normals - not understanding
- From: "Mathieu Leclaire" <mleclair(at)hybride.com>
- Re: [script] Normals - not understanding
| DATE: | << | >> | THREAD: | << | >> | INDEX: | Main | Thread |
|---|
- Previous by Date: Re: xsi to maya
- Next by Date: Re: xsi to maya
- Previous by Thread: Re: xsi to maya
- Next by Thread: Re: xsi to maya
- Index(es):
| Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available. |