Are these tangents typical?

Hello,

I have a question: Are tangents like in the following pictures okay / typical?
I used a textured Sphere with Polar projection and then
TangentBinormalGenerator.genTbnLines(mesh, 0.108f)
to make the tangents (red), binormals (green), normals (blue).
The normals and binormals seem to look okay (they are normalized, obviously).
But the tangents look strange… ( I think - but don’t really know if it’s okay how they look )

So, for this I used a factor of 1.0 to calculate U,V coords (basically the same like the code in Sphere.java):

And for this I used a factor of 150.0 to calculate U,V coords (multiplied with every U,V in the mesh gen code of the Sphere):

Note:
This is not the usual Sphere, but my HemiSphere. As you’ve already guessed, it can use a variable factor for the U,V. And as the name suggests, it builds “half spheres” and other fractions of a Sphere.

Happily waiting for comments from experienced gfx people now,
:chimpanzee_smile:

The tangent lines look took long to me… like by about 10 times.

So they should be normalized?

Yes… they aren’t tangents otherwise.

Okay. Thanks for the info.

I will try these two things then:
a) reproduce it with Sphere.java - it’s a bug then - either in Sphere or in tangent generator.
b) use a different TextureMode (there are 3 for Sphere, I think) and compare the results.

sphere shouldn’t have tangents on its own unless you generate them I guess.

Yes, I meant the normals or UV coords that are being fed to the tangent generator.

Okay, same for the original jME Sphere.

Tested all three TextureMode settings, tested different radii too.

Did use sphere.scaleTextureCoordinates(new Vector2f(tScale, tScale)); where needed, to get the same u,v factors. Using that line of code “shortens” the tangent, inverse to the texture scale factors. So it’s the same like in my two pictures: uvFactor=1 => long tangent, uvFactor=150 => short tangent.

Using a unit-Sphere (radius = 1) gives correct tangents, as long as there is no texture-scaling or model-scaling.
When texture-scaling is used => see above (shorter tangents when u,v factor is 150).
When model-scaling the unit-Sphere => scaled normals, example: scale (x,y,z) = 10,10,10 and texture factors (u,v) = 1,1 => gives normals, tangents, binormals with length 10 world units when viewed in 3D scene.

Problems now:
I’m using a fairly old version of jME (3.0.10).
The TangentBinormalGenerator is currently being worked on by @nehon.

How to continue:
Will just ignore that for now.
Will do some more tests with other mesh types later.
Will look for an updated version of the tangent generator for jME 3.0 later and use that.
(If anyone knows a good update for the jME 3.0 tangent generator - please say so).

And another thought:
Might also be that TangentBinormalGenerator.genTbnLines does not work correctly?
(in that case, only my visual debugging tool is defect).

Note: 3.1 alpha 2 is up in the repos and we’re just waiting for jcenter to properly list some of the artifacts… but effectively 3.1 alpha 2 is ‘released’.

Oh, that’s nice.

It’s probably a good idea to check this with a jME 3.1 version first.
Maybe I can backport the TangentBinormalGenerator in an easy way too.
But first, should really check if problem exists in all jME versions.

I guess I’m confused about why you would want to backport it. Maybe I’ve misunderstood why you are holding onto 3.0 so hard… I thought it was to have a common stable baseline for writing your tutorials but then a custom fork doesn’t make any sense at all.