collapse

* Important


The forum and all threads have been locked, but are still available for browsing.  There is more information about this here.


The

Is still open for article contributions.

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

Offline Vkoslak

  • Moderator
  • Rare
  • *
  • *
  • Posts: 156
    • View Profile
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 30, 2018, 02:51:48 am by Vkoslak »

Offline Kva3imoda

  • Developer
  • Legendary
  • *
  • Posts: 1,079
  • Country: ru
    • status ready
    • View Profile
  • Mood: mood cool
Re: OgreXmlConverter options to make mesh files smaller, with script!
« Reply #1 on: May 21, 2018, 12:10:23 am »
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 21, 2018, 12:18:18 am by Kva3imoda »

Offline Vkoslak

  • Moderator
  • Rare
  • *
  • *
  • Posts: 156
    • View Profile
Re: OgreXmlConverter options to make mesh files smaller, with script!
« Reply #2 on: May 21, 2018, 01:49:38 am »
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

Offline Lord Nyriox

  • Emigrated to Cyrodiil
  • Developer
  • Rare
  • *
  • Posts: 161
  • Country: us
    • status away
    • View Profile
    • Github Profile
  • Mood: mood grin
Re: OgreXmlConverter options to make mesh files smaller, with script!
« Reply #3 on: May 29, 2018, 08:26:55 pm »
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.

Offline Vkoslak

  • Moderator
  • Rare
  • *
  • *
  • Posts: 156
    • View Profile
Re: OgreXmlConverter options to make mesh files smaller, with script!
« Reply #4 on: May 30, 2018, 02:48:45 am »
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.

Offline Lord Nyriox

  • Emigrated to Cyrodiil
  • Developer
  • Rare
  • *
  • Posts: 161
  • Country: us
    • status away
    • View Profile
    • Github Profile
  • Mood: mood grin
Re: OgreXmlConverter options to make mesh files smaller, with script!
« Reply #5 on: May 30, 2018, 04:40:00 am »
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.

Offline Phanjam

  • Operator
  • Legendary
  • *
  • Posts: 2,751
  • Country: ph
    • status ready
    • View Profile
  • Mood: mood angel
Re: OgreXmlConverter options to make mesh files smaller, with script!
« Reply #6 on: May 30, 2018, 09:24:08 am »
Thanks so much @Vkoslak and @Lord Nyriox for these! They add a lot of value to the body-of-knowledge on modding in general!



Tags: ogre meshes 3d 
 

Our host and sponsor

* Quick Search


* Mod Boards Activity

* Popular Topics