News:

SMFNew Installed

+-+-

User+-

Welcome, Guest.
Please login or register.
 
 
 

Login with your social network

Forgot your password?

Site Stats+-

Members
Total Members: 728
Latest: Cho
New This Month: 0
New This Week: 0
New Today: 0
Stats
Total Posts: 10932
Total Topics: 795
Most Online Today: 1
Most Online Ever: 854
(September 18, 2024, 07:49:37 am)
Users Online
Members: 0
Guests: 6
Total: 6

Author Topic: [SCRIPT] Automatic Mesh Rebuilding  (Read 8988 times)

0 Members and 0 Guests are viewing this topic.

Lord Nyriox

  • Emigrated to Cyrodiil
  • Moderator
  • *
  • Posts: 161
  • Gender: Male
    • View Profile
    • Github Profile
[SCRIPT] Automatic Mesh Rebuilding
« on: May 29, 2018, 03:22:05 pm »
Windows Scripts:
Automatic Mesh Rebuilding

As I mentioned during the discussion on my "Emberdrake" class project, when @Anarch16sync suggested converting meshes to XML (to fix bugs in a previous project of mine), I ended up creating a small suite of recursive Windows command scripts to fully automate that process (using the official OGRE command-line tools). 

They do require some initial set-up, but once that is finished, they should be more or less easy to run automatically.

Steps to Use: 
  • Extract the OGRE command-line tools for version 1.7.x into a directory.  Make sure that OgreXMLConverter.exe, OgreMeshMagick.exe, and OgreMain.dll are all in that directory.
  • Modify the paths in the Mesh-scripts to point to whatever directory you have the OGRE tools stored in.
  • Copy the scripts into the directory of the model you want to edit.
  • Run the scripts from within the model directory.

