Search Unity

3D Mesh from Texture

Discussion in 'Made With Unity' started by longshot, Sep 29, 2010.

  1. longshot

    longshot

    Joined:
    Sep 24, 2009
    Posts:
    71
    Did a small editor utility that takes a texture, then converts it into a Mesh. Should be good for more retro looking games, or for easier placeholder art.

    I will release a version of it in the next few days, once I take care of making it more production ready.

    Thanks for looking.

     
    Last edited: Oct 2, 2010
  2. Caliber-Mengsk

    Caliber-Mengsk

    Joined:
    Mar 24, 2010
    Posts:
    689
    Interesting idea... Would be great for making a 2.5d scroller I would think.
     
  3. Artimese

    Artimese

    Joined:
    Nov 22, 2009
    Posts:
    794
    Quite an interesting idea, I think it should be further taken :p (Omg pixils)
     
  4. Deleted User

    Deleted User

    Guest

    lol that looks awesome. How would you animate the characters though?
     
  5. longshot

    longshot

    Joined:
    Sep 24, 2009
    Posts:
    71
    Thanks, you'd have to have an array of meshes, then swap out the mesh on the mesh renderer to to the frame you want in script.
     
  6. DustyJoel

    DustyJoel

    Joined:
    Sep 25, 2010
    Posts:
    14
    This looks really interesting. I'll keep my eye on this thread...
     
  7. kenlem

    kenlem

    Joined:
    Oct 16, 2008
    Posts:
    1,630
    I'm am always amazed at the clever things Unity users create. Well done!
     
  8. Rush-Rage-Games

    Rush-Rage-Games

    Joined:
    Sep 9, 2010
    Posts:
    1,997
    Looks great!
     
  9. longshot

    longshot

    Joined:
    Sep 24, 2009
    Posts:
    71
    License -


    Documentation -
    After importing the package, select the wizard, it should show up at the bottom of the assets menu.

    1. Drag a texture to the texture box in the wizard. The texture will need to have been imported with read/write enabled to true, and have a format of ARGB32. If it is a non power of 2 texture, make sure to select None under the power of two settings. For importing, your texture settings should look something like this, under the "Advanced" menu.



    2. Set a filename for the mesh that will be created. You don't need an extension.

    3. Set the color you want to mask out, this color will not be converted to 3D Pixels. This defaults to 0,0,0,0 , which works with sprites that have a blank, transparent back ground. For sprites that don't, usually just clicking on the background with the eyedropper tool works fine.

    4. Set the dimensions of the 3D Pixels, if you want fat or deep pixels, or want a smaller mesh, this is the time to set it.

    5. Click the Create button. This will create the mesh, and it will show up in your assets folder.

    6. Drag the mesh into the scene. In order to see the pixel colors, drag the PixelSprite material over it in the scene. I've included two different shaders. The mobile one will not cast shadows.

    Have fun!
     

    Attached Files:

  10. Itchy-Games

    Itchy-Games

    Joined:
    Jul 8, 2009
    Posts:
    221
    WORKS PERFECT!!! the only one problem is the large amount of polys (a 16x31 texture generates a +4000 mesh), but it´s a nice beginning.

    I think there is a better way for optimize this cool utility.
     
  11. longshot

    longshot

    Joined:
    Sep 24, 2009
    Posts:
    71
    Yes, that's one thing I forgot to mention :). When I was originally doing it( the utility was for a game I never finished ), I wanted to have it also generate a bunch of cube attached to rigibodies, so when I shot an enemy they could explode into a big mess of cubes.

    However, it really should check for faces that aren't visible. That would eliminate a decent chunk of polys. To really eliminate most of the polys though, it would have to be done without vertex colors, and it would have to generate a texture.
     
  12. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,769
  13. BakedPot8o

    BakedPot8o

    Joined:
    Jan 26, 2019
    Posts:
    1
    Not working anymore, shows change to ARGB32 format but now there's no such thing and it doesn't work if its rgba32.
    Trying to update the scrpit.
     
  14. Seromu

    Seromu

    Joined:
    Nov 30, 2015
    Posts:
    34
    mgear likes this.