Get/Calculate Vertex Tangents using Python Exporter

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

Post Reply
azy.4849
Posts: 0
Joined: Fri Jul 26, 2013 8:00 am

Get/Calculate Vertex Tangents using Python Exporter

Post by azy.4849 »

Hi,

This is my first post since the documentation has actually been wonderful up until now. I have written a custom Blender (2.67) Python (3.x) exporter to export models for some games I'm making. They include things like vertex coordinates (of course), normals, (vertex) colors, UV coords, indices, etc.

I am now at the point of trying to use baked tangent space normal maps for use in game. I'm not totally clear on how to either get or calculate the tangents (and bitangent) values of each vertex using the data in the the Mesh object (which for all intents and purposes I extract data from in my Python script).

Having looked far and wide over the internet and Blender documentation I'm starting to worry that there is no easy way to do this.

I even found a Blender 2.4x Python API call called Mesh.getTangents() and a request for it to be put back into the 2.5x API as shown here:

http://web.archiveorange.com/archive/v/ ... XZrHV5BYUz

It strikes me as very VERY odd that the ability to create tangent space normal maps was left in but the ability to extract the data required to be able to use them was removed.

Any help would be appreciated.

PS. Other places I've looked include for information both Blender related and nonrelated:

http://www.blender.org/documentation/bl ... ea=default

http://blenderartists.org/forum/archive ... 15957.html

http://www.terathon.com/code/tangent.html

http://wiki.blender.org/index.php/Dev:S ... ormal_Maps

azy.4849
Posts: 0
Joined: Fri Jul 26, 2013 8:00 am

Post by azy.4849 »

Edit: Hmm, this forum doesn't seem to provide an edit button. In my frustration I had missed this earlier post:

http://www.blender.org/forum/viewtopic. ... ht=tangent

From that post, I still cannot determine how to proceed but I'll continue to research. Of course, any additional information is still welcome.

Post Reply