Vertex normals not exporting correctly

Started by Rush_Freak, July 18, 2013, 08:58:36 PM

Previous topic - Next topic

Rush_Freak

I apologize for bugging you, as normally I try to work these things out for myself and/or scour for information, but it's sort of a recurring issue.

I'm trying to export a model of a car (in prep for a large asset pack I'm attempting to put together), however, only some of the vertex normals actually export correctly.
In Max, I drop an "Edit Normals" modifier ontop of the geometry to double-check that they are pointed the correct direction. However, when the model is compiled, some elements of the geometry are either faceted or pointed off to one side strangely, while others are perfectly fine. I've checked the smoothing groups applied to each sub-object in the model, and everything looks completely correct, so I'm quite baffled. I had attempted to use the "Explicit Normals" export method in the dropdown, but all of the vertex normals ended up completely distorted as if the entire object had been twisted or something.

I remember having this exact same issue several versions of WWMT ago, but a recent build had fixed it, only it's now returned again for reasons beyond me. I'm not sure what I'm doing wrong after having tried so many different possible solutions for it to behave like this, and frankly, it's driving me nuts.

Any help would be appreciated if you can spare the time. I can also post some screenshots if it would be of assistance.

wallworm

This might be fixed in an update I am about to release. You can test this version out if you'd like and let me know how it works.

http://www.wallworm.com/projects/utilities/dev_wallworm_model_tools.zip

Please note various changes in the included changelog file.

Rush_Freak

#2
Wow, you're fast with responses, thank you. :P

Irony though; I think the dev build was part of the problem. I had the latest official build installed until I installed the dev build (aka: the one you just linked, but I had gotten it before I noticed this problem again). That build had the issues with exporting normals, so I downgraded to the official build again, only to have the exact same problem.

Any other ideas you might have?

On another note, I was also curious what the normals are actually calculated from. are they taken from smoothing groups exclusively, or does it allow smoothing groups to be abandoned altogether in favour of specific per-vertex data? (I'd really rather not have surfaces be auto-smoothed with smoothing groups on the occasion I need to hand-edit normals.) :V

EDIT: I unchecked "Rotate Origin" in the compile panel and it seems to have fixed that strange twisting normals problem (possibly a bug you could look into?), however the faceting problem is still there. I'll keep you posted.

EDIT again: I tried using "Explicit Normals" in combination with having "Rotate Origin" disabled and it seems to work perfectly now (albeit with the compile time being 3-ish times longer). I may test again with the dev build just to see if the same method will work there and it's just me being stupid again. This is exactly the reason I don't like bugging people for help, I always end up figuring it out myself. xD

Final Edit: The dev build of v1.9453 works just as well now that I have the correct settings as stated above. The new "Auto" normals function seems to act much the same way as "Face Render Normals" in my case. And I'm glad that the "Explicit Normals" setting now adds no extra time to the compile. Buuut there's a different problem now... The car is the size of a die-cast toy, it seems about 1/16th scale, give or take.

I may have just done something wrong again, but I think I'll just call it a day. I'll use the last stable version to avoid fighting with the scale issue in the dev build until you feel it's ready to be released.

wallworm

A couple thing... the dev build link was updated just before I posted the above link to it, so if you had a previous version, this one is newer.

First, for reference, the Rotate Origin is best ONLY for static prop models. Anything that uses Skin will have a problem with that option. Furthermore, always make sure that all geometry (and especially the root mesh) has a reset XForm.

Regarding the time of export... the latest dev builds should make it a little faster with Explicit Normals... but unfortunately, there is a limitation in MAXScript regarding how the Edit Normals (and Skin modifier too) work in terms of speed. I have a feeling that I cannot do anything further to increase the speed of models with Explicit Normals (and actually, the latest version of WW in the dev build has a new option called Auto that uses Explicit Normals if you have an Edit Normals modifier but the Face Normals if not).

In the future, I may convert some function to the SDK instead of MAXScript so they will run faster... but that is only if I have time and incentive to do that... as SDK development takes a lot longer than the MAXScript development I currently do.

wallworm

Quote from: Rush_Freak on July 18, 2013, 09:22:43 PM
Buuut there's a different problem now... The car is the size of a die-cast toy, it seems about 1/16th scale, give or take.

I may have just done something wrong again, but I think I'll just call it a day. I'll use the last stable version to avoid fighting with the scale issue in the dev build until you feel it's ready to be released.

This is most likely caused from scaling the model. In Max, (not just for Wall Worm but in general) you should never scale a mesh. You should scale it at the sub-object level OR after scaling it, apply a XForm modifier and collapse it back to Editable Poly (or Editable Mesh depending on your preference).

wallworm

I received your model and see that the XForm was all wrong.

So I selected the mesh and the hull, added an XForm modifier, then collapsed to editable poly... then exported. (I also deleted the massive number of hidden objects in the scene).

The exported model then came out as expected (see attached image).

I do want to point out a couple things:

1) The tri-count on this model is really high. I'm assuming it came as an import from another package. The model has 26938 tris after export. For most purposes, this is way overkill... but that depends on your intended use.

2) The Auto function I've added to WW in the dev build is an auto based on this: If there is already an Edit Normals modifier on the model, use the Explicit Normals; if not, use the Face Normals. If your model was brought in externally and does not have an Edit Normals modifier, Auto won't detect that any you need to either choose Explicit Normals or add an Edit Normals modifier.

SMF spam blocked by CleanTalk