[no subject]

> How about parallax mapping, can you shed some
> light on that technique?

Andr=E9 already explained it nicely.

I wanted to see if I could quickly mop up a rendertree that does =
parallax mapping, and it worked :) Looks quite nice, even.

Here's a quick render:

http://animus.brinkster.net/temp/Parallax.mov

I also put the scene up:

http://animus.brinkster.net/temp/Parallax.zip

You can play with the PARALLAX_SCALE and PARALLAX_OFFSET nodes to =
influence the strength of the effect.

Ciao, Daniel!

PS: Looking at the render tree can also cause nausea, headaches and/or =
breathing difficulties :P
  ----- Original Message -----=20
  From: Tim Leydecker=20
  To: XSI(at)Softimage.COM=20
  Sent: Friday, January 26, 2007 10:44 AM
  Subject: Re: tangent maps




  It seems there=B4s all sorts of workflows superior to the
  more traditional bumpmap implementation, starting with
  Ben=B4s ZBump, various ways of Normalmapping and last
  but not least just tesseleating the mesh to infinity and using
  a displacement instead - or even a vector displacement.

  Problem is, as allways, the limited information available
  like, "now is that stored in float or clamped8bit..."
  Pretty hard to get to a point of confidential usage then,
  or as you=B4ve put it - use it in production asap.

  Cheers

  tim


  ----- Original Message -----=20
  From: "Andr=E9 Adam" <a_adam(at)49games.de>
  To: <XSI(at)Softimage.COM>
  Sent: Friday, January 26, 2007 9:58 AM
  Subject: Re: tangent maps


  > I've a whole bunch of programmers around here that got headaches =
because of those=20
  > alpha values; actually we did not find out up to now and my personal =
opinion still=20
  > is it simply is trash (though I'm the only one over here with that =
opinion...).=20
  > Anyone from Soft like to give us a hint?

  >
  >
  > Ben Rogall wrote:
  >>
  >>
  >> Thanks for forwarding that Andre. The hardest part about the vector =
displacement=20
  >> was setting up the tangent space conversion. Well, that and trying =
different ways=20
  >> of exporting objects and mapping the position data. Mental Ray =
already knows how=20
  >> to do multi-directional displacement.
  >> Regarding the bit-depth of the tangent property, if I read out any =
of the values,=20
  >> say by checking the SDK explorer and multiply by 255, I get a whole =
number. Btw, I=20
  >> have no idea what is being stored in the alpha channel.
  >>
  >>
  >>
  >> --- On Thu 01/25, =3D?ISO-8859-1?Q?Andr=3DE9_Adam?=3D < =
a_adam(at)49games.de > wrote:
  >>
  >>     *From: *=3D?ISO-8859-1?Q?Andr=3DE9_Adam?=3D [mailto: =
a_adam(at)49games.de]
  >>     *To: *XSI(at)Softimage.COM
  >>     *Date: *Thu, 25 Jan 2007 17:32:02 +0100
  >>     *Subject: *Re: tangent maps
  >>
  >>     Hi Ben,
  >>
  >>     thanks for the kind words! Very nice work on the displacement =
mapping!
  >>     A vertex colour property stores float values, not 8bit data, so
  >>     you're
  >>     practically lossless when converting back to vectors. The =
smoothing
  >>     works similar, since it is angle based, but is not connected in
  >>     any way
  >>     to the geo approximation or the normals. In theory, the normal =
map
  >>     should be able to compensate cracks in the tangent space, but
  >>     practically the normal map's texels would have to line up
  >>     perfectly with
  >>     the polygon edges which is a very unlikely occasion. So, as =
soon
  >>     as you
  >>     try to fit a normal map texture with its pixel raster onto =
uneven 3d
  >>     geometry, the tangent space needs to be smoothed to avoid =
cracks
  >>     and seams.
  >>
  >>     I've attached the script to this mails, but really, this is =
nothing
  >>     fancy, just a one-time creation of null objects pointing in the
  >>     vector's
  >>     direction. A compiled operator with live-input certainly would =
be way
  >>     nicer. Oh, and it is slow, be careful with meshes heavier than =
-
  >>     say - a
  >>     thousand polygons, trying it out on small objects will be more
  >>     fun... :)
  >>
  >>     Cheers!
  >>
  >>     -Andr=E9
  >>
  >>
  >>     Ben Rogall wrote:
  >>     >
  >>     > Andre, very very nice explanation. I've been using XSI =
