That's Awesome
#769 posted by ijed on 2014/06/08 22:38:23
Origami
#770 posted by madfox on 2014/06/13 02:21:44
Some examples of the hellknight in paper, made with pepakura.
Now he will be my action figure ever!
Little hard to paint on the skin right.
1 2 3
MD3 Exporter
#771 posted by Qmaster on 2014/08/20 04:16:30
@Preach: I'm trying to create a model and it looks ok in darkplaces if I simply use the md3 file, but whenever I "compile" the mdl file from the md3 file it comes out all poly garbled, like the faces are pointing the wrong ways and small faces get stretched or combined and folded inwards on itself. I suspect it's the exporter that I'm using with blender because the skin works and the model is visible so I think md3tomdl is working fine.
Preach, what md3 exporter are you using? and what blender version? I have 2.71 and am using katsbits md3 exporter version 1.6.3 (for blender 2.63a from this page: http://www.katsbits.com/tools/
Qmaster
#772 posted by necros on 2014/08/20 05:25:39
Maybe this might be useful: http://www.quakeunity.com/file=481
I use it when importing md3s exported from max, but you could try just importing the blender md3 and see if anything looks wrong then saving from that application before using preach's converter.
Sounds Like A Bug
#773 posted by Preach on 2014/08/20 11:39:09
I use GMAX and the md3 export which comes with that - by pop'n'fresh I think... If darkplaces loads the md3 fine then it's more likely a bug in md3tomdl, probably some edge case that the parser I wrote gets wrong. Can you e-mail me a copy of the file so I can take a look.
#774 posted by Spirit on 2014/08/20 13:36:57
Hmmm
#775 posted by necros on 2014/08/20 19:17:26
actually, you'd probably be better using qwalk as the npherno tool is ancient.
Preach
#776 posted by Qmaster on 2014/08/21 13:18:57
Hey @Preach I sent you the md3 file and a screenshot of what it looks like on my end.
Diagnosing
#777 posted by Preach on 2014/08/22 02:09:58
Hi Qmaster. I've got your e-mail and taken a look, but I don't have a complete fix yet. I can reproduce the bug - when I compile with md3tomdl I also get a corrupted model. It's not all bad news with the model though. It seems correct topologically - the triangles are all connected to the correct vertices, it's just those vertices which are out of place.
Specifically for this model, if you translate the right sets of vertices about the place you can get it looking normal. The place where the conversion suffers most is the right arm of the robot - half of the vertices have been displaced to the robot's far left. Then the head vertices have been moved to the bottom, and a few vertices from the front have been displaced to the back.
It's almost like lots of the vertex coordinates are overflowing and wrapping round to the other side of the model. That might be possible if md3tomdl miscalculates the bounding box for the original model. Having multiple surfaces in the model might be the issue here - can you combine the whole model into one and re-export to md3? Since you can't get multiple surfaces in a mdl file, I tend to only use one and that code may be under-tested...
Huh
#778 posted by ijed on 2014/08/22 02:15:13
I might be completely wrong, but this sounds like a bug with the skeleton. If it is rigged, and half the rig is simply flipped (arms legs) then the flipped bones can have a negative scale, which fucks up the position of the verts, which try to maintain their true position despite the negative scale transform.
Wild shot in the dark.
@ijed
#779 posted by Qmaster on 2014/08/22 04:27:32
I checked that this morning and found that to be the case for the left arm mesh object, the scale was negative, but even after fixing it still didnt work, and I sent that 2nd one to preach as well. I don't have any armiture/bone/skeleton for the mesh. I like to animate each frame by hand, it lends better to the original style I'm going for better.
@Preach, I'll give that a wack. In the editor, there are 3 objects, the 2 arms and the 1 body. I'll combine them as one and reexport and give that a whirl. Might be something to do with the way the blender exporter combines mesh data from multiple objects, or rather doesnt. I hope it works! I have a lot more npc's to maje after this one.
Qmaster
#780 posted by necros on 2014/08/22 04:32:05
do you mean you are moving vertices manually for each frame? That's hardcore man... but honestly, you should look into animating with bones. You can't get good proper movement without expending 10x as much work.
You don't need any fancy thing like max's Biped or anything. Just using primitive boxes as bones can save you hours and hours or work.
@Preach
#781 posted by Qmaster on 2014/08/22 05:07:26
I think I figured it out. Its to do with local origin placement. The object's local origin needs to be equal to global coord 0 0 0, the world origin in the editor. Any deviation from 0 0 0 will cause an issue when converted to mdl. Multiple mesh objects doesnt affect it. It all converts fine so long as I have an object origin of '0 0 0'.
Perhaps md3tomdl should check that the md3 origin value is equal to 0 0 0 and if not adjust each vertex by the origin amount to zero out the md3's origin before converting.
Think I've Nailed It
#782 posted by Preach on 2014/08/22 10:09:15
I spent a long time looking at the code that was working out the bounding box for the model, thinking that's where the wrapping was occuring. MD3 files can have a different origin in each frame (but rarely bother), so when you mentioned non-zero origin, I thought it might relate to that. But the bounding box code accounts for that already.
Then I realised that it wasn't an overflow, but an underflow! The bounding box was accounting for the frame origins, but the code that actually exports the vertices does not. I need to get a compiler installed on this new computer, then I'll try and bash out a fix...
@necros
#783 posted by Qmaster on 2014/08/22 13:54:56
Yeah i do and I dont use skeletal animation. It really depends on the model. For a very simplistic robot it doesnt make much difference. For a floating blob of goo: http://www.spriters-resource.com/resources/sheets/28/30623.png Theres really no better way. Anyways, it helps me keep to the original style by having fewer frames.
Negative Scale
#784 posted by ijed on 2014/08/22 14:31:25
Is a bitch.
Think That's Fixed
#785 posted by Preach on 2014/08/22 20:58:40
I'm gonna put a proper post on the blog later on, but for now grab the patched version
http://www.quaketastic.com/files/tools/windows/misc/md3tomdl-0.4.zip
Works But...
#786 posted by Qmaster on 2014/08/23 07:00:09
The mesh itself is healthy, but the offset from the origin is getting doubled. If the md3 is 16 units from the origin the mdl will be 32 units away (regardless of axis).
I noticed you added in " + f.org[0]" in mdlexport.cpp (line 215) which I'm assuming is what fixed the origin mix-up. See line 7 in md3import.cpp where you already added this to the frame.mins and frame.maxs... so is this doubling it?
Psst...if I don't actually even have any line for a skinfile in the compile txt then it crashes (yes I know I'm a basket case).
I'm thinking that writedummyskin(mdlfile) doesn't actually get called if skinfile == "". I guess it's something to do with !q1skin.height not being true in mdlexport.cpp->export_to_mdl{} (see Line 147)?
I'd try compiling it myself with some trial and error, but I haven't bothered to install any c++ IDE at the moment.
...
#787 posted by Qmaster on 2014/08/23 07:06:27
Thanks by the way! It's awesome to get such quick feedback. You're a real coding guru around here, it means a lot that you can do all of this. You're the best!
Working Through It
#788 posted by Preach on 2014/08/23 15:53:54
I'll try and fix all these things before I put 0.4 up. got a favour to ask first though: my tools don't ever create MD3s with an origin key to test, and I could really use a specific pair of models here. Could you send me two MD3 models, which are identical except for having different offsets? Like maybe 32 units from the origin on one, and 50 units on the other. It will make it easier to spot the doubling taking place. Thanks!
The skin issue is due to me failing to initialise some values properly, looks like it works in my local copy now!
#789 posted by Spike on 2014/08/23 18:00:42
the 'q3_frame.org' field in the frame info is strictly a culling origin. apparently it can also be used for fog. It will not move the mesh up/down, unlike mdl.
using it to determine either the bounding box or the verticies is a bug. probably you should ignore it completely (in theory, you'll find a decent model has it set to the center of the frame's bounding box).
@Preach Check Your Email
#790 posted by Qmaster on 2014/08/23 19:25:45
Thanks For That Spike And Qmaster
#791 posted by Preach on 2014/08/24 00:40:37
That would explain everything, the correct fix (deleting the org stuff from the bounding box, not adding it to the vertices) is in place and the robot now hits a minimum of -24, which I assume was the intention. Here's a link to the new 0.4 download, once I hear a thumbs up from Qmaster I'll update the blog.
http://www.quaketastic.com/files/tools/windows/misc/md3tomdl-0.4.zip
Uh...
#792 posted by Qmaster on 2014/08/24 05:14:22
I'm not getting any different results? Maybe you uploaded the wrong exe or something? I deleted all md3tomdl's on my end and redownloaded again, but it still doubles away from the origin, and there's still the wierd crash without a skinfile line (not that it matters much, I have skinned it now, but it's nice to have for robustness). I checked the source code that you provided and it looks like you fixed it for both cases, but the actual exe doesn't seem to have the changes?
Dunno what's up.
Alright Althea
#793 posted by Qmaster on 2014/08/24 05:53:37
I'm going to the source. I think Preach's program works fine enough for his workflow...it's blender's exporter that doesnt provide a similar md3 file. From what I've read, Pop'n'Fresh's md3 exporter for gmax determines the bounding box for each frame. I found the source code for it here: http://forums.duke4.net/topic/1065-md3-exporter-for-3ds-max-2010-x86-and-x64/ I'll check it out when I get a chance and compare it with the katsbits exporter for blender. I might have to modify the blender exporter to match the gmax one. Translating from c++ to python here so wish me luck.
|