I re-wrote the createMeshWithTangents function to be more efficient and produce better looking results. Before the function would duplicate the vertices of every triangle (resulting in extra vertices) and calculate the tangent/binormal/normal for each one. This is redundant since the three vectors are the same for each face. The new function does not duplicate any vertices (so models should be more efficient) and it also smooths the vectors to get a more pleasing result. I did a quick test and it seems to work fine - let me know if I'm missing something.
Sound very good! This Tangents problem is indeed rather disturbing. Since all the calculations are hard wired it would be perfectly possible to make the conversion automatically when required. But the vertex object structure doesn't make it that easy.
I think to keep smoothed and edgy normals as wanted it would be best to reuse the original normals of the vertices. As soon as the mesh loaders will support smoothing normals these should not be recalculated.
Keeping the original normals might be a problem since it would break the orthogonality of the tagent/binormal/normal vectors.. You would have to calculate the tangent and binormal according to the normal which is a bit above my math level. Ideally the mesh format should store the tangent / binormal / normal info since it is time consuming to calculate. Another solution (and I think other games do this) is to add a few extra faces to preserve the sharpness of edges [ie, give it a very slight bevel].. For future versions of irrlicht we might want to just have one vertex format that has all the info or somehow make it more flexible through abstraction (though maybe this won't be efficient.. ).
It seems that irrlicht::createMeshW.. and your createMeshW.. alter original normals (those that come from mesh file). Let me know if I am wrong. I'm just getting familiar with Irrlicht internals.
So, do you plan to improve your code in order to reuse original normals ? I'm getting interested with a createMeshWith... that doesn't change those normals. Perhaps, I will try and write one.
Return to Irrlicht after years... I'm lovin it. It's hard to be a Man ! Si vis pacem para belum
That's correct, it takes the average normal, the same as if you called 'recalculateNormals'. I don't have any plans to modify it - in most cases I think you'd want to use the average normal anyway.
Because the code has to be fixed such that it takes the original normals
And now the CreateMeahWithTangents finds tangent and binormal and creates new normal as a cross product of those two.
Much proper aproach is to find tangent, cross it with smooth normal and get the binormal, hereby everything is orthogonal and smooth normal is untouched