Welcome to
Mod The Sims
Online: 1415
News:
Have an account? Sign in:
pass:
If you don't have an account, why not sign up now? It's free!
Other sites: SimsWiki
Reply  Replies: 109 (Who?), Viewed: 200468 times.
Search this Thread
Old 14th Jul 2009, 2:01 PM DefaultBlender GEOM Mesh Plugin (updateversion 0.5) #1
morgade
Original Poster

Lab Assistant

Join Date: Jul 2009
Posts: 59
Thanks: 2006 in 31 Posts
6 Achievements


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
Click image for larger version

Name:  ss1.jpg
Views: 0
Size:  148.0 KB   Click image for larger version

Name:  ss2.jpg
Views: 0
Size:  53.9 KB   Click image for larger version

Name:  ss.jpg
Views: 0
Size:  41.6 KB   Click image for larger version

Name:  ss2.jpg
Views: 0
Size:  42.2 KB  
Download - please read all instructions before downloading any files!
File Type: zip geom-plugin-0.5.zip (6.6 KB, 9739 downloads) - View custom content
File Type: zip geom_morph_import-beta.zip (3.4 KB, 5376 downloads) - View custom content
Description: Morph apply beta
Last edited by morgade : 25th Jul 2009 at 3:12 AM.
Old 14th Jul 2009, 2:31 PM #2
cmomoney
˙uʍop ǝpᴉsdn ǝɹ,noʎ 'oN

Join Date: Dec 2008
Posts: 1,814
Thanks: 102372 in 71 Posts
28 Achievements


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
| ( ◡)| (❍ᴥ❍ʋ) [◕ ‿ ◕]
Old 14th Jul 2009, 4:56 PM #3
jadaytime
Lab Assistant

Join Date: Jun 2009
Posts: 133
Thanks: 802 in 8 Posts
5 Achievements


Are the body mesh files close at all to the object mesh files? This is such a big step already...
Old 14th Jul 2009, 9:17 PM #4
morgade
Original Poster

Lab Assistant

Join Date: Jul 2009
Posts: 59
Thanks: 2006 in 31 Posts
6 Achievements


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 !
Last edited by morgade : 15th Jul 2009 at 12:10 AM.
Old 16th Jul 2009, 3:32 AM #5
morgade
Original Poster

Lab Assistant

Join Date: Jul 2009
Posts: 59
Thanks: 2006 in 31 Posts
6 Achievements


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 ??
Old 16th Jul 2009, 3:58 AM #6
quetzilla
Lab Assistant

Join Date: Jul 2008
Posts: 96
Thanks: 1112 in 7 Posts
6 Achievements


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...
Old 16th Jul 2009, 4:28 AM #7
WesHowe
Alchemist

Join Date: Nov 2004
Posts: 2,830
Thanks: 6313 in 20 Posts
15 Achievements


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 *>
Old 16th Jul 2009, 4:35 AM #8
jadaytime
Lab Assistant

Join Date: Jun 2009
Posts: 133
Thanks: 802 in 8 Posts
5 Achievements


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.
Old 16th Jul 2009, 6:47 AM #9
cmomoney
˙uʍop ǝpᴉsdn ǝɹ,noʎ 'oN

Join Date: Dec 2008
Posts: 1,814
Thanks: 102372 in 71 Posts
28 Achievements


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
| ( ◡)| (❍ᴥ❍ʋ) [◕ ‿ ◕]
Old 16th Jul 2009, 1:31 PM #10
morgade
Original Poster

Lab Assistant

Join Date: Jul 2009
Posts: 59
Thanks: 2006 in 31 Posts
6 Achievements


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.
Old 16th Jul 2009, 1:40 PM #11
Tashiketh
Warrior Gryphon



Join Date: May 2004
Posts: 9,747
Thanks: 85238 in 16 Posts
28 Achievements


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.
Old 16th Jul 2009, 3:47 PM #12
xanathon
Forum Resident

Join Date: Oct 2004
Posts: 699
Thanks: 33097 in 58 Posts
20 Achievements


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! :.
Old 16th Jul 2009, 6:45 PM #13
WesHowe
Alchemist

Join Date: Nov 2004
Posts: 2,830
Thanks: 6313 in 20 Posts
15 Achievements


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 *>
Old 17th Jul 2009, 12:25 AM #14
morgade
Original Poster

Lab Assistant

Join Date: Jul 2009
Posts: 59
Thanks: 2006 in 31 Posts
6 Achievements


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
Old 17th Jul 2009, 1:03 AM #15
AnnieBonnie
Forum Resident

Join Date: Oct 2004
Posts: 649


YESSSSSSSSSS!!!!! Sorry...I over reacted....
Old 17th Jul 2009, 4:00 AM #16
mason666
Test Subject

Join Date: Feb 2007
Posts: 36
Thanks: 603 in 14 Posts
5 Achievements


Exellent ^^
Old 18th Jul 2009, 5:02 PM #17
morgade
Original Poster

Lab Assistant

Join Date: Jul 2009
Posts: 59
Thanks: 2006 in 31 Posts
6 Achievements


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)
Old 19th Jul 2009, 10:25 AM #18
moondragon77
Lab Assistant

Join Date: Feb 2005
Posts: 64


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!
Old 19th Jul 2009, 2:59 PM #19
AnnieBonnie
Forum Resident

Join Date: Oct 2004
Posts: 649


Excuse me...are you going to release those elf ears? I do hope so....please? *puppy eyes*
Old 20th Jul 2009, 6:28 AM #20
daluved1
Perfecting the Pedagogy



Join Date: Dec 2008
Posts: 2,711
Thanks: 106100 in 185 Posts
42 Achievements

View My Journal


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!"
Old 20th Jul 2009, 8:59 PM #21
hisui_hana
Lab Assistant

Join Date: Jan 2008
Posts: 112
Thanks: 1140 in 8 Posts
6 Achievements


All the meshes done using this program replaces the default?
Old 21st Jul 2009, 3:01 PM #22
jmtmom
Forum Resident

Join Date: Oct 2005
Posts: 713
Thanks: 4701 in 67 Posts
13 Achievements

View My Journal


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.
Old 21st Jul 2009, 5:18 PM #23
Sammy79
Field Researcher

Join Date: Jan 2006
Posts: 312
Thanks: 2340 in 13 Posts
9 Achievements


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
Old 21st Jul 2009, 5:25 PM #24
cmomoney
˙uʍop ǝpᴉsdn ǝɹ,noʎ 'oN

Join Date: Dec 2008
Posts: 1,814
Thanks: 102372 in 71 Posts
28 Achievements


Have you considered doing a plugin for MODLs?

"Part of being a mesher is being persistent through your own confusedness" - HystericalParoxysm
| ( ◡)| (❍ᴥ❍ʋ) [◕ ‿ ◕]
Old 22nd Jul 2009, 8:50 AM #25
daluved1
Perfecting the Pedagogy



Join Date: Dec 2008
Posts: 2,711
Thanks: 106100 in 185 Posts
42 Achievements

View My Journal


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!"
Reply


Section jump:


Powered by MariaDB Some icons by http://dryicons.com.