Lab Assistant
Original Poster
#1 Old 14th Jul 2009 at 2:01 PM Last edited by morgade : 25th Jul 2009 at 3:12 AM.
Default Blender GEOM Mesh Plugin (updateversion 0.5)
Blender GEOM Import/Export (Work in Progress)

This is a GEOM (body meshes) import/export plugin for Blender .

- Import: All data is imported into Blender (Vertex, Faces, Normals, Tangents, UVs, Bone Weigths and Vertex Colors)

- Export: It reads a template file (the original geom file) to find the original vertex ids and normals. (Normal are adjusted only on moved vertices).
Added vertex will be exported with the same vertex id of the nearest original vertex

How to use:
- Extract and copy the python files to folder Blender\.blender\scripts
- Export GEOM using Postal or sim3pe
- On Blender, File => Import => Sims 3 GEOM
- Edit the mesh (*)
- File => Export => Sims 3 GEOM
- To export, you need first to select the original GEOM file (to copy id references, original normals and other data), then select output file

(*) Editing problems
- Do NOT remove vertexes and/or faces (or anything that changes vertex order, like extruding faces): Original vertex ids and normals are copied using the mesh vertex order. Changing this order in any way will mess export file

- Do not change verts at seams as this will make seams visible in the game. Export script copies normals of unmoved verts from the original file, so, if seams are not touched, everything will be fine (this can be fixed in future).

- You can add new vertexes or subdivide edges, as the export script will assign to new vertices the same vertexid of the nearest original vertex, but do NOT extrude faces as this will change vertex order

- Do not choose wrong GEOM template file when exporting (resulting geom will not work).

Take a look at teen elf ears:



UPDATE
- Added a morph import beta (select morph geom, then mesh geom to import a morphed mesh)
Screenshots
Attached files:
File Type: zip  geom-plugin-0.5.zip (6.6 KB, 10500 downloads) - View custom content
File Type: zip  geom_morph_import-beta.zip (3.4 KB, 5755 downloads) - View custom content
Description: Morph apply beta
Advertisement
˙uʍop ǝpᴉsdn ǝɹ,noʎ 'oN
#2 Old 14th Jul 2009 at 2:31 PM
YYYEEESS! I'm glad somebody is working on this. Thanks for sharing!

"Part of being a mesher is being persistent through your own confusedness" - HystericalParoxysm
| (• ◡•)| (❍ᴥ❍ʋ) [◕ ‿ ◕]
Lab Assistant
#3 Old 14th Jul 2009 at 4:56 PM
Are the body mesh files close at all to the object mesh files? This is such a big step already...
Lab Assistant
Original Poster
#4 Old 14th Jul 2009 at 9:17 PM Last edited by morgade : 15th Jul 2009 at 12:10 AM.
Posted update 0.2.
Everything (Vertex, Faces, Normals, UVs, Bone Weigths, Vertex Colors) is imported to Blender.

Gonna try export now.

Edit: 0.2 had a stupid debug absolute path. Sorry !
Lab Assistant
Original Poster
#5 Old 16th Jul 2009 at 3:32 AM
Posted update 0.2.2

It now imports EVERITHING (including tangents and vertex color).

Export is almost working. Take a look at teen elf ears:




Now, to really finish exporting, i just need to understand how the hell the TailOffset value are calculated.

Any ideas ??
Lab Assistant
#6 Old 16th Jul 2009 at 3:58 AM
This is only slightly related to this but I figured I'd ask -- is there a limit on the texture resolution for clothing meshes for example? As with TS2, most of the default clothing is relatively low-res and I'd kill to have clothes with better textures...
Alchemist
#7 Old 16th Jul 2009 at 4:28 AM
Code:
#define HEADERLONGS 11
#define BLOCK1ALONGS 4

	tailseek=4+TailOffset-((HEADERLONGS+BLOCK1ALONGS)*4);
	fwrite(&tailseek, 1, 4, fp);

