glTFast
glTFast copied to clipboard
Option to generate tangents without specifying materials
Is your feature request related to a problem? Please describe.
As discussed in my other reports, I'm using binary glTF to hold the bits of scenes I'll dynamically load that it's good at, and a less compact second serialisation system to hold Unity-specific data that can't be represented by glTF. One thing I'd like would be to have standard Unity materials in the other system and related data (e.g. textures with the necessary swizzles applied) in the .glb
. This poses a problem when tangents are required, as glTFast only computes tangents when required by a material, but getting Unity to compute them later is presumably going to be less efficient as it'll need to reallocate the vertex buffer and repack it as glTFast won't have left space.
Describe the solution you'd like An option that can be set which makes the import process compute tangents for all primitives even when there's no material present.
Describe alternatives you've considered
- I could include a dummy material which everything uses which requires tangents.
- I could include tangents in the mesh data instead of relying on them being computed during load.
- I could detect which meshes are missing tangents after loading and have Unity compute them.
Additional context For whatever reason, Unity doesn't seem to be automatically computing tangents if I use a material that needs them with a mesh that doesn't provide them, instead falling back to a dummy value.
Hi @chrisdjali-wrld3d,
A solution could be to add a forceNormalsAndTangents
boolean property to ImportSettings
and react to it in GltfImport.LoadAccessorData
around here.
I can offer to review a PR, but I don't have resources to implement that.