Re: [Bf-committers] Blender tangent space calculation

2011-11-19 Thread Eugene Minov

 Correct, this is how blender does it everywhere in its code-base.


Ok.
I've asked because after weldind I've gotten this problem with some quads.
But today seems that I solve it by swapping the first vertex in the vert
array with
the first finded vertex that is not indexed to any of the 4'th face's index.

On Sat, Nov 19, 2011 at 1:13 AM, Morten Mikkelsen mikkels...@gmail.comwrote:

 
  I wanted to ask about this line:
  const int iGetNrVerts= data-mface[face_num].v4!=0 ? 4 : 3;
 
  Or there is no way that last index points to zero?
 

 Correct, this is how blender does it everywhere in its code-base.
 Super glad to hear you're getting useful results! Be sure to submit a patch
 for review.
 ___
 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


Re: [Bf-committers] Blender tangent space calculation

2011-11-19 Thread Eugene Minov

 Be sure to submit a patch for review.


I've submitted a patch today.
This is my first patch and I hope I've did all right.

I've checked it for warnings, added txt file with small description about
api.
I've added a simple test exporting script that writes a data to txt file.
I've added a 'weldmesh.h' and 'weldmesh.c' too.
And also added the blend file with a simple mesh and generated normal map.

http://projects.blender.org/tracker/index.php?func=detailaid=29335group_id=9atid=127

I'll be very grateful if someone's find a time to test it.
Thanks :)

On Sat, Nov 19, 2011 at 8:27 PM, Eugene Minov minov@gmail.com wrote:

 
  Correct, this is how blender does it everywhere in its code-base.
 

 Ok.
 I've asked because after weldind I've gotten this problem with some quads.
 But today seems that I solve it by swapping the first vertex in the vert
 array with
 the first finded vertex that is not indexed to any of the 4'th face's
 index.

 On Sat, Nov 19, 2011 at 1:13 AM, Morten Mikkelsen mikkels...@gmail.comwrote:

 
  I wanted to ask about this line:
  const int iGetNrVerts= data-mface[face_num].v4!=0 ? 4 : 3;
 
  Or there is no way that last index points to zero?
 

 Correct, this is how blender does it everywhere in its code-base.
 Super glad to hear you're getting useful results! Be sure to submit a
 patch
 for review.
 ___
 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


Re: [Bf-committers] Blender tangent space calculation

2011-11-19 Thread Morten Mikkelsen
I am not 100% sure I understand you correctly but your fix doesn't sound
correct but perhaps
I am misunderstanding you. Anyway, the welder is going to generate a zero
based index list unlike what is used within
Blender. If you want to use the indexed result within a Blender context
you'd have to put a dummy vertex at the beginning of the vertex array such
that all other vertices are offset by one entry and then you'd add all the
welder-generated indices by +1 to offset to after the dummy vertex. This
way triangles can still have their fourth index as 0 which points to the
dummy vertex and within Blender means no vertex assigned.



On Sat, Nov 19, 2011 at 9:27 AM, Eugene Minov minov@gmail.com wrote:

 
  Correct, this is how blender does it everywhere in its code-base.
 

 Ok.
 I've asked because after weldind I've gotten this problem with some quads.
 But today seems that I solve it by swapping the first vertex in the vert
 array with
 the first finded vertex that is not indexed to any of the 4'th face's
 index.

 On Sat, Nov 19, 2011 at 1:13 AM, Morten Mikkelsen mikkels...@gmail.com
 wrote:

  
   I wanted to ask about this line:
   const int iGetNrVerts= data-mface[face_num].v4!=0 ? 4 : 3;
  
   Or there is no way that last index points to zero?
  
 
  Correct, this is how blender does it everywhere in its code-base.
  Super glad to hear you're getting useful results! Be sure to submit a
 patch
  for review.
  ___
  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


Re: [Bf-committers] Blender tangent space calculation

2011-11-19 Thread Morten Mikkelsen
 If you want to use the indexed result within a Blender context you'd have
to put a dummy vertex at the beginning of the vertex array such that all
other vertices are offset by one entry

