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

Optimize corner quad generation #160

Merged
merged 2 commits into from
Jun 20, 2024

Conversation

limbonaut
Copy link
Collaborator

  • Distortions appear because we rely on normals in the process of building the quad.
  • Reworks algorithm to rely on delta vectors instead.
  • Aligns better with overall shape geometry, and also improves results of render_offset.

@limbonaut limbonaut added the bug Something isn't working label Jun 18, 2024
@limbonaut
Copy link
Collaborator Author

I can rebase it after #156 is merged.

@limbonaut limbonaut requested a review from mphe June 18, 2024 10:33
@mphe
Copy link
Collaborator

mphe commented Jun 19, 2024

Code looks fine, but I'm also not that familiar with the inner edge generation workings.

What exactly does this PR fix? Is it related to #156? Would it affect the outcome of #156, i.e. does #156 need to be tested with this PR or the other way round?

Can you provide an example image how it improves distortions?

@limbonaut
Copy link
Collaborator Author

limbonaut commented Jun 19, 2024

#156 introduces a set of changes, one of which, as you know, is corner anti-distortion code. This PR achieves the same result, but instead of compensating for the "bad" generation result, it instead generates a "good" one. So the code is simpler and faster. As a side effect, this approach also improves render_offset results - additional benefits. This PR would be in direct conflict with #156, that is why I offered to rebase it after we merge that one. I my tests, unless you use render_offset, the result would be identical to #156 (when it comes to corner distortions ofc - that PR is much more than dealing with distortions).

@mphe
Copy link
Collaborator

mphe commented Jun 19, 2024

Ah, thanks for clarifying.

@limbonaut limbonaut marked this pull request as draft June 19, 2024 21:50
- Distortions appear because we rely on normals in the process of building the quad.
- Reworks algorithm to rely on delta vectors instead.
- Aligns better with overall shape geometry, and also improves results of `render_offset`.
@limbonaut limbonaut changed the title Fix corner quad distortions Optimize corner quad generation Jun 20, 2024
@limbonaut limbonaut marked this pull request as ready for review June 20, 2024 15:31
@limbonaut limbonaut requested a review from mphe June 20, 2024 15:38
@limbonaut
Copy link
Collaborator Author

limbonaut commented Jun 20, 2024

Ready for review.
Test scene: corner_anti_distortion.zip
Rebased on current master.

Copy link
Collaborator

@mphe mphe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides the small optimization, LGTM.

addons/rmsmartshape/shapes/shape.gd Outdated Show resolved Hide resolved
@limbonaut limbonaut requested a review from mphe June 20, 2024 19:22
@limbonaut
Copy link
Collaborator Author

Besides the small optimization, LGTM.

Thanks, fixed it and merging 👍

@limbonaut limbonaut merged commit 8acfa4e into SirRamEsq:master Jun 20, 2024
1 check passed
@limbonaut limbonaut deleted the fix-corner-distortions branch June 20, 2024 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants