Skip to content

Switch CSG tangent generation to meshopt_generateTangents - #120829

Merged
Repiteo merged 1 commit into
godotengine:masterfrom
zeux:csg-tangents
Jul 3, 2026
Merged

Switch CSG tangent generation to meshopt_generateTangents#120829
Repiteo merged 1 commit into
godotengine:masterfrom
zeux:csg-tangents

Conversation

@zeux

@zeux zeux commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

This is a followup to #119161 and replaces CSG tangent generation with the same algorithm.

Since CSGShape does not use SurfaceTool, we replicate the code to copy tangent inputs and generate tangents here directly; the CSG data is not indexed so we do not need any complex post-processing like vertex splitting.

The time tangent generation takes during CSG operations tends to not be very significant but this ensures we use consistent tangent algorithm everywhere, and removes the dependency on mikktspace library.

Tested using tangent visualization patch (https://github.com/user-attachments/files/24402824/tangent-debug.patch) but showing binormal here to ensure sign remains consistent too:

mode autosmooth off autosmooth on
before image image
after image image

Since CSGShape does not use SurfaceTool, we replicate the code to copy
tangent inputs and generate tangents here directly; the CSG data is not
indexed so we do not need any complex post-processing like vertex
splitting.

The time tangent generation takes during CSG operations tends to not be
very significant but this ensures we use consistent tangent algorithm
everywhere, and removes the dependency on mikktspace library.
@zeux
zeux requested a review from a team as a code owner July 1, 2026 18:00
@AThousandShips AThousandShips added this to the 4.x milestone Jul 2, 2026
@BlueCube3310 BlueCube3310 modified the milestones: 4.x, 4.8 Jul 3, 2026
@Repiteo
Repiteo merged commit 4d074ea into godotengine:master Jul 3, 2026
20 checks passed
@Repiteo

Repiteo commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Thanks!

BendyLand pushed a commit to BendyLand/voltaire that referenced this pull request Aug 2, 2026
Switch CSG tangent generation to meshopt_generateTangents
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants