Texture to 3D weapon

For my game I want to use a simillar pixel style weapons as minecraft and I was wondering how he gets the 2D textures and turns them into 3D models in game.

I guessed that I could just create a plane and apply a texture to it. But if anyone has any better ideas please post them

I don’t think he uses planes for weapons. I think they are actually 3D models. (voxels? I dunno)

ive been thinking about that too, i think its just a script that automaticaly turns a texture into a model, take a look at texture packs they are just textures but some of them change the weapons apearence and as you don´t change nor add anything to your game files id say its automated.

Extrude shader might work also?

If you edit a 2d image in minecrafts items.png the “model” changes as well.

Yup, Its probably this, but I still dont know how its done.

Im not sure I understand. Could you go into some more detail?

Made some testing with extrude shader.
(this is using default plane mesh, doesnt look nice with so few vertices)

The shader is based on this, “Normal Extrusion with Vertex Modifier”

That is then modified it to extrude vertices, based on texture color:

Currently its using 2 bitmaps, one for color, one for extrude amount…
(not really need 2, can take extrude from the main image)

Attached 2 images, viewport shader properties

793797--29075--$shader1.jpg

Hmmm. But minecrafts weapons / items have a “top” kind of.

Yup…that might be fixed with better mesh/image,
but would be just easier to build a mesh from bitmap…

check pixel alpha values (x,y),
if its > 0, then add meshpiece…

Good idea, Ill look into that

Using Triangulator and Mesh Extrusion you can build extruded mesh from Vector2 points,
http://forum.unity3d.com/threads/102629-Trying-extrude-a-2d-polygon-to-create-a-mesh

And those vector2D points you can get from pixels, going to try it later also…

I think he proboly uses a script that makes the voxels in the positions of the pixels then makes them the same colours, how he dose it i dont know.

Yep, something like that.

testing…something went wrong with the vertices…but almost : )

(also would need to drop the not needed vertices…)

Nice, are you willing to share the source or explain how you achieved that?

yes, source will be published on my blog later,
but the the link on my previous post does all the hard work. (that 2D polygon to mesh extrude)

Nice :smile:

I hope someone tries different techniques aswell : )

bitmap outline detection works,
just need to combine this to the meshmaker…

screenshot, showing bitmap outline as default boxes:

I would give it a go but I have an extremely limited knowledge of meshes and vertices. I don’t think I would be able to make anything worthwile. However what your doing looks very promising.

Kind of works now… atleast for a start, can add more stuff later.

Need to clean it up a bit, before upload the source,
hopefully in the next few days.

794977--29140--$Untitled-1.jpg

Is the width that the mesh extrudes easily customizable?