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: Implement better extended culling options #4285

Merged
merged 4 commits into from
Aug 12, 2024

Conversation

Archez
Copy link
Contributor

@Archez Archez commented Aug 9, 2024

This PR achieves two main goals:

  • Improve upon the existing "Disable Draw Distance" enhancement
  • Re-implement widescreen actor culling as an optional toggle

Draw Distance

Previously our Draw Distance enhancement was implemented rather poorly. The way it worked essentially bypassed culling checks entirely, meaning that all actors were drawn and updated, even if they where behind the camera/out of view. For lower end devices, this would cause significant lag in larger areas like Hyrule Field.

The changes in this PR attempt to address this in two ways:
First, a "draw distance" enhancement should really only increase the forward culling plane of the uncull frustum. So now things behind the camera will cull as expected following the actors rules.
Second, the "draw distance" enhancement is now a slider so that players can choose "how much" increased range they want. This works as a multiplier against each actors forward uncull zone value, so that the zones scale per actor (e.g. trees scale father than insects).

Widescreen culling

Previously we hardcoded the side, top, and bottom uncull planes to be increased by a factor of 2. This change was arbitrary and got lost in git history, not to mention changing the top and bottom planes is not necessary for widescreens. It worked decently for 16:9 aspect ratios, but started to show actor pop-in on much larger ratios like 32:9. In 8.0.5, we reverted this change back to vanilla to restore certain uncull glitches (i.e. King Zora unfreeze), but now there is noticeable actor pop-in on regular widescreen ratios.

The changes in this PR bring back widescreen actor culling as a dedicated option, so that it can be turned on/off. Additionally, the horizontal planes are now increased proportionally to the games aspect ratio so that even 32:9 displays should have little-to-no actor pop-in.

Exclude glitch useful actors

To deal with glitches, a new option is added that allows specific glitch-useful actors to be excluded from the extended culling options. This means things like King Zora unfreeze, Gerudo guard unculling, blue warp unculling, etc can all work as expected while extended culling is active. This works by allowing actors to "draw" without actually "updating", so there won't be pop-in, but update logic will not run (the logic that uncull glitches take advantage of).
Specific actors have been identified and included as of now, but we can add more as other use cases are identified.

Other things to note

Previous actor exclusions like Dark Link's room or Dodongos Cavern Lizalfos are not longer necessary with these updates so they have been removed. Others were just incorrect (zelda/ganon horse), and have been replaced with the appropriate actor (en_viewer).

Some trees/bushes spawn and clean up "additional" actors in Hyrule field using the same extended logic now.
Bush/rock circles have additional logic to spawn/clean up their individual actors tweaked to match the extended culling options.

Build Artifacts

Copy link
Contributor

@Pepe20129 Pepe20129 left a comment

Choose a reason for hiding this comment

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

Looks good, mostly some cvar prefix stuff and maybe it'd be a good idea to rename gDisableDrawDistance.

soh/soh/SohMenuBar.cpp Show resolved Hide resolved
soh/soh/SohMenuBar.cpp Show resolved Hide resolved
Comment on lines +2878 to +2881
// Skip cutscne actors that depend on culling to hide from camera pans
if (actor->id == ACTOR_EN_VIEWER) {
return false;
}
Copy link
Contributor

@Pepe20129 Pepe20129 Aug 9, 2024

Choose a reason for hiding this comment

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

Are all the cutscene actors we want to hide like this, ACTOR_EN_VIEWER?

Copy link
Contributor Author

@Archez Archez Aug 9, 2024

Choose a reason for hiding this comment

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

This actor pertains to zelda/impa/ganon and their horses, primarily from the chase scene. The previous issue noticed by our enhancements was their horses "running in place" during camera pans when they would have been culled.

I'm not aware of any other actor that needs special handling, and this is on par with SoH since 1.0.0, but we can always add more actors later if necessary.

soh/soh/SohMenuBar.cpp Show resolved Hide resolved
@Archez
Copy link
Contributor Author

Archez commented Aug 9, 2024

Looks good, mostly some cvar prefix stuff and maybe it'd be a good idea to rename gDisableDrawDistance.

This is a MacReady PR, the cvar prefixes don't exist here yet, and similarly we wouldn't want to rename gDisableDrawDistance here. That should happen after we do a merge to develop and add an entry for it in the config migrator with the other prefix changes.

@Malkierian
Copy link
Contributor

Looks good, mostly some cvar prefix stuff and maybe it'd be a good idea to rename gDisableDrawDistance.

This is a MacReady PR, the cvar prefixes don't exist here yet, and similarly we wouldn't want to rename gDisableDrawDistance here. That should happen after we do a merge to develop and add an entry for it in the config migrator.

On that note, let me know what things need to be added to the migrator, my migrator for the CVar macros hasn't gone through yet, so I can add them to that.

Copy link
Contributor

@Pepe20129 Pepe20129 left a comment

Choose a reason for hiding this comment

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

Whoops, forgot macready doesn't have the prefixes.

@Archez Archez merged commit 16aaf2f into HarbourMasters:develop-macready Aug 12, 2024
8 checks passed
@Archez Archez deleted the better-culling branch August 18, 2024 19:25
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.

3 participants