[Bf-committers] Blender tangent space calculation

Eugene Minov minov.eug at gmail.com
Sun Nov 13 22:51:34 CET 2011


Wow!! Thanks a lot, for pointing me to the google ;)

But I afraid that maybe I've not correctly describe my problem. If so,
sorry for that, because my english is still kinda weak.
My problem not in generating a normal maps (a textures) in blender. Not at
all.

My problem is that I cannot fully correct render my already generated
normal maps in my app. Because, how I mentioned in the last mail, the usual
methods for this purpose (by UV coords) is not gives me desired results.

So I wanted to ask for help with information about methods blender uses for
generating tangents.

And yes, I had searched in google but unfortunately have't found something
helpful yet.
If someone can point me to that kind of info, I will be very grateful!

On Mon, Nov 14, 2011 at 12:08 AM, Morten Mikkelsen <mikkelsen7 at gmail.com>wrote:

> There you go buddy --> http://lmgtfy.com/?q=blender+tangent+space
>
>
>
> On Sun, Nov 13, 2011 at 8:46 AM, Eugene Minov <minov.eug at gmail.com> wrote:
>
> > Hi.
> > I am sorry if I subscribe into a wrong place, I am new and I've not
> > actually planned to change or to debug the blender sources yet.
> > But I trying to write app that'll be render models with normal mapping
> > exported from blender, and I have a question about how exactly is blender
> > calculates a tangent vectors when Unwrap operation in the editing mode
> > performs?
> >
> > Calculating tangents in my app in usual manner (using UV coords and verts
> > positions) gives me different tangents for each face of the same vertex
> > indexed from, and thus crumpled normal map looking.
> > Then by looking into blender sources (searching  by 'tangent' keyword)
> I've
> > found a couple of functions with tangents calculations, like:
> >    float axis[3] = {0.0f, 0.0f, 1.0f};
> >    cross_v3_v3v3(tangent, normal, up);
> >    normalize_v3(tangent);
> >
> > After I tried same method in my program I've gotten almost perfect
> looking
> > model, depending on what initial axis I've used.
> > To choose, which axis to use (0, 0, 1), (0, 1, 0) or (1, 0, 0) for each
> > normal, I calculate max dot product of tangent calculated by each axis
> with
> > tangent calculated from UV coords.
> > But still it seems that in some rare vertices tangent is calculates
> wrong,
> > maybe because of wrong initial axis.
> >
> > So, can anyone please give me any information about tangents calculation
> > formula that blender uses while generates UV coords or some advice about
> > choosing initial axis.
> > Thanks for help.
> >
> > Eugene
> > _______________________________________________
> > Bf-committers mailing list
> > Bf-committers at blender.org
> > http://lists.blender.org/mailman/listinfo/bf-committers
> >
> _______________________________________________
> 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