Included Scripts: 
  • MESH2ROTATE rebuilds all MESH and SKELETON files, then rotates all skeletons within its directory (and sub-directories) to 90 degrees counterclockwise.  It was created to help fix bad rotations in animations exported via "PinkVertex".
  • MESH2XML converts all Mesh and Skeleton files within its directory (and sub-directories) into Mesh.xml and Skeleton.xml files, then deletes the original Mesh and Skeleton files after conversion.
  • XML2MESH converts all Mesh.xml and Skeleton.xml files within its directory (and sub-directories) back into Mesh and Skeleton files, then deletes all Mesh.xml and Skeleton.xml files in the directory after conversion.
  • MESH2CLEAN uses the optimize function of OgreMeshMagick on all Mesh and Skeleton files within its directory (and sub-directories).  See the MeshMagick page for more details.
  • Simply combines 3 other scripts in this list (MESH2XML, XML2MESH, and MESH2CLEAN, respectively) to automatically decompile, recompile, then optimize all Mesh and Skeleton files within its directory.  I developed this script as a more robust alternative to OgreMeshUpgrader.  (By decompiling and then recompiling the models using tools whose OGRE version matches Torchlight's, I can ensure the meshes are not way out of date.)
  • MESH2SCALE scales all meshes and skeletons within its directory (and sub-directories) to 2.0 times their original size.  It was created as a proof-of-concept script demonstrating how one can use this scripting method to automate other MeshMagick commands.
  • MESH2UPGRADE runs "OgreMeshUpgrader" on all Mesh and Skeleton files within its directory (and sub-directories).  It throws an error at any Skeleton files, but does not seem to damage them.
  • MESH2UPGRADE_V8 is a modified version of "MESH2UPGRADE", which uses the version-targeting feature from OGRE version 1.8+, for downgrading models from later OGRE versions (back to the version used by Torchlight 2).



Notes:
  • All scripts make use of the "FOR /R" command to ensure all relevant files are recursively converted. 
  • XML2MESH, MESH2REBUILD, and MESH2UPGRADE use the "-e" (disable generation of Edge Lists) option when converting XML files to Mesh and Skeleton files, which reduces file-sizes dramatically (compared to OgreXMLConverter defaults).  The in-game behavior of the resulting models does not seem to be impacted. 
  • The MESH2CLEAN and MESH2SCALE scripts can be easily adapted to perform other operations using MeshMagick.  See the MeshMagick wiki page or the "Open Dungeons" OgreMeshMagick guide for other examples on what you can do using it. 
« Last Edit: October 31, 2019, 12:19:41 pm by Lord Nyriox »
I am off to Tamriel, seeking new adventures, great and small.  One day, I might return to Novastraia and show what I have learned.

Share on Bluesky Share on Facebook


Phanjam

  • Operator
  • *
  • Posts: 2,752
  • Gender: Male
  • Location: same as you. at the center of the universe.
    • View Profile
Re: [SCRIPT] Automatic Mesh and Skeleton Rebuilding
« Reply #1 on: May 30, 2018, 02:42:37 am »
This is fantastic @Lord Nyriox ! Thanks for sharing your tools and work!


Lord Nyriox

  • Emigrated to Cyrodiil
  • Moderator
  • *
  • Posts: 161
  • Gender: Male
    • View Profile
    • Github Profile
Re: [SCRIPT] Automatic Mesh and Skeleton Rebuilding
« Reply #2 on: May 30, 2018, 03:21:42 pm »
This is fantastic @Lord Nyriox ! Thanks for sharing your tools and work!

I figured that, given the almost complete lack of automation tools in Torchlight modding, anything to make mod-development easier can only improve the variety and quality of mods out there. 

Speaking of which, do you think anyone would be interested in a "Mesh optimization" mod (in which all vanilla Model files are rebuilt with these)? 

Given how much smoother gameplay gets with just the used player model optimized like this, what benefit could having every Model in the game optimized as well?  ;> 
I am off to Tamriel, seeking new adventures, great and small.  One day, I might return to Novastraia and show what I have learned.

steffire3

  • Mod_Seeker, Balance_Researcher, Person_Listener.
  • Rare
  • *
  • Posts: 241
  • Gender: Male
  • I am more active on the Steam Workshop Discussions
  • Location: TL2-Ace mod ^_^
    • View Profile
Re: [SCRIPT] Automatic Mesh and Skeleton Rebuilding
« Reply #3 on: May 30, 2018, 03:37:48 pm »
@Lord Nyriox If any tool helps to cut down the time required to build mods and fix or avoid buggy writing then I am all in favor of it.
At this point after playing Torchlight 2 for 8 years original and modded... ignorant of mods and now wise with compatibility... the one thing I value the most-

-is being able to have "support" from the author of any mod.

I think the only advice I can give is that you don't burn yourself out. ^_^

Lord Nyriox

  • Emigrated to Cyrodiil
  • Moderator
  • *
  • Posts: 161
  • Gender: Male
    • View Profile
    • Github Profile
Re: [SCRIPT] Automatic Mesh and Skeleton Rebuilding
« Reply #4 on: June 12, 2018, 11:08:25 am »
Updated the script package.  Now includes a script for OgreMeshUpgrader as well. 

I removed the Tangent-generation script, since it is currently useless for Torchlight modding. 

You can find the latest version in the OP. 
I am off to Tamriel, seeking new adventures, great and small.  One day, I might return to Novastraia and show what I have learned.

DragonDawn

  • Common
  • *
  • Posts: 16
  • Gender: Male
    • View Profile
Re: [SCRIPT] Automatic Mesh and Skeleton Rebuilding
« Reply #5 on: December 17, 2018, 11:59:03 am »
Can you include a readme in the zip explaining how these tools work in detail along with installation instructions?

Lord Nyriox

  • Emigrated to Cyrodiil
  • Moderator
  • *
  • Posts: 161
  • Gender: Male
    • View Profile
    • Github Profile
Re: [SCRIPT] Automatic Mesh and Skeleton Rebuilding
« Reply #6 on: December 26, 2018, 07:41:03 am »
Can you include a readme in the zip explaining how these tools work in detail along with installation instructions?
In retrospect, my description of each script's functionality does seem a bit dense.

These scripts are the product of extensive research on the OGRE model format, so a proper description of their behavior would probably wind up more technical than readable. 

I will see about adding comments (and a "readme" file) to the script package.
I am off to Tamriel, seeking new adventures, great and small.  One day, I might return to Novastraia and show what I have learned.

Phanjam

  • Operator
  • *
  • Posts: 2,752
  • Gender: Male
  • Location: same as you. at the center of the universe.
    • View Profile
Re: [SCRIPT] Automatic Mesh Rebuilding
« Reply #7 on: October 31, 2019, 10:58:39 am »
Hi @Lord Nyriox . I made a readme for myself, from the info in the OP.  Sharing it with you here (attached) in case you can use it ;)


Kva3imoda

  • Developer
  • *
  • Posts: 1,079
  • Gender: Male
    • View Profile
Re: [SCRIPT] Automatic Mesh Rebuilding
« Reply #8 on: January 09, 2020, 05:33:48 pm »
Thanks for these scripts @Lord Nyriox. They saved me a ton of time right now.  :)

Lord Nyriox

  • Emigrated to Cyrodiil
  • Moderator
  • *
  • Posts: 161
  • Gender: Male
    • View Profile
    • Github Profile
Re: [SCRIPT] Automatic Mesh Rebuilding
« Reply #9 on: May 21, 2020, 08:33:07 pm »
Thanks for these scripts @Lord Nyriox. They saved me a ton of time right now.

That is great to hear, @Kva3imoda!

I may one day come back and clean my scripts up (i.e. add proper variables and better documentation).  But I am glad that even in its incomplete state, my TL2 toolchain has proven useful for you. 

P.S.  For now, I will be locking all my forum topics while I am away.

Thank you so very much for all your support!
« Last Edit: May 21, 2020, 08:37:53 pm by Lord Nyriox »
I am off to Tamriel, seeking new adventures, great and small.  One day, I might return to Novastraia and show what I have learned.

 

Recent Topics+-