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

Tweak to how polygon orientation is determined #2137

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

Jaklyy
Copy link
Contributor

@Jaklyy Jaklyy commented Aug 16, 2024

Makes small tweaks to clarify and improve the algorithm for determining polygon orientation.
Main thing that sparked this dive was the mystery of how a polygon with a dot of 0 can be treated as either both facing directions or "neither" (always rendered) for poly face culling depending on whether the first/second vertex is overlapping the 3rd vertex.
After essentially rewriting the entire algorithm and coming to almost exactly the same conclusions as the original algorithm i can now explain this by the fact that the initial vectors have a length of 0.
Doesn't really explain why they decided to handle those vectors differently, but it at least gives us some excuse to go off of.

Current caveats:
I have yet to figure out why we're doing normalization currently, but i kept it anyway. I'm assuming that i have simply yet to find some horrifying edge case.
Update: i found the edge case, i... also found another edge case that isn't covered by it?
i dunno what's going on there

maybe better explains the weird behavior with the 3rd vertex (vtx2)
at least for determining the orientation?
was not actually 27 bit oops
but this time actually correct
@Jaklyy Jaklyy changed the title Rework to how polygon orientation is determined Tweak to how polygon orientation is determined Aug 17, 2024
@Jaklyy Jaklyy marked this pull request as ready for review August 17, 2024 17:44
or alternatively we might need to normalize them somehow?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant