Quick Reply
Search this Thread
Forum Resident
Original Poster
#1 Old 18th Jun 2023 at 8:40 AM Last edited by CardinalSims : 5th Jul 2023 at 2:26 AM. Reason: More tweaks.
Default TUTORIAL: Real Geostates with Blender and S3PE
So, I've written another tutorial and it isn't Part Two of the tutorial I was working on.
I couldn't wait- after a small breakthrough, I cracked each geostate value and now have a sure-fire method for creating the same type of geostates as EA objects have- no tricks with extra groups. This method also retains all material references with no need to go back and renumber. This is kind of like a tutorial on manually importing a mesh with the added bonus of getting your geostate values along the way.

As far as I know, there has never been a full geostate tutorial even for the ‘spoof’ version.
I hope this knowledge will help breathe some life into the creations that have long went without custom meshes, such as recipes and plants.

Requirements
Blender (2.98 used in tutorial)
S3PE
Milkshape 3D 1.8.5
(trial version is fine)
S3PE to Milkshape Plugin
Milkshape to S3PE Plugin
Any Decimal to Hexadecimal Converter*
Any Calculator


*If you've ever used Sims4Studio, the Hash Generator has this built in and you can close the main program while in use. I use this. You can also just google this and use an online one.

Process Index
  • Prepare Meshes in Blender
  • Export as OBJ
  • Export an MLOD/MODL
  • Replace Mesh in Milkshape
  • Import into S3PE
  • Add Geostate Values

Prepare Meshes in Blender
Have your meshes ready in a Blender project. You can make them in whatever software you’re comfortable, just have them in Blender when you’re ready to get them into the game and assign your geostates. Importing as .obj will prevent most issues.
Every piece that is going to be a geostate needs to be a separate mesh at this time.


Before we combine them into one group, hide all of the meshes and take turns unhiding one and noting the number of vertices and the number of faces.

You can actually see a major error I made and had to go back to correct in the above screenshot. Faces and Tris inequal. Make sure everything is triangulated first : (
Incorrect values fixed in other screenshots, leaving this one for posterity.


Note these carefully and exactly, where you clearly know which mesh each belongs to.
Every geostate value can be determined from these values.

In S3PE, the keys are named:
StartIndex
MinVertexIndex
VertexCount
PrimitiveCount


Your VertexCount and PrimitiveCount for each state will be the vertices and faces exactly.
Now, we determine the other two. There is a detailed example after the explanation, if the math isn't intuitive.

StartIndex is also known as the Vertex Buffer, and it is where the number of repeating vertices is stored- meaning, unlike the regular count, verts shared by faces are counted every time they are part of a face.
Which means that this number is total faces from PREVIOUS states multiplied by 3.
So, Geostate_0 has a StartIndex of 0.
Geostate_1 has a StartIndex of Geostate_0's PrimitiveCount x 3
Geostate_2 would have a StartIndex of Geostate_0 + Geostate_1's PrimitiveCounts x 3
So on, when working with more.

MinVertexCount is the VertexID where the mesh starts. Every vert is assigned a number ascending from 0, which you usually cannot preview by default.
That is why it is important to combine your meshes in the exact order their geostates will be in, so you can simply infer the ID. For example, a mesh with 100 verts has the IDs 0 through 99. Combine it with duplicate of itself, and the duplicate would begin at ID 100 through to 199. If the meshes don't begin separately, the assignment of 0 through 198 would be scrambled between them.
Again, Geostate_0 begins on ID 0.
Geostate_1 begins on the same number as G0's VertexCount (because, accounting for 0 being an ID, that's the next ID)
Geostate_2 begins on the VertexCounts of G0 and G1 combined, minus one to account for ID 0.
So on.

An Example:

Meshes must be carefully combined in order, as to preserve the IDs as we have inferred them to be.
In Object Mode, click the next mesh in the sequence then CTRL + click the first mesh. The first mesh should be highlighted in yellow and the piece to be added should be highlighted in orange.
Right click in the viewport, select Join. Repeat for all meshes, adding them in the same order they will be as geostates.


Export as OBJ
There are some key export settings to apply before you save.
Make sure your total mesh is selected. Navigate to File > Export > Wavefront (.obj)
Tick Selection Only and Keep Vertex Order, and untick Write Materials.


