Up until now I’ve always used the SDK to generate tangents for my models. But recently I’ve been optimizing my asset pipeline to do everything automatically in preparation for some large scale scene designing, so now I need to use code to generate the tangents.
I see there are a few different methods in the
TangentBinormalGenerator class for generating tangents with extra options.
Specifically there are 2 boolean options for generating tangents and I don’t know what they do::
However the javadoc doesn’t have any extra information about what any constructors or methods do (TangentBinormalGenerator (jMonkeyEngine3)), and I can’t seem to find any further documentation.
Would anyone be able to explain to me what those 2 booleans do when generating tangents? And should i be setting either of these true by default, or is there any reasoning I should be using to determine which to use for my specific case?
And any more information about what the other methods in the TangentBinormalGenerator class do (such as
setToleranceAngle() ) would be greatly appreciated too.
Do not know about those fields but FYI there is also
MikktspaceTangentGenerator which is newer. If you are converting from Gltf models then you do not need to regenerate them, GltfLoader will already generate them using
Thanks for the information, I didn’t know there was something newer.
It seems that I still need to generate them after saving the converted gltf model as j3o.
I am currently just using the assetManager to load a .gltf model and then I save it as j3o with the BinaryExporter. Does the assetManager automatically use the gltfLoader in this case, or is there a different way I should be converting my models with gltfLoader so that the tangents are automatically generated?
Why? aren’t they get saved into j3o?
Yes, it should use the GltfLoader.
I must recheck it to be sure but afaik they will be generated if there is a normal map specified on the material and there is no tangent buffer. It won’t generate If there is no normal map specified or if the Gltf file already has tangents (i.e. if you check the “tangent” checkbox when exporting the Gltf file in Blender).
Do you develop you importer/splitter/material separator as a standalon lib or part of the game?
With the rise of PBR Mikktspace is kind of a industry standart as well. Use that one if you go for pbr.
Thank you both for the replies.
Right now its built directly into my custom scene designer for convenience. So its separate from my game, but its not quite a standalone library even though its written so it could be.
Ah that explains it. I’ve been testing things with an untextured model that has its material applied after its already been converted to j3o. Although it would be nice if the tangents were still generated for models without a normal map in case a material is later applied, although I can understand the argument against this in cases where a jme dev isn’t using normal maps and wants to save space by never generating tangents.
In my case, I’ve setup my gltf converter/splitter utility so it has a checkbox for saving spatials and a seperate checkbox for saving the materials. If both are checked, it saves out the model as well as its materials. But if I make a change to the un-textured version of my model in blender, I can leave the “save materials” checkbox in my converter unchecked and it will overwrite the j3o files, but will replace their embedded material with the the proper material if its already been saved to my assets folder. And if I export a textured version of the model from substance painter, then I can check only the “save materials” checkbox so it only overwrites the materials. This way I don’t have to make changes to both the blender and substance file when I want to make a minor change to an existent model, unless I modify the model’s texture coordinates in which case both the mesh and material need updated.