Log in

View Full Version : [TEC]Reusing and placing objects with S3D (pic heavy)


Ducimus
04-30-08, 02:35 PM
This is a tutorial on how to do the following in the latest version of S3D:

A. Isolate an object you want to use elsewhere as "reuseable code"
B. Insert your "reuseable code" into an existing dat file
C. Placing the object in 3d (the hard way if you have no 3d editor skills).




Isolating the object you want to use elsewhere:
In this step by step tutorial, ill be isoloating an engine exhaust node that id like to use on the S class.

1. Take the file that has the item you want, copy it somewhere handy (i use my desktop), and rename it.

2. Open the dat your working with in S3D, and start cleaning up the dat file by remove EVERYTHING from it except the item you want to use. Now, this can be rather tricky if the item you want is nested inside a node or two. So heres a picture

http://www.ducimus.net/sh4/tec/s3d_tut1_01.jpg
In this picture you can see that ive
a.) Orginally used a gato dat file
b.) ive renamed it.
c.) Ive highlighted the item i want to isolate and use elsewhere. Trouble is, its nested inside the gato object, so onto the next step.


3.) Ive marked out the parent ID of this object in the above picture, which is the NSS Gato object, i want to break this parent->child relationship. So i CNTRL click on the parent ID of this object. What i often find handy for this, is the 3D model box as it contains a 0 hex address/ node ID. This is what i need to break the parent->child relationship from the node i want, as shown in this picture:

(Note the new Parent ID of the exhaust node, and its location in the node tree. It is completely free of the gato object now.)
http://www.ducimus.net/sh4/tec/s3d_tut1_02.jpg



4.) Delete EVERYTHING else from the dat file now. You should also remap all the ID's, so you don't forget to do it later. It should look like this:
(note that ive circled out its new ID if you compare it to the previous pic)
http://www.ducimus.net/sh4/tec/s3d_tut1_03.jpg

*note: You'll be importing this dat file later, ANYTHING you leave inside a dat file gets imported along with it. Author info, etc, you'll end up with duplicate EOF markers and indexs as well, so its very important to clean EVERYTHING out except the item you want to use.

I now have a nice little dat file with what is tantamount to reuseable code. On to the next part, inserting it into another file.


Insert your "reuseable code" into an existing dat file

1.) Create a test modlet. Dont work on files you want to keep.

2.) Open the file you want to work on in S3D, handy tip here, if you keep a mods shortcut on your desktop, you can navigate straight to your mods, regardless of where they're located, thereby saving you alot of needless scrolling around for files:

http://www.ducimus.net/sh4/tec/s3d_tut1_04.jpg
Note my reuseable code on the desktop.


3.) Having your test file open, scroll down to where you want to insert the new node. WHAT ORDER NODES APPEAR IN, DOES MATTER. As standard practice, i NEVER insert anything before the rendering controller. I do however want to insert my node right after it. Heres a picture:
http://www.ducimus.net/sh4/tec/s3d_tut1_05.jpg

What im doing here is im scrolling down to where i want to insert my new node. Note the number indexes. S3D is smart enough to change these on its own now. In this example, i want to insert my node right after the unified render controller. Whos properties end at index number 10. If i highlight number 10, and insert my dat here, S3D is smart enough to say, "oh, ok, ill insert your stuff as number 11, and bump everything down in sequence".

So at this point, right click where ive higlighted, and insert a dat file. If you've done this correctly, you'll get this dialog box:
http://www.ducimus.net/sh4/tec/s3d_tut1_06.jpg

Click yes.

What will happen is this:
http://www.ducimus.net/sh4/tec/s3d_tut1_07.jpg

Note here that my exhaust node has been inserted, starting as index number 11, but it does not have a parent-> child relationship with anything yet. But the point of this here is you can see how S3D has changed the indexes of your import.

4.) Establish the parent->child relationship. Its quite simple, just take the parent ID of the object you want your node embedded in, and and paste it into the parent ID box of your new node,
http://www.ducimus.net/sh4/tec/s3d_tut1_08.jpg


What will happen is this:
http://www.ducimus.net/sh4/tec/s3d_tut1_09.jpg
Notice how everything is sequential. So in summary, PAY ATTENTION TO YOUR INSERTION POINT WHEN IMPORTING DAT FILES.


So, now that wev'e successfully imported reuseable code into the dat file, its time to place it.



Placing the object in 3d (the hard way).

1. We enable our S boat test modlet, and go look at it in game. Since the node i used was addressed to work on other boats, i dont expect it to line up perfectly, but be in the general area. Here is my new exhaust node for the s boat:

http://www.ducimus.net/sh4/tec/s3d_tut1_10.jpg

Not quite where you'd like it. Now we have to fix that.

2. Your going to have to find the X,y,Z grid orientation of the object your working on. This is done mostly through trial and error of moving objects and see which way they go. In the case of submarines, its something like this.
http://www.ducimus.net/sh4/tec/s3d_tut1_11.jpg
Where the axis intersect is the 0,0 point. All object placement is relative to that point.




3.) Moving the Z coordinate.

(note the node positioning coordinate)
http://www.ducimus.net/sh4/tec/s3d_tut1_12.jpg

Since our exhaust is obviously too far aft, i have to move it forward. In this example, im moving the z coordinate closer to 0 (and subsquently toward the bow) by changing
the z coordinate to a number closer to 0. In this case im moving it from -2.4 to -1.75

This is the result:
http://www.ducimus.net/sh4/tec/s3d_tut1_13.jpg

If you compare the node placement now as compared to the last pic of an S class, you'll see it has indeed moved forward. However, its still out there floating in the breeze. So we have to bring it closer to the hull.