tangents
  >>     > recently in experiments with tangent space vector =
displacement:
  >>     >
  >>=20
  >> =
http://www.xsibase.com/forum/index.php?board=3D29;action=3Ddisplay;thread=
id=3D28834;start=3D0
  >>     > It took me a little while to realize I had to do the [0,1] to
  >>     [-1,1]
  >>     > interval correction. I'm also curious to see whether having =
only 8
  >>     > bits per channel for the tangent vector is enough to avoid =
jumping
  >>     > though I haven't seen anything obvious yet.
  >>     >
  >>     > Another issue with tangent space is difficulty when you try =
to get
  >>     > different 3D applications to work with eachother. Once you =
have the
  >>     > normal and tangent vectors, there are still several ways to
  >>     determine
  >>     > your T,B,N space depending on which of these vectors you =
decide to
  >>     > orthoganalize to the others. This choice has to match between =
the
  >>     > applications.
  >>     >
  >>     > I hadn't even thought about the smoothing issue you =
mentioned.
  >>     Is that
  >>     > analogous to the normal automatic discontinuity control?
  >>     >
  >>     > Also is your tangent display utility publicly available?
  >>     >
  >>     > Thanks,
  >>     > Ben
  >>     >
  >>     >
  >>     > --- On Thu 01/25, =3D?ISO-8859-1?Q?Andr=3DE9_Adam?=3D <
  >>     a_adam(at)49games.de >
  >>     > wrote:
  >>     >
  >>     > *From: **=3D?ISO-8859-1?Q?Andr=3DE9_Adam?=3D [mailto: =
a_adam(at)49games.de]
  >>     > *To: *XSI(at)Softimage.COM
  >>     > *Date: *Thu, 25 Jan 2007 11:20:09 +0100
  >>     > *Subject: *Re: tangent maps
  >>     >
  >>     > Hi Bernard,
  >>     >
  >>     > the tangent property in XSI is the so called tangent map, or =
