OBJ to S3O and S3O to OBJ converter (get it here :D)

OBJ to S3O and S3O to OBJ converter (get it here :D)

Share and discuss visual creations and creation practices like texturing, modelling and musing on the meaning of life.

Moderators: MR.D, Moderators

User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

OBJ to S3O and S3O to OBJ converter (get it here :D)

Post by Beherith »

Ever wanted to edit just a small imperfection in an s3o model? Tired of screwed up normals and per piece importing into upspring? Dislike making text files for assimp? Here is the ultimate solution!

Complete S3O to OBJ and OBJ to S3O converter.
Needs python 2.x to run.
Billion thanks to Muon for his wonderfule S3O library!

Converts OBJ files to S3O files, while retaining pieces and piece hierarchies.
Image
Instructions and notes:

Launch by double clicking obj2s3o.py!

1. Converting S3O to OBJ:
Open an s3o file, and the obj file will be saved with the same name and an .obj extension. The name of each object in the .obj file will reflect the naming and pieces of the s3o file. All s3o data is retained, and is listed as a series of parameters in the object's name.
Example:
base,ox=-0.00,oy=0.00,oz=0.00,p=,mx=-0.00,my=4.00,mz=0.00,r=17.50,h=21.00,t1=tex1.png,t2=tex2.png
ALL s3o info is retained, including piece hierarchy, piece origins, smoothing groups, vertex normals, and even degenerate pieces with no geometry used as emit points and vectors. These emit pieces will be shown as triangles with their correct vertex ordering.
2. Converting OBJ to S3O:
The opened .obj file will be converted into s3o. If the piece names contain the information as specified in the above example, the entire model hierarchy will be correctly converted. If it doesnt, then the program will convert each object as a child piece of an empty base object

Download here: https://github.com/beyond-all-reason/OBJ2S3O

Why is this all good for you?
It creates closed surfaces editable in wings3d.
It retains piece heirarchy and piece origins both ways.
It optimizes s3o vertex counts and performs vertex cache optimization.
Allows normals-correct importing and exporting
Allows graphical editing of directed emit points
For an empty emit piece, make a triangle, its first vertex will be the emit pos with a direction of (0,0,1), and name the piece like this: 'flare,e=0'.
For an emit piece with a position and a custom direction, make a triangle object; its first vertex will be the emit position, and the vector pointing from first vertex to second vertex will be the emit direction. name the piece like this: 'wake,e=1'
Calculates proper smoothing groups for .obj files.
And as a bonus, you can linear transform the UV space of any .obj file upon importing! (yes this includes flipping the UVs, in which case you want to specify (1,0,-1,1)

Edit: edited for completeness

Edit2: New download link, windows EXE
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: OBJ to S3O and S3O to OBJ converter (get it here :D)

Post by Forboding Angel »

I am so horny for you right now.
User avatar
Karl
Panzerstahl Developer
Posts: 746
Joined: 01 Apr 2010, 21:05

Re: OBJ to S3O and S3O to OBJ converter (get it here :D)

Post by Karl »

OBJ? Have fun for a click festival...

Oh yeah keyboard bashing
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: OBJ to S3O and S3O to OBJ converter (get it here :D)

Post by Beherith »

Karl wrote:OBJ? Have fun for a click festival...

Oh yeah keyboard bashing
WTF?
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: OBJ to S3O and S3O to OBJ converter (get it here :D)

Post by Beherith »

Fixed a bug that caused wierd smoothing groups.
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Re: OBJ to S3O and S3O to OBJ converter (get it here :D)

Post by rattle »

cool... would've been handy when I was still making stuff and fighting with upspring most of that time
User avatar
FireStorm_
Posts: 666
Joined: 19 Aug 2009, 16:09

Re: OBJ to S3O and S3O to OBJ converter (get it here :D)

Post by FireStorm_ »

Used the s3o to obj and it worked perfectly. (apart from a few Hardness lines here and there I think, nothing bothersome.)
Awesome tool :-).
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: OBJ to S3O and S3O to OBJ converter (get it here :D)

Post by Beherith »

Could you post the s3o on which the smoothing failed?
User avatar
FireStorm_
Posts: 666
Joined: 19 Aug 2009, 16:09

Re: OBJ to S3O and S3O to OBJ converter (get it here :D)

Post by FireStorm_ »

Yes. But I also realised (I didn't at the time :-) ) that the smoothing changes might have happened when the model went from obj to Wing3D. So it might be a false alarm.
Attachments
mr_bob_corak.zip
(158.23 KiB) Downloaded 49 times
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: OBJ to S3O and S3O to OBJ converter (get it here :D)

Post by Beherith »

Ah, that AK was imported into upspring from 3ds, which is why it fails. Mine works perfect :D
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: OBJ to S3O and S3O to OBJ converter (get it here :D)

Post by Beherith »

Another major bugfix: vanilla obj->s3o conversion used to fail because of piece reordering.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: OBJ to S3O and S3O to OBJ converter (get it here :D)

Post by Forboding Angel »

I assume this works with objs who have multiple pieces?
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: OBJ to S3O and S3O to OBJ converter (get it here :D)

Post by Beherith »

Thats the whole point of it. That if an obj has multiple pieces, they will be individually added to an empty root object. If it has multiple pieces, and they are correctly named (with the parameters in the post, or by exporting from s3o to obj by this tool) they will retain their parent-child relationships, textures, offests, origins, etc.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: OBJ to S3O and S3O to OBJ converter (get it here :D)

Post by Forboding Angel »

NOICE!
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: OBJ to S3O and S3O to OBJ converter (get it here :D)

Post by Beherith »

Version 5:
Fixed a bug in the UV linear transformation
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: OBJ to S3O and S3O to OBJ converter (get it here :D)

Post by Forboding Angel »

Image

This is me. (50 points if you get what I'm trying to say)
User avatar
enetheru
Posts: 627
Joined: 11 Jun 2010, 07:32

Re: OBJ to S3O and S3O to OBJ converter (get it here :D)

Post by enetheru »

I have a problem with objects exported from blender.
basically it appears to mess with something cause the commander gets all messed up and the objects position somehow is dependent.

converting from existing s3o and back works fine.. only from blender to obj to s30 is broken..
attached is the zip with the original export from blender, and the s3o

any help appreciated.
Attachments
cube.zip
(703 Bytes) Downloaded 52 times
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: OBJ to S3O and S3O to OBJ converter (get it here :D)

Post by Beherith »

The cube.obj converts perfectly to s3o for me.
Please post your commander, and screenshot the nature of your issue. If the script throws an error in console, paste that.

EDIT: The object hierarchies made in blender _WILL NOT_ be retained. Neither will the object offsets. The object hierarchies made in upspring are retained.
User avatar
enetheru
Posts: 627
Joined: 11 Jun 2010, 07:32

Re: OBJ to S3O and S3O to OBJ converter (get it here :D)

Post by enetheru »

Beherith wrote:The cube.obj converts perfectly to s3o for me.
Please post your commander, and screenshot the nature of your issue. If the script throws an error in console, paste that.

EDIT: The object hierarchies made in blender _WILL NOT_ be retained. Neither will the object offsets. The object hierarchies made in upspring are retained.
currently uploading a youtube vid to illustrate, also appears to be linux only.

I have to go out now, so will post a link to the vid later.
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: OBJ to S3O and S3O to OBJ converter (get it here :D)

Post by Kloot »

enetheru wrote:only from blender to obj to s30 is broken
Why would you even bother with that last step?

http://springrts.com/phpbb/viewtopic.php?f=9&t=22635
Post Reply

Return to “Art & Modelling”