Greetings!
I’m putting the finishing touches on an exporter I’ve written that will allow Blender’s .blend files to be converted to Natural Selection 2’s (http://www.naturalselection2.com/) model format (including animations! :D). I also recently discovered the “normal edit” modifier, and a thought occurred to me: what if I could, via a python script, manually edit the normals, tangents, and bitangents of a mesh INSIDE of blender, and then, would that mean I could also bake normal maps with blender, to an extreme degree of accuracy?
See… I’m attempting to solve the same problem that handplane was designed to solve (http://www.handplane3d.com/) – that is, that the normals/tangents/bitangents generated by the 3d application to bake the normal map texture don’t exactly match the techniques used by the game engine to calculate the normals/tangents/bitangents, leading to odd artifacts near poles and seams – areas where the small discrepancies are magnified. In this case, I’m only interested in getting the normals/tangents/bitangents in blender to match what is output by the export script for the NS2 model format.
Anyways, here’s my questions:
- How do I go about modifying the actual tangent/bitangent/normal values of each vertex via python? I’ve tried simply writing, for example:
bpy.data.objects['Suzanne'].data.loops[0].bitangent = Vector((1.0,0.0,0.0))
However, blender tells me this data is read-only, implying there is a “proper” way to handle this. To be clear, I’ve already got the exporter working, however what I’m trying to do here is generate the proper normals/tangents/bitangents inside of blender, so that the normal map baking process can be using the proper tangents, rather than those generated by blender. I know the methodology for matching them up, I just don’t know how to go about actually modifying this particular mesh data within blender – assuming this is possible.
- Does blender’s texture baking even take into account the custom split normals, or does it re-do the calculations – and therefore defeat the purpose of customizing the normals in the first place?
Cheers!
Trevor