tangent
  >>     > space. Encoded in there you can find a given texture space's
  >>     > u-direction
  >>     > (the reason why you have to reference a texture projection =
when
  >>     > creating
  >>     > a tangent property) in 3d space (you could call this the =
"texture
  >>     > mapped" u-direction) on a per sample basis, so we're talking =
of
  >>     > vectors
  >>     > here. In absence of a more convenient property Softimage =
decided to
  >>     > encode the tangents into vertex colors. That means you have a
  >>     > little bit
  >>     > of math to do to revert them back to vector data: (VC-0.5)*2. =
This
  >>     > formula stretches the RGB vertex color values, which have a =
0-1
  >>     > range,
  >>     > back to a vector's -1 to +1 range.
  >>     >
  >>     > The reason you need a tangent space when dealing with normal =
maps is
  >>     > that a "normal map in tangent space" (there is also an object
  >>     > space flavour)
  >>     > stores relative information as to where a given normal should =
be
  >>     > bent,
  >>     > which after all is what bump mapping is all about (bump =
mapping and
  >>     > normal mappinng are practically the same thing). The =
lila-blueish
  >>     > color
  >>     > in a tangent space normal map means that the geometry's input =
normal
  >>     > should not be altered, where cyan, magenta, etc colours =
indicated a
  >>     > shift in normal orientation.
  >>     > This shift, which is a relative bit of information as it does =
not
  >>     > point
  >>     > to global world coordinates, needs a reference on the object
  >>     > itself from
  >>     > which the relative shift should be calculated - the tangent =
space.
  >>     > The
  >>     > tangent space offers a predefined vector for each sample =
point
  >>     and is
  >>     > directly generated from the texture projection the normal map =
is
  >>     > mapped
  >>     > with onto the object.
  >>     >
  >>     > I've written a small utility that creates little pointers =
from the
  >>     > tangent space right on the object's surface to better show =
the
  >>     > vectors
  >>     > encoded there. I've attached two screenshots which might =
clearify
  >>     > that a
  >>     > bit. The first one shows a straight spherical mapping, the =
second
  >>     > one is
  >>     > twisted. As soon as a texture space shows distortions (or =
even
  >>     worse:
  >>     > seams), just like the second one, tangent spaces become =
tricky; the
  >>     > samples for a single vertex point in different directions, =
which
  >>     > finally
  >>     > would create artifacts during normal mapping. To cope with =
this
  >>     issue
  >>     > the tangent operator in XSI has a smoothing value, which =
basically
  >>     > middles the different sample's tangent vectors using an =
angle-based
  >>     > approach.
  >>     >
  >>     > Since the normal map stores its data relative to the tangent =
space,
  >>     > generation, as done with the ultimapper for example, =
therefore
  >>     always
  >>     > needs to reference it during generation to provide correct =
results.
  >>     > Ultimapper basically marries referenced object curvature from =
a high
  >>     > resolution source object with the normals of the low =
resolution
  >>     > source
  >>     > object and the tangent space of the low resolution object.
  >>     >
  >>     > The Photoshop plugins and tools provided by graphics hardware
  >>     vendors
  >>     > don't have this kind of 3d information available when =
generating
  >>     > normal
  >>     > maps from heightmaps. They assume that the object the =
generated
  >>     > normal
  >>     > map might get mapped onto shows an ideal tangent space, which
  >>     > usually is
  >>     > nonsense. The more distorted the texture space on the mapped
  >>     > object is,
  >>     > the wronger (is that english?!) the bump mapping results with =
such a
  >>     > textures are. I'd stay away from these tools for production =
work.
  >>     >
  >>     > Hope that makes some sense, cheers!
  >>     >
  >>     > -Andr=E9
  >>     >
  >>     =
/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D
  >>     "Show Tangents" / Andr=E9 Adam
  >>     Tool to create null object pointers on an polymesh object's =
surface
  >>     to visualise direction in a tangent space.
  >>     =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D*/
  >>
  >>
  >>     function fGetPointer(oObj, oSize){
  >>     var oNull, oDisplay
  >>     oNull =3D oObj.AddNull();
  >>     oNull.Parameters("Primary_Icon").Value =3D 9;
  >>     oNull.Parameters("Size").Value =3D oSize;
  >>     oDisplay =3D oNull.AddProperty("Display Property");
  >>     oDisplay.Parameters("wirecol").Value =3D =
Math.round(Math.random()*1023);
  >>     return oNull;
  >>     }
  >>
  >>     function fGetTangents(oPolyMsh){
  >>     var eVCs =3D new Enumerator(oPolyMsh.VertexColors);
  >>     while(!eVCs.atEnd()){
  >>     if(eVCs.item().Name =3D=3D "Tangents"){
  >>     return new VBArray(eVCs.item().Elements.Array).toArray();;
  >>     }
  >>     eVCs.moveNext();
  >>     }
  >>     return false;
  >>     }
  >>
  >>     function fGetSamplePositions(oPolyMsh){
  >>     var aSamplePositions =3D new Array();
  >>     var ePoints =3D new Enumerator(oPolyMsh.Vertices);
  >>     for(var i=3D0; i
  >>     ePoints.moveFirst();
  >>     while(!ePoints.atEnd()){
  >>     var eSamples =3D new Enumerator(ePoints.item().Samples);
  >>     while(!eSamples.atEnd()){
  >>     if(eSamples.item().Index =3D=3D i){
  >>     aSamplePositions.push(ePoints.item().Position);
  >>     }
  >>     eSamples.moveNext();
  >>     }
  >>     ePoints.moveNext();
  >>     }
  >>     }
  >>     return aSamplePositions;
  >>     }
  >>
  >>     function fShowTangents(oObj, oSize){
  >>     var oPolyMsh =3D oObj.ActivePrimitive.Geometry;
  >>     var aTangents =3D fGetTangents(oPolyMsh);
  >>     if(aTangents){
  >>     var aSamplePositions =3D fGetSamplePositions(oPolyMsh);
  >>     for(var i=3D0; i var vY =3D
  >>     XSIMath.CreateVector3((aTangents[i]-0.5)*2,
  >>     (aTangents[i+1]-0.5)*2, (aTangents[i+2]-0.5)*2);
  >>     var vX =3D XSIMath.CreateVector3(0, 1, 0);
  >>     var vZ =3D XSIMath.CreateVector3();
  >>     vZ.Cross(vY, vX);
  >>     vX.Cross(vY, vZ);
  >>     vX.Normalize(vX);
  >>     vY.Normalize(vY);
  >>     vZ.Normalize(vZ);
  >>     var oM3 =3D XSIMath.CreateMatrix3(vX.X, vX.Y, vX.Z, vY.X, vY.Y,
  >>     vY.Z, vZ.X, vZ.Y, vZ.Z);
  >>     var oTrans =3D XSIMath.CreateTransform();
  >>     oTrans.SetRotationFromMatrix3(oM3);
  >>     oTrans.SetTranslation(aSamplePositions[i/4]);
  >>     oTrans.SetScalingFromValues(0.25, 1, 0.25);
  >>     var oPointer =3D fGetPointer(oObj, oSize);
  >>     oPointer.Kinematics.Local.Transform =3D oTrans;
  >>     }
  >>     }
  >>     else{
  >>     LogMessage("aa_ShowTangents: No tangents found on object!", =
siError);
  >>     }
  >>     }
  >>
  >>     =
/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D
  >>     MAIN
  >>     =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D*/
  >>
  >>     if((Selection.Filter.Name =3D=3D "object") && (Selection.Count =
=3D=3D 1)
  >>     && (Selection(0).Type =3D=3D "polymsh")){
  >>     fShowTangents(Selection(0), 1);
  >>     }
  >>     else{
  >>     LogMessage("aa_ShowTangents: Not a single polymesh object
  >>     selection!", siError);
  >>     }
  >>
  >> =
------------------------------------------------------------------------
  >> *Join Excite! - http://www.excite.com*
  >> The most personalized portal on the Web!
  >
  > ---
  > Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in =
body:
  > unsubscribe xsi=20


  ---
  Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in =
body:
  unsubscribe xsi
------=_NextPart_000_009C_01C7415E.D8F16B20
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.5730.11" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>&gt; That only 8bit data thing for the tangents =
is odd,=20
since they use float arrays... <BR>&gt; on the other hand, that whole =
normal=20
mapping technique is unprecise as hell <BR>&gt; anyways, so I guess =
nobody will=20
ever notice... ;)
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>From taking a look at the SDK docu, it =
seems that=20
Vertex Color properties (like the tangent op generates) are stored as =
short int=20
internally. Still, that should give 65k colors per channel, not=20
256...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV>&gt; How about parallax mapping, can you shed some<BR>&gt; light on =
that=20
technique?</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Andr=E9 already explained it =
nicely.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I wanted to see if I could quickly mop =
up a=20
rendertree that does parallax mapping, and it worked :) Looks quite =
nice,=20
even.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Here's a quick render:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><A=20
href=3D"http://animus.brinkster.net/temp/Parallax.mov";>http://animus.brin=
kster.net/temp/Parallax.mov</A></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I also put the scene up:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><A=20
href=3D"http://animus.brinkster.net/temp/Parallax.zip";>http://animus.brin=
kster.net/temp/Parallax.zip</A></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>You can play with the PARALLAX_SCALE =
and=20
PARALLAX_OFFSET nodes to influence the strength of the =
effect.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Ciao, Daniel!</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>PS: Looking at the render tree can also =
cause=20
nausea, headaches and/or breathing difficulties :P</FONT></DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV=20
  style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: =
