-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Fox.glb has incorrectly scaled normals #8099
Comments
New to Bevy, would love to help out. Still learning the codebase Does this change involve edits to the 3D model itself? I looked under examples/animated_fox.rs and didn't find any code performing scaling. I've been searching under crates/bevy_render as well for where this error could be originating |
Looks like it. There's no normalization code we do on any meshes by default. IMO we should any or all of the following:
|
Looking into adding the validation step for when meshes are normalized I found the compute_flat_normals method which utilizes the face_normal would it be possible to reuse this functionality for the validation check, or do we want to calculate the standard normals instead of flat? Also, at what point should the validation check occur? My initial thoughts are in either ::new() or inert_attribute() |
While you are figuring out validation, I've been trying to fix the model itself. I've loaded it into blender, recalculated normals (removed duplicate vertices, recalculated, disconnected faces back, export). Visually nothing changed (judging by blender's normal visualization), I tried it on commit specified in #6528 and it's still black. I've uploaded my updated model to a fork: https://github.com/JohnTheCoolingFan/bevy/blob/dfdda55edb9e1ac6f6d497259faed32dd300068b/assets/models/animated/Fox.glb |
For reference, the way I personally did the normalization was via MeshLab, which has a "normalize normals" option. I unfortunately could not get to output a drop in replacement .glb file though. |
I would prefer to not change the model at all. It should come straight from https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/Fox without any modification. If it's wrong and need updating, could you submit your fix on the gltf sample repo? |
I believe one of the aim of glTF is avoiding the kind of pitfall where everything needs to be sanitized and recomputed, it's "GPU ready". The glTF standard unambiguously says the normal attributes are normalized so if the model doesn't have normalized normals, it's probably in infraction of the standard. |
If the wrong normals are confirmed on the upstream fox, fixing them would be very nice. If not, we can update ours with the original 👍 |
There's been a commit about "fixing validation errors" upstream that's newer than the in-tree copy, perhaps pulling that in would actually already be enough. |
Bevy version
35e107c
What went wrong
The
Fox.glb
model has incorrect scaling of the vertex normals.e.g. for the first vertex, the normals are:
correctly scaled would be:
This has led to issues such as #6528. That has been fixed, but it would be good to fix this at the source anyway.
The text was updated successfully, but these errors were encountered: