www.tombraiderforums.com

Go Back   www.tombraiderforums.com > Tomb Raider Modding > Tomb Raider Level Editor > Software Development

Reply
 
Thread Tools
Old 04-09-09, 11:57   #1
sapper
Archaeologist
 
sapper's Avatar
 
Join Date: Sep 2007
Posts: 1,598
Default Program (beta) to recalculate normals

StrPix may not calculate the vertex normals for a mesh correctly so I have written a program that can recalculate them.

Sometimes StrPix does give better results, however, so experiment and use the calculation that gives the best results.

The program has not been tested on many PC's and only on XP so it may not work with your settings or system. If there is a problem, post here, but I may be unable to solve it.

Since it is a beta version make sure you always have a backup copy of any wad you use it with and test the new wad before using for your game.

There is no mesh viewer so you need to know the number of the mesh you want to change. The number is the same as in StrPix.

Double sided polygons are a problem for calculating vertex normals since they often result in a vertex normal pointing in the wrong direction. There is a workaround in the program (see the readme) which requires you to know the face indices for the faces on the interior of the double sided polygon. To get these you need to use Wadexplorer (link in my remap tutorial).

http://www.4shared.com/file/12782801...TRNormals.html 571 kB

Other downloads in this thread.

editwad1_3.zip (version 1.3 of editwad. Help docs included.)
editwad1_3resize.zip (Same as editwad 1.3 but a resizeable window in case full user interface not visible. Note no help docs included)
MetaRemap PDF (How to remap in Meta for editwad)