black"><B>From:</B>=20
  <A title=3DBauerOink(at)gmx.de href=3D"mailto:BauerOink(at)gmx.de">Tim =
Leydecker</A>=20
  </DIV>
  <DIV style=3D"FONT: 10pt arial"><B>To:</B> <A =
title=3DXSI(at)Softimage.COM=20
  href=3D"mailto:XSI(at)Softimage.COM">XSI(at)Softimage.COM</A> </DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Friday, January 26, 2007 =
10:44=20
  AM</DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Subject:</B> Re: tangent maps</DIV>
  <DIV><FONT face=3DArial size=3D2></FONT><BR></DIV><BR><BR>It seems =
there=B4s all=20
  sorts of workflows superior to the<BR>more traditional bumpmap =
implementation,=20
  starting with<BR>Ben=B4s ZBump, various ways of Normalmapping and =
last<BR>but=20
  not least just tesseleating the mesh to infinity and using<BR>a =
displacement=20
  instead - or even a vector displacement.<BR><BR>Problem is, as =
allways, the=20
  limited information available<BR>like, "now is that stored in float or =

  clamped8bit..."<BR>Pretty hard to get to a point of confidential usage =

  then,<BR>or as you=B4ve put it - use it in production=20
  asap.<BR><BR>Cheers<BR><BR>tim<BR><BR><BR>----- Original Message ----- =

  <BR>From: "Andr=E9 Adam" &lt;<A=20
  href=3D"mailto:a_adam(at)49games.de">a_adam(at)49games.de</A>&gt;<BR>To: =
