|Sometimes its easy to put an equation together - or use an
API to create them. But its sometimes worth trying to code it and
actually visualise it.
So I put together a set of functions which generates the Normal, Tangent
and Binormal and renderes them to a mesh surface.
In actual fact, the hardest part of the demo was writing the sphere mesh
algorithm - which fill a ID3DXMesh* variable with the mesh texture coods,
vertice positions and incdices. If you have time you might want to
look at the code in xsphere.cpp and see how it works. I'm sure you can
take it to a new level and possibly optimise it or shrink it down. I'd
be glad of an email if you find a smaller better way of improving it.
A good reference for further reading on Tangents and Binormals and all
the maths and equations, is Mathematics for 3D Game Programming by Eric
The demo program was programmed with Visual Studio and DirectX9.0.