Fix Compute3DSModelNormals and ComputeMD2ModelNormals face normal calculation - #32
Fix Compute3DSModelNormals and ComputeMD2ModelNormals face normal calculation#32moonwho101 wants to merge 3 commits into
Conversation
…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>
|
👋 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
…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>
Refactored
Compute3DSModelNormalsandComputeMD2ModelNormalsto directly assign normalized face normals and tangents to model vertices without premature smoothing accumulation, delegating smoothing toSmooth3DSModelNormalsandSmoothMD2ModelNormals. Fixed global vertex boundary checks and loop bounds to prevent triangle rejection.PR created automatically by Jules for task 6008408416220456197 started by @moonwho101