Parameter Assignment Pmd Editor

tl;dr version:

FOR ALL USER'S SAKE please use PMXEditor to do a PMX check by selecting File --> Validate PMX model (the bottom-most option) and fix the errors reported there before shipping out your edits, so that you don't induce your users with pains in the neck. Especially display-related issues, pretty much everyone fails at that

Full version:

Almost every time, when one uses an edit from dA, he'll inevitably find out there are always problems - after all, nothing can be free of bugs. Serious issues include mis-rigs or rigidbody set-up failure which makes stuff look terrible, but there are also some more subtle ones that most people don't catch immediately, and when the time comes, bite a user in full force.

Normally, bugs are hard to find and fix. But then we're not talking about those complex rig/rigidbody problems here. Instead we'll talk about some PMX validity system-checks and sanity-checks that can be performed by PMXEditor easily, by selecting the bottom-most "Validate PMX model" in the File tab. It checks the following, and reports problems if found any, indicated by a cross or triangle symbol, and with the exception of vertex/face related checks, shows you which part went wrong:


System
Number of additional UV sets:
Oh well, almost nobody uses additional UVs anyway. (It only has 3 uses: sub-texture, per-vertex coloring, and effect support. Currently supported effects include Autoluminous and model disintegration effect)
Anyways, this value should be between 0 to 4. If you've chosen "Automatically determines numbers of additional UV sets" then it should not be a problem.
Otherwise, adjust it properly at the model information tab, on the top-right side.


Model Information
Model name and comment:
Frankly, since PMX 2.0 uses UTF-16 encoding and has a upper limit of 2 gigabytes on them, it's impossible that one would mess a PMX model up this way.
Except in the case that one forgot to put text into it, then PMXEditor will give a triangle to you, warning you that it's empty. (And seriously, why'd you leave it blank? It's very user-unfriendly.)
They all lie at the model information tab.


