[custom levels] A few bug fixes (#3736)

- Bug fix to KD tree splitting, should fix cases with bad vertex
colors/alphas.
- Normalize normals instead of asserting if they are the wrong length.
**the fact that blender exports normals incorrectly is a bug and I doubt
their implementation is correct if you've scaled things on only on
axis.**
- Automatically resize metallic texture (envmap strength) if it doesn't
match the size of the rgb texture instead of asserting

Co-authored-by: water111 <awaterford1111445@gmail.com>
This commit is contained in:
water111
2024-10-27 12:31:41 -04:00
committed by GitHub
parent 1962fbfb51
commit dff9ac163a
8 changed files with 195 additions and 9 deletions
+2 -1
View File
@@ -323,7 +323,8 @@ ExtractedVertices gltf_vertices(const tinygltf::Model& model,
normals = extract_vec3f(data_ptr, count, byte_stride);
for (auto& nrm : normals) {
math::Vector4f nrm4(nrm.x(), nrm.y(), nrm.z(), 0.f);
nrm = (w_T_local * nrm4).xyz();
// we found that normals aren't normalized if an object is scaled in blender.
nrm = (w_T_local * nrm4).xyz().normalized();
}
ASSERT(normals.size() == result.size());
} else {