Comments (5)
case TextureFormat.R8:
return 8;
case TextureFormat.R16:
return 16;
case TextureFormat.BC4:
return 16;
case TextureFormat.BC5:
return 8;
case TextureFormat.BC7:
return 8;
case TextureFormat.RFloat:
return 32;
case TextureFormat.RG16:
return 16;
case TextureFormat.RG32:
return 32;
case TextureFormat.RHalf:
return 16;
case TextureFormat.BC6H:
return 8;
case TextureFormat.RGB48:
return 16;
case TextureFormat.RGFloat:
return 32;
case TextureFormat.RGHalf:
return 16;
case TextureFormat.EAC_R:
return 4;
case TextureFormat.RGBA64:
return 16;
case TextureFormat.EAC_RG:
return 4;
case TextureFormat.RGBAFloat:
return 32;
case TextureFormat.RGBAHalf:
return 16;
case TextureFormat.ETC2_RGB:
return 4;
case TextureFormat.ETC2_RGBA1:
return 4;
case TextureFormat.ETC2_RGBA8:
return 8;
case TextureFormat.EAC_R_SIGNED:
return 4;
case TextureFormat.EAC_RG_SIGNED:
return 8;
from unity-resource-checker.
int CheckIsBlock(TextureFormat format)
{
switch (format)
{
case TextureFormat.ASTC_HDR_4x4:
return 16;
case TextureFormat.ASTC_HDR_5x5:
return 25;
case TextureFormat.ASTC_HDR_6x6:
return 36;
case TextureFormat.ASTC_HDR_8x8:
return 64;
case TextureFormat.ASTC_HDR_10x10:
return 100;
case TextureFormat.ASTC_HDR_12x12:
return 144;
case TextureFormat.ASTC_4x4:
return 16;
case TextureFormat.ASTC_5x5:
return 25;
case TextureFormat.ASTC_6x6:
return 36;
case TextureFormat.ASTC_8x8:
return 64;
case TextureFormat.ASTC_10x10:
return 100;
case TextureFormat.ASTC_12x12:
return 144;
}
return 0;
}
from unity-resource-checker.
int tWidth = tTexture.width;
int tHeight = tTexture.height;
if (tTexture is Texture2D)
{
Texture2D tTex2D = tTexture as Texture2D;
if (CheckIsBlock(tTex2D.format) == 0)
{
int bitsPerPixel = GetBitsPerPixel(tTex2D.format);
int mipMapCount = tTex2D.mipmapCount;
int mipLevel = 1;
int tSize = 0;
while (mipLevel <= mipMapCount)
{
tSize += tWidth * tHeight * bitsPerPixel / 8;
tWidth = tWidth / 2;
tHeight = tHeight / 2;
mipLevel++;
}
return tSize;
}
else
{
int bitsPerBlock = CheckIsBlock(tTex2D.format);
int tSize = tWidth * tHeight / bitsPerBlock * 128 / 8;
return tSize;
}
}
if (tTexture is Texture2DArray)
{
Texture2DArray tTex2D = tTexture as Texture2DArray;
if (CheckIsBlock(tTex2D.format) == 0)
{
int bitsPerPixel = GetBitsPerPixel(tTex2D.format);
int mipMapCount = 10;
int mipLevel = 1;
int tSize = 0;
while (mipLevel <= mipMapCount)
{
tSize += tWidth * tHeight * bitsPerPixel / 8;
tWidth = tWidth / 2;
tHeight = tHeight / 2;
mipLevel++;
}
return tSize * ((Texture2DArray)tTex2D).depth;
}
}
else
{
Texture2DArray tTex2D = tTexture as Texture2DArray;
int bitsPerBlock = CheckIsBlock(tTex2D.format);
int tSize = tWidth * tHeight / bitsPerBlock * 128 / 8;
return tSize * ((Texture2DArray)tTex2D).depth;
}
from unity-resource-checker.
Hi, this seems interesting, however could you try to clarify/synthesize your different posts ?
from unity-resource-checker.
Hi, I don't remember very well anymore, the problem was calculating the size of textures. In this case, the build was for android, ASTC texture formats (automatic most optimal choice of unity). For them, I manually added the counting function (in the existing code) based on my observations and approximate understanding of the documentation. The weight of the sprites practically reflected reality, although there were small discrepancies.
from unity-resource-checker.
Related Issues (10)
- Exception when material does not have "_MainTex" property
- Null Check on AnimationClips
- Update Asset Store? HOT 1
- Error CS0246 in Unity 5.3.6f1 HOT 1
- Compile errors on Unity 2017.4.2f2 with v2.1 HOT 5
- Calculating Crunched Textures
- copy-paste error:the second lightmapColor should be lightmapDir
- T is not a Unity Component
- Multiple Scenes in Hierarchy with only one loaded throws "scene not loaded" HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unity-resource-checker.