HOWTO: Make A New Nexuiz Playermodel.

Post anything to do with editing Nexuiz here. Whether its problems you've had, questions, or if you just want to show off your work.

Moderators: Nexuiz Moderators, Moderators

Postby ai » Thu Mar 12, 2009 5:48 pm

glennxserge wrote:Given the two Maya exporters, Prall or Valve, which would be better to use? I haven't had luck with either regarding bones/weighting.

I myself am using Valves SMD exporter. I tried Prall's but I also use newer version of Maya so either the plugin doesn't work or I don't know how to use it. It does say it should work with the 8 version, I did try it but I was unsuccessful. It was for me too complicated to use.
Thanks to Valves SMD plugin my life got a lot easier. I have seen people using Prall's successfully, but unless you absolutely know what you're doing it's hard to make it work in my opinion.

However, I use Prall's SMD plugin to import .smd files. I found that Valve breaks or can't import the .smd's that exist in Nexuiz. Weird indeed, hopefully it's just me it doesn't work for.

glennxserge wrote:Does Nexuiz use a standardized bone naming convention or do I have some room there?

I don't know, I suppose someone else should answer this question. What advice I can give you is to import (if you haven't done so already) the existing skeletons (the source is available somewhere, forgot the link for now. If you want it I bet I can dig it up) and use them on your model.

glennxserge wrote:Should I use Rigid binding on my skeleton or Smooth Bind with Max influences set to 1 (essentially 100% weighting per vertex)? I have tried both with no luck.

I'd say go with Smooth Bind, RIgid Bind is too awkward and wouldn't give good result. I believe DarkPlaces should be able to handle that.

glennxserge wrote:I noticed that when I am exporting my mesh the weighting isn't getting caught. My geometry is all assigned as a child to the mesh and not the bones. So all the triangles in the geometry block of the SMD are assigned the handle of the mesh instead of their corresponding bones.

First of all, which export option are you using? Exporting model with animation?
Secondly, I don't really understand what you mean. The geometry isn't your mesh or you have multiple objects which aren't combined? As far as I know a player model is one single object/mesh which then is bound to a skeleton. And what do you mean with that last sentence?

glennxserge wrote:I tried importing some SMDs from the actual playermodel's and haven't been able to reproduce the proper skinning out of Maya, even with the exact model and mesh.

Hmm, do you know how Nexuiz does the player model animations? The .zym is working like so that you have several animations (bones only, no geometry) in separate .smd files. Then one .smd file (called mesh.smd or something) which only includes the mesh and no bones or animations, just clean geometry.

Now I too am trying to learn this process, I haven't been able to understand this process fully. How to create player models and make the animation work. I've had some weird stuff going on when I rigged the CTF flags with bones at first (never the result I actually went for) but it did show that I was on the right way.
I hope we can learn each other if you actually stick through this. :)
Cheers.
ai
Forum addon
 
Posts: 2131
Joined: Sun Mar 05, 2006 3:54 pm
Location: Behind you

Postby glennxserge » Fri Mar 13, 2009 7:08 am

thank you both for your prompt replies.

I will clarify my process since I am probably only missing a simple step somewhere in here.

I came to the same conclusion about importing. Valve kept failing with the nexuiz models. I wanted to make sure my own rig and skeleton wasn't to blame so I imported one of the robot animations using Prall, to get its skeleton (so far so good).
I smooth skinned one simple mesh (a triangulated cube in fact) to the skeleton and made sure the max influences were set to 1. I select the mesh and go to "Export Selection", and choose the Valve Model. As far as my understanding goes, the Valve Animation is just for bones to create the idle, run, die1, etc..., and Valve Model is for mesh.smd.

Once the mesh.smd is created I open it up in a text editor and check it. Everything looks fine in the skeleton section of the code:

Code: Select all
version 1
nodes
  0 "Bip01"             -1
  1 "Bip01_Footsteps"    0
  2 "Bip01_Pelvis"       0
  3 "Bip01_L_Thigh"      2
  4 "Bip01_L_Calf"       3
  5 "Bip01_L_Foot"       4
  6 "Bip01_L_Toe0"       5
   . . .
  68 "pCube1"            -1
end
skeleton


Referencing http://developer.valvesoftware.com/wiki/SMD_file_format has been useful for details on the SMD structure. It was helpful in identifying what the data in the triangle block was, particularly the order.

Code: Select all
triangles
lambert1
68   -8.21721  -8.21721 68.215496    0       0      1      0      0          1  35    1       
68    0          -8.21721    68.215496    0       0      1      0.5    0         1  35    1       
68   -8.21721     0          68.215496    0       0      1      0      0.5       1  22    1       
lambert1
68    0          -8.21721    68.215496    0       0      1      0.5    0         1  35    1       


starting from the left is the Parent Bone, x,y,z, nx,ny,nz, u, v, link, bone ID, weight.
So the problem is the value 68 above is referencing the mesh (pcube) in my skeleton. Eeek! the entire triangle block looks this way. When comparing it to an actual Nexuiz mesh.smd, which looks like:

