|
Hi!
I’m trying to extract tangent information from a polymsh, but I seem to get the wrong values.
How I do it:
XSI::PolygonMesh mesh(X3DObject.GetActivePrimitive().GetGeometry())
XSI::CGeometryAccessor in_ga=mesh.GetGeometryAccessor()
XSI::ClusterProperty tangents = in_ga.GetClusterProperty(XSI::siClusterPropertyVertexColorType, L"Tangents")
XSI::CFloatArray tangentValues; tangents.GetValues(tangentValues)
int elementSize = tangents.GetValueSize()
int elementCount = tangentValues.GetCount() / elementSize; for(int i=0; i<elementCount; i++)
{
for(int j=0; j<elementSize; j++)
{
float value = tangentValues[i * elementSize + j];
uprintf("Tangent %d - Element %d = %f", i, j, value)
}
}
In XSI I create a grid polygon mesh. Apply texture projection Planar XZ. Add property Tangents (ok to default values).
Now the values I get with the above piece of code is:
Tangent 0 - Element 0 = 0.752941
Tangent 0 - Element 1 = 0.752941
Tangent 0 - Element 2 = 0.752941
Tangent 0 - Element 3 = 1.000000
Tangent 1 - Element 0 = 0.752941
Tangent 1 - Element 1 = 0.752941
Tangent 1 - Element 2 = 0.752941
Tangent 1 - Element 3 = 1.000000
Tangent 2 - Element 0 = 0.752941
Tangent 2 - Element 1 = 0.752941
Tangent 2 - Element 2 = 0.752941
Tangent 2 - Element 3 = 1.000000
Tangent 3 - Element 0 = 0.752941
Tangent 3 - Element 1 = 0.752941
Tangent 3 - Element 2 = 0.752941
Tangent 3 - Element 3 = 1.000000
..
I would expect the tangent to be 1,0,0,1 (Ie aligned with u tex coordinate)
If I select the material and choose OpenGL display - texture selection mode = No OGL texture I can see that the tangents are indeed 1,0,0,x (my mesh goes completely red), so I
assume I somehow get the wrong values (looks like some default grey value - maybe default vertex color?)
Am I doing something wrong, or is this a bug?
BTW: I’m running XSI 2010 SP1 win32
Thanks,
Henning
|