Export an MLOD/MODL
This is my method for replacing a mesh, but if you are more comfortable with TSRW you can use that and skip to the last section.
Just note, the following method is easier for default replacements (TSRW will renumber everything internally, this will not).

You'll want to have a clone of a similar type of object prepared as in any object creation. For plants and food, it's important to use a clone (or the original) of an existing plant or food because of the way textures are attached to material properties for these types of object. This way you preserve seasonal textures and burned states.
I'm replacing the harvestable bush, so I cloned the original with S3OC without renumbering. Check out tutorials on making custom recipes to learn how to clone those.

The resources you want are the MLOD and the MODL. There are some strange unique things to note for certain objects.
In plants (and most objects), the MLOD is the main high level of detail and the MODL is the distant LOD.
Food is an outlier, where all of the meshes seem to be MODL and one unused(?) MLOD that is just a plate. You probably only need the former.

I extract both from my plant package as s3asc files. The option for this will only appear if you have correctly installed the MeshHelper plugin.


This will create a _filebase file and additional files per mesh group.

Replace Mesh in Milkshape
Milkshape is pretty much a permanent requirement for object creation, until a new plugin is written for Blender. This isn't that big of a deal, I use it almost exclusively as a conversion tool. There is no need to actually edit meshes in it anymore, and asfaik the trial expiring only disables saving- not exporting.

In Milkshape, navigate to File > Import > Sims3 Object Import and select the MLOD_filebase (or MODL, if that is all your object had).


Next, import the obj you made previously from File > Import > Wavefront OBJ
Now, most objects have a bone that will appear in the Joints tab. The plant I'm working on didn't!
If your object has a bone, all you have to do is click SelUnAssigned and then Assign to apply it to the new mesh parts.


Then you can simply delete the original mesh from the Groups tab. The process is the same for multi-group meshes- import an obj for each and just make sure they're in the same order.


Export to Sims3 Object Export.
IMPORTANT: This format can only OVERWRITE an existing filebase. Select the same file you imported and save over it.

File > New before you repeat with the MODL. With reasonable polycounts, you can reuse the exact same obj for this. If performance is a concern, you can make LODs in Blender and repeat the tutorial for them and use that.

Import into S3PE
Return to your object in S3PE, right click the same resources and this time Import from s3asc to reimport the files you just overwrote. Select Yes to all pop-ups.
There should be new entries with the old ones crossed out. You can Save your package and these will disappear.

Add Geostate Values
Now, we can simply input our earlier values as geostates and they're completely done and ready to go. There's one catch, which is that S3PE records these values in a different format than just numbers so we need to do a little converting. S3PE doesn't have Decimal-to-Hexadecimal in its hash generator, so I use the one from Sims 4 Studio. This is also something you can find online, like this website.
Put each number you wrote down in as Decimal and write down the Hexadecimal that is generated. You don't have to write down all the zeroes, just note the letters and numbers at the end.
For example, my Geostate_0 values become 0, 0, 268, and 206.


Select your MLOD in S3PE and press the Grid button on the bottom row.


Within the Data Grid, click the dropdown arrows to open ChunkEntries > [0] ChunkEntries > RCOLBlock and click the Meshes entry, then the three dots that appear on the right. If you are working with a MODL, the Meshes will be under [1] ChunkEntries instead.


Click GeometryStates, then the three dots again. If you imported into a mesh that already had geostates, these will still be there.
If you imported into a mesh without geostates, click Add for each state (3 for plants, 4 for food) then OK.

Add your hexadecimal values into each textbox, replacing only the same amount of zeroes as your value has.


Repeat for each state, then click OK, OK again, then Commit. Save your package.
Repeat on the MLOD.
Mine look like this when they are complete.

You can check the MLOD Preview to make sure your mesh looks alright. The preview wont open if something is wrong, so it's a good net to catch if you made a mistake.
Now you can replace the textures in the package as normal. If you made a default replacement, you can delete every other resource except the meshes and textures.
Special objects like these don't always open well in TSRW, but you are free to try for another chance to preview the states working before you try them ingame.

Tutorial Complete!



Final Notes
May update with info on how states can share a mesh piece.
Credits to S3PE, Blender, Milkshape, Wes Howe for the plugins. Timeless contributions to the community. Remember not to take free modding tools for granted, everyone!
Back to top