Skip to content

Commit

Permalink
Fix baked texture size limit
Browse files Browse the repository at this point in the history
Texture import settings could restrict size.
  • Loading branch information
daleeidd committed May 8, 2022
1 parent 1203189 commit 15ab420
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions crest/Assets/Crest/Crest/Scripts/LodData/OceanDepthCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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))));
ti.SaveAndReimport();

Debug.Log("Crest: Cache saved to " + path, AssetDatabase.LoadAssetAtPath<UnityEngine.Object>(path));
Expand Down

0 comments on commit 15ab420

Please sign in to comment.