-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tangents to the GLTF loader or generate if they don't exist. #121
Comments
Yes, the library that Bevy uses to import 3D models (Gltf) supports loading in tangents so that should be fairly easy to add. Though, for calculating tangents for models that doesn't have them, there are some things to consider. The Mikktspace crate depends on Nalgebra which would likely add a bit of time to Bevy's build times. If Mikktspace is used to calculate tangents in Bevy, maybe it would be possible to fork it and use Glam as the math library? Then Bevy's build times won't take as much of a hit, because Glam is already in use in Bevy. An alternative way to add tangents to a model, that I know of, is to use Blender. I think Blender also uses the Mikktspace algorithm. These are the steps:
|
Mikktspace seems to be the industry standard. I don't think it would be too difficult to either fork the I don't think we should have to rely on people using blender or some other 3D modeling program to generate tangents. The mesh asset should ideally generate them if they don't exist. Also this is a great article on normal mapping/tangents in general: |
I've run into this problem. It seems Wings3D does not generate the required tangent data. I tested the code in #1795 and it allowed me to load the Wings3D-exported model without using another tool to re-export. I'd be happy it that was merged. However, I have very much enjoyed the fast build times w/ bevy and I would also be happy if bevy shipped a companion program to one-shot reprocess GLTF files to include this data. That seems like a reasonable compromise between making assets easy to use while also keeping the engine fast. |
Closing this, as |
Tangents are useful for normal mapping and they are easy to load in from the model if they don't exist I would suggest using:
https://crates.io/crates/mikktspace
Mikktspace is what most 3D engines use to calculate tangents.
The text was updated successfully, but these errors were encountered: