Skip to content

Commit

Permalink
Fix distorted normals in large-radius flat IcoSpheres. (#12789)
Browse files Browse the repository at this point in the history
Prior to this commit, a subdivided IcoSphere with a large radius would have distorted normals
for the vertices that were in the original set prior to subdivision.

After some troubleshooting, I discovered that this problem was due to scaling at an inappropriate
point in the process of generating the mesh. After removing this inappropriate scaling,
the normals of the vertices now look as expected without distortion.

Non-flat icospheres are unaffected - they still look appropriately round, as they did before.

Former-commit-id: 4e6750a1121ca12bbdec4048e0fa93ef0266295b
  • Loading branch information
jemc authored Jul 25, 2022
1 parent 1f373cd commit 2a40258
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/dev/core/src/Meshes/Builders/icoSphereBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@ export function CreateIcoSphereVertexData(options: {
icoVertices[3 * vertices_unalias_id[v_id] + 1],
icoVertices[3 * vertices_unalias_id[v_id] + 2]
);
// Normalize to get normal, then scale to radius
face_vertex_pos[v012].normalize().scaleInPlace(radius);
// Normalize to get normal
face_vertex_pos[v012].normalize();

// uv Coordinates from vertex ID
face_vertex_uv[v012].copyFromFloats(
Expand Down

0 comments on commit 2a40258

Please sign in to comment.