Code Monkey home page Code Monkey logo

meshcombinewizard's Introduction

What does it do?

Running the wizard will combine all the meshes on the chosen Game Object and its children that share the same material. If there is more than a single material in all sub-objects, sub-objects of result will be created so that each corresponds to a single material. A prefab will be created from the combined Game Object in the root of the Assets folder, with all the newly created merged meshes. The original will be set inactive in the scene and the combined Game Object will be put in its position.

How does it work?

Put the provided script in any Editor folder. In the Menu Bar a new entry will appear ("E.S. Tools/Mesh Combine Wizard"). Picking this option will show the wizard dialog. The parent of objects to be combined should be assigned to a filed called combine Parent, which may be auto-assigned based on existing editor selection.

Benefits:

  • Lowers the amount of draw calls, usually dramatically.
  • Does not need to draw all objects in the same batch regardless of wheter they are on screen or not, as opposed to static batching.
  • Does not compromise workflow - no need to merge modular pieces outside Unity in a 3D tool. Quick iteration time when changing the combined design.
  • Works with combined objects that have more than 64k verts.
  • Does not compromise the original object's pivot point.

Known limitations:

  • Does not support objects with multiple materials on submeshes. Such meshes should be split in an external 3D tool, so that there is only a single material per mesh.
  • Does not migrate components from the original other than MeshFilter and MeshRenderer.
  • The default setting is using 32 bit indexes. From https://docs.unity3d.com/ScriptReference/Rendering.IndexFormat.UInt32.html (Note that GPU support for 32 bit indices is not guaranteed on all platforms; for example Android devices with Mali-400 GPU do not support them. When using 32 bit indices on such a platform, a warning message will be logged and mesh will not render.) If the combined mesh has less than 65535 vertices, it is safe to uncheck the 32-bit option in the window (otherwise meshes will be garbled).

Versions:

2.0 - Added proper support for meshes with over 65K verts. Hardened the script and commented for public consumption. 1.0 - Original release

meshcombinewizard's People

Contributors

sirgru avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.