obj weight

Started by Dune, November 29, 2022, 03:37:56 AM

Previous topic - Next topic

Dune

I have made this character consisting of a human from DAZ, weighing around 16MB's. Then I add a series of clothing parts exported from Marvelous Designer and hair from ZBrush. They total about 67 MB's. Added up would be a guy of around 84 MB's. But when combined and exported from Poseray, I end up with a file of about 164 MB's.
I know ZBrush hair doesn't have normals, but the guy and the clothing do, as they look smooth when imported in Poseray, and you can't have a smooth look without (smooth vertex and/or face) normals having been calculated, I'd say. Or am I wrong? The parts are also all UV mapped, if that would add any weight, it's not that.
So why would the filesize be doubled?

Tried to find answers on the web, but can't find any. Can anyone explain this to me?

masonspappy

I'm not familiar with MD and Zbrush. Instead of combing all files for the export, is it possible to export one file at a time and see if the inflation among the files is consistent.  If one file seems to be inflated much more than the others, that might give you a clue about the culprit.


Dune

Thanks for your idea, I will try that.

KlausK

I do not know the math behind this but there are some differences in how applications convert and store obj, obviously  :P

An example is shown in the attached picture:

Astronaut obj model in Meshlab - from left to right:

L: Original simply opened in Meshlab
M: Original opened in Poseray and exported as new obj. No modifications whatsoever
R: Obj from Poseray optimized in Meshlab (delete duplicate points etc...)

Filesizes:
L = 2.95 MB
M = 3.72 MB
R = 3.02 MB

A few thoughts...

Obj`s are text files so they are already very un-optimized.
If you open the Astronaut after export from Poseray there are two new text blocks in the file which already take up 500 KB alone.
And that is a file which is only 2.59 MB originally.
The original file only has 1 line of descriptive text as a header.
Vertices and Faces count are the same (according to Meshlab) but the structure looks completely different.
Look at the *.mtl files of the original and the Poseray export. A lot more information (aka text) in there.
Maybe Poseray stores more information on the vertices on export (if that is possible with obj`s).

My conclusion would be to try to be as efficient as possible when building the file in your modeling app,
run it through Poseray nad afterwards run it again through Meshlab, which has tons of functions
to clean, repair, re-do virtually anything on the file.

I guess also that if you do the Poseray process in any other application you get varying file sizes after exporting again.
The algorithms differ quite a lot from soft to soft.

CHeers, Klaus
/ ASUS WS Mainboard / Dual XEON E5-2640v3 / 64GB RAM / NVIDIA GeForce GTX 1070 TI / Win7 Ultimate . . . still (||-:-||)

KlausK

/ ASUS WS Mainboard / Dual XEON E5-2640v3 / 64GB RAM / NVIDIA GeForce GTX 1070 TI / Win7 Ultimate . . . still (||-:-||)

KlausK

This is a snippet from a programming forum which might be something:

"Ok, this is a limitation of the OBJ Loader not the Exporter. The loader is only able to produce a so called non-indexed geometry.
When this geometry representation is exported again, the resulting file gets bigger.
An indexed geometry is useful if a lot of vertices are shared.
In this case, a vertex is define only once and face indices just point to it.
A non-indexed geometry has no shared vertices. All faces have unique vertices even if certain vertices have identical values."
/ ASUS WS Mainboard / Dual XEON E5-2640v3 / 64GB RAM / NVIDIA GeForce GTX 1070 TI / Win7 Ultimate . . . still (||-:-||)

KlausK

/ ASUS WS Mainboard / Dual XEON E5-2640v3 / 64GB RAM / NVIDIA GeForce GTX 1070 TI / Win7 Ultimate . . . still (||-:-||)

Dune

Thanks very much for all your input, Klaus! It's complicated, and I guess maybe Poseray doesn't export indexed geometry, but non-indexed, which would make it heavier. I noticed before that if I open and save, open again and resave again, it's getting bigger with every step.
I will open in meshlab and see what that says.

It's not really a problem, because it's still reasonable in size, but I am just very curious.

Dune

Interesting differences. It seems indeed that Meshlab writes the textfile differently, but also exports with default smooth normals. So it's important to have the right mesh (I sometimes choose normal calculation per material or part in Poseray).
After further reducing the obj's in TG, the tgo's differ less in size.
Another point is that exporting from meshlab sometimes looses the list of materials.

Conclusion; I'll stick with Poseray for the most.

sboerner

What steps do you take during the pass through Poseray? It looks like you use it to assemble the character parts -- body, hair, and clothing -- and to set face and vertex normals.

Have you ever considered using Blender for this instead? It will allow you to do those things (and like Poseray it's free).

My process is a little different than yours -- I use Blender to animate the body mesh and to model some clothing (like hats and boots) and hair (which are curves). Clothing is then imported as obj from Marvelous. But I've never seen file-size inflation like you seem to be experiencing.

Just a suggestion, if only to try it for comparison.

On the other hand, if it ain't broke why fix it?

Dune

I import all those indeed (but hair from ZB), but the main thing is that I merge some parts that share the same material. So instead of 30+ parts of the DAZ figure alone I end up with 8 or so, which makes it a lot easier to attach shaders in TG. Like all the different limbs, hands toenails, fingernails combined into one; face, lip and nostrils combined, etc.

The body always has the right smooth normals when imported, but especially when adding clothes (sometimes later), they often need an extra recalculation of normals. When I have merged the 'similar' parts in the groups section, I transfer these groups to materials and export.

And I export 2 versions from DAZ; my pose, and a Tpose for the MD morphing. Tpose, is later discarded.

I have no experience in Blender other than importing a .blend or .fbx and exporting as .obj. Thanks for the suggestion. I might one day try, but I have ample room on my HD, so I'm not worried, just curious. Indeed, why fix if it ain't really broken?

WAS

#11
Honestly Meshlab objects look better. Poseray one looks very uniform between materials, and too more matte, or the wood looks too matching to the iron.

Quote from: Dune on November 30, 2022, 04:50:58 AMbut also exports with default smooth normals
How? Isn't this a setting of renderers, not a object? Unless you actually run a filter to augment the normals and mesh to be smoother.

Dune

You can't really compare Meshlab and Poseray from this render, as the light is different (as positions of the casks are different), and the color variation PF gives them all a different shading.
Regarding the smooth normals; if I open an unwelded object in Meshlab, it exports with smooth normals automatically (just import-export), whereas in Poseray you have to manually set that (and you can choose angles). So for my first tries, the iron bands where 3 rows of polys, and they were smoothed out to a curve by the normal calculation (not nice), so later I smoothed the 90ยบ angle between sides and top of the bands with extra narrow rows of faces, and only they were smoothed by the normal calculation. That is the version you see here.