Skip to main content
gamedev.net
🔒 Locked

Maxscript export - wrong normals

Started by bucheron Apr 28, 2004 at 2:05 AM 7 replies 1.7k views
Original Post
bucheron
bucheron
I use 3dsmax5 and have written a small maxscript to export my objects to a textfile format. Everything is working except the vertices normals which are wrong. I don't know where it comes from. It seems some normals are correctly defined, others are flipped. Did anyone run into such issues, is it a known bug or am I an unknown bug ? Here is how I extract the information : for geomObj in geometry do ( tMesh = snapshotAsMesh geomObj ... for v = 1 to nbVerts do ( normal = getNormal tmesh v ) ... ) [edited by - bucheron on April 28, 2004 3:06:30 AM]
Geocyte
Geocyte
Hi,



I''ve encountered similar problems in the past. I have also seen this type of thing reported elsewhere on the web. I never figured out exactly what the problem was but it also occurs in the 3dsmax ASE exporter.

It appears to happen after certain combinations of transformations involving scaling and mirroring. The problem may well be with max and not with your script.

If the normals are always flipped the same way, or z & y are always mixed up then you can easily fix it by flipping them back but the problem I had was the that the normals would sometimes flip and sometimes not depending on what transforms had been applied to the object. Very frustrating.

My solution was simply to avoid mirroring or negative scaling of objects wherever possible.

Sorry I can''t be more specific about the problem or offer a proper solution. Good luck.


Geocyte Has Committed Suicide.
Geocyte Has Committed Suicide.
bucheron
bucheron
Thanks for your answers. Geocyte, I''m happy to hear I''m not the only one to have this problem. I think I will "manually" compute the normals to be sure everything is correct. Frustrating is the word, yep. I''m wondering if this problem also appears in the SDK, seems it''s maxscript related.
Tom
Tom
Here are some suggestions; don't know if they'll help.

- Try unifying your normals first, see if that works.

- Use transform modifier instead of toolbar buttons; that could solve the problem.

- Collapse modifier stacks prior to export (and subsequently undo collapse if you want to keep modifiers intact).

If none of this works, you may have to compute by hand like you said. Personally, I've never had problems with ASE export.

[edited by - Tom on April 28, 2004 11:02:02 AM]
GDNet+. It's only $5 a month. You know you want it.
bucheron
bucheron
I will try collapsing, this looks like a possible workaround, thanks for the tip.
mikiex
mikiex
I have come across this problem with some exporters before
and it may be a max bug.

Try adding smoothing groups to all faces in your model.
editmesh/select all faces / apply your smoothing groups

smoothing groups let you control normals. for some reason
max outputs reversed crap if you you don''t have them set.

Its interesting you have this problem, I thought it was
our tools guy messing them up

Please post and tell us if this does work..
mikiex
mikiex
while were on MAX.....

another trick you can do in max with problem objects
is to go into edit mesh, select all faces, detach them as a new object and then delete the current object (that has no faces or anything)

then u have a somewhat fresher object.

The other key tip with objects is resetting the xforms
using the reset xforms tool or modifier... this clears
out all your transformations, I often use this - especially after resetting the pivots
bucheron
bucheron
I tried your different tips, Xform, collapsing and smooth groups (those looked promising in Max) but it didn't solve the prob . I tried to tesselate the mesh with 2 iterations to see if the problem was coming from the original geometry. Still weird bands patterns in the middle of my mesh. In fact, it's happening on any kind of objects, cylinders, extruded lines, whatever..if you take 4 triangles, you can be sure that one vertex has a flipped normal. This must be Maxscript related as nobody seems to have this problem with ASE which is part of the SDK. So back to the roots with the good ol' method for normals That's a shame, those maxscripts are neat to write exporters, I wish they fix the bug (hey, it's version 5, shouldn't have this been reported before ?).

[edited by - bucheron on April 28, 2004 6:45:51 PM]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.