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: 157
Most Online Ever: 854
(September 18, 2024, 07:49:37 am)
Users Online
Members: 0
Guests: 220
Total: 220

Author Topic: OgreXmlConverter options to make mesh files smaller, with script!  (Read 1219 times)

0 Members and 68 Guests are viewing this topic.

I was playing around with an exporter earlier and captured the options it passes to OgreXmlConverter.
The meshes the created with the exporter were always smaller than when I just dragged the mesh to the exe.

"-e -t -td tangent -ts 4 P:\Blender\models\pinata\export\Llama.mesh.xml"

What they mean:
-e             = DON'T generate edge lists (for stencil shadows)
-t             = Generate tangents (for normal mapping)
-td [uvw|tangent]           = Tangent vertex semantic destination (default tangent)
-ts [3|4]      = Tangent size (3 or 4 components, 4 includes parity, default 3)


This resulted in my Fionna.mesh being reduced from 722KB with drag n drop to 298KB.


Being lazy and not wanting to type in those parameters every time I need to convert a mesh...

I made a batch file to do it for me  ;D

Slap the batch file I've attached below into the same directory as your OgreCommandLineUtils, and then drag your XML files over the batch file instead of the exe.

« Last Edit: May 29, 2018, 07:51:48 pm by Vkoslak »

Share on Bluesky Share on Facebook


Re: OgreXmlConverter options to make mesh files smaller, with script!
« Reply #1 on: »
I have to try this. You tested these models in the game, are there any problems?

Do these keys "-e -t -td tangent -ts 4" work for a file shortcut? Because I use the OgreXmlConverter as "Send to..." because it is much more convenient than "drag&drop".
« Last Edit: May 20, 2018, 05:18:18 pm by Kva3imoda »

Re: OgreXmlConverter options to make mesh files smaller, with script!
« Reply #2 on: »
I just loaded up my model in guts.  Looks fine to me. Animations are working.  No issues.


I tried it with a shortcut.  That works too.

Just set it like this with the quotes around the exe.
"C:\OgreCommandLineTools\OgreXMLConverter.exe" -e -t -td tangent -ts 4

Re: OgreXmlConverter options to make mesh files smaller, with script!
« Reply #3 on: »
What they mean:
-e             = DON'T generate edge lists (for stencil shadows)
-t             = Generate tangents (for normal mapping)
-td [uvw|tangent]           = Tangent vertex semantic destination (default tangent)
-ts [3|4]      = Tangent size (3 or 4 components, 4 includes parity, default 3)

@Vkoslak

Dude...do not get your command-line options mixed up. 

When I tried to use these options on a mesh I have been converting back and forth between XML and MESH, I received an error during the second conversion, saying that these "tangents" were "already generated". 

A quick Google search on "Ogre mesh tangents" turned up this discussion, which discusses how to make bump-mapping textures work. 

In short, you are actually optimizing on one side (edge-lists), and de-optimizing on another (by adding data for a texturing feature your model does not use). 

Try removing everything but "-e" and compare sizes (on a new mesh) with your old script.  You might be pleasantly surprised. 

I am off to Tamriel, seeking new adventures, great and small.  One day, I might return to Novastraia and show what I have learned.

Re: OgreXmlConverter options to make mesh files smaller, with script!
« Reply #4 on: »
That is a huge savings.

I was only using what the default was in the exporter. 

Unless we figure out how to get a normal map shader program working in torchlight the tangent options aren't needed.

Good find!

I'll update my batch file.

Re: OgreXmlConverter options to make mesh files smaller, with script!
« Reply #5 on: »
Good find!

I'll update my batch file.

I have been doing quite a bit of work requiring OgreXMLConverter lately.  It was actually in an effort to integrate your work into my own suite of automation scripts that I discovered the issue.  ;}

Why not try my scripts out as well? 
https://torchmodders.com/forums/3d-modelling-animation/(script)-automatic-mesh-and-skeleton-rebuilding-and-optimization/
I am off to Tamriel, seeking new adventures, great and small.  One day, I might return to Novastraia and show what I have learned.

Re: OgreXmlConverter options to make mesh files smaller, with script!
« Reply #6 on: »
Thanks so much @Vkoslak and @Lord Nyriox for these! They add a lot of value to the body-of-knowledge on modding in general!


 

Recent Topics+-