&lt;<A=20
  href=3D"mailto:XSI(at)Softimage.COM">XSI(at)Softimage.COM</A>&gt;<BR>Sent: =
Friday,=20
  January 26, 2007 9:58 AM<BR>Subject: Re: tangent maps<BR><BR><BR>&gt; =
I've a=20
  whole bunch of programmers around here that got headaches because of =
those=20
  <BR>&gt; alpha values; actually we did not find out up to now and my =
personal=20
  opinion still <BR>&gt; is it simply is trash (though I'm the only one =
over=20
  here with that opinion...). <BR>&gt; Anyone from Soft like to give us =
a=20
  hint?<BR><BR>&gt;<BR>&gt;<BR>&gt; Ben Rogall=20
  wrote:<BR>&gt;&gt;<BR>&gt;&gt;<BR>&gt;&gt; Thanks for forwarding that =
Andre.=20
  The hardest part about the vector displacement <BR>&gt;&gt; was =
setting up the=20
  tangent space conversion. Well, that and trying different ways =
<BR>&gt;&gt; of=20
  exporting objects and mapping the position data. Mental Ray already =
knows how=20
  <BR>&gt;&gt; to do multi-directional displacement.<BR>&gt;&gt; =
Regarding the=20
  bit-depth of the tangent property, if I read out any of the values,=20
  <BR>&gt;&gt; say by checking the SDK explorer and multiply by 255, I =
get a=20
  whole number. Btw, I <BR>&gt;&gt; have no idea what is being stored in =
the=20
  alpha channel.<BR>&gt;&gt;<BR>&gt;&gt;<BR>&gt;&gt;<BR>&gt;&gt; --- On =
Thu=20
  01/25, =3D?ISO-8859-1?Q?Andr=3DE9_Adam?=3D &lt; <A=20
  href=3D"mailto:a_adam(at)49games.de">a_adam(at)49games.de</A> &gt;=20
  wrote:<BR>&gt;&gt;<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; *From:=20
  *=3D?ISO-8859-1?Q?Andr=3DE9_Adam?=3D [mailto: <A=20
  =
href=3D"mailto:a_adam(at)49games.de">a_adam(at)49games.de</A>]<BR>&gt;&gt;&nbsp=
;&nbsp;&nbsp;&nbsp;=20
  *To: <A=20
  =
href=3D"mailto:*XSI(at)Softimage.COM">*XSI(at)Softimage.COM</A><BR>&gt;&gt;&nbs=
p;&nbsp;&nbsp;&nbsp;=20
  *Date: *Thu, 25 Jan 2007 17:32:02 =
+0100<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  *Subject: *Re: tangent =
maps<BR>&gt;&gt;<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; Hi=20
  Ben,<BR>&gt;&gt;<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; thanks for the =
kind=20
  words! Very nice work on the displacement=20
  mapping!<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; A vertex colour property =
stores=20
  float values, not 8bit data, so<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  you're<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; practically lossless when=20
  converting back to vectors. The =
smoothing<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  works similar, since it is angle based, but is not connected=20
  in<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; any=20
  way<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; to the geo approximation or =
the=20
  normals. In theory, the normal map<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; =
should=20
  be able to compensate cracks in the tangent space,=20
  but<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; practically the normal map's =
texels=20
  would have to line up<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; perfectly=20
  with<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; the polygon edges which is a =
very=20
  unlikely occasion. So, as soon<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; as=20
  you<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; try to fit a normal map =
texture with=20
  its pixel raster onto uneven 3d<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; =
geometry,=20
  the tangent space needs to be smoothed to avoid=20
  cracks<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; and=20
  seams.<BR>&gt;&gt;<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; I've attached =
the=20
  script to this mails, but really, this is=20
  nothing<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; fancy, just a one-time =
creation of=20
  null objects pointing in the<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  vector's<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; direction. A compiled =
operator=20
  with live-input certainly would be =
way<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  nicer. Oh, and it is slow, be careful with meshes heavier than=20
  -<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; say -=20
  a<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; thousand polygons, trying it out =
on=20
  small objects will be more<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; fun...=20
  :)<BR>&gt;&gt;<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  Cheers!<BR>&gt;&gt;<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  -Andr=E9<BR>&gt;&gt;<BR>&gt;&gt;<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; =
