> > >The proper way to get the tangent layer can be seen in: > > > > https://svn.blender.org/svnroot/bf-blender/trunk/blender/source/blender/editors/object/object_bake.c >
Okay, I've found a 'multiresbake_get_normal' function for correct normals calculation. I also looked into 'DM_add_tangent_layer' function in: https://svn.blender.org/svnroot/bf-blender/trunk/blender/source/blender/blenkernel/intern/DerivedMesh.c According to it, the tangent layer is filling by tangents when created. So I do need only to access and welding them and normals? That's good if so. Today I had time to try understand how RNA's works. And I almost create and test python interface with collections for faces and indexed vertices with normals and tangents in it. Hopefully soon I'll start welding. > > >If you need a free ultra simple welder there's one here --> > >http://jbit.net/~sparky/academic/welder/ > >You specify how many floats you have per vertex and it will weld for you. > Okay, good one, I think I'll use it :) Thanks! On Wed, Nov 16, 2011 at 8:43 PM, Morten Mikkelsen <mikkels...@gmail.com>wrote: > Sorry for confusing you here but I think I found a better reference for you > since > you'll be needing the tangents too and you are not supposed to be building > them yourself. > > The proper way to get the tangent layer can be seen in: > > > https://svn.blender.org/svnroot/bf-blender/trunk/blender/source/blender/editors/object/object_bake.c > > do_multires_bake() > > These are being fetched after the line: > > float *pvtangent= NULL; > > > These are then read in the function flush_pixel() including the normal > which is fetched from there using multiresbake_get_normal() > which as you can see looks a lot like the GetNormal() function > I pointed you to in DerivedMesh.c. > Anyway, definitely use this file as your reference. I should have shown you > this one from the beginning. > > If you need a free ultra simple welder there's one here --> > http://jbit.net/~sparky/academic/welder/ > You specify how many floats you have per vertex and it will weld for you. > > > > On Wed, Nov 16, 2011 at 5:32 AM, Eugene Minov <minov....@gmail.com> wrote: > > > > > > > >If you can get hold of the dm > > > >(DerivedMesh) > > > >on the c side of things then I can show you how to get the correct > > normals > > > >and tangents > > > >and even help you get them welded should you want this. > > > > > > > Ok! Sounds good to me :) > > > > So right now I in progress of checkout latest svn sources and compile > > blender. (had problems with net) > > Then first of I'll try to create test version of python/C interface. I've > > not decided yet what names I'll use for it. > > And finally will be trying to implement it looking in DerivedMesh.c, > > I think that it's realy are a good example. > > > > If or when I have a problem, I'll be glad to use your help :) > > Many thanks for your kind cooperation! > > > > > > > > On Tue, Nov 15, 2011 at 10:41 PM, Morten Mikkelsen <mikkels...@gmail.com > > >wrote: > > > > > I don't know anything about Python but if you can get hold of the dm > > > (DerivedMesh) > > > on the c side of things then I can show you how to get the correct > > normals > > > and tangents > > > and even help you get them welded should you want this. > > > > > > > > > > > > > > > On Tue, Nov 15, 2011 at 10:43 AM, Eugene Minov <minov....@gmail.com> > > > wrote: > > > > > > > Yes, I absolutely agree, hard faces obviously must be exported in the > > > same > > > > way how they seen in render. > > > > I think they can welds along with tangents. > > > > > > > > On Tue, Nov 15, 2011 at 9:01 PM, Morten Mikkelsen < > > mikkels...@gmail.com > > > > >wrote: > > > > > > > > > There is no point in doing this unless you export the correct > > tangents > > > > and > > > > > normals. That is the ones > > > > > that were used to bake the normal map. > > > > > > > > > > I realize it blows that there is no API function to get the render > > > > normal. > > > > > So what you have to do is produce it yourself > > > > > like is done in > > > > > DerivedMesh.c< > > > > > > > > > > > > > > > https://svn.blender.org/svnroot/bf-blender/trunk/blender/source/blender/blenkernel/intern/DerivedMesh.c > > > > > > > > > > > and > > > > > many other places as well. > > > > > An example in this file is the static function GetNormal() which is > > > used > > > > as > > > > > a call-back function by mikktspace.c > > > > > and you can see how it uses the averaged normal if the face is set > to > > > > > smooth and it uses > > > > > the face normal which it calculates itself if the face is set to > > flat. > > > > > > > > > > If you are going to make an api to export tangents I for one cannot > > > > > emphasize enough > > > > > that I prefer an all or nothing solution. Either do it right or > don't > > > do > > > > it > > > > > at all. > > > > > The last thing we need is to introduce a new tangent space standard > > > > within > > > > > blender. > > > > > Either export the correct basis that was used for baking (this > > includes > > > > the > > > > > normal) > > > > > or don't try to do it at all. > > > > > _______________________________________________ > > > > > Bf-committers mailing list > > > > > Bf-committers@blender.org > > > > > http://lists.blender.org/mailman/listinfo/bf-committers > > > > > > > > > _______________________________________________ > > > > Bf-committers mailing list > > > > Bf-committers@blender.org > > > > http://lists.blender.org/mailman/listinfo/bf-committers > > > > > > > _______________________________________________ > > > Bf-committers mailing list > > > Bf-committers@blender.org > > > http://lists.blender.org/mailman/listinfo/bf-committers > > > > > _______________________________________________ > > Bf-committers mailing list > > Bf-committers@blender.org > > http://lists.blender.org/mailman/listinfo/bf-committers > > > _______________________________________________ > Bf-committers mailing list > Bf-committers@blender.org > http://lists.blender.org/mailman/listinfo/bf-committers > _______________________________________________ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers