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 Ocean Depth Cache baked texture size limit #1016

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

Conversation

daleeidd
Copy link
Collaborator

@daleeidd daleeidd commented May 8, 2022

Texture import settings can limit the baked texture size. If users specify a resolution in ODC UI, then they would expect the bake to be the same I think. Reported on Discord that baked texture was limited to 2K.

@daleeidd daleeidd added the Bug label May 8, 2022
@daleeidd daleeidd added this to the 4.15.2 milestone May 8, 2022
@daleeidd daleeidd requested a review from huwb May 8, 2022 22:34
daleeidd added 2 commits May 8, 2022 15:35
Texture import settings could restrict size.
@daleeidd daleeidd force-pushed the fix/max-baked-tex-res branch from e586ae7 to 84783b5 Compare May 8, 2022 22:35
@@ -433,6 +433,8 @@ public override void OnInspectorGUI()
ti.wrapMode = TextureWrapMode.Clamp;
// Values are slightly different with NPOT Scale applied.
ti.npotScale = TextureImporterNPOTScale.None;
// Round up so it encompasses desired resolution.
ti.maxTextureSize = Mathf.RoundToInt(Mathf.Pow(2f, Mathf.Ceil(Mathf.Log(dc._resolution, 2f))));
Copy link
Contributor

Choose a reason for hiding this comment

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

may be worth using max(dc._resolution, 1) . i'm not sure if it could ever be 0 in any situation but log() will go haywire if it is

@huwb
Copy link
Contributor

huwb commented May 8, 2022

will approve anyway so you can pull the trigger, thanks

@daleeidd
Copy link
Collaborator Author

Going to defer this one for now. This will fight against the Unity preset system and developers can always do it themselves. Validation could work, but will have to think more about it.

@huwb
Copy link
Contributor

huwb commented May 10, 2022

That's fair

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants