| Search this Thread |
|
|
Modding Infocenter - The Resource Node (CRES) #1 |
|
Numenor
Original Poster
The ModFather
|
DISCLAIMER: The "Modding InfoCenter" threads are NOT tutorials: they are intended to help average-experienced object creators performing specific tasks, or to give users a deeper in-sight on specific modding-related subjects. So, don't expect to find step-by-step explanations, to be performed "blindly". Please DO NOT REPOST the following info, or part of them, on other sites. All the "Modding InfoCenter" threads are created and mantained by Numenor and JWoods. Everyone is welcome to post his own questions or additional information about the specific thread subject. CREDITS: Most of the known information about the CRES structure has been provided by Raquelcesar. Since she is (hopefully temporarily) away from the modding scene, we can't ensure full support about this subject, but we'll do our best, as usual ![]() -------------------------------------------------------------------------------------
SUMMARY This article will try and explain the function and the structure of the Resource Node (CRES). The following info apply to objects, though the CRES works in a similar way also with Sims, Lots and many other package types.
-------------------------------------------------------------------------------------
PART 1 - THE "CRES HIERARCHY" Just like many other Scenegraph files, the CRES is composed by a bunch of blocks: you can see them with SimPE, in Plugin view: But the CRES has a peculiarity: the blocks aren't read by the game in sequence; on the contrary, they form a tree structure, that is called "CRES Hierarchy". SimPE provides a useful tab that shows the Hierarchy: The first block of the hierarchy is always a "cResourceNode" block (with number 0x00). If we examine this block in "Content" view, we'll see (among some unknown values) the Child Nodes list: it tells us the number of the "following" block(s) in the hierarchy. In the picture below, there is only 1 "following" block, the 0x02 one (in the cResourceNode blocks, the block number is the one underlined in red) From now on, every block will contain info about the "following" blocks in the hierarchy: in our sample CRES, the block 0x02 has 5 entries in the "Child Nodes" list; this means that 5 "branches" of the tree start from block 0x02, and these "branches" are blocks 0x03, 0x04, 0x05, 0x06 and 0x07 As you may guess, each of these "branches", in turn, may have one or more Child Nodes, thus creating a complex tree structure, clearly depicted in the "CRES Hierarchy" tab (as seen above).
PART 2 - TRANSLATIONS AND ROTATIONS We have talked about "modifications" applied to a branch that automatically are extended to all the Child Nodes. These "modifications" are mainly (but not only) translations and rotations. Translations represent movements of the object (or part of it) in the 3D space; we can specify a translation by editing the X, Y and Z values in the "cTransformNode" tab of each block. The unit of measure for the translations is the "tile" (the ones that we can see in the game when we place an object in the lot).
Rotations, on the other hand, are represented in the game by means of quarternions. The quarternion is the most complicated concept that anyone without a degree in maths or engineer may have the misfortune to deal with. *Luckily* Quaxi's beautiful mind was perfectly able to understand them and create a "conversion" utility: it's the box labelled "Rotation". Obviously, if you do have a degree in maths, then you can use the "Querternion" box, if you like ![]() I will explain only the use of the "Rotation" box, if you don't mind You need to specify the amplitude of the rotation itself (in degrees: 0°--360°) and the axis around which the rotation should be performed. For a rotation by 30° around the X axis, you have to write X=1, Y=0, Z=0, Rotation=30; if the rotation axis is halfway between the X and Y axis, write X=0.5, Y=0.5, Z=0; and so on...
PART 3 - JOINTS In the CRES hierarchy, usually some blocks are assigned to Joints. This is not the right place to explain what Joints are, but in few (and rough) words, the Joints are invisible points that are used to animate the mesh and/or create an "interaction point" between the mesh and the sims. When the game needs to animate a single part of the object (e.g. the CD drawer of the PC), it simply applies a translation to a joint; as a consequence, the joint moves in the desired direction, along with all the vertices assigned to that joint. Let's take, again, as an example, the CRES of the cheap PC: But what part of the mesh is associated with Joint3? We can see this by examining the GMDC in "Advanced Mode":
PART 4 - THE CRES AND THE SCENEGRAPHIC CHAIN A specific InfoCenter article will explain the Scenegraphic chain in detail. For our purposes, we only need to know that the Scenegraphic chain is responsible of the exterior look of the object. The chain starts with the CRES; into the CRES are referenced the Shapes, the Lights (if any) and the mirrors (if any). All these references can be seen in the "Reference" tab of the CRES:
FINAL NOTE The CRES is one of the most (if not the most) complex file within a package. The information provided so far are definitely not exhaustive and complete. We'll try and integrate them, with additional info provided by other modders, and regarding the question that will be asked by the users. -------------------------------------------------------------------------------------
OTHER USEFUL RESOURCES Modding InfoCenter Index - Comprehensive list of all the InfoCenter threads Object Creation Workshop and Repair Center - If your object doesn't work, no matter what you try Colour Options for "EP-ready" packages - About the texture linking tecniques Sims 2 start to finish Object Creation Tutorial - Learn how to create your own object -------------------------------------------------------------------------------------
|
|
I've finally started my Journal. Information only, no questions. My latest activity: CEP 9.2.0! - AnyGameStarter 2.1.1 (UPD) - Scriptorium v.2.2f - Photo & Plaques hide with walls - Magazine Rack (UPD) - Animated Windows Hack (UPD) - Custom Instrument Hack (UPD) - Drivable Cars Without Nightlife (UPD) - Courtesy Lights (FIX) - Custom Fence-Arches - Painting-TV - Smarter Lights (UPD) I *DON'T* accept requests, sorry.
|
|
|
|
Last edited by Numenor : 4th Aug 2006 at 10:58 PM.
Reason: Fixed in-text images
|
|
34 users say thanks for this.
[ Click here to view a longer list ] |
|
|
|
#2 |
|
JWoods
|
A quick note about the CRES (Resource Node). This is, as Numenor has explained a very intricate file. If there folks out here that feel they have formatable information they should post there comments in the "InfoCenter" workspace thread. |
|
|
|
|
|
#3 |
|
Fat D
Forum Resident
Join Date: Nov 2004 |
http://en.wikipedia.org/wiki/Quaternion Now I understand what you mean... BTW, is rotation for the in-game axis or for the 3d-editor axis? OK, found out myself, game. |
|
|
Last edited by Fat D : 27th Aug 2005 at 09:57 PM.
|
|
|
#4 |
|
SnowStorm
|
Ages ago I found these three images. I can't find the original threads they belonged to but these or something similar would be a good addition to this thread or your upcoming scenegraphic chain article. I found them very useful in understanding the interrelationships of the file types. I had to zip the pics because they were all too big to post as is and I didn't want to resize them. |
|
Eclectic Sims The place for your younger sims and unique animated items!
Charmed Sims Archives Gorgeous Clothing, Furnishings and more. Two great sites ALL FREE NOW!!! |
|
|
|
|
|
|
#5 |
|
Echo
|
I'm not sure this is the right place for this question, but I'm hoping! How is the CRES related to the OBJD? Is there a direct connection? And if not, then how does the OBJD connect to the rest of the scenegraph? I'm asking because at the moment I am working on an object which does not have a CRES in the file. It is clearly referencing one though, because its slots are using the joints. The object in question is based on an NPC, so it is probably referencing a body CRES somewhere. Alas, I don't know which. I want to be able to import it and change some translations around in a local copy, so that I don't override every sim in the game! |
|
|
|
|
|
#6 |
|
Numenor
Original Poster
The ModFather
|
The scenegraph chain is connected to the non-scenegraph parts via the Text List 0x85, that holds the reference(s) to the CRES. Some (rare) non-buyable objects are particular, though, because they have no TL85 and no mesh at all; but they "Create New Object Instance" via their init/main BHAV (so that it *looks* like they have a mesh, but actually the mesh is contained in another object). Normal buyable objects always have a Text List 0x85, in my experience. A hint: if you know the filename of some scenegraph files, you can perform a scan of the game files using SimPE's "Finder" plugin: write in the search field the first part of the filenames you know, and if there is a CRES to go with them, the Finder will find it. |
|
I've finally started my Journal. Information only, no questions. My latest activity: CEP 9.2.0! - AnyGameStarter 2.1.1 (UPD) - Scriptorium v.2.2f - Photo & Plaques hide with walls - Magazine Rack (UPD) - Animated Windows Hack (UPD) - Custom Instrument Hack (UPD) - Drivable Cars Without Nightlife (UPD) - Courtesy Lights (FIX) - Custom Fence-Arches - Painting-TV - Smarter Lights (UPD) I *DON'T* accept requests, sorry.
|
|
|
|
|
|
|
#7 |
|
Echo
|
Ah, I never thought to look there. Turns out I really wasn't looking in any of the right places though - as it was an NPC, the cres was actually referenced in its 3D ID Referencing File. I really should have looked in there, it is kind of obvious now that I think about it, but that's the benefit of hindsight. Thanks for the answer! |
|
|
|
| |
| maybesomethingdunno |
| This message has been deleted by maybesomethingdunno. Reason: no longer needed |
![]() |




This 
Twitter
del.icio.us
StumbleUpon
Google