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 ETC quality setting #44682

Merged
merged 1 commit into from
Dec 26, 2020
Merged

Conversation

madmiraal
Copy link
Contributor

@madmiraal madmiraal commented Dec 25, 2020

To compress VRAM textures takes time. b19225b ensured that ETC compression was as fast as possible. However, there were three issues with this change:

float effort = 0.0; //default, reasonable time
if (p_lossy_quality > 0.75) {
effort = 0.4;
} else if (p_lossy_quality > 0.85) {
effort = 0.6;
} else if (p_lossy_quality > 0.95) {
effort = 0.8;
}

  1. The else if statements will never be true so the higher settings will never be applied.
  2. ETC effort is a value between 0 and 100, not 0 and 1; so even with 0.4 the effort value is effectively 0 (although there is still a difference, as ETC checks if the value is > 0).
  3. There is an artificial shift between the lossy_quality setting and the effort applied.

This PR addresses the first two issues. I haven't addressed the third issue, because I suspect there was a reason for introducing this shift: most of the benefit from ETC compression is obtained between 40 and 65 (reference) and setting it to 100 has little benefit.

Note: This PR leaves the default effort at 0, because the default lossy_quality is 0.7. Therefore there will be no impact to most users. However, anyone using a higher value for the lossy_quality will notice a significant increase in the time it takes to create the VRAM compressed files. As an indication, here are the times in ms I get for importing a 1024x1024 texture to ETC and ETC2 format with this PR:

Lossy Quality ETC ETC2
0.7 797 1,452
> 0.75 4,104 9,284
> 0.85 11,419 36,787
> 0.95 44,267 73,894

The benefit of course is that the textures will have the expected higher quality; even if the artificial adjustment to the effort remains.

@akien-mga akien-mga merged commit f2968f5 into godotengine:master Dec 26, 2020
@akien-mga
Copy link
Member

Thanks!

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