editwad1_4.zip ( No help docs, resizeable window, same as ver 1.3 but added feature to save Lara Skin and Lara Skin Joints to a single MQO file to check the connections.
Instructions. Move slider until info button (Blue Button top right) shows "7".
Press the info button and save the MQO file.

See this post for update to enable editwad1.4 to read Metasequoia 3.1.1 MQO files.

**NEW**

Latest version of editwad 1.4 that can import MQO files from Metasequoia 4.5.8. Includes help docs.

http://www.mediafire.com/file/ik5019...ad1_4_2017.zip



Note 4Shared now requires registration to to download but you can get editwad1.4 from skribblerz.com or the tools section at trsearch.

Last edited by sapper; 20-03-17 at 06:10. Reason: add MQO 4.5.8 link
sapper is offline   Reply With Quote
Old 04-09-09, 11:59   #2
MyRaider4Life
Tomb Raider
 
MyRaider4Life's Avatar
 
Join Date: Jun 2007
Location: Australia
Posts: 10,202
Default

Sounds good but I'm puzzled about what the program does.
I don't really get it.
MyRaider4Life is offline   Reply With Quote
Old 04-09-09, 12:03   #3
aktrekker
Relic Hunter
 
aktrekker's Avatar
 
Join Date: Aug 2006
Posts: 5,239
Default

Normals are used for objects that are affected by external lighting. The lighting system uses the normal for each vertex (shows which way the vertex points) to determine how much of each light should affect the vertex.
If the normal is wrong, the lighting will not look right.
When you have an object that is internally lit, it has no normals. If you change the object to be externally lit, the normals must be calculated. This program calculates the normals.

Last edited by aktrekker; 04-09-09 at 12:04.
aktrekker is offline   Reply With Quote
Old 04-09-09, 12:17   #4
sapper
Archaeologist
 
sapper's Avatar
 
Join Date: Sep 2007
Posts: 1,598
Default

StrPix recalculation of normals.


TRNormals recalculation of normals.


I think StrPix automatically recalculates the vertex normals for any DXF you import but if you remap a mesh you have to recalculate them again using "Re-calc Normals" from the Remap menu. My program just does the same as that but results in different vertex normals. I haven't seen the StrPix code so cannot be sure what method TurboPascal used.
sapper is offline   Reply With Quote
Old 04-09-09, 15:56   #5
God Horus
Tomb Raider
 
God Horus's Avatar
 
Join Date: Jun 2005
Posts: 11,869
Default

Cool program! I am going to use it on Trangel's new outfit and see how it works.
God Horus is offline   Reply With Quote
Old 04-09-09, 16:33   #6
Shauni
Relic Hunter
 
Shauni's Avatar
 
Join Date: Feb 2005
Location: Emotion
Posts: 5,279
Default

This sounds very interesting! I'll try it out and post screenies too. My head meshes usually a few double sided parts on it with the bangs, do you think it'll make it a lot harder to work with?
__________________
(. .' ~Trinity~..)
Shauni is offline   Reply With Quote
Old 04-09-09, 16:49   #7
Titak
Moderator
 
Titak's Avatar
 
Join Date: Jul 2003
Location: Drenthe, The Netherlands
Posts: 31,999
Default

I just tested it on my Vista computer and I have found no problems. I recalculated the normals of an outfit placed in my outfit wad, then copied the outfit with the new normals into my levelwad. No problems there either.
And no problems ingame.

(I recalculated the normals of Po Yu's TRU head.)
__________________
If it walks like a duck and if it quacks like a duck, it is a duck.
Titak is offline   Reply With Quote
Old 05-09-09, 12:08   #8
sapper
Archaeologist
 
sapper's Avatar
 
Join Date: Sep 2007
Posts: 1,598
Default

Quote:
Originally Posted by Shauni View Post
... My head meshes usually a few double sided parts on it with the bangs, do you think it'll make it a lot harder to work with?
Depends how easily you can access the inside of the bangs in wadexplorer to get the face indices.

Maybe the bangs will still look ok without fixing the normals on the bangs. StrPix has the same problem with double sided polygons.

In the zip file of the download you may have noticed an MQO file with the normals shown as lines connected to the mesh. Titak said they look like acupuncture needles sticking out.

I'm working on a program that let's you output an MQO with normals so you can then adjust the direction of any of the normals just by selecting the vertex at the free end and then using meta's move command. You save the MQO with the adjusted normals then load it back into the wad. The program then calculates the normals from the directions of the lines. It's a Python 2.5 program at this stage so you would need Python 2.5 installed to use it.

You would recalc normals with TRNormals as best you can and then just use this program to manually correct the normals that still point in the wrong direction.
sapper is offline   Reply With Quote
Old 02-10-09, 14:39   #9
sapper
Archaeologist
 
sapper's Avatar
 
Join Date: Sep 2007
Posts: 1,598
Default



Ok here's the program to adjust single normals. It can do some other stuff to meshes in the wad too, see the included guide. Take the usual precautions when editing wads with the program. Always have a backup and test the wad in StrPix, wadmerger and a test level before using objects from the edited wad in your main wad.

There are two versions available.

1. editwad.zip(1.2MB)
This version requires PYTHON 2.5 installed. The program might work with later versions but it was only tested with 2.5. This version uses a console window to display help & error messages as shown above and this window is not available with the version below.

2. editwad_standalone.zip(6MB) (Download latest standalone version editwad1_3.zip (11MB))
This version doesn't need python installed but needs certain DLLs installed on your system that cannot be distributed with the program. Your OS probably will have them already but if not, the program will not work. Only tested with XP.

The following pics show how to correct normals that TRNormals cannot.




Note the viewers in the program are 2D not 3D so you may need to use StrPix to get the right mesh.
You can use the program to swap Lara's head without remapping*. Need to have the alternate outfit already in the wad by copying it across in wadmerger to an unused slot since the program only operates with a single wad. The two lists are the same.

*Remember the head must fit the neck joint and have the same remapping as the scream head and the alternate head must already have correct remapping.

Last edited by sapper; 03-01-11 at 05:01.
sapper is offline   Reply With Quote
Old 02-10-09, 14:46   #10
Titak
Moderator
 
Titak's Avatar
 
Join Date: Jul 2003
Location: Drenthe, The Netherlands
Posts: 31,999
Default

Great results!

This sure adds another dimension to creating outfits...
__________________
If it walks like a duck and if it quacks like a duck, it is a duck.
Titak is offline   Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 18:29.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.