Ben Rogall=20
  wrote:<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  &gt;<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; Andre, very very nice=20
  explanation. I've been using XSI =
tangents<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  &gt; recently in experiments with tangent space vector=20
  displacement:<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt;<BR>&gt;&gt;=20
  <BR>&gt;&gt; <A=20
  =
href=3D"http://www.xsibase.com/forum/index.php?board=3D29;action=3Ddispla=
y;threadid=3D28834;start=3D0">http://www.xsibase.com/forum/index.php?boar=
d=3D29;action=3Ddisplay;threadid=3D28834;start=3D0</A><BR>&gt;&gt;&nbsp;&=
nbsp;&nbsp;&nbsp;=20
  &gt; It took me a little while to realize I had to do the [0,1]=20
  to<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  [-1,1]<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; interval correction. =
I'm also=20
  curious to see whether having only =
8<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt;=20
  bits per channel for the tangent vector is enough to avoid=20
  jumping<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; though I haven't seen =

  anything obvious yet.<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  &gt;<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; Another issue with =
tangent space=20
  is difficulty when you try to get<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; =
&gt;=20
  different 3D applications to work with eachother. Once you have=20
  the<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; normal and tangent =
vectors, there=20
  are still several ways to<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  determine<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; your T,B,N space =
depending=20
  on which of these vectors you decide =
to<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  &gt; orthoganalize to the others. This choice has to match between=20
  the<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt;=20
  applications.<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  &gt;<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; I hadn't even thought =
about the=20
  smoothing issue you mentioned.<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; Is=20
  that<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; analogous to the normal=20
  automatic discontinuity control?<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  &gt;<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; Also is your tangent =
display=20
  utility publicly available?<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  &gt;<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt;=20
  Thanks,<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt;=20
  Ben<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  &gt;<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  &gt;<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; --- On Thu 01/25,=20
  =3D?ISO-8859-1?Q?Andr=3DE9_Adam?=3D =
&lt;<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; <A=20
  href=3D"mailto:a_adam(at)49games.de">a_adam(at)49games.de</A>=20
  &gt;<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt;=20
  wrote:<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  &gt;<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; *From:=20
  **=3D?ISO-8859-1?Q?Andr=3DE9_Adam?=3D [mailto: <A=20
  =
href=3D"mailto:a_adam(at)49games.de">a_adam(at)49games.de</A>]<BR>&gt;&gt;&nbsp=
;&nbsp;&nbsp;&nbsp;=20
  &gt; *To: <A=20
  =
href=3D"mailto:*XSI(at)Softimage.COM">*XSI(at)Softimage.COM</A><BR>&gt;&gt;&nbs=
p;&nbsp;&nbsp;&nbsp;=20
  &gt; *Date: *Thu, 25 Jan 2007 11:20:09=20
  +0100<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; *Subject: *Re: tangent=20
  maps<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  &gt;<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; Hi=20
  Bernard,<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  &gt;<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; the tangent property in =
XSI is=20
  the so called tangent map, or =
tangent<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt;=20
  space. Encoded in there you can find a given texture=20
  space's<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt;=20
  u-direction<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; (the reason why =
you have=20
  to reference a texture projection =
when<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  &gt; creating<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; a tangent =
property) in=20
  3d space (you could call this the =
"texture<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  &gt; mapped" u-direction) on a per sample basis, so we're talking=20
  of<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt;=20
  vectors<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; here. In absence of a =
more=20
  convenient property Softimage decided =
to<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  &gt; encode the tangents into vertex colors. That means you have=20
  a<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; little=20
  bit<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; of math to do to revert =
them back=20
  to vector data: (VC-0.5)*2. This<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; =
&gt;=20
  formula stretches the RGB vertex color values, which have a=20
  0-1<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt;=20
  range,<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; back to a vector's -1 =
to +1=20
  range.<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  &gt;<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; The reason you need a =
tangent=20
  space when dealing with normal maps =
is<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  &gt; that a "normal map in tangent space" (there is also an=20
  object<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; space=20
  flavour)<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; stores relative =
information=20
  as to where a given normal should =
be<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt;=20
  bent,<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; which after all is what =
bump=20
  mapping is all about (bump mapping =
and<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  &gt; normal mappinng are practically the same thing). The=20
  lila-blueish<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt;=20
  color<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; in a tangent space =
normal map=20
  means that the geometry's input =
