Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create tangent array if mesh created without tangents #84576

Merged
merged 1 commit into from
Nov 8, 2023

Conversation

clayjohn
Copy link
Member

@clayjohn clayjohn commented Nov 7, 2023

Fixes: #84277
Fixes: #83667

In both cases the issue came from a limitation in the Metal API that we were unaware of. We previously relied on overlapping reads from the normal buffer to pretend that we had tangents. Since we can't do that on Apple devices, we just provide tangent arrays always.

MoltenVK "corrected" our mistake which avoided logical errors on Apple devices, but which led to this subtle bug (https://github.com/KhronosGroup/MoltenVK/blob/bb914faa533a3ed923abf9cce3f9702492bfaef0/MoltenVK/MoltenVK/GPUObjects/MVKPipeline.mm#L1454-L1455)

This greatly simplifies our compression code at the cost of a small amount of bandwidth.

We can now go through our compression code and assume that tangents are always available (and thus remove some now superfluous code). I haven't done so yet as it will be a riskier change. This change is very low risk and is more suitable for a beta fix. I may make a follow up PR to clean the compression code if it makes sense to do so and can be done without compat breakage

This extends our previous change to ensure that compressed meshes have tangents

Now we ensure tangents are always used. This greatly simplifies our compression code at the cost of a small amount of bandwidth
@clayjohn clayjohn added this to the 4.2 milestone Nov 7, 2023
@clayjohn clayjohn requested a review from a team as a code owner November 7, 2023 13:31
@akien-mga akien-mga merged commit f0c52c0 into godotengine:master Nov 8, 2023
15 checks passed
@akien-mga
Copy link
Member

Thanks!

@clayjohn clayjohn deleted the mesh-tangents-always branch November 27, 2023 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants