再推薦一個(gè) 剖切 工具包(更多同類(lèi)型的倉(cāng)庫(kù)見(jiàn)本文擴(kuò)展閱讀)。切西瓜嘛,測(cè)試一下這個(gè)玩意唄~
GitHub 上的工程多如繁星,有些好的倉(cāng)庫(kù),但凡不經(jīng)意間錯(cuò)過(guò)了就很難找回,故稍作采擷,希望能幫助到有心人。
簡(jiǎn)介:
筆者今天推薦的倉(cāng)庫(kù)叫 EzySlice。 - 便捷剖切工具

功能:
- Ability to slice any convex Mesh using a Plane
- 支持使用一個(gè)面片對(duì)任意的 Convex Mesh 進(jìn)行剖切。 - UV/Normal/Tangent Space Interpolation for seamless cuts
- UV / Normal / Tangent Space插值,用于無(wú)縫切割 - Flexible and Documented API
- 靈活且文檔化的API - No external plugin dependencies, fully written in C#
- 無(wú)需外部拆件支持,全部使用 C# 實(shí)現(xiàn) - Updated for Unity3D 2018
- 支持到 Unity 2018 - MIT Open Source License
-使用 MIT 開(kāi)源協(xié)議
使用:
倉(cāng)庫(kù)作者提供的示例:https://github.com/DavidArayan/EzySlice-Example-Scenes
下面這兩個(gè)示例告訴你如何使用 貼圖 和 材質(zhì)球的API 。
如何使用貼圖
/**
* Example on how to calculate a custom TextureRegion to reference a different part of a texture
*
* px -> The start X Position in Pixel Coordinates
* py -> The start Y Position in Pixel Coordinates
* width -> The width of the texture in Pixel Coordinates
* height -> The height of the texture in Pixel Coordinates
*/
public TextureRegion CalculateCustomRegion(Texture myTexture, int px, int py, int width, int height) {
return myTexture.GetTextureRegion(px, py, width, height);
}
如何使用材質(zhì)球
/**
* Example on how to calculate a custom TextureRegion to reference a different part of a texture
* This example will use the mainTexture component of a Material
*
* px -> The start X Position in Pixel Coordinates
* py -> The start Y Position in Pixel Coordinates
* width -> The width of the texture in Pixel Coordinates
* height -> The height of the texture in Pixel Coordinates
*/
public TextureRegion CalculateCustomRegion(Material myMaterial, int px, int py, int width, int height) {
return myMaterial.GetTextureRegion(px, py, width, height);
}
演示:
略
鏈接:
DavidArayan/ezy-slice: An open source mesh slicer framework for Unity3D Game Engine. Written in C#.
結(jié)語(yǔ):
- 這個(gè)倉(cāng)庫(kù)還在持續(xù)更新,且倉(cāng)庫(kù)作者許諾會(huì)有更多的示例出來(lái),喜歡的可以關(guān)注下。
- 這個(gè)功能可以用在所以涉及到剖切功能的場(chǎng)景。切西瓜,且 齒輪,切淫(ren),都行。
擴(kuò)展閱讀:
-
mattatz/unity-mesh-slicing: View-aligned mesh slicing for Unity.
-
Dandarawy/Unity3DCrossSectionShader: CG shader for unity3D to create a cross section through meshes - 通過(guò)shader實(shí)現(xiàn)的剖切
[Unity 3d] SplitMesh(運(yùn)行時(shí)Mesh切割) - GitHub - 簡(jiǎn)書(shū) - 往期推薦
-
-
NobleMuffins/LimbHacker: Limb Hacker cuts skinned mesh characters in Unity3D.
-
toninhoPinto/MeshSlicingRunTime
cut.gif
本文集持續(xù)更新ing,喜歡記得點(diǎn)贊關(guān)注哦!




