Planetside Software Forums

General => Terragen Discussion => Topic started by: KirillK on March 26, 2019, 08:58:12 am

Title: Micro mesh exporter very messy geometry?.
Post by: KirillK on March 26, 2019, 08:58:12 am
All triangles disconnected , some having messy UVs . All this making it pretty useless for gamedev related purposes.  And extremely difficult to fix, especially for hi res geometry .   Such geometry produce massive artifacts afterward in texture baking engines.

Could it be fixed somehow?
Title: Re: Micro mesh exporter very messy geometry?.
Post by: digitalguru on March 27, 2019, 09:34:05 pm
Yes, the Micro Exporter can export very messy geo indeed, but it's all easily fixable.

As far as I understand it, the Micro Exporter isn't exporting a geometric object from Terragen, but a collection of faces calculated at render time by the micro-polygon renderer. It doesn't understand that the exported mesh is one homogeneous object, so you are right - all the triangular faces are disconnected as the mesh doesn't share vertices between faces.

This can result in the object having literally millions of extra redundant vertices for a high-res mesh, and since UV coords and normal info are stored per vertex, turning on these options in the Micro exporter can further increase the size of the mesh on disk.

There will also be duplicate faces - if the Micromesh is rendered with multiple threads, then as each bucket is rendered, a certain amount of overlap occurs at the edge of each bucket. Planetside recommend rendering single-threaded when exporting a mesh for this reason.

The simple solution is to filter for duplicate vertices and duplicate faces in a mesh editing program.

I use Meshlab - which has many, many mesh editing functions.  It's open source and free and runs on Windows/Mac/Linux.

I mainly use it for just two functions:
Filters/Cleaning and Repairing/Remove Duplicate Vertices
Filters/Cleaning and Repairing/Remove Duplicate Faces

So long as you remove the duplicate faces, you can export the mesh with as many threads as you like.

and that's it - job done.

In fact I've folded a batch script to run from my Maya/Terragen script  -


The ability to clean up the mesh before importing it into your 3d app is the reason I always use .obj as the export format.

Meshes can be exported as FBX and this can reduce the file size a little as it is a binary format,  but there are not any applications I know of that can edit FBX directly.

Same goes for .tgo and I imagine the options are limited for .lwo

.obj is pretty universal, and since it's human-readable, you can hack the file in a text editor if you're so inclined  :)

I would also recommend turning off Normals in the Micro Exporter in Terragen, this can help to reduce the file size further and you can always soften the normals with a bit more precision in your 3d app.

p.s - this can all be done in a prog like Maya, but Maya is horribly slow when editing high-density meshes. Meshlab is relatively quick.