Vertex
Invalid Normals:
It reports you with problems if you have any normal that is a zero vector. (All normals are automatically normalized when you press "validate", but zero vectors can't be normalized!)
If there's any of them, go to information window's Edit tab --> Vertex --> Fix invalid normals, and PMXEditor will recalculate those zero vector normals for you.
(You may still need to flip the normal afterwards, for this select the respective vertex in question in PMXView, and choose Edit --> Normal --> Flip selected normals, i.e the last one.)
It still doesn't check whether they're actually normal, i.e perpendicular to the surface (in the proper direction) in question though, and for that you just choose the respective vertices, and go to Edit in PMXView --> Normal --> Set select normal as averages of faces' normals (second option). Again, you may have to flip the normals manually.
(Although frankly, it usually ends up not as good as setting it up yourself, or by other means.)

Invalid weights/Unconfigured SDEF parameters/Invalid SDEF bone references of vertices:
These all happens only when you have SDEF set up improperly.
However, in almost all practical usage, SDEF are set up via Metasequoia's plugin keynote, or via PMXEditor's own BDEF to SDEF conversion function, which shouldn't give you errors except you've got some really edgy cases. So... unless you're trying to set up SDEF yourself, this isn't a problem.
Don't worry if they happen though, you can convert them back to BDEF2 by going to Edit --> Vertex --> Convert all invalid SDEF vertices to BDEF2, in the information window.

Isolated vertices (i.e not connected with any faces):
It's a common thing that happens with edits. They don't break things in general, but they're useless anyway...
Remember a rule of thumb: A isolated vertex = practically doesn't exist at all.
Fixing it requires two step:
1. Information window's Edit --> Vertex --> Select Isolated vertices
2. Go to PMXView and press Shift+Delete to delete them.
(If you're unsure of this, BACKUP. A sign of not selecting anything actually important is indicated by NOT showing any selected vertices when you let PMXView to display them. And of course, the model shouldn't have any visual difference at all after deletion of such vertices.)


Face
Invalid vertex references:
This error appears when you have faces specifying a vertex that is out of range, and simply doesn't exist.
Of course, if you're not doing something fishy with them, they won't occur at all.
And unfortunately, there's is not built-in options to deal with them, so better not mess with vertex references.

Invalid faces:
Sometimes you have a trianglar face with 2 or 3 vertices referencing to the same vertex. It's obviously not a triangle, so face normals can't be calculated, and PMXEditor will report you with a positive number count in "invalid faces".
Of course, these kind of faces are useless; they don't span any effective area.
To fix them, select all the FACES in PMXView (Not just vertices!), and choose Edit --> Selected faces --> Delete invalid faces.

Duplicate faces:
Again, common feature of edits. Not really sure if it can cause problems, but then again, it's pointless to put faces at exactly the same patch of space, which won't achieve any effect other than the probability of causing more problems with transparency.
Fixing them is moreso the same as fixing invalid faces (see above), but you choose "Delete duplicate faces" instead (just below the invalid faces option).


Material
Material name not set/collison:
Again, you're confusing the users if you ever do it.
Name the materials sensibly!
(Not like material name collision have any problem, but it's still not prefered. If you've ever used MME you'll know how annoying naming materials "Material #15" are, they're non-indicative.)

Material with no faces:
Similarly, a material without any faces assigned to it is useless. It usually happens when one delete the vertices of a whole part instead of deleting its material along with everything assiged to that material, or trying to assign some part of a model to a new material improperly.
For the former, just delete the material. For the latter, though, you need to do the following:
Select the relevant FACES in PMXView, choose Edit --> Selected faces --> Assign to new material / Seperate vertices and assign to new material (depending on your needs). Then, simply edit the new material you've created.

Invalid texture/sphere texture/sphere settings/toon textures:
All sort of errors that emerges if you have texture paths pointing to a file that doesn't exist, or specified a sphere texture already but disabled sphere texture usage.
Don't worry, these happens all the time. Most of them can be caught by inspection, but letting the system assist you is always better.
(Note that it doesn't notify you if you assigned a wrong texture, though)

Material face sum:
Sanity check that every face is assigned with EXACTLY ONE material.
Not sure if they can happen at all...


Bone, i.e the part where many falls
Bone count:
I don't think any error can pop up with that... Unless you've got too much bones. Which should be at least 1000+.

Bone name not set/collision:
The problem with setting bone names improperly is actually much worse than that of materials/rigidbodies/whatever, because VMD files are saved and loaded according to the bone name. If the names don't match, the respective motion won't be applied even when the bone is sitting there, waiting for the keyframes.
It is the best way to break compatibility with almost all VMDs available on the Internet, and maybe as well as your own VMDs.

Circular reference:
Loops.
And everybody knows infinite loops are bad.

Bone hierarchy order validation:
In 3DCG, bones are transformed with an order: from the 1st bone to the last. The bone list already tells you in what order are the transformation performed.
So, if you have a child bone transformed first before the parent bone, there'll be a problem with bone transformation.
And to fix that, simply make sure that every child bone doesn't go before their parents.

Invalid parent bone reference:
Similar to other invalid references, it happens when the specified parent bone doesn't exist.
a index of -1 corresponds to the invisible "root" bone, which, if you're using a sufficiently new version of MMD, is actually the root of all roots for that single model.
Normally a index 0 "base" bone is used instead, so you can have control over all bones (root bones aren't available to the user).

Transformation assignation hierarchy order validation/improper transformation assignation parent:
This check is about the bone transformation assignation just below the display target, which is used to make one bone move/rotate by itself as the other does the same.
(All eye bones uses this. Also, a workaround for post-IK bones before MMD v8.12 uses this too.)
Again, if you happen to have the child-parent relationship not following the bone order, or assigned a target that's invalid (for many reasons), PMXEditor'll report errors.

Invalid bone pointing target:
A bone is set pointing to a bone that doesn't exist.

Improper transformation assignation parent:
I think it's a duplicate, and has no usage.

Invalid IKTarget/IKLink reference:
Related to IK chains. Though, with the new IK set-up mechanism, you can't really mess up with them... Unless you did something wrong.
In that case, just set the IK chain again.

Morph
Morph name not set/collision:
Do I really need to mention "NAME THEM SENSIBLY" the third time...?
By the way, there's again a built-in "Merge morphes with the same name" function in PMXEditor, which means name collision may cause problems with that function.

Invalid morph offset reference:
Again, you've specified a invalid index for one of your morph's content, which shouldn't be occuring normally.
Fixing them would be a pain in the ass (again, there's no built-in function to automatically set that) as you try to find which reference in a morph is incorrect, so...

Display, i.e OH MY GOD PRETTY MUCH EVERYONE FAILS AT THERE
Display category not set/collision:
This is when you have categories with no names/collisions.
Trust me, this happens quite often, and it makes the model hard to use.

Unregistered bone/morph:
THE FIRST THING PEOPLE FORGET WHEN SHIPPING OUT EDITS.
Almost every edits I've encountered had bones/morphes forgot to add to the display after creation. IT'S TERRIBLE FOR MANY REASONS, which if it's allowed, I'll just skip them.
Anyways, to make sure there isn't any unregistered bone/morphes... Go to the display tab, open the list of morphes/bones that you can add on the right, and make sure there's NOTHING there.

Duplicated bone/morph
THE SECOND THING PEOPLE FORGET WHEN SHIPPING OUT EDITS.
When making edits, you may end up multiple instances of a same bone in the display due to many importing actions. WHEN IT GOES IN MMD IT WILL BEHAVE WEIRDLY.
So, to really help your model users, please, perform a check and delete all duplicated instances.
p.s: PMXEditor doesn't allow you to add a bone to the display twice.

Morph/System category check:
Checkes that if they're here. It should be there in all normal usages.


Rigidbody/Joint/Softbody
Name not set/collision
Again...?
Okay, but nobody really cares about the names of them, since you can't see their names anyway (except in PMXEditor). Not like anyone cares at all.

Invalid reference:
Again, pointing at something that doesn't exist.
NOTE! THIS IS IMPORTANT!
Leaving this kind of error in the model causes MMD to crash whenever the model is loaded, and physics is on. Hours of work!
And even worse, it seems that it'll corrupt your project file if you save a file loaded with such model without turning physics on.


Okay, and last thing:
Don't rely only on PMX validation to proof-check your model. It's just a tool, it can't do everything for you.

72 Comments

I use all the time for object attributes.

The keyword has visibility semantics when used on object attributes. Basically, setting the value of a final object attribute happens-before the constructor returns. This means that as long as you don't let the reference escape the constructor and you use for all you attributes, your object is (under Java 5 semantics) guarenteed to be properly constructed, and since it is also immutable it can be safely published to other threads.

Immutable objects is not just about thread-safety. They also make it a lot easier to reason about the state transitions in your program, because the space of what can change is deliberately and, if used consistently, thoroughly limited to only the things that should change.

I sometimes also make methods final, but not as often. I seldomly make classes final. I generally do this because I have little need to. I generally don't use inheritance much. I prefer to use interfaces and object composition instead - this also lends itself to a design that I find is often easier to test. When you code to interfaces instead of concrete classes, then you don't need to use inheritance when you test, as it is, with frameworks such as jMock, much easier to create mock-objects with interfaces than it is with concrete classes.

I guess I should make the majority of my classes final, but I just haven't gotten into the habbit yet.

One thought on “Parameter Assignment Pmd Editor

Leave a Reply

Your email address will not be published. Required fields are marked *