Mon, Oct 21, 5:32 PM CDT

Renderosity Forums / Poser - OFFICIAL



Welcome to the Poser - OFFICIAL Forum

Forum Coordinators: RedPhantom

Poser - OFFICIAL F.A.Q (Last Updated: 2024 Oct 21 5:20 pm)



Subject: Object grouping Utility...What is it?


Photopium ( ) posted Sun, 19 February 2012 at 1:28 PM · edited Wed, 09 October 2024 at 9:48 AM

Attached Link: I think I know what this is, but Can't be sure

New item in the marketplace.  I've read the description and looked at the pictures, and I'm really not sure what this is.

Has anyone beta-tested it and can desribe what it does without a language/translation barrier?


PhilC ( ) posted Sun, 19 February 2012 at 1:59 PM

Any OBJ file can contain many groups and materials. Let us consider one containing two groups and two materials. The data might be as below:-

g head
usemtl lips
f 322/323/322 1041/322/1041 321/321/321 1/1/1
f 323/325/323 1251/324/1251 322/323/322 1/1/1
f 327/335/327 1043/334/1043 326/333/326 2/2/2
usemtl skin
f 322/323/322 1041/322/1041 321/321/321 1/1/1
f 323/325/323 1251/324/1251 322/323/322 1/1/1
usemtl lips
f 325/331/325 1042/330/1042 324/329/324 2/2/2
f 326/333/326 1206/332/1206 325/331/325 2/2/2
f 327/335/327 1043/334/1043 326/333/326 2/2/2
usemtl skin
f 322/323/322 1041/322/1041 321/321/321 1/1/1
f 323/325/323 1251/324/1251 322/323/322 1/1/1
g neck
f 331/347/331 1044/346/1044 330/345/330 4/4/4
f 332/349/332 1252/348/1252 331/347/331 4/4/4
f 321/351/321 1041/350/1041 332/349/332 4/4/4
g head
f 331/347/331 1044/346/1044 330/345/330 4/4/4
f 332/349/332 1252/348/1252 331/347/331 4/4/4
f 321/351/321 1041/350/1041 332/349/332 4/4/4
g neck
f 331/347/331 1044/346/1044 330/345/330 4/4/4
f 332/349/332 1252/348/1252 331/347/331 4/4/4
f 321/351/321 1041/350/1041 332/349/332 4/4/4

It works, but the group and material data is all jumbled up. My interpretation of that application's info page is that it will reorganize those data blocks into something like:-

g head
usemtl lips
f 322/323/322 1041/322/1041 321/321/321 1/1/1
f 323/325/323 1251/324/1251 322/323/322 1/1/1
f 324/327/324 1042/326/1042 323/325/323 1/1/1
f 321/321/321 961/328/961 324/327/324 1/1/1
f 325/331/325 1042/330/1042 324/329/324 2/2/2
f 326/333/326 1206/332/1206 325/331/325 2/2/2
f 327/335/327 1043/334/1043 326/333/326 2/2/2
f 324/329/324 961/336/961 327/335/327 2/2/2
f 328/339/328 1043/338/1043 327/337/327 3/3/3
f 329/341/329 1202/340/1202 328/339/328 3/3/3
f 330/343/330 1044/342/1044 329/341/329 3/3/3
usemtl skin
f 322/323/322 1041/322/1041 321/321/321 1/1/1
f 323/325/323 1251/324/1251 322/323/322 1/1/1
f 324/327/324 1042/326/1042 323/325/323 1/1/1
f 321/321/321 961/328/961 324/327/324 1/1/1
f 325/331/325 1042/330/1042 324/329/324 2/2/2
f 326/333/326 1206/332/1206 325/331/325 2/2/2
f 327/335/327 1043/334/1043 326/333/326 2/2/2
f 324/329/324 961/336/961 327/335/327 2/2/2
f 328/339/328 1043/338/1043 327/337/327 3/3/3
f 329/341/329 1202/340/1202 328/339/328 3/3/3
f 330/343/330 1044/342/1044 329/341/329 3/3/3
g neck
f 322/323/322 1041/322/1041 321/321/321 1/1/1
f 323/325/323 1251/324/1251 322/323/322 1/1/1
f 324/327/324 1042/326/1042 323/325/323 1/1/1
f 321/321/321 961/328/961 324/327/324 1/1/1
f 325/331/325 1042/330/1042 324/329/324 2/2/2
f 326/333/326 1206/332/1206 325/331/325 2/2/2
f 327/335/327 1043/334/1043 326/333/326 2/2/2
f 324/329/324 961/336/961 327/335/327 2/2/2
f 328/339/328 1043/338/1043 327/337/327 3/3/3
f 329/341/329 1202/340/1202 328/339/328 3/3/3
f 330/343/330 1044/342/1044 329/341/329 3/3/3

Whilst it can be argued that applications can read this data easier and thus faster my reading of the store page is that the primary reason for this utility is so that humans can read and thus edit an obj file easier.

This I stress is just my understanding having read the store info page.


millighost ( ) posted Sun, 19 February 2012 at 2:36 PM

Quote - ... It works, but the group and material data is all jumbled up. My interpretation of that application's info page is that it will reorganize those data blocks into something like:-

...

You mean, similar to this ?:

call with obj-file: python obj_sort.py <filename.obj>

import sys
fs = list ()
d = { 'g': 'default', 'u': 'Preview' }
for line in open (sys.argv[1], 'r').readlines ():
  if line.startswith ('g') or line.startswith ('usemtl'):
    d[line[0]] = line
  elif line[0] == 'f':
    fs.append ((line, d['g'], d['u']))
  else:
    sys.stdout.write (line)
fs.sort (key = lambda x: (x[1], x[2]))
lg = lu = None
for f in fs:
  if f[1] != lg:
    sys.stdout.write (f[1])
    lg = f[1]
  if f[2] != lu:
    sys.stdout.write (f[2])
    lu = f[2]
  sys.stdout.write (f[0])


RobynsVeil ( ) posted Sun, 19 February 2012 at 3:00 PM

Thanks for that, MilliGhost. Studying the code: really nicely done!

Monterey/Mint21.x/Win10 - Blender3.x - PP11.3(cm) - Musescore3.6.2

Wir sind gewohnt, daß die Menschen verhöhnen was sie nicht verstehen
[it is clear that humans have contempt for that which they do not understand] 

Metaphor of Chooks


lesbentley ( ) posted Sun, 19 February 2012 at 7:53 PM

Thanks millighost!  👍


bantha ( ) posted Sun, 19 February 2012 at 8:28 PM

I don't know if it's still the case, but Firefly used to need more time for creating it's data structures if a model changes the material often in a group of polygons. If this is still true, this reordering may speed up the time needed before the render process starts.


A ship in port is safe; but that is not what ships are built for.
Sail out to sea and do new things.
-"Amazing Grace" Hopper

Avatar image of me done by Chidori


lmckenzie ( ) posted Sun, 19 February 2012 at 11:31 PM

Among other neat .obj cleanup and tweaking functions, Spanki's S.T.O.M.P. utility will do this if you select Face Sorting: By Group in the export options.

http://skinprops.com/download.php?view.1 

"Democracy is a pathetic belief in the collective wisdom of individual ignorance." - H. L. Mencken


Privacy Notice

This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.