I mean put a dummy vertex in front of the unique vertices of course
(meaning after welding). And also +1 to the indices you get after welding.



On Sat, Nov 19, 2011 at 12:35 PM, Morten Mikkelsen mikkels...@gmail.comwrote:

 I am not 100% sure I understand you correctly but your fix doesn't sound
 correct but perhaps
 I am misunderstanding you. Anyway, the welder is going to generate a zero
 based index list unlike what is used within
 Blender. If you want to use the indexed result within a Blender context
 you'd have to put a dummy vertex at the beginning of the vertex array such
 that all other vertices are offset by one entry and then you'd add all the
 welder-generated indices by +1 to offset to after the dummy vertex. This
 way triangles can still have their fourth index as 0 which points to the
 dummy vertex and within Blender means no vertex assigned.




 On Sat, Nov 19, 2011 at 9:27 AM, Eugene Minov minov@gmail.com wrote:

 
  Correct, this is how blender does it everywhere in its code-base.
 

 Ok.
 I've asked because after weldind I've gotten this problem with some quads.
 But today seems that I solve it by swapping the first vertex in the vert
 array with
 the first finded vertex that is not indexed to any of the 4'th face's
 index.

 On Sat, Nov 19, 2011 at 1:13 AM, Morten Mikkelsen mikkels...@gmail.com
 wrote:

  
   I wanted to ask about this line:
   const int iGetNrVerts= data-mface[face_num].v4!=0 ? 4 : 3;
  
   Or there is no way that last index points to zero?
  
 
  Correct, this is how blender does it everywhere in its code-base.
  Super glad to hear you're getting useful results! Be sure to submit a
 patch
  for review.
  ___
  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


Re: [Bf-committers] Blender tangent space calculation

2011-11-19 Thread Eugene Minov

 If you want to use the indexed result within a Blender context
 you'd have to put a dummy vertex at the beginning of the vertex array
such
 that all other vertices are offset by one entry and then you'd add all
the
 welder-generated indices by +1 to offset to after the dummy vertex.


Yes you're right! My first thought was to fix this in the same way.
Seems that I just wanted to find a way to not allocate an extra dummy
vertex :)

Actually I doing this, I put a dummy vertex at the beginning and then do +1
to the
indices.
But only if I cannot find another appropriate vertex within other unique
vertices in the array, on which didn't point any fourth index from any face.
There's almost always must be that vertex.

Then if I find this vertex I swap it with a vertex at the begining.
Then I loop all my indexes and change indexes that
point to fonded vertex, to '0', and otherwise, those indexes that
point to '0', i change to index of founded vertex.

I've tested this on a diferent meshes, wached results and I pretty sure
that it must work correct, but now I think that maybe it'd be better and
easier
to put an extra vertex only :)


On Sat, Nov 19, 2011 at 11:36 PM, Morten Mikkelsen mikkels...@gmail.comwrote:

  If you want to use the indexed result within a Blender context you'd have
 to put a dummy vertex at the beginning of the vertex array such that all
 other vertices are offset by one entry

 I mean put a dummy vertex in front of the unique vertices of course
 (meaning after welding). And also +1 to the indices you get after welding.



 On Sat, Nov 19, 2011 at 12:35 PM, Morten Mikkelsen mikkels...@gmail.com
 wrote:

  I am not 100% sure I understand you correctly but your fix doesn't sound
  correct but perhaps
  I am misunderstanding you. Anyway, the welder is going to generate a zero
  based index list unlike what is used within
  Blender. If you want to use the indexed result within a Blender context
  you'd have to put a dummy vertex at the beginning of the vertex array
 such
  that all other vertices are offset by one entry and then you'd add all
 the
  welder-generated indices by +1 to offset to after the dummy vertex. This
  way triangles can still have their fourth index as 0 which points to the
  dummy vertex and within Blender means no vertex assigned.
 
 
 
 
  On Sat, Nov 19, 2011 at 9:27 AM, Eugene Minov minov@gmail.com
 wrote:
 
  
   Correct, this is how blender does it everywhere in its code-base.
  
 
  Ok.
  I've asked because after weldind I've gotten this problem with some
 quads.
  But today seems that I solve it by swapping the first vertex in the vert
  array with
  the first finded vertex that is not indexed to any of the 4'th face's
  index.
 
  On Sat, Nov 19, 2011 at 1:13 AM, Morten Mikkelsen mikkels...@gmail.com
  wrote:
 
   