Code: Select all
nexus.tga
20 0.0000 -12.6964 69.4068 0.0000 0.9763 0.2165 0.9690 0.9789
20 3.6677 -13.7728 69.0497 0.4677 0.7536 0.4619 0.9236 0.9715
20 4.1963 -12.9598 66.2430 0.3140 0.9151 0.2529 0.9299 0.9342
nexus.tga
22 1.8506 -16.1344 74.9871 0.4262 0.2151 0.8787 0.2138 0.9274
22 0.0000 -15.1944 75.1177 0.0000 0.4071 0.9134 0.2156 0.9933
22 0.0000 -17.1106 75.2997 0.0000 -0.0216 0.9998 0.1487 0.9767
nexus.tga
  2 0.0000 -24.0376 36.8271 0.0000 -0.9166 -0.3997 0.7704 0.5893
  2 2.7195 -22.8170 36.5031 0.3378 -0.6979 -0.6315 0.7595 0.5622
  2 3.0839 -23.0801 38.3437 0.3281 -0.9211 -0.2094 0.7411 0.5690


you can see this model's Parent Bone value varies appropriately to the bone it is weighted against, whereas mine only uses 68 (the handle of the pCube mesh).

I understand how to export the animation SMDs and understand the compiling process, but I just can't seem to get a good fit with exporting the mesh.

I have tried selecting just the mesh to export, selecting the mesh and the bones, selecting the bones and then the mesh.... and so on. That about sums up where I am in the process. I stopped working on the animations cause I wasn't sure if I would be able to use the current rig, and didn't want to do everything over again, but the model is done and textured and the rig is ready provided it will export. I will definitely post it when I am done, although it is more of an easter egg character (now your curiosity should be piqued).

On one last note, I have been browsing the how to's on writing custom shaders and was wondering exactly where to put those and how to compile them for Nexuiz, seemed like bits and pieces of how to do it are scattered around the forums, but I didn't find anything definitive. Have been looking at the shader bible and the code seems fairly straight forward. Thanks again, hopefully my blundering around is also helping someone else out too.
glennxserge
Member
 
Posts: 11
Joined: Wed Mar 11, 2009 6:55 am

Postby ai » Fri Mar 13, 2009 11:13 am

You pretty much summed up where I am as well.
However, I think I found a bug with the Valve plugin. I once exported a model that was rigged and had it smooth bound. But when I selected only the model and exported as Valve Model I in fact got more information (excessive in this case) in the .smd. I got bone information and such, I think that breaks it.
So try to unbind your model, have no rigs or skeletons attached to it just clean geometry (delete history) then export that as Valve Model for your mesh.smd. You can duplicate it (but make sure not to move it of course) if you don't want to mess up your existing model.

See if that helps in some way.

On another note.
The node number is defined for each single object (I also believe it applies to bones as well). A cube is only one single object so it will only have one number (68 in your case). I don't really know how your rig for the cube looks like but I believe it would be like 5 bones?
So what you would want is a mesh.smd with only the cube (which in your case the code would be correct), animate the bones in some way and export the bones with Valve Animation. Try to compile that.
But, with a Smooth Bind, all bones together would result in max influence (1). If you take away some influence on one bone, another will gain some. So I don't really know about that '1' in the end of that cube code. I believe that not everyone should have a solid 1 (the Nexuiz code just below shows what I mean).
However, I'm not that knowledgeable in the code just yet.

Lastly, some other (unrelated) info, but something one might want to keep in mind:
I haven't found a use of the Valve Animated Model feature. If you don't use bones and only animate a model (rotating it, scaling it or whatever, no deformers) the Valve Model works great. I've used dpmodel to compile it into a .md3 and .dpm, I haven't tried zmodel but I believe it should work as well.
ai
Forum addon
 
Posts: 2131
Joined: Sun Mar 05, 2006 3:54 pm
Location: Behind you

Postby glennxserge » Sat Mar 14, 2009 3:27 am

However, I think I found a bug with the Valve plugin. I once exported a model that was rigged and had it smooth bound. But when I selected only the model and exported as Valve Model I in fact got more information (excessive in this case) in the .smd. I got bone information and such, I think that breaks it.


I think this is actually correct. In Maya the mesh has skinning history and the exporter is picking that up. How else would we build our mesh.smd with the proper bone weigthing assigned to it? All of the mesh.smd files from Nexuiz seem to contain both the mesh and the bones. Here is a snippet from the Marine mesh.smd file. You can see that the bones come first and are assigned numbers that are later used to reference them in the triangle block. So 2 of the vertexes are assigned to "Bip01 Pelvis" while 1 is assigned to "Bip01 Spine". (see below)

Code: Select all
version 1
nodes
  0 "Marine"  -1
  1 "Bip01"  -1
  2 "Bip01 Footsteps"   1
  3 "Bip01 Pelvis"   1
  4 "Bip01 Spine" 3
  5 "Bip01 Spine1"   4
  6 "Bip01 Spine2"   5
