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
TehWut
January 8, 2012, 4:28pm
2
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.
mgear
January 8, 2012, 5:23pm
4
Extrude shader might work also?
If you edit a 2d image in minecrafts items.png the “model” changes as well.
StormGamer:
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.
Yup, Its probably this, but I still dont know how its done.
Im not sure I understand. Could you go into some more detail?
mgear
January 8, 2012, 7:56pm
6
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
mgear:
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”
http://unity3d.com/support/documentation/Components/SL-SurfaceShaderExamples.html
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
Hmmm. But minecrafts weapons / items have a “top” kind of.
mgear
January 8, 2012, 8:57pm
8
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
mgear
January 9, 2012, 7:37am
10
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.
mgear
January 9, 2012, 12:21pm
13
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?
mgear
January 9, 2012, 12:44pm
15
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)
mgear
January 9, 2012, 3:33pm
17
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:
mgear:
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.
mgear
January 9, 2012, 6:43pm
19
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.
Is the width that the mesh extrudes easily customizable?