normal<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  &gt; should not be altered, where cyan, magenta, etc colours indicated =

  a<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; shift in normal=20
  orientation.<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; This shift, =
which is a=20
  relative bit of information as it does =
not<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  &gt; point<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; to global world=20
  coordinates, needs a reference on the=20
  object<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; itself=20
  from<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; which the relative shift =
should=20
  be calculated - the tangent space.<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; =
&gt;=20
  The<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; tangent space offers a =
predefined=20
  vector for each sample point<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; and=20
  is<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; directly generated from =
the=20
  texture projection the normal map =
is<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt;=20
  mapped<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; with onto the=20
  object.<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  &gt;<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; I've written a small =
utility=20
  that creates little pointers from =
the<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt;=20
  tangent space right on the object's surface to better show=20
  the<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt;=20
  vectors<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; encoded there. I've =
attached=20
  two screenshots which might =
clearify<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt;=20
  that a<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; bit. The first one =
shows a=20
  straight spherical mapping, the =
second<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  &gt; one is<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; twisted. As soon =
as a=20
  texture space shows distortions (or =
even<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  worse:<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; seams), just like the =
second=20
  one, tangent spaces become tricky; =
the<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  &gt; samples for a single vertex point in different directions,=20
  which<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt;=20
  finally<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; would create =
artifacts during=20
  normal mapping. To cope with this<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  issue<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; the tangent operator in =
XSI has=20
  a smoothing value, which basically<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; =
&gt;=20
  middles the different sample's tangent vectors using an=20
  angle-based<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt;=20
  approach.<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  &gt;<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; Since the normal map =
stores its=20
  data relative to the tangent =
space,<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt;=20
  generation, as done with the ultimapper for example,=20
  therefore<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  always<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; needs to reference it =
during=20
  generation to provide correct =
results.<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  &gt; Ultimapper basically marries referenced object curvature from a=20
  high<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; resolution source object =
with=20
  the normals of the low resolution<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; =
&gt;=20
  source<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; object and the tangent =
space=20
  of the low resolution object.<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  &gt;<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; The Photoshop plugins =
and tools=20
  provided by graphics hardware<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  vendors<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; don't have this kind =
of 3d=20
  information available when =
generating<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt;=20
  normal<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; maps from heightmaps. =
They=20
  assume that the object the =
generated<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt;=20
  normal<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; map might get mapped =
onto=20
  shows an ideal tangent space, =
which<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt;=20
  usually is<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; nonsense. The more =

  distorted the texture space on the =
mapped<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  &gt; object is,<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; the wronger =
(is that=20
  english?!) the bump mapping results with such=20
  a<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; textures are. I'd stay away =
from=20
  these tools for production work.<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  &gt;<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt; Hope that makes some =
sense,=20
  cheers!<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  &gt;<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &gt;=20
  -Andr=E9<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  &gt;<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  =
/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  "Show Tangents" / Andr=E9 Adam<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; =
Tool to=20
  create null object pointers on an polymesh object's=20
  surface<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; to visualise direction in =
a=20
  tangent space.<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D*/<BR>&gt;&gt;<BR>&gt;&gt;<BR>&gt;&gt;&nbsp;&nbsp;&nbsp=
