Home Technical Talk

Maya Shading $*&%ed

polycounter lvl 18
Offline / Send Message
Asthane polycounter lvl 18
A while ago I posted This Thread, got an answer, and was happy. I'm no longer quite so happy.

You'll excuse the garrish lighting and specular, there is a point.

-=-=-=-=--=-=-=-=--=-=-=-=--=-=-=-=--=-=-=-=--=-=-=-=--=-=-=-=--=-=-=-=--=-=
Here we have the model newly imported from Wings3d via the .obj exporter (The only format it and Maya seem to have in common)

As you can see, I have set up two directional lights in the scene, one green, one purple. At this point you cannot see much wrong.

Katt_Poo_01.jpg

-=-=-=-=--=-=-=-=--=-=-=-=--=-=-=-=--=-=-=-=--=-=-=-=--=-=-=-=--=-=-=-=--=-=
...Except for small errors like this, as were mentioned in the other thread. They are, however, not just hard edges.

Katt_Poo_02.jpg

-=-=-=-=--=-=-=-=--=-=-=-=--=-=-=-=--=-=-=-=--=-=-=-=--=-=-=-=--=-=-=-=--=-=
In this image I have rotated the model as a whole 90 degrees, all seems okay.

Katt_Poo_03.jpg

-=-=-=-=--=-=-=-=--=-=-=-=--=-=-=-=--=-=-=-=--=-=-=-=--=-=-=-=--=-=-=-=--=-=
...but it isn't. Here what I've done is smooth bound the mesh to a bone and rotated it a full 180 degrees. There are three things to note here:

1) First off, comparing the lighting of the model to the lighting of the sphere next you it, you can see that after being bound to the bone, the lighting on the model does not change
when moved. and deformed.

2) Secondly, you can see that some polygons have the correct lighting. These are the same polygons which displayed shading errors. It bears noting that these polygons did have correct lighting (and thus similar to the rest of the model) before the 'rigged' model was rotated.

3) The model appears to have virtually all of its specular attribute.

Katt_Poo_04.jpg

-=-=-=-=--=-=-=-=--=-=-=-=--=-=-=-=--=-=-=-=--=-=-=-=--=-=-=-=--=-=-=-=--=-=
Nothing has been changed in this last image, it is merely a close up on the correctly lit polygons. It bears mentioning that there is (I believe) without exception, exactly one of these per object.
Katt_Poo_05.jpg

-=-=-=-=--=-=-=-=--=-=-=-=--=-=-=-=--=-=-=-=--=-=-=-=--=-=-=-=--=-=-=-=--=-=

Now, the obvious answer here is, that Wings3d's obj exporter is fubared (and has been for many releases). Obviously I should go tell the developer that.

But that's not why I posted this. I posted this to see if anyone has any idea just what is going on here, and if the model and rig is salvagable (I discovered the full extent of this problem only after fully rigging the model for a second time....)

So once again I ask... any ideas?

Replies

  • Whargoul
    Options
    Offline / Send Message
    Whargoul polycounter lvl 18
    It sounds like your normals are locked. Fixing this usually means resetting which edges are hard/soft, but it's probably the only thing you can do.

    Here's what I'd do (and this will preserve your skin weights & rig):

    1. Duplicate the model & hide the original.
    2. Select your new mesh.
    3. Unlock the normals. Edit Polygons -> Normals -> Set Vertex Normal []-> make sure "Unlock Normals" is checked and hit "Apply"

    Now your mesh is probably all facted again (I'll explain this later why it happens).

    4. Edit Polygons -> Normals -> Soften/Harden [] -> Press "all soft" then "apply" (make sure the model is still selected).
    5. Now your model will be all smooth with possibly some weird shading in areas you wanted hard edges.
    6. Press F10 to enter "Edge" mode.
    7. Select all the edges you want hard (crisp).
    8. Edit Polygons -> Normals -> Soften/Harden [] -> Press "all hard" then "apply".

    Now your model should look like it did in Wings. Onto preserving weights.

    9. Bind your new model to the same set of bones the original one is bound to.
    10. Select your original model, then your new model (have them both selected, in that order). Go to the Animation menu -> Skin -> Edit Smooth Skin -> Copy Skin Weights.

    Now your new model is bound exactly like your old model (it copies weights spatially across meshes, and identical meshes copy exact) and you can delete it. Everything should be peachy now!


    As to why the normals are locked on import:

    Maya lets you set completely custom normals on every vertex. A vertex can either have locked (custom) or unlocked (variable) normals. If it's unlocked and you move vertices around, it keeps the normal as the average of all the faces connected to it (if soft), or the face normal itself (if hard). But if it's locked, the normals stay put, even though you move the vertices around. Handy for some things, but annoying to someone who doesn't know exactly what they're doing.

    Now when you import a model, in the model format it will probably have vertices, faces, UVs and normals. Most model files don't save "smoothing groups" or "hard/soft edges" or any crap like that, they store pure normal info. So when Maya imports it, it doesn't know if the edges are hard or soft, it just sets each normal to the one found in the .obj. And the only way to keep them in that position is to lock them.

    It would be nice if the importer was smart enough to set the edge hardness properly, but it doesn't. It seems fairly easy to write a MEL script that analizes each edge in a locked mesh, to see if they are hard or soft. Then unlocking, softening, and then re-hardening edges. Hmmm....
  • Asthane
    Options
    Offline / Send Message
    Asthane polycounter lvl 18
    I guess that'll teach me to go jumping to conclusions, though there is still the question of the polygons that don't get locked, which probably is a bug worth reporting.

    Thanks for the help, I feel kinda silly for making such a big deal out of it now ¬_¬
Sign In or Register to comment.