[Bf-committers] Blender tangent space calculation

Eugene Minov minov.eug at gmail.com
Tue Nov 15 17:12:02 CET 2011


>
> >If it's not already available in the python API
>

Hmm, I think not, as far as I can see in 'blender_python_reference_2_57'
and by searching in 'blender-2.60a' sources. I've found only two files in
sources with references to 'SMikkTSpaceContext' struct and
to 'genTangSpaceDefault' function:
- 'source/blender/blenkernel/intern/DerivedMesh.c'  to get tangents for
using in GLSL, I think;
- 'source/blender/render/intern/source/convertblender.c'  to get tangents
for render's needs.
But I not completely sure, I will look deeper.

>
> >However, you'd need to supply support for normals as well since
> >at this point the python API only gives access to the unconditionally
> >averaged/smooth normals
> >at the vertices. Ie. the api doesn't take faces set to soft/hard into
> >account when submitting normals
> >back to the script.
>

Yes, I was wondering about that when started to write my own exporter
since blender 2.49 :)
But after I've found an 'EdgeSplit' modifier, I used to to export my meshes
applied by it and to welding vertices and normals after.

Maybe we'd can go a similar way and to provide tangents using averaged
normals only?, since soft/hard edge's flags is 'de-facto' uses in that
modifier only (as far as I know, even blender's render is not uses those
flags).

As about realization, I think it may be some analogue to
the 'bpy.types.MeshTextureFace' class array, like 'MeshTangentFace' with
four tangent vectors and fSign values for each vertex per face in it. Or
with
indexes to already welded ones.
And generate data by request, in the 'Mesh.tangent_normals' accessor.

Thanks.

Eugene

On Tue, Nov 15, 2011 at 4:02 AM, Morten Mikkelsen <mikkelsen7 at gmail.com>wrote:

> >
> > >So why not to simply adding possibility for generate/access a tangent
> > >normals into the python api?
> >
>
>
> If it's not already available in the python API then I agree that it's a
> good idea.
> However, you'd need to supply support for normals as well since
> at this point the python API only gives access to the unconditionally
> averaged/smooth normals
> at the vertices. Ie. the api doesn't take faces set to soft/hard into
> account when submitting normals
> back to the script.
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers
>


More information about the Bf-committers mailing list