{
  "schemaVersion": "0.11.0",
  "canonical": "https://www.pystone.net/notes/uwa-answer-mesh-memory-usage/",
  "atlas": "https://www.pystone.net/?node=uwa-answer-mesh-memory-usage#knowledge-atlas",
  "markdown": "https://www.pystone.net/notes/uwa-answer-mesh-memory-usage.md",
  "context": "https://www.pystone.net/notes/uwa-answer-mesh-memory-usage.context.json",
  "knowledgeVersion": "224c990773de.5fa8af6e39fa",
  "build": {
    "siteCommit": "224c990773de166d23a886306577dd90379529ce",
    "notesCommit": "5fa8af6e39fa3891d1b9b4832bfa6c4e0ecaaf0a",
    "builtAt": "1970-01-01T00:00:00.000Z",
    "version": "224c990773de.5fa8af6e39fa"
  },
  "id": "note:uwa-answer-mesh-memory-usage",
  "slug": "uwa-answer-mesh-memory-usage",
  "title": "关于mesh占用内存的问题",
  "type": "note",
  "visibility": "public",
  "idStability": "rename-stable",
  "author": {
    "name": "石心.Yong"
  },
  "publisher": {
    "name": "Perrin Yong",
    "profile": "https://www.pystone.net/profile/"
  },
  "aliases": [],
  "summary": "关于mesh占用内存的问题",
  "contentRole": "source",
  "sourceType": "source",
  "sourceMetadata": {
    "author": "石心.Yong"
  },
  "isMoc": false,
  "mocRecognition": "none",
  "generated": false,
  "attribution": "external_source",
  "domain": "10-计算机、信息技术与工程",
  "tags": [],
  "mocs": [],
  "contentHash": "00217798323bb13fd5afdb03b4627022ef0401d291667d6a079f2992dc09d4e6",
  "assets": [
    {
      "reference": "assets/6088d9dc6bb31032f979147e/01.png",
      "url": "/media/f8f7727e82e4d525e4af.png",
      "mediaType": "image/png",
      "contentHash": "f8f7727e82e4d525e4af7b94244b014f46f5767165de6d09b1479997715bb152",
      "byteLength": 28656,
      "width": 414,
      "height": 415
    },
    {
      "reference": "assets/6088d9dc6bb31032f979147e/02.png",
      "url": "/media/cc424694cead57931a4f.png",
      "mediaType": "image/png",
      "contentHash": "cc424694cead57931a4fc7db790396ea465f1c49f2d7bae3f9d1bca7ce4b9d1d",
      "byteLength": 22605,
      "width": 409,
      "height": 334
    },
    {
      "reference": "assets/6088d9dc6bb31032f979147e/03.png",
      "url": "/media/99ad1a5c8aac423c9659.png",
      "mediaType": "image/png",
      "contentHash": "99ad1a5c8aac423c965968dba1758c54d5bef281f99755c596a6337fbf1e7d79",
      "byteLength": 23125,
      "width": 770,
      "height": 190
    },
    {
      "reference": "assets/6088d9dc6bb31032f979147e/04.png",
      "url": "/media/4aab08c1db594108591c.png",
      "mediaType": "image/png",
      "contentHash": "4aab08c1db594108591c36cef5e3c4377ea30ba2db6bea4690019a6dc7f35e87",
      "byteLength": 10463,
      "width": 660,
      "height": 171
    },
    {
      "reference": "assets/6088d9dc6bb31032f979147e/05.png",
      "url": "/media/f93972e52b8c40847f44.png",
      "mediaType": "image/png",
      "contentHash": "f93972e52b8c40847f44946910b5d94c1650154aaf9778506f97e83de9541d13",
      "byteLength": 18876,
      "width": 383,
      "height": 412
    },
    {
      "reference": "assets/6088d9dc6bb31032f979147e/06.png",
      "url": "/media/30a2a2d1bf57936a1b54.png",
      "mediaType": "image/png",
      "contentHash": "30a2a2d1bf57936a1b54a582437bb8a82fa4da45a6fa7ff8339ad00eb01477a4",
      "byteLength": 8968,
      "width": 424,
      "height": 167
    },
    {
      "reference": "assets/6088d9dc6bb31032f979147e/07.png",
      "url": "/media/df96af4c7fc07d9f5cff.png",
      "mediaType": "image/png",
      "contentHash": "df96af4c7fc07d9f5cff6217d803eaad7f4c23e23419b5300a7c414aa7355494",
      "byteLength": 8870,
      "width": 275,
      "height": 185
    }
  ],
  "headings": [
    {
      "depth": 1,
      "text": "关于mesh占用内存的问题",
      "anchor": "关于mesh占用内存的问题",
      "citation": "https://www.pystone.net/notes/uwa-answer-mesh-memory-usage/#%E5%85%B3%E4%BA%8Emesh%E5%8D%A0%E7%94%A8%E5%86%85%E5%AD%98%E7%9A%84%E9%97%AE%E9%A2%98"
    },
    {
      "depth": 2,
      "text": "问题",
      "anchor": "问题",
      "citation": "https://www.pystone.net/notes/uwa-answer-mesh-memory-usage/#%E9%97%AE%E9%A2%98"
    },
    {
      "depth": 2,
      "text": "我的回答",
      "anchor": "我的回答",
      "citation": "https://www.pystone.net/notes/uwa-answer-mesh-memory-usage/#%E6%88%91%E7%9A%84%E5%9B%9E%E7%AD%94"
    },
    {
      "depth": 2,
      "text": "来源与关系",
      "anchor": "来源与关系",
      "citation": "https://www.pystone.net/notes/uwa-answer-mesh-memory-usage/#%E6%9D%A5%E6%BA%90%E4%B8%8E%E5%85%B3%E7%B3%BB"
    }
  ],
  "claims": [],
  "outgoing": [
    {
      "id": "note:my-uwa-answers",
      "title": "我的 UWA 问答",
      "url": "https://www.pystone.net/notes/my-uwa-answers/",
      "atlas": "https://www.pystone.net/?node=my-uwa-answers#knowledge-atlas",
      "label": "我的 UWA 问答",
      "origin": "explicit",
      "humanReviewed": true,
      "context": "上位集合：我的 UWA 问答",
      "citation": "https://www.pystone.net/notes/uwa-answer-mesh-memory-usage/#%E6%9D%A5%E6%BA%90%E4%B8%8E%E5%85%B3%E7%B3%BB"
    }
  ],
  "incoming": [
    {
      "id": "note:my-uwa-answers",
      "title": "我的 UWA 问答",
      "url": "https://www.pystone.net/notes/my-uwa-answers/",
      "atlas": "https://www.pystone.net/?node=my-uwa-answers#knowledge-atlas",
      "label": "我的 UWA 问答",
      "origin": "explicit",
      "humanReviewed": true,
      "context": "2021-04-28：关于mesh占用内存的问题（资源管理）",
      "citation": "https://www.pystone.net/notes/my-uwa-answers/#2021"
    },
    {
      "id": "note:game-graphics-and-runtime",
      "title": "游戏图形与运行时",
      "url": "https://www.pystone.net/notes/game-graphics-and-runtime/",
      "atlas": "https://www.pystone.net/?node=game-graphics-and-runtime#knowledge-atlas",
      "label": "游戏图形与运行时",
      "origin": "explicit",
      "humanReviewed": true,
      "context": "我的UWA问答中的“2021-04-28 - 关于mesh占用内存的问题”导航项",
      "citation": "https://www.pystone.net/notes/game-graphics-and-runtime/#%E6%88%91%E7%9A%84uwa%E9%97%AE%E7%AD%94"
    }
  ],
  "contentMarkdown": "# 关于mesh占用内存的问题\n\n> [!note] 我的 UWA 问答\n> 本文收录我在 UWA 问答发表的公开回答。问题内容归原提问者；回答保留当时语境，技术结论可能受 Unity 版本、平台和项目条件限制。\n\n## 问题\n\n在unity2020中能看见mesh中包含那些信息：\n\n![image.png](assets/6088d9dc6bb31032f979147e/01.png)\n\n（导入骨骼）\n\n这里如果不导入骨骼的话，顶点信息占用空间会减少一倍，请问导入骨骼后顶点信息增加了什么\n\n![image.png](assets/6088d9dc6bb31032f979147e/02.png)\n\n（未导入骨骼）\n\n然后是第二个问题，在导入骨骼的情况下内存中这个mesh占用了0.6m刚好差不多是上面inspector中显示的两倍，做过其他模型的测试也是两倍\n\n![image.png](assets/6088d9dc6bb31032f979147e/03.png)\n\n本来以为是开启read/write Enabled的问题，但是发现开不开起这个选项占用内存都不变。这个内存占用是怎么来的，开启read/write Enabled是否具体会造成两倍的内存开销\n\n- 提问者：正二八经\n- 提问时间：2021-04-28 19:43:24\n\n## 我的回答\n\n第一个问题：\n\nInspector面板的Vertices一栏指的是Mesh的顶点属性（或通道），如果该Mesh包含某个通道的数据，就意味着每个顶点都有一份该顶点属性。\n\n![image.png](assets/6088d9dc6bb31032f979147e/04.png)\n\n而Unity定义的顶点通道一共有14个：\n\n![image.png](assets/6088d9dc6bb31032f979147e/05.png)\n\n如果导入了骨骼，多出来的顶点属性是顶点的骨骼权重和骨骼索引。\n\n![image.png](assets/6088d9dc6bb31032f979147e/06.png)\n\n可通过Mesh.boneWeights()和Mesh.GetBonesPerVertex()访问。\n\n而一个BoneWeight属性存了4个float32和4个int32，一共8x4=32bytes。一个Bones index是一个byte。\n\n![image.png](assets/6088d9dc6bb31032f979147e/07.png)\n\n(8x4+1)byte/vert x 5512vert = 177.63KB\n\n###\n\n- 回答时间：2021-04-28 22:49:17\n- 最后更新：2021-04-28 23:03:56\n- 采纳状态：已采纳\n\n## 来源与关系\n\n- 上位集合：[[10-计算机、信息技术与工程/05-游戏图形与运行时/我的UWA问答/我的UWA问答|我的 UWA 问答]]\n- UWA 标签：资源管理\n- 原始问题：[关于mesh占用内存的问题](https://answer.uwa4d.com/question/6088d9dc6bb31032f979147e)\n- 源页最后更新：2021-11-20 22:28:02\n"
}