TailOffset in the above code is the actual offset of the start of the tail data section in the generated file. So what we are doing above is generating the number of bytes between the start of the next field (the tailsize) and the start of the tail data. So after export, you can read the tailOffset value, and use that value to fseek() from the current location.

The tail contains the reference tables, so it takes just a few reads and seeks to get to the reference table, without parsing the entire file again. I suspect this was put in to make the game more efficient at runtime.

The #defines are related to my method of building the (scenegraph) header, because in practice only a few values are ever variant in a GEOM (has only one part). I retain the TailOffset by caching the filepos when I generate the file, and then I go back and fseek() to certain locations, such as that, and "backpatch" in the final values.

<* Wes *>
Lab Assistant
#8 Old 16th Jul 2009 at 4:35 AM
Quote: Originally posted by morgade
Posted update 0.2.2

It now imports EVERITHING (including tangents and vertex color).

Export is almost working. Take a look at teen elf ears:




Now, to really finish exporting, i just need to understand how the hell the TailOffset value are calculated.

Any ideas ??


It looks like it's working to me...

Also, amazing work. People like you are the backbone of modding, from all people who own the Sims 3, thank you for all your whard work that you have put into making TS3 a much better place.
˙uʍop ǝpᴉsdn ǝɹ,noʎ 'oN
#9 Old 16th Jul 2009 at 6:47 AM
Good work, Morgade! (the ears look good, by the way ) And now Wes is helping!?! It's only a matter of time, my friend... *awaits eagerly*

"Part of being a mesher is being persistent through your own confusedness" - HystericalParoxysm
| (• ◡•)| (❍ᴥ❍ʋ) [◕ ‿ ◕]
Lab Assistant
Original Poster
#10 Old 16th Jul 2009 at 1:31 PM
Quote: Originally posted by wesHowe
TailOffset in the above code is the actual offset of the start of the tail data section in the generated file. So what we are doing above is generating the number of bytes between the start of the next field (the tailsize) and the start of the tail data. So after export, you can read the tailOffset value, and use that value to fseek() from the current location.
...
<* Wes *>


Yep. This is what i'm trying to do.
Actually I think I got the problem.
Sims2Wiki says that tail is formed by flags, count1, bonehasharray, numtgi and references. So, I was expecting that this offset is used to get to the position of flags value. But looks like it is used to get to the position of numtgi.
Warrior Gryphon
site owner
#11 Old 16th Jul 2009 at 1:40 PM
TailOffset is calculated from the GEOM chunk, not the start of the RCOL resource. If you want to go straight to the tail chunk from the beginning, use this:

- Record the offset of the start of the GEOM chunk (say, 44)
- Add this to the TailOffset value

output.Seek(tailOffset + startOfGEOM, SeekOrigin.Begin);

Obviously, the 44 can change depending on the size of the RCOL chunk, hence why you have to do it dynamically.

This method should take you right to the Flags value.

Note also that the TailLength seems to correspond more to the length of the TGI64 list, and doesn't include the Flags/count information just prior to it.

Story books are full of fairy tales, of Kings and Queens, and the bluest skies.
Forum Resident
#12 Old 16th Jul 2009 at 3:47 PM
Very nice work, Morgade, thanks for the effort.

I fear I have to regrapple the heavily nonstandard Blender GUI...

happy simming,
Xanathon


Xanathon's Laboratory :: WishList

.: Do not harass me with requests via PM, you will only get ignored :.
.: Don't post my objects or objects derived from them on paysites or the exchange! :.
Alchemist
#13 Old 16th Jul 2009 at 6:45 PM
Quote: Originally posted by morgade
Yep. This is what i'm trying to do.
But looks like it is used to get to the position of numtgi


Well, you can blame me, as I wrote the original parts of that spec.
But yes, it goes to the TGI count, and the length would be ((4*number of tgis)+1)*sizeof(long);

