Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

CuHe - convert image to mesh

Discussion in 'Made With Unity' started by Tiles, Nov 12, 2014.

  1. Tiles

    Tiles

    Joined:
    Feb 5, 2010
    Posts:
    2,481
    What is it? CuHe is a one trick tool, made with Unity free. It creates some kind of a heightmap mesh from a source image, which can be saved as a 3D object in Obj format then. But not one vertice per pixel, but one cube per pixel. Something like a cubic heightmap. That’s where the name comes from CUbic HEightmap. Note, greyscale images are ideal. But you can also use coloured images. But beware, only the red channel gets used for calculation.

    It is freeware, Open Source, Windows only. And works with Jpeg and PNG only.

    The project page with the downloads can be found here: http://www.reinerstilesets.de/programme/2014-cuhe/

    The intention of this tool was to save me the work with manually sweeping out meshparts to create a level mesh with sharp cliffs. The tool doesn't do the whole work, you still have to finish the levelmesh in a 3D software then, but it saves me quite a few hours. And it was a learning experience for me in more than one area. Having a proper windows file dialog working is a good starting point for further tools.

    But not only the tool itself may be interesting for you. I made it open source under the MIT license, the Unity project file is available at my project page too. It is currently made with Unity 4.6 RC1. I will update the project file once 4.6 final comes out. And i will most probably port it over to Unity 5 too.

    Having the project file available makes it a good example project. Means you can have a look at how the menu is made, it is using the new Unity menu, how the Windows file browser is implemented. How the mesh creation happens. How the whole export as obj works. And you can reuse the code however you need it.

    It is even made in both available Unity languages. Unity JS and C#. So when you come from Unity JS then you can have a look at the JS code, and when you come from C#, then you can have a look at the C# code.

    I hope it is of use for some :)

     
    Last edited: Nov 27, 2014
  2. Tiles

    Tiles

    Joined:
    Feb 5, 2010
    Posts:
    2,481
    Updated to latest Unity 4.6 release. Means the development is finished. And the two additional Unity project folders where you can have a look at the code are gold now too.