4.) Moving the X coordinate. Basically the same thing as moving the Y coordinate, just using a different number. In this example, if you refer to the above pic in step 3, im moving the x axis from 0.25, closer to 0 to a value of 0.14 This is the result:

http://www.ducimus.net/sh4/tec/s3d_tut1_14.jpg

5.) Moving the Y coordinate. In this example, the Y coordinate is the up and down placment of the node. Since it seems "about" right, im not going to alter it.



6.) Now that i have a working node that is properly placed, its time to rename it, in preperation of inserting another node just like it.

http://www.ducimus.net/sh4/tec/s3d_tut1_15.jpg


7). Now its time to reinsert another node. Open up your reuseable code dat file, remap the IDs again, and find your insertion point, import the dat, and establish its parent->child relationship to the main node of the dat file.

Study this picture for a moment:
http://www.ducimus.net/sh4/tec/s3d_tut1_16.jpg
- My insertion point was index number 18, which forced the import to be at the next higher number, and everything after it properly sequenced.
- ive established the parent child relationship

8.) Now that ive got this node it, its time to give it a proper name, and position it. YOU ALREADY HAVE THE COORDINATES IN YOUR FIRST NODE!!!!
So all you have to do, is copy and paste the coordiantes from your first node, into your second node, with one minor exception:

http://www.ducimus.net/sh4/tec/s3d_tut1_17.jpg

Since this node is going to be on the opposite side of the ship, all i had to do, was insert a negative mark on the Xaxis, which essentually flips it in orientation. (refer to above pic of coord mapping)

9. Give er a test run!
http://www.ducimus.net/sh4/tec/s3d_tut1_18.jpg
You can d/l the result of this tutorial here:
http://files.filefront.com/z+Test+SClass7z/;10108830;/fileinfo.html




This can be some very time consuming work. The basic principles of described here can be applied to most anything.

As an side, given the size of this object:
http://www.ducimus.net/sh4/tec/s3d_tut1_19.jpg

This, was alot of "fun".
http://www.ducimus.net/sh4/tec/s3d_tut1_20.jpg


I hope this tutorial is easy to understand, i type this in a hurry, i'll probably have to go back and change some wording here or there later.

Ducimus
04-30-08, 02:36 PM
Being limited to 12 pictures sucks. Ill have to split this post out later i guess.

LukeFF
04-30-08, 05:24 PM
Excellent job!

Now, if I'm reading this right, the orientation of the coordinates works like this (for ships, at least):

Y axis: bow to stern
X axis: port to starbord
Z axis: up and downRight?

Fincuan
04-30-08, 05:42 PM
"3,1415..." is a 180° rotation, "1,57...." is 90°, etc

Just say the word: They're in RADIANS :D

Lagger123987
04-30-08, 05:42 PM
Is this also helpful for moving zone compartments in the .zon files too?:hmm:
Would be nice if S3D have a XYZ map place into S3D.

Ducimus
04-30-08, 05:51 PM
RE grid orientations.

I made a typo, ill fix it when i get home from work. (not editing large posts at work, looks bad in logs)

Z is bow to stern
X is port to starboard
Y is up and down.


3.) Moving the Y coordinate.

Should be Z, not Y. See pic in that step, i circled the Z coord.

Fincuan
04-30-08, 06:25 PM
"3,1415..." is a 180° rotation, "1,57...." is 90, etc
Just say the word: They're in RADIANS :D

In what ? :rotfl:


360° equals 2π radians(~6,28319)
180° equals π radians(~3,14159)
90° equals π/2 radians(~1,57080)
etc...

http://en.wikipedia.org/wiki/Radian

Lagger123987
04-30-08, 06:34 PM
"3,1415..." is a 180° rotation, "1,57...." is 90°, etc
Just say the word: They're in RADIANS :D

In what ? :rotfl:

@Lagger, yep you can move/stretch/shrink hitboxes in the .zon file by playing with the min xyz and max xyz values, check the Pocket BB I made a post on this :)

Ok, but which page? I'm lazy to find it anything today.

Captain von Keldunk
05-01-08, 04:38 AM
Hello:D
Open S3D, opent tools, open options:
Value formatting options,
Show rotation values in radians (degrees=unchecked.:smug:
With S3D you have show in radians or degrees option.:yep:
:up: :up:

Xantrokoles
05-01-08, 02:41 PM
Ok, but which page? I'm lazy to find it anything today.
:/\\x:

It's not difficult in itself, but for such a big ship it would require either big compromises or big work. Basically, for a normal sub, in the .zon file you have boxes with x-y-z coordinates based on their parent 3D model (the hull for most of them). Each box also have an individual armor level and a "zone type". Say that zone type is "206", open zones.cfg, 206 is "UbtEngineRoom", go to that zone's text block and you have the detailed info (flooding time, hitpoints, armor etc). The upc/upcge file of your sub does the connection between the sub model hitboxes/zones and the damage screen (among other stuff), for example find the "engine room bulkhead" for a u-boot, you will see that it's linked to the zone "206".
Each submarine zones is linked to a compartment or a functionnal subsystem (engine, torp tube, radio, whatever).
The problem with the AI ships is that they use totally different sort of zones useless for subs (like fireworks and stuff). Basically you would need to delete all the "boxes" in the .zon file and redo them from scratch. Then create new zones in zones.cfg adapted to the battleship or modify the existing submarine zones and link them to the boxes in the .zon file.
To get your new hitboxes coordinates you just need to export the hull and view it in 3dsmax or the like, decide where you want to put which compartment/subsystem box and set the coordinates for each box in the .zon file with S3D.

msb80sc
07-21-08, 08:01 PM
After searching the board for answers and trying for a few days, success! Added 2 deck gun nodes. Now to get them to show up and work in game. Thanks Ducimus, your the man.