I wanted to ask about this line:
const int iGetNrVerts= data-mface[face_num].v4!=0 ? 4 : 3;
   
Or there is no way that last index points to zero?
   
  
   Correct, this is how blender does it everywhere in its code-base.
   Super glad to hear you're getting useful results! Be sure to submit a
  patch
   for review.
   ___
   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


Re: [Bf-committers] Blender tangent space calculation

2011-11-18 Thread Eugene Minov
Hi!

I think that I've finished this.


 Don't forget to look in do_multires_bake() in object_bake.c
 It shows you how to add the tangent layer:


Yes, I've figured out how to create DerivedMesh object by Mesh object.
And then I've created the tangent layer in this way.


 // get pointer to the already generated tangents
 pvtangent= DM_get_face_data_layer(dm, CD_TANGENT);


But if mesh don't have a tex-coords, 'pvtangent' anyway is NULL
For this case I weld normals only.

I tried to export a mesh with tangents and normals into my app
and seems that normal map looking correct.

const int iGetNrVerts= data-mface[face_num].v4!=0 ? 4 : 3;

On Thu, Nov 17, 2011 at 8:33 PM, Morten Mikkelsen mikkels...@gmail.comwrote:

 And flush_pixel() shows you how to traverse the buffer.
 Essentially the way it works in blender is there's always 4 of them
 per face whether it's a triangle or a quad.





 On Thu, Nov 17, 2011 at 9:31 AM, Morten Mikkelsen mikkels...@gmail.com
 wrote:

  Don't forget to look in do_multires_bake() in object_bake.c
  It shows you how to add the tangent layer:
 
  float *pvtangent= NULL;
 
  // create tangent vectors if not already created
  if(CustomData_get_layer_index(dm-faceData, CD_TANGENT) == -1)
DM_add_tangent_layer(dm);
 
  // get pointer to the already generated tangents
  pvtangent= DM_get_face_data_layer(dm, CD_TANGENT);
 
 
 
 
 
  On Thu, Nov 17, 2011 at 8:49 AM, Eugene Minov minov@gmail.com
 wrote:
 
  
   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 

Re: [Bf-committers] Blender tangent space calculation

2011-11-18 Thread Eugene Minov
Sorry for extra line :)

I wanted to ask about this line:
const int iGetNrVerts= data-mface[face_num].v4!=0 ? 4 : 3;

I think 'iGetNrVerts' may be incorrect with some cases when there is four
vertices per face but the last one is points to first indexed vertex.
Or there is no way that last index points to zero?

On Fri, Nov 18, 2011 at 9:48 PM, Eugene Minov minov@gmail.com wrote:

 Hi!

 I think that I've finished this.

 
  Don't forget to look in do_multires_bake() in object_bake.c
  It shows you how to add the tangent layer:
 

 Yes, I've figured out how to create DerivedMesh object by Mesh object.
 And then I've created the tangent layer in this way.

 
  // get pointer to the already generated tangents
  pvtangent= DM_get_face_data_layer(dm, CD_TANGENT);
 

 But if mesh don't have a tex-coords, 'pvtangent' anyway is NULL
 For this case I weld normals only.

 I tried to export a mesh with tangents and normals into my app
 and seems that normal map looking correct.

 const int iGetNrVerts= data-mface[face_num].v4!=0 ? 4 : 3;

 On Thu, Nov 17, 2011 at 8:33 PM, Morten Mikkelsen mikkels...@gmail.comwrote:

 And flush_pixel() shows you how to traverse the buffer.
 Essentially the way it works in blender is there's always 4 of them
 per face whether it's a triangle or a quad.





 On Thu, Nov 17, 2011 at 9:31 AM, Morten Mikkelsen mikkels...@gmail.com
 wrote:

  Don't forget to look in do_multires_bake() in object_bake.c
  It shows you how to add the tangent layer:
 
  float *pvtangent= NULL;
 
  // create tangent vectors if not already created
  if(CustomData_get_layer_index(dm-faceData, CD_TANGENT) == -1)