<* Wes *>
Lab Assistant
Original Poster
#14 Old 17th Jul 2009 at 12:25 AM
Export is now usable. Thanks for all your help !

To export, you need first to select the original GEOM file (to copy id references, original normals and other data), then select output file

(*) Editing problems
- Do NOT remove vertexes and/or faces (or anything that changes vertex order): Original vertex and normals ids are copied using vertex order. Changing this order in any way will mess export file

- Do not change verts at seams as this will mess with normals. Export script copies normals of unmoved verts from the original file, so, if seams are not touched, everything will be fine (this restriction can be fixed in future detecting seams on export).

- As i'm writing this text, i'm wondering what happens if some vertexes/faces are added to the mesh ... (testing later)

- Do not choose wrong GEOM template file when exporting (resulting geom will not work).

Well. A mesh modding tutorial with Blender is needed now.

We also need the specs of MODL chunks to edit objects !
This one don't tell much :p
Forum Resident
#15 Old 17th Jul 2009 at 1:03 AM
YESSSSSSSSSS!!!!! Sorry...I over reacted....
Test Subject
#16 Old 17th Jul 2009 at 4:00 AM
Exellent ^^
Lab Assistant
Original Poster
#17 Old 18th Jul 2009 at 5:02 PM
Updated to version 0.5

Now you can add new vertexes to the mesh or subdivide edges.
The export script will assign to new vertices the same vertexid of the nearest original vertex (so, your new vertexes will deform with CAS sliders)

Do NOT extrude faces as this will change vertex order

I was able to add real nipples (with depth) to female meshes subdividing edges.
I don't know if this kind of content is allowed here. Posted at the adult site (waiting in moderation queue)
Lab Assistant
#18 Old 19th Jul 2009 at 10:25 AM
WOW. I may actually be able to create something worth sharing for sims 3. I'm certainly going to try with things like this making it possible. Thank you sooo much!
Forum Resident
#19 Old 19th Jul 2009 at 2:59 PM
Excuse me...are you going to release those elf ears? I do hope so....please? *puppy eyes*
Mother Function
retired moderator
#20 Old 20th Jul 2009 at 6:28 AM
Quick n00b question, where are the ".blender\scripts" folders?

I checked under program files and I only have "Blender Foundation\Blender" no sub-folders.
\
EDIT- Ah ha I feel dumb I found it

"Holy Shift! Check out the asymptotes on that mother function!"
Lab Assistant
#21 Old 20th Jul 2009 at 8:59 PM
All the meshes done using this program replaces the default?
Forum Resident
#22 Old 21st Jul 2009 at 3:01 PM
Elf ears, you say!!?? I'm not too proud to beg for these. I am stunned that EA left them out of Sims 3. Excellent work everyone. This game will actually not suck once you talented folks are done with it.
Field Researcher
#23 Old 21st Jul 2009 at 5:18 PM
Hey wait, hold everything. With these ears, are you editing the sim's actual face in Blender? If so, how do you get the face back onto the sim? I've tried looking at the contents of a .sim file and can't figure it out :-\

Please don't PM/IM me with requests
˙uʍop ǝpᴉsdn ǝɹ,noʎ 'oN
#24 Old 21st Jul 2009 at 5:25 PM
Have you considered doing a plugin for MODLs?

"Part of being a mesher is being persistent through your own confusedness" - HystericalParoxysm
| (• ◡•)| (❍ᴥ❍ʋ) [◕ ‿ ◕]
Mother Function
retired moderator
#25 Old 22nd Jul 2009 at 8:50 AM
I seem to be having some import troubles. I extracted the GEOM scenegraph and everything, but when I try to import it into Blender, I get an error....and the mesh fails to load. I installed the scripts correctly and the Sims 3 GEOM extension importer shows up, but it just won't load =/

Any thoughts as to what's wrong?

"Holy Shift! Check out the asymptotes on that mother function!"
Page 1 of 5
Back to top