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

Fix 2d software skinning relative transforms #48402

Merged
merged 1 commit into from
May 3, 2021

Conversation

lawnjelly
Copy link
Member

All my earlier test cases for software skinning had the polys parent transform to be identity. This works fine until you had cases where the user had moved the transform of the parent nodes of skinned polys.

This PR fixes this situation by taking into account the final (concatenated) transform of the polys RELATIVE to the skeleton base transform. It does this by applying the inverse skeleton base transform to the poly final transform.

Fixes #48348
Fixes #48380

Notes

  • This has to perform a little gymnastics to get the skeleton base transform to the software skinning code. It has to do it on a per item basis, not per joined item, as several skeletons can be batched together. For this reason I don't use the state.skeleton_transform variable as it is only set per joined item. (It is however still used for hardware skinning).
  • I notice that the skeleton_base_inverse_xform seems to be recalculated for each poly, rather than per skeleton. This can probably be optimized to one time, but I will leave that for a separate PR, I doubt it is a major bottleneck in most cases.

All my earlier test cases for software skinning had the polys parent transform to be identity. This works fine until you had cases where the user had moved the transform of the parent nodes of skinned polys.

This PR fixes this situation by taking into account the final (concatenated) transform of the polys RELATIVE to the skeleton base transform. It does this by applying the inverse skeleton base transform to the poly final transform.
@akien-mga akien-mga merged commit 2d1aeac into godotengine:3.x May 3, 2021
@akien-mga
Copy link
Member

Thanks!

@akien-mga
Copy link
Member

Cherry-picked for 3.3.1.

@lawnjelly lawnjelly deleted the ewok_skin_basexform branch May 3, 2021 14:40
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.

2 participants