How to get good UV's and vertex normals?

Next
 From:  sharky0815
4515.1 
Hi!

As I am exploring a possible workflow to integrate MoI it gets more and more apparent that as soon as I manipulate the UV map I loose my vertex normals on exporting, which means I can either have a nice UV layout OR good shading, but not both.

Which applications or workflow can you recommend to achieve this? It would be best to find some small tool to just unwrap the geometry while preserving the normals, but right now I am looking for anything that can provide me with an obj with both the changed uv's and the vertex normals.

As the obj format is not that complex, another idea I had was to just copy the changed vt's (texture coordinates) to the orginal obj file or copy the original vn's (vertex normals) to the unwrapped obj file. But that didn't turn out well as the whole file seems to have been changed in between and they were out of sync. Is this feasible? All it would take is a small script, providing the vertex order, coordintes etc. stay the same.

Right now I am using Blender which I can get the normals to read using the build on this forum but on export they are lost again. My main render engine is Thea which reads obj's with vertex normals, no problem.

This seems so simple yet poses such a huge problem for me!
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  anthony
4515.2 In reply to 4515.1 
Use my old custom blender build (v2.49) and my moi import script. It will preserve normals and UV's while editing and upon export. My 2.5x builds are not that reliable.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
4515.3 In reply to 4515.1 
Hi sharky - unfortunately that's a big limitation of Blender - it doesn't deal with vertex normals properly and will discard them every time you go edit mode, even if you didn't edit anything that would require them to actually be recalculated.

That's pretty much a Blender specific problem, you could pretty much use any other kind of modeling program out there to avoid that happening.

Here are a couple of previous discussion threads about it:
http://moi3d.com/forum/index.php?webtag=MOI&msg=4256.1
http://moi3d.com/forum/index.php?webtag=MOI&msg=3583.1
http://moi3d.com/forum/index.php?webtag=MOI&msg=4424.9

If you must use Blender then Anthony's custom build that he mentioned above that fixes this is here:
http://chronosphere.home.comcast.net/~chronosphere/true-normals.htm


> Which applications or workflow can you recommend to achieve this?

As far as I know you can use literally any other program that can edit UV coordinates other than Blender.


> As the obj format is not that complex, another idea I had was to
> just copy the changed vt's (texture coordinates) to the orginal obj
> file or copy the original vn's (vertex normals) to the unwrapped obj
> file. But that didn't turn out well as the whole file seems to have
> been changed in between and they were out of sync. Is this feasible?

Yeah, that is probably possible, but you'll probably need to put only a single mesh object into each OBJ file that you want to edit this way.

I also wrote an OBJ merger utility that you can get here:
http://moi3d.com/wiki/Resources#MergeOBJ_utility
which was to help some people working this way of editing some separate OBJ files by hand and then having a way to merge them all together without losing the vertex normals.


You may want to look at a dedicated UV map editor program for doing this - there are a few choices for that:

UVMapper: http://www.uvmapper.com/
Unwrap3D: http://www.unwrap3d.com/u3d/index.aspx
Unfold3D: http://www.polygonal-design.fr/

The first 2 are pretty inexpensive and I think there is also an older free version of UVMapper available on their download page, that might be worth checking out.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  sharky0815
4515.4 
Thanks Anthony and Michael!

The Blender 2.49 route works perfectly for me, I only tried the newer version because newer is always better, right? :-)
Anthony, if you say normals are preserved on export, do you mean obj or lwo?
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  anthony
4515.5 In reply to 4515.4 
Probably neither of the default exporters will make use of the normals. However, all versions of Blender can export the true, unmodified normals with a simple change in the script. This is what I did to get Sunflow and Radium to render the true-normal.

I need to update my code and get Blender 2.5X importing, rendering, and exporting properly. But who has the time?
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  sharky0815
4515.6 In reply to 4515.5 
Providing I use your 2.49 exe plus your lwo import script, if I export using the bundled 2.49 obj export script, will it export the "true normals" or will it recalculate them? Do I have to enable both "Normals" and "HQ Normals" or just one?

If it does recalculate the normals on obj export, what would I have to change?

Thanks so much!

EDITED: 20 Sep 2011 by SHARKY0815

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  ycarry
4515.7 
Yes anthony please take the time to update your code
...for Blender 2.6 (incoming) !
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  anthony
4515.8 
1. In export_obj.py, change line 413 from "me.calcNormals()" to "pass #me.calcNormals()"
2. Import with import_moi.py
3. Edit your object: add/edit UVs, materials, taxtures, etc. Do not apply modifiers or move a vertex/face!
4. Export to OBJ and enable the Normals button.
5. Leave the HQ button off as it doesn't really calculate any high quality normals, it simply recalculates them.

Make sure your application/renderer will read the normals from the OBJ file (the lines that start with "vn") and actually use them instead of recalculating them.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  sharky0815
4515.9 
Now it works! Again, thousand thanks for laying this out! Maybe your post should be linked from the wiki?
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All