PDA

View Full Version : Adding new GEOMs to a CAS part with s4pe & S4CASTools


MyreMylar
28th Sep 2014, 4:38 PM
http://i.imgur.com/r5YsIuW.png

That CAS part was made by adding a shorts mesh and a tank top mesh to the same package and fixing the data so that they could be displayed as one part under the full body category. This is how:


First extract your separate CAS part packages with S4CASTools and save them.
Open up one of the packages in s4pe and delete the CASP, most of the texture resources and RegionMap file (you may want to save the textures as dds first). Basically you want to be left with the GEOM files and a normal map if you have one. Save the newly slimmed down package.
Open up the other package and import the package you just slimmed down so you now have two sets of GEOMs.
It's a good idea at this point to copy the resource keys of the new GEOMs into a text file and sort them by LOD.
To make the CAS part pick up the new meshes we need to edit the CASP file. First up the TGIList, open the CASP file with the Grid editor, scroll down to the TGIList and open it up with the [...] button.
Add the ResourceKeys of the imported GEOMs to the TGIList as new entries.
Next open up the 'LodBlockList' there should be 4 entries. If you open one up - 'Level' indicates the LOD and the 'LODKeyList' should have an entry pointing to the index of each Geom in the TGIList. So go ahead and add new entries to each LOD with the indexes of your new GEOMs making sure the LODs of the Geoms match up to the 'Level' of the LodBlockList.
Next you probably want to switch how the part is displayed in the Create a Sim. In our case we will move the part to the body category. Find the 'BodyType' line and set it to 0x00000005. I also set the following 'CASPartFlags' - 0x0046 (OutfitCategory) to 0x0107 (Jump suits) and 0x0053 (Body) to 0x0176.
Once you've finished all that commit the edits in the grid editor and this is a good time to save the package.
Next we need to fix the RegionMap resource (the resource with type 0xAC16FBEC). These seem to control the order in which the GEOMs are rendered. I'm not sure exactly how that is controlled but it has it's own GEOMReferenceBlockList with one entry for each LOD set of GEOMs. Unfortunately we can't just add a new GEOMReferenceBlockList and add the ResourceKeys of your new GEOMs to the tgiList because s4pe can't manage that properly. Luckily we can delete and edit entries so we just need to find a RegionMap resource with more GEOMReferenceBlockList entries than we have GEOM LOD sets (if that makes sense). I found one by using S4CASTools and extracting an existing fullbody part with lots of LOD parts listed. So go ahead and do that, and follow the same process we used for adding the GEOMs to get the new RegionMap into our package including adding it to the TGIList.
Once we have a RegionMap with sufficient GEOMReferenceBlockList entries, first delete the old RegionMap from the package, then delete the GEOMReferenceBlockList entries from our imported RegionMap until there is exactly the right number and edit each GEOMReferenceBlockList -> tgiList to point to our package's GEOMs. One LOD set per entry.
Make sure that the 'RegionMapKey' entry in the CASP resource is pointing to our new RegionMap in the TGIList.
Save everything and done! Test it out in Create-a-sim and see if it worked.


Let me know if this helps you out/doesn't work/any problems. It's possible I missed something out as I've been fiddling with this stuff for a few days.

plasticbox
28th Sep 2014, 6:28 PM
Have you looked at how this behaves in-game? I'm not asking because I have any doubt that you know what you're doing ;), more because I'm not familiar enough with CAS Part creation to be able to tell whether this a WIP/experimental kind of thing (seen enough screenshots in passing of hiccups between CAS and game) or whether I should add it to the tutorials list right away.

Either way, great to see that you got it to work, and thanks for posting it!

MyreMylar
28th Sep 2014, 7:00 PM
Have you looked at how this behaves in-game? I'm not asking because I have any doubt that you know what you're doing ;), more because I'm not familiar enough with CAS Part creation to be able to tell whether this a WIP/experimental kind of thing (seen enough screenshots in passing of hiccups between CAS and game) or whether I should add it to the tutorials list right away.

Either way, great to see that you got it to work, and thanks for posting it!

Hah! I have no idea what I'm doing, I just felt compelled to share after messing with s4pe for many hours.

Having said that, while I've not tested it for hours in-game, it seemed to work in a quick run around:

http://i.imgur.com/V1s0iWS.png

Apart from my awful WIP texture and unedited normal & shadow maps obv.

Of course, this is 'fresh off the presses' today though so it's very possible there is some part of the process I don't understand yet that I just accidentally got right. I'm obviously curious to see if anyone else can get something like this to work.

plasticbox
28th Sep 2014, 7:09 PM
OK cool! Will add it to the list then -- the more people see it and give it a try, the more likely any issues can be ironed out. Thanks! =)

skottyboy
12th Dec 2014, 5:09 AM
I really want to try this but it sounds too difficult :(