Wireframe Mesh Creator
Last updated
Last updated
Wireframe Mesh Creator tool allows generating mesh with wireframe data baked inside it, directly inside Unity Editor.
Tool is available from the Main Toolbar → Window → Amazing Assets → Wireframe Shader menu:
For generating wireframe data and baking them inside meshes, simply drag and drop them from Hierarchy or Project windows here. Drag and drop supports not only meshes but prefabs and even entire folders. Additionally meshes can be added using Add Selected and Add Custom Prefab buttons.
After adding meshes to the conversion list, click on the Run button.
Tool will calculate wireframe data for selected meshes, generates new mesh files with wireframe data baked inside it, sets up new prefabs for them with wireframe material and instantiates them in the scene in the same position as the source objects (if source object exists in the currently opened scene).
Normalize Edges - Mesh wireframe data is calculated per-triangle and depending on a mesh, visual size of the wirefame edges may be different for each triangle. This effect can be noticeable when using Thickness property inside wireframe materials. By enabling Normalize Edges toggle, wireframe baking algorithm will try to make edges of a wireframe same size as much as possible.
Try Quad - By default wireframe is calculated and render per-triangle and it always has a triangle shape. By enabling Try Quad toggle, mesh wireframe will be calculated per-quad. However this is a pure approximation and final quad wireframe's quality completely depends on the mesh vertex/triangle layout. Disabling Normalize Edges when baking quads, in some cases can render better wireframe.
Editor tool after generating wireframe data saves it in 3 type of objects:
Prefab - Editor tool generates wireframe meshes and materials. Then duplicates source object from the conversion list and based on it creates new prefab file. All meshes in the MeshFilter and SkinnedMeshRenderer components of this prefab are replaced with newly generated wireframe meshes. And all materials in the Renderer components are replaced with new wireframe materials. If source object is part of the scene, then this prefab is instantiated in the same place in the scene as the source object.
Mesh Only - Editor tool generates only mesh file with wireframe data baked inside it. Without creating prefab and materials.
Overwrite Original Mesh - If the source mesh file is in an .asset format then Editor tool can bake wireframe data directly inside it, without creating any additional files. Overwritten meshes can't be Undo.
Combine option allows merging generated meshes to have only one submesh (this allows mesh to be rendered using just one draw call) or even merge almost all meshes in source object hierarchy.
If Full Hierarchy combine is selected, then using Mesh Index option can be selected generated mesh's index format, that can be 16 bit (supports up to 65,535 vertices in a mesh), or 32 bit (supports up to 4 billion vertices).
If 16 Bits is selected and combined mesh vertex count exceeds 65,535, then mesh is automatically split.
For generated mesh Editor tool offers several material creation methods:
Use Original - New material asset is not created and generated prefab uses material from the source object.
Create New - Creates new material asset using selected shader.
Create Duplicates - Creates new material asset using selected shader and copies properties from the source object material there.
Make sure selected shader is capable of reading wireframe data from a mesh and render it.
Mesh Format - Generated mesh file is saved in Unity's default .asset format. Currently no other mesh formats are supported.
Compression - Allows reducing generated file size by lowering numerical accuracy of a mesh. Instead of 32-bit floats, lower size fixed number will be used to represent mesh data.
Note, more compression introduces more artifacts in vertex data (position, normal, uv, etc.).
Components - By default generated mesh has all components that are available in the source mesh. Using this option unwanted components can be excluded from the generated mesh and file size will be reduced.
Prefab Flags - Overrides generated prefab’s flag.
Name - Adds prefix & suffix to the all generated files names (mesh, material, prefab).
Location - Generated files save location. Can be any folder on the hard drive, inside or outside of a project.