. . .
end
skeleton
. . .
triangles
marine.tga
  3   0.4654  -3.0518  54.8639  -0.7375  -0.5651   0.3699   0.0081   0.0613
  4  -1.5803   1.2848  57.4095  -0.7729  -0.4725   0.4234   0.0601   0.0873
  3  -1.9974  -1.0700  52.9720  -0.7564  -0.5457   0.3606   0.0416   0.0398
. . .
end


So try to unbind your model, have no rigs or skeletons attached to it just clean geometry (delete history) then export that as Valve Model for your mesh.smd. You can duplicate it (but make sure not to move it of course) if you don't want to mess up your existing model.


If I do that I end up with just a bunch of triangle statements that have the parent bone still assigned as pCube.

The node number is defined for each single object (I also believe it applies to bones as well). A cube is only one single object so it will only have one number (68 in your case). I don't really know how your rig for the cube looks like but I believe it would be like 5 bones?


Yes, the node number seems to apply to bones as well. My rig is imported directly off of one of the Nexuiz characters. So it has 67 bones (a waste for a simple cube I know, but I am merely doing a really quick test with bone naming conventions).

It seem like since we are both stuck at this point, maybe we should bring in some outside help. Do we know who did the original models and if they are available for contact?

If I am fundamentally misunderstanding what you are saying, feel free to clobber me with a 2X4 :shock:

I will keep testing to see if I can't get something working.

Before I forget, one last question for anyone reading this forum. How is the player's weapon attached? Is there something in the rig I need to account for?
glennxserge
Member
 
Posts: 11
Joined: Wed Mar 11, 2009 6:55 am

Postby Alien » Sat Mar 14, 2009 1:36 pm

Weapon is attached by referencing bone handle (name, number) in the code.

Morphed knows how to make those models.
Alien
Forum addon
 
Posts: 1212
Joined: Tue Apr 22, 2008 7:12 am

Postby glennxserge » Sat Mar 14, 2009 7:56 pm

Thanks Alien, I will try contacting Morphed for more info.
glennxserge
Member
 
Posts: 11
Joined: Wed Mar 11, 2009 6:55 am

Postby ihsan » Sun Mar 15, 2009 3:08 am

There difference i have noticed between valve and nexuiz SMD's is Nexuiz can't use smooth binds. All the code which adds all those smoothed weights (last in each row in the mesh-type smds) should be disabled.

As far as i have seen the only standard bones which must be in each in your skeleton is bone1 and bip01. bip01 holds your weapon and bone01 is the root of your skeleton. This is just an observation, developers will have to give the facts.
ihsan
Alien trapper
 
Posts: 305
Joined: Fri Mar 03, 2006 3:33 pm
Location: Trinidad (Where Obama met Chavez)

Postby glennxserge » Sun Mar 15, 2009 10:03 am

Cool, thanks Ihsan.

So I noticed that even having Smooth Bind with Max influences set to one, both the Prall and Valve exporter try to add the weights on the end. I couldn't find any settings that would disable that feature so I went back to using a rigid bind and Valve behaves properly while Prall still attempts to add weighting on the end of the line. So I am throwing Prall out the window for now and just focusing on getting the valve exporter to work.

I went through every option in the Valve exporter and couldn't get it to write the parent bones properly. I am stumped. So I am gonna sleep on it and maybe see if I can't find another solution.
glennxserge
Member
 
Posts: 11
Joined: Wed Mar 11, 2009 6:55 am

Postby glennxserge » Sun Mar 22, 2009 9:38 am

Success!! Finally, got the behavior I wanted in the mesh and it didn't come from the exporter. I gave up on relying on Valve's plugin as I couldn't find any settings that would match the output of the Nexuiz smds. Instead I wrote a perl script to correct the parent bone order and now... voila animation works!

The script is just a regular expression that rewrites the files substituting:
Code: Select all
37   12.109526  -40.477092  -19.507335    0.94921     0.062465   -0.308379    0.690844    0.190893    1  2  1

for:
Code: Select all
2   12.109526  -40.477092  -19.507335    0.94921     0.062465   -0.308379    0.690844    0.190893

So the weights on the end become the parent bone at the beginning. Kind of hacky, but hey I was starting to get desperate.

Now that I have that hurdle crossed I can focus on actually making the real animations. Will post some more findings or issues as they come up.
glennxserge
Member
 
Posts: 11
Joined: Wed Mar 11, 2009 6:55 am

Postby ai » Sun Mar 22, 2009 10:59 am

What kind of expression/perl script is it? Is it possible to share it with others, like me :wink: , who uses Maya. I'm not such a hoot on perl. :(
ai
Forum addon
 
Posts: 2131
Joined: Sun Mar 05, 2006 3:54 pm
Location: Behind you

PreviousNext

Return to Nexuiz - Editing

Who is online

Users browsing this forum: No registered users and 1 guest