In the last days I've been doing a blender->ogre material converter and after learning how each engine calculates the normals from tangent normal maps, I've found that Ogre::Mesh::buildTangentVectors builds the necessary vectors compatible with blender ones. It has a couple of options for splitting mirrored UVs and saving the polarity in the 4th component, just like blender's generated GLSL code expects.
2011/11/14 Eugene Minov <[email protected]>: > Hi! > One more question, if I may. > I've seen that there is a couple of the exporter programs which can > generate tangents to export for specific 3D engines only, like OgreExporter. > > So why not to simply adding possibility for generate/access a tangent > normals into the python api? > I am not saying that it very hard to generate those tangents using Morten's > implementation directly in program, but think it'll be more a.. consistence > and ease way for people who building their games to properly export their > meshes :) > > Maybe if nobody wants, then I'd like to try implement this by some time. > What you guys think about this? > > Eugene > > On Mon, Nov 14, 2011 at 2:41 AM, Eugene Minov <[email protected]> wrote: > >> Oh, my bad :) I've seen that page but I'd thought this page is explains >> different baking modes in blender's render. >> >> Morten Mikkelsen - thank you for your great implementation! I'will learn >> it! >> M.G. Kishalmi - thanks for explanation ) >> >> >> On Mon, Nov 14, 2011 at 1:55 AM, M.G. Kishalmi <[email protected]> wrote: >> >>> Eugene, >>> >>> the link Morten pointed you >>> to< >>> http://wiki.blender.org/index.php/Dev:Shading/Tangent_Space_Normal_Maps >>> >explains >>> that >>> the tangent space you created your normal maps in (in blender) >>> is generated by the implementation in >>> mikktspace.h< >>> https://svn.blender.org/svnroot/bf-blender/trunk/blender/intern/mikktspace/mikktspace.h >>> >and >>> mikktspace.c< >>> https://svn.blender.org/svnroot/bf-blender/trunk/blender/intern/mikktspace/mikktspace.c >>> > >>> . >>> >>> you might want to use those in your app (check the licence inside). >>> >>> cheers, >>> lmg >>> >>> >>> On Sun, Nov 13, 2011 at 10:51 PM, Eugene Minov <[email protected]> >>> wrote: >>> >>> > 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 < >>> [email protected] >>> > >wrote: >>> > >>> > > There you go buddy --> http://lmgtfy.com/?q=blender+tangent+space >>> > > >>> > > >>> > > >>> > > On Sun, Nov 13, 2011 at 8:46 AM, Eugene Minov <[email protected]> >>> > 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 >>> > > > [email protected] >>> > > > http://lists.blender.org/mailman/listinfo/bf-committers >>> > > > >>> > > _______________________________________________ >>> > > Bf-committers mailing list >>> > > [email protected] >>> > > http://lists.blender.org/mailman/listinfo/bf-committers >>> > > >>> > _______________________________________________ >>> > Bf-committers mailing list >>> > [email protected] >>> > http://lists.blender.org/mailman/listinfo/bf-committers >>> > >>> _______________________________________________ >>> Bf-committers mailing list >>> [email protected] >>> http://lists.blender.org/mailman/listinfo/bf-committers >>> >> >> > _______________________________________________ > Bf-committers mailing list > [email protected] > http://lists.blender.org/mailman/listinfo/bf-committers > _______________________________________________ Bf-committers mailing list [email protected] http://lists.blender.org/mailman/listinfo/bf-committers
