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

Portals - improve PVS tracing #51370

Merged
merged 1 commit into from
Aug 7, 2021

Conversation

lawnjelly
Copy link
Member

@lawnjelly lawnjelly commented Aug 7, 2021

The existing tracing routine for building the PVS was overly simplistic compared to the main portal tracing, and could not correctly cope with multiple portal paths between adjacent rooms, and as a result would sometimes underestimate the rooms visible.

This PR adds an improved function that can cope with entering a room multiple times during a trace. As a result it has to take care of portal directions (to prevent going back on itself) in a similar, but not identical way to the main portal tracing routine, and internal rooms, to prevent recursive loops.

Notes

  • The main portal culling in Partial and Full PVS mode depend on the accuracy of the PVS.
  • This makes the routine a bit more complex and epsilons in particular can be error prone, but it is a necessary evil.
  • I've left in a copy of the original PVS tracing routine (marked simple) - it is not called but may be useful for comparison for debugging.

The existing tracing routine for building the PVS was rather simple compared to the main portal tracing, and could not correctly cope with paths that went through multiple portals from room A to B, and as a result would sometimes miss room entries in the PVS resulting in too many culled rooms in these circumstances.

This PR adds an improved function that can cope with entering a room multiple times during a trace. As a result it has to take care of portal directions (to prevent going back on itself) in a similar, but not identical way to the main portal tracing routine, and internal rooms, to prevent recursive loops.
@lawnjelly lawnjelly requested a review from a team as a code owner August 7, 2021 17:13
@Calinou Calinou added this to the 3.4 milestone Aug 7, 2021
@akien-mga akien-mga merged commit 42e40a7 into godotengine:3.x Aug 7, 2021
@akien-mga
Copy link
Member

Thanks!

@lawnjelly lawnjelly deleted the portals_better_pvs branch August 8, 2021 07:07
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.

3 participants