Blender MDL export

Discuss the creation of various model formats for Quake engines, and related matters to modeling.
ShoTro
Posts: 61
Joined: Tue Mar 18, 2008 2:46 pm
Location: Virginia, USA

Post by ShoTro »

Might be a stupid question, but is there any import for Quake MDL format models in Blender 3d?

Update: Nevermind, did a DXF export from qMe and then imported into blender just fine. A single frame is all I needed.

Does anyone know if the script ignores bones and just collects the mesh data? (Sorry at work, can't test anything too critical right now)

And does anyone have a link to the Quake1 color palette? Just the palette. Preferably in a format gimp can use.
leileilol
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Post by leileilol »

ShoTro wrote:Might be a stupid question, but is there any import for Quake MDL format models in Blender 3d?
You could convert a MDL to MD2 or MD3 then import that
i should not be here
ShoTro
Posts: 61
Joined: Tue Mar 18, 2008 2:46 pm
Location: Virginia, USA

Post by ShoTro »

leileilol wrote:
ShoTro wrote:Might be a stupid question, but is there any import for Quake MDL format models in Blender 3d?
You could convert a MDL to MD2 or MD3 then import that
But how? The issue is I can't seem to find any practical export from MDL. I thought Milkshape would have a way to open MDL so I could export as MD2, but it doesn't.

That is the issue, how do I actually import MDL into anything other then qMe or Meddle (sp?) to export as something Blender can use? Currently my export options are simply DFX or CAD on a frame by frame basis.
leileilol
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Post by leileilol »

unfortunately I have to use this crappy program to convert to and fro mdl :(, because of this program's naggy existence it doesn't seem to encourage mdl tool development.
i'm sick of working with what crappy tools there are
i should not be here
Dr. Shadowborg
InsideQC Staff
Posts: 1120
Joined: Sat Oct 16, 2004 3:34 pm

Post by Dr. Shadowborg »

ShoTro wrote: And does anyone have a link to the Quake1 color palette? Just the palette. Preferably in a format gimp can use.
Here's the one I use with paint shop pro, dunno if gimp can handle .pal files or not:

http://tlb.quakedev.com/files/unsupported/q1.pal
ShoTro
Posts: 61
Joined: Tue Mar 18, 2008 2:46 pm
Location: Virginia, USA

Post by ShoTro »

Hey thanks Dr. Shadowborg and Leileilol. For the palette there was a converter out there so I got it working pretty fast. I am trying to figure out how the best way to import would be, frame by frame seems to work fine for what I am doing since I am looking at the characters geometry and scale Vs my models, and would like to modify existing creatures into new ones.

I have been working with the exporter, took a bit of tweeking to get it to work, but can now see what all I can do with it... even if it is exporting frames then recompiling them using qMe or something, just that blender is SO much easier to work with.

Also, you can use a skeleton with the models, just requires that you "make real" the pose you currently are on. Meaning, you need to have a base model then pose each frame, then make the pose real to the verts. I need to work on this a bit more, maybe there is a way to animate then convert each locked frame for the verts.

Not sure why, but I keep getting a warning that I am exceeding the number of verts on the original (minus a few verts) zombie model. Not sure what is going on.

Update 1: Actually did a "by hand" conversion of the palettes. Took like two seconds, I will post a link as soon as I get home. The converter was changing some values.

Update 2: Apparently when exporting a frame in qMe to DXF format it creates about 10 copies of the verts... doing a remove doubles on the verts in Blender3D fixes the problem with the verts, but not the 10 frames of animation with the export script. Might be the DFX format, need to test that. Or is that the default script doing that? What format is the script in?

Update 3: Quark does an excellent job of exporting to Quake 2 format so that Blender can read the files. Not sure why I am getting memory address errors in qMe when viewing it after export (fixed it), but viewing in most other applications seem to work fine.

Using Paint.net and a PCX Plug-in (http://paintdotnet.forumer.com/viewtopic.php?t=2493) to convert the Quake 2 skin into a PNG for use in blender. Works perfectly.

Image
The result: ready to reanimate/edit/skin quake1 models.

Update 4: Gimp Palette (drop into the palette directory in the Gimp/share folder)
ShoTro
Posts: 61
Joined: Tue Mar 18, 2008 2:46 pm
Location: Virginia, USA

Post by ShoTro »

Ok, sorry about the double post, but the in terms of using blender for animations I have noticed that Shape Keys are used and not the IPO driver.

So I am guessing right now, but it seems like you CAN model in blender and use a skeleton based animation, then assign Shape Keys per frame for the model. This will augment the mesh per frame to fit as it is when the skeleton is set as a modifier (make real). You need to assign a Shape Key while in Edit Mode after posing the model.

I am having a couple issues right now with this but it seems like the process of modeling for Quake one as a whole seems like it might be easier then anticipated.

Importing and exporting seems to be very easy, once you get the hang of it using Quark along with the export script, and doing all the work in Blender3D definitely speeds the modeling and skinning processes up a lot.
Shoot everything that moves. When it stops moving shoot it again just for good measure.
ShoTro
Posts: 61
Joined: Tue Mar 18, 2008 2:46 pm
Location: Virginia, USA

Post by ShoTro »

Yeah, me again.

Why is it when I import from MD3 format I get the error:

"Vertex UV not supported- use Sticky UV"?

Also I found a script that converts Armature animations into Shape Keys.

Code: Select all

#To Add the currently deformed mesh as new Shape key.
#Disable interactive display of subsurf modifier before running this script.

import Blender
Blender.Window.EditMode(0)

ob = Blender.Scene.getCurrent().objects.active
mesh = ob.getData(mesh=1)

defmesh = Blender.Mesh.New()
defmesh.getFromObject(ob.name)

if not mesh.key:
    mesh.insertKey()

for i in range(len(defmesh.verts)):
    mesh.verts[i].co.x = defmesh.verts[i].co.x
    mesh.verts[i].co.y = defmesh.verts[i].co.y
    mesh.verts[i].co.z = defmesh.verts[i].co.z

mesh.insertKey()
defmesh.verts = None
I apparently don't understand Shape Keys well enough to understand this in terms of converting the entire IPO driver into a series of shape keys, but this is a good start. I am assuming you want to grab the initial mesh for each frame of the IPO driver then apply this code to the object. I have NO python or blender scripting experience so I am piecing this together very slowly.

Not sure if that helps at all if you want to write an exporter that can export from a skeletal animation in blender. Credit goes to tolobán and the thread I got the information from is here

Update:
I got some updated code for what I presented above.

Code: Select all

#Make shape keys from a mesh every frame.
#Disable interactive display of subsurf modifier before running this script.
# (Yes I know, Python should do it)

import Blender
startframe = Blender.Get('staframe')
endframe = Blender.Get('endframe')

# Set window in object mode
Blender.Window.EditMode(0)

ob = Blender.Scene.getCurrent().objects.active
mesh = ob.getData(mesh=1)

#Create Basis key if it doesn't exist yet
if not mesh.key:
	mesh.insertKey()

#Create container in which to copy deformed data
defmesh = Blender.Mesh.New()

# Loop all frames
for frame in range(startframe, endframe + 1):

	print "Processing frame", frame
	Blender.Set('curframe', frame)

	#Get deformed data
	defmesh.getFromObject(ob.name)

	for i in range(len(defmesh.verts)):
		mesh.verts[i].co.x = defmesh.verts[i].co.x
		mesh.verts[i].co.y = defmesh.verts[i].co.y
		mesh.verts[i].co.z = defmesh.verts[i].co.z

	mesh.insertKey()
	# Set shapekey name to frame number
	mesh.key.blocks[-1].name = "%05i" % frame

#Free memory
defmesh.verts = None
You need to delete the armature after you are done in order to get the correct animation out of the skeleton. It works really well, combined with the MDL export things are getting really simple to just keep the whole modeling process within blender3D itself.
Shoot everything that moves. When it stops moving shoot it again just for good measure.
motorsep
Posts: 231
Joined: Wed Aug 02, 2006 11:46 pm
Location: Texas, USA
Contact:

Post by motorsep »

Is Blender 2 MDL dead? It would be nice to have it for Blender 2.56a+
leileilol
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Post by leileilol »

There's a different (and superior IMO) MDL exporting script here
i should not be here
motorsep
Posts: 231
Joined: Wed Aug 02, 2006 11:46 pm
Location: Texas, USA
Contact:

Post by motorsep »

Thanks man. Now I need for someone to port it for Blender 2.56+ :)
leileilol
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Post by leileilol »

Why? 2.5x isn't even out of beta yet. I wouldn't jump the gun either, I still use 2.49b and i'm fine
i should not be here
motorsep
Posts: 231
Joined: Wed Aug 02, 2006 11:46 pm
Location: Texas, USA
Contact:

Post by motorsep »

2.56a is stable enough for the production.. I switched almost completely to it.
Yingchun
Posts: 3
Joined: Sat Aug 06, 2011 7:14 am

Post by Yingchun »

That dude looks cool. Where can I download TF2 low-poly models (I assume they can be imported into Blender for dissection)?





Coach outletcoach handbags
Jukki
Posts: 214
Joined: Wed Apr 07, 2010 4:59 am

Post by Jukki »

First time spam bot actualy somehow maaged to sta on topic O.o
Post Reply