DM_add_tangent_layer(dm);
 
  // get pointer to the already generated tangents
  pvtangent= DM_get_face_data_layer(dm, CD_TANGENT);
 
 
 
 
 
  On Thu, Nov 17, 2011 at 8:49 AM, Eugene Minov minov@gmail.com
 wrote:
 
  
   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 

Re: [Bf-committers] Blender tangent space calculation

2011-11-18 Thread Morten Mikkelsen

 I wanted to ask about this line:
 const int iGetNrVerts= data-mface[face_num].v4!=0 ? 4 : 3;

 Or there is no way that last index points to zero?


Correct, this is how blender does it everywhere in its code-base.
Super glad to hear you're getting useful results! Be sure to submit a patch
for review.
___
Bf-committers mailing list
Bf-committers@blender.org
http://lists.blender.org/mailman/listinfo/bf-committers


Re: [Bf-committers] Blender tangent space calculation

2011-11-17 Thread Eugene Minov

 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.comwrote:

 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 

Re: [Bf-committers] Blender tangent space calculation

2011-11-17 Thread Morten Mikkelsen
Don't forget to look in do_multires_bake() in object_bake.c
It shows you how to add the tangent layer:

float *pvtangent= NULL;

// create tangent vectors if not already created
if(CustomData_get_layer_index(dm-faceData, CD_TANGENT) == -1)
DM_add_tangent_layer(dm);

// get pointer to the already generated tangents
pvtangent= DM_get_face_data_layer(dm, CD_TANGENT);





On Thu, Nov 17, 2011 at 8:49 AM, Eugene Minov minov@gmail.com wrote:

 
  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
  

Re: [Bf-committers] Blender tangent space calculation

2011-11-17 Thread Morten Mikkelsen
And flush_pixel() shows you how to traverse the buffer.
Essentially the way it works in blender is there's always 4 of them
per face whether it's a triangle or a quad.





On Thu, Nov 17, 2011 at 9:31 AM, Morten Mikkelsen mikkels...@gmail.comwrote:

 Don't forget to look in do_multires_bake() in object_bake.c
 It shows you how to add the tangent layer:

 float *pvtangent= NULL;

 // create tangent vectors if not already created
 if(CustomData_get_layer_index(dm-faceData, CD_TANGENT) == -1)
   DM_add_tangent_layer(dm);

 // get pointer to the already generated tangents
 pvtangent= DM_get_face_data_layer(dm, CD_TANGENT);





 On Thu, Nov 17, 2011 at 8:49 AM, Eugene Minov minov@gmail.com wrote:

 
  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
  

Re: [Bf-committers] Blender tangent space calculation

2011-11-16 Thread Morten Mikkelsen
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


Re: [Bf-committers] Blender tangent space calculation

2011-11-15 Thread Eugene Minov

 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 mikkels...@gmail.comwrote:

 
  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@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


Re: [Bf-committers] Blender tangent space calculation

2011-11-15 Thread Eugene Minov
Oh, I am sorry again, I'd thought that you mean soft/hard edges not faces,
I stupid! :\
Yeah there is must me way to gen those normals too.

On Tue, Nov 15, 2011 at 7:12 PM, Eugene Minov minov@gmail.com wrote:

 
  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 mikkels...@gmail.comwrote:

 
  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@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


Re: [Bf-committers] Blender tangent space calculation

2011-11-15 Thread Morten Mikkelsen
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.chttps://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


Re: [Bf-committers] Blender tangent space calculation

2011-11-15 Thread Eugene Minov
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.comwrote:

 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


Re: [Bf-committers] Blender tangent space calculation

2011-11-15 Thread f . paglia . 80
Chiamami domani verso ora di pranzo al 3777074625 ora sono molto impegnato sto 
lavorando su una Correzione Colore
E-Mail Sent via BlackBerry from BT Mobile