;&nbsp;=20
  function fGetPointer(oObj, oSize){<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; =
var=20
  oNull, oDisplay<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; oNull =3D=20
  oObj.AddNull();<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  oNull.Parameters("Primary_Icon").Value =3D=20
  9;<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; oNull.Parameters("Size").Value =
=3D=20
  oSize;<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; oDisplay =3D=20
  oNull.AddProperty("Display =
Property");<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  oDisplay.Parameters("wirecol").Value =3D=20
  Math.round(Math.random()*1023);<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; =
return=20
  oNull;<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  }<BR>&gt;&gt;<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; function=20
  fGetTangents(oPolyMsh){<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; var eVCs =
=3D new=20
  Enumerator(oPolyMsh.VertexColors);<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; =

  while(!eVCs.atEnd()){<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; =
if(eVCs.item().Name=20
  =3D=3D "Tangents"){<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; return new=20
  =
VBArray(eVCs.item().Elements.Array).toArray();;<BR>&gt;&gt;&nbsp;&nbsp;&n=
bsp;&nbsp;=20
  }<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  eVCs.moveNext();<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  }<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; return=20
  false;<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  }<BR>&gt;&gt;<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; function=20
  fGetSamplePositions(oPolyMsh){<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; var =

  aSamplePositions =3D new Array();<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; =
var=20
  ePoints =3D new=20
  Enumerator(oPolyMsh.Vertices);<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; =
for(var=20
  i=3D0; i<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  ePoints.moveFirst();<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  while(!ePoints.atEnd()){<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; var =
eSamples =3D=20
  new =
Enumerator(ePoints.item().Samples);<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  while(!eSamples.atEnd()){<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  if(eSamples.item().Index =3D=3D =
i){<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  =
aSamplePositions.push(ePoints.item().Position);<BR>&gt;&gt;&nbsp;&nbsp;&n=
bsp;&nbsp;=20
  }<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  eSamples.moveNext();<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  }<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  ePoints.moveNext();<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  }<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; =
}<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  return aSamplePositions;<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  }<BR>&gt;&gt;<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; function =
fShowTangents(oObj,=20
  oSize){<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; var oPolyMsh =3D=20
  oObj.ActivePrimitive.Geometry;<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; var =

  aTangents =3D =
fGetTangents(oPolyMsh);<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  if(aTangents){<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; var =
aSamplePositions =3D=20
  fGetSamplePositions(oPolyMsh);<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; =
for(var=20
  i=3D0; i var vY =3D<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  =
XSIMath.CreateVector3((aTangents[i]-0.5)*2,<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;=
&nbsp;=20
  (aTangents[i+1]-0.5)*2,=20
  (aTangents[i+2]-0.5)*2);<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; var vX =
=3D=20
  XSIMath.CreateVector3(0, 1, 0);<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; =
var vZ =3D=20
  XSIMath.CreateVector3();<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; =
vZ.Cross(vY,=20
  vX);<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; vX.Cross(vY,=20
  vZ);<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  vX.Normalize(vX);<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  vY.Normalize(vY);<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  vZ.Normalize(vZ);<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; var oM3 =3D=20
  XSIMath.CreateMatrix3(vX.X, vX.Y, vX.Z, vY.X,=20
  vY.Y,<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; vY.Z, vZ.X, vZ.Y,=20
  vZ.Z);<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; var oTrans =3D=20
  XSIMath.CreateTransform();<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  =
oTrans.SetRotationFromMatrix3(oM3);<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  =
oTrans.SetTranslation(aSamplePositions[i/4]);<BR>&gt;&gt;&nbsp;&nbsp;&nbs=
p;&nbsp;=20
  oTrans.SetScalingFromValues(0.25, 1,=20
  0.25);<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; var oPointer =3D =
fGetPointer(oObj,=20
  oSize);<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  oPointer.Kinematics.Local.Transform =3D=20
  oTrans;<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  }<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; =
}<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  else{<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; LogMessage("aa_ShowTangents: =
No=20
  tangents found on object!", =
siError);<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  }<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  }<BR>&gt;&gt;<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  =
/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  MAIN<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D*/<BR>&gt;&gt;<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  if((Selection.Filter.Name =3D=3D "object") &amp;&amp; (Selection.Count =
=3D=3D=20
  1)<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; &amp;&amp; (Selection(0).Type =
=3D=3D=20
  "polymsh")){<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; =
fShowTangents(Selection(0),=20
  1);<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; =
}<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
  else{<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; LogMessage("aa_ShowTangents: =
Not a=20
  single polymesh object<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; =
selection!",=20
  siError);<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; =
}<BR>&gt;&gt;<BR>&gt;&gt;=20
  =
------------------------------------------------------------------------<=
BR>&gt;&gt;=20
  *Join Excite! - <A=20
  href=3D"http://www.excite.com";>http://www.excite.com</A>*<BR>&gt;&gt; =
The most=20
  personalized portal on the Web!<BR>&gt;<BR>&gt; ---<BR>&gt; =
Unsubscribe? Mail=20
  <A href=3D"mailto:Majordomo(at)Softimage.COM">Majordomo(at)Softimage.COM</A> =
with the=20
  following text in body:<BR>&gt; unsubscribe xsi=20
  <BR><BR><BR>---<BR>Unsubscribe? Mail <A=20
  href=3D"mailto:Majordomo(at)Softimage.COM">Majordomo(at)Softimage.COM</A> =
with the=20
  following text in body:<BR>unsubscribe xsi</BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_009C_01C7415E.D8F16B20--

---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi


Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available.
This site supposedly brought to you by Benjamin Grosser and the Imaging Technology Group.