Skip to content

Fix Compute3DSModelNormals and ComputeMD2ModelNormals face normal calculation - #32

Open
moonwho101 wants to merge 3 commits into
DS-fixnormals7-3dsfixfrom
jules-6008408416220456197-d8c4ecfc
Open

Fix Compute3DSModelNormals and ComputeMD2ModelNormals face normal calculation#32
moonwho101 wants to merge 3 commits into
DS-fixnormals7-3dsfixfrom
jules-6008408416220456197-d8c4ecfc

Conversation

@moonwho101

Copy link
Copy Markdown
Owner

Refactored Compute3DSModelNormals and ComputeMD2ModelNormals to directly assign normalized face normals and tangents to model vertices without premature smoothing accumulation, delegating smoothing to Smooth3DSModelNormals and SmoothMD2ModelNormals. Fixed global vertex boundary checks and loop bounds to prevent triangle rejection.


PR created automatically by Jules for task 6008408416220456197 started by @moonwho101

…culation

- Store raw face normals and tangents directly in vertices without premature smoothing accumulation
- Fix vertex index boundary checks in Compute3DSModelNormals to check global vertex bounds, preventing valid triangles from being rejected
- Fix loop bounds in ComputeMD2ModelNormals (j + 2 < num_verts_per_poly) to prevent reading past polygon arrays
- Ensure normal and tangent vectors are negated in both functions to account for DirectX model space coordinate system handedness and produce outward-pointing surface normals

Co-authored-by: moonwho101 <90150577+moonwho101@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

google-labs-jules Bot and others added 2 commits August 22, 2026 03:13
…ization in model normal computation

- CalculateVertNormalAndTangent now uses Gram-Schmidt orthogonalization to ensure computed tangents are strictly orthogonal to face normals
- Compute3DSModelNormals and ComputeMD2ModelNormals directly store raw face normals and tangents in each triangle's vertices without premature accumulation or smoothing
- Corrected vertex array bounds checking in Compute3DSModelNormals to use global vertex indices
- Corrected MD2 loop bounds to prevent reading past polygon arrays

Co-authored-by: moonwho101 <90150577+moonwho101@users.noreply.github.com>
… tangent calculation

- Directly assign raw face normals and tangents in Compute3DSModelNormals and ComputeMD2ModelNormals without premature accumulation or smoothing
- Fixed global vertex array index bounds checking in Compute3DSModelNormals to prevent triangle rejection
- Ensured outward-pointing normals for both 3DS and MD2 models (negating 3DS vectors to match 3DS winding order while retaining MD2 vector orientation)
- Added Gram-Schmidt orthogonalization in CalculateVertNormalAndTangent to guarantee tangents are strictly perpendicular to normals

Co-authored-by: moonwho101 <90150577+moonwho101@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant