Md2 to json converter
Tried to make a simple little “webapp” that converts Md2 models(the old quake 2 model format) into the json format(version 3) that is used by three.js.
You simply open the page, and then drag and drop a *.md2 file and it will be converted and a preview of the mesh should appear. You can then drag and drop jpg/png images for the texture to be previewed as well.
Left click and drag to rotate, right click and drag to move. Scrollwheel to zoom.
If it looks ok, enter a filename and hit “Save”.
It should now be downloaded(in Chrome at least, Firefox opens it in a new window).
You can then load in the json files into your three.js projects and use them as morphTargets.
MD2 to JSON Converter (a model to test with, if you don’t have one)
Example of converted model as morphTarget
I have only tested this in Chrome and Firefox, so not sure if it works anywhere else. Mostly done as an exercise for myself to understand the format, drag and drop and filehandling etc. But might be useful to someone else out there.
Edit (Mar 08, 2012): Looks like I had the exporter output a horizontally flipped model, should be fixed now. Thanks to @alteredq for letting me know.
Edit (May 11 2013): Updated it to export to the latest format(3.1).
Edit (Feb 10 2014): Fixed it, was broken due to some webgl changes in recent browsers.
13 Comments
Leave a comment
-
Some more exploration with tubes/cables. Could also be a 3d visualization of the blueprint that generates it... #UE4 https://t.co/5kbOLzMP1D
-
A test to procedurally generate some random cables between points in #UE4. Saw someone doing something similar, but… twitter.com/i/web/status/1…
-
The amount of packages, dependencies, plugins, command lines, config files, jargon & documentation required before… twitter.com/i/web/status/1…
-
Introducing Blob Opera, an experiment I created for Google Arts & Culture: g.co/blob-opera https://t.co/UYbZH8jXE2
-
More #UE4 ray tracing, testing the caustics stuff in Nvidias RTX branch: youtube.com/watch?v=4fqU6a…
Categories
Blogroll
- actionscript microcosmos
- Alternativa Platform blog
- Andre Michelle
- Antti Kupila
- Ars Thanea Blog
- astatic notes
- b-log – betriebsraum weblog
- betaruce
- blog-o-fobik
- blog.joa-ebert.com
- Cheezeworld
- Chris O'Shea
- Coding Cowboys
- CreativeApplications.Net
- Darren Richardson
- Dead End Thrills
- Designchapel
- Everyday Flash
- Everything Visual
- flash platform!
- franto.com
- gaming your way – blog
- gBlog
- generalrelativity
- generalrelativity
- Keeping track of myself
- KevLinDev Blog
- lessrain blog
- metablog
- Mike Chambers
- MoiK78 blog
- moockblog
- neurofuzzy
- North Kingdom
- Over Here
- Peter Elst
- peter nitsch.net
- Photon Storm
- PICNIC WITH PANIC
- pixelbreaker
- pixelconsumption
- Play with Motion
- polygonal labs
- Power-up Media Blog
- Quasimondo
- Razorberry's Adobe Flash Blog
- RIAgora
- ricardo cabello
- Simon Wacker
- simppa.fi/blog
- Sönke Rohde
- The efnx code blog
- toxi.in.process
- trace(myBitmapdata);
- UnitZeroOne
- w3blog
Archives
- December 2020
- December 2019
- December 2018
- September 2018
- December 2017
- November 2017
- December 2016
- December 2015
- December 2014
- December 2013
- May 2013
- April 2013
- December 2012
- July 2012
- June 2012
- January 2012
- December 2011
- October 2011
- December 2010
- December 2009
- January 2009
- December 2008
- December 2007
- June 2007
- February 2007
- December 2006
- October 2006
- September 2006
- August 2006
- June 2006
- December 2005
- October 2005
- September 2005
- August 2005
- March 2005
- December 2004
- November 2004
- October 2004
- September 2004
- August 2004
- June 2004
- April 2004
- March 2004
- December 2003
- September 2003
- August 2003
- July 2003
- May 2003
- April 2003
- February 2003
- January 2003
- December 2002
- November 2002
Awesome!
I tested it with some models from
http://telias.free.fr/Models_menu.html
They came in just fine…
Thanks a lot for this amazing tool!
Could you please let me know where you get the MD2 models? looking for a place I can get few for free or buy.
Glad you find it useful! :)
It´s a really old format so it´s not used much nowadays.
But there are some models still around.
The most obvious is Planet Quake: http://planetquake.gamespy.com/View.php?view=Quake2.List&game=5&category_select_id=3
This one got a few: http://www.md2.sitters-electronics.nl/models.html
Some fangame that got a few: http://mb.srb2.org/forumdisplay.php?s=6b3f4a9fd6558d6393ef62f56adfc92a&f=72
I guess you could also use something like Milkshape 3d( http://chumbalum.swissquake.ch/ ) to convert between other formats. I think Md2 models had like a 4k polycount limit or something though.
When i download it with Firefox, it’s saved like “name.part” file. Why i can’t save it like .js? It’s only a .part file
Not sure why that is, I guess it´s just the way Firefox handles these “blobs” differently. But all the data is there and you can just rename the *.part-file to “whatever.js”.
I’ve got an issue with a two-materials model (a single texture seems to be used for the whole model), is it possible to convert it from md2 to json using your tool ?
You mean two textures are used on a single model? Do you have an example of such a model somewhere? Might be better to go with the three.js blender pipeline for such a model though.
This is really awesome work.
Do you think it’s possible to convert the normal indexes to the json format ?
I guess what you are after is something like this that is already in three.js by now:
https://github.com/mrdoob/three.js/blob/master/src/core/Geometry.js#L305
So you could just load the model and then do geometry.computeMorphNormals();
This example might be helpful: http://mrdoob.github.com/three.js/examples/webgl_morphnormals.html
Or did you mean something else?
Yes, you’re right there’s no need to used the pre-computed values.
Thanks
I’ve tried to use the converter under different versions of Three.js and since r50 the texture mapping fails as the mapping vertices seem to be wrong.
Do you have any idea of what has changed in Three.js since r50 that might have caused the problem ?
Yes, I think something with the texture-flipping changed in Three.js. Between 3.0 and 3.1 of the json-format: https://github.com/mrdoob/three.js/wiki/JSON-Model-format-3.1
I´ll see if I have time to change the converter to output v 3.1 instead, should be an easy fix.
In the meantime you could probably set texture.flipY = false;
You’re right the flipY trick worked just fine.