-Original Message-
From: Eugene Minov minov@gmail.com
Sender: bf-committers-boun...@blender.org
Date: Tue, 15 Nov 2011 21:43:12 
To: bf-blender developersbf-committers@blender.org
Reply-To: bf-blender developers bf-committers@blender.org
Subject: Re: [Bf-committers] Blender tangent space calculation

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.comwrote:

 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


Re: [Bf-committers] Blender tangent space calculation

2011-11-15 Thread Morten Mikkelsen
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


Re: [Bf-committers] Blender tangent space calculation

2011-11-15 Thread Alberto Torres
I've said compilant as in I've tested with several meshes with
automatic unwrapping (lots of seams) and baking from multires data and
the result is perfect. I don't really know if it's really 100%
compatible. I guess I must test with weird quads to be sure.

In any case, I can tab - ctrl+t whenever I see a problem there. I'm
just commenting that if you use ogre this shouldn't be an issue, but I
completely agree that it should be a way to get exactly the same
normals blender generates.

2011/11/15 Morten Mikkelsen mikkels...@gmail.com:
 You should be careful referring to them as compliant. I understand what
 you mean that they are compliant in format.
 But as is explained here --
 http://wiki.blender.org/index.php/Dev:Shading/Tangent_Space_Normal_Maps
 the only way to be fully compliant is to use the exact same spaces that
 were used to generate the bake.
 This can also be achieved by using the referenced implementation (which is
 used in Blender) because it's designed to be order-independent
 and also independent of how the geometry is indexed or even indexed at all.

 Being fully compliant is what allows the renderer to achieve smooth
 transitions of normal fields going from one island to the next.
 This is important for characters especially.




 On Mon, Nov 14, 2011 at 8:34 AM, Alberto Torres kungfoo...@gmail.comwrote:

 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 minov@gmail.com:
  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 minov@gmail.com
 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 l...@kishalmi.net
 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 minov@gmail.com
  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 
  mikkels...@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@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?

 

Re: [Bf-committers] Blender tangent space calculation

2011-11-14 Thread Eugene Minov
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 minov@gmail.com 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 l...@kishalmi.net 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 minov@gmail.com
 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 
 mikkels...@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@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@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

Re: [Bf-committers] Blender tangent space calculation

2011-11-14 Thread Alberto Torres
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 minov@gmail.com:
 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 minov@gmail.com 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 l...@kishalmi.net 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 minov@gmail.com
 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 
 mikkels...@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@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@blender.org
http://lists.blender.org/mailman/listinfo/bf-committers
   
   ___
   Bf-committers mailing list
   Bf-committers@blender.org
   

Re: [Bf-committers] Blender tangent space calculation

2011-11-14 Thread Morten Mikkelsen

 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@blender.org
http://lists.blender.org/mailman/listinfo/bf-committers


Re: [Bf-committers] Blender tangent space calculation

2011-11-13 Thread Morten Mikkelsen
There you go buddy -- http://lmgtfy.com/?q=blender+tangent+space



On Sun, Nov 13, 2011 at 8:46 AM, Eugene Minov minov@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@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


Re: [Bf-committers] Blender tangent space calculation

2011-11-13 Thread Eugene Minov
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 mikkels...@gmail.comwrote:

 There you go buddy -- http://lmgtfy.com/?q=blender+tangent+space



 On Sun, Nov 13, 2011 at 8:46 AM, Eugene Minov minov@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@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


Re: [Bf-committers] Blender tangent space calculation

2011-11-13 Thread M.G. Kishalmi
Eugene,

the link Morten pointed you
tohttp://wiki.blender.org/index.php/Dev:Shading/Tangent_Space_Normal_Mapsexplains
that
 the tangent space you created your normal maps in (in blender)
 is generated by the implementation in
mikktspace.hhttps://svn.blender.org/svnroot/bf-blender/trunk/blender/intern/mikktspace/mikktspace.hand
mikktspace.chttps://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 minov@gmail.com 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 mikkels...@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@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@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


Re: [Bf-committers] Blender tangent space calculation

2011-11-13 Thread Eugene Minov
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 l...@kishalmi.net wrote:

 Eugene,

 the link Morten pointed you
 tohttp://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 minov@gmail.com
 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 mikkels...@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@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@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