Python Forum
Preprocessing an OBJ file, what is the best way to?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Preprocessing an OBJ file, what is the best way to?
#6
Thanks for trying to help, the OBJ file is as per the https://en.wikipedia.org/wiki/Wavefront_.obj_file

My initial test file is 98.7 meg but I would like to be able to process even larger.

The file has a few lines of comments then a

mtllib {filename}
That is a reference to a materials definition file.

Then a large number of vertex and face definitions
v 6.806145 3.287188 34.507591
v 6.889372 3.314378 34.482964
...... repeat large number of times with different values
g groupName
usemtl groupMaterial
f 1 2 3
f 4 5 6
f 4 7 8
f 5 4 8
f 8 7 9
...... repeat a large number of times with different values
v -5.852165 2.924480 33.700558
v -5.861451 2.937897 33.763584
v -5.978782 2.973776 33.743969
v -5.635860 2.871064 33.685860
v -5.709496 2.899417 33.751705
v -5.442479 2.838525 33.676365
v -5.522288 2.871565 33.741238
v -5.261642 2.836869 33.678814
v -5.349662 2.853023 33.73287
.... repeat a large number with different values

g nextGroupName
usemtl nextGroupMaterial

... more v & f definitions
In total there are 173 different groups and material definition.

I can call a python function which has a c++ function to process the file and it creates the 173 objects but does nothing
with the materials, so I wish to preprocess the file to get a list/dictionary of objects and their materials.
After loading I would then process the 173 objects and allocate the associated material.

It would also be useful to get a list of the materials in the preprocess so that I could offer a set of mapping to
a different set of materials.
Reply


Messages In This Thread
RE: Preprocessing an OBJ file, what is the best way to? - by KeithSloan - Mar-02-2024, 08:14 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020