[Sur Tutorial] Hitbox from 3DSMAX to Freelancer
-
From the little pices of french i do understand i must say this one looks good.
Hopefully someone with good french knowledge will translate it soon, we have such a player on NU but he’s a modding noob and might not be the best person for the job@Mirkha: Good job keep the good work.
-
Part 1
You will hereby find a method for creating hitboxes made in 3ds Max and convert them in viable Freelancer formats.
Nothing revolutionary, but it’s still a method which works well, as you’ll see at the end of this tutorial in the videos and screensI immediately want to say (and you will see this throughout the tutorial) that as long as the collision hitboxes are made WITH 3ds Max, you can actually include CONCAVE shapes.
You read that well; even with ROOT.
Proof:
This object is totally concave; it even has a few inverted faces…
That’s saying how different it is from what it “should” be…
But…
As you can see here, the hitbox works. Freelancer does not crash!I will also show you how to make a “hole” into the hitbox with the boolean tool, which will allow you to do something similar to this, for example:
Station docking bay, ship docking bay. Passageways between different parts of a base. In short, a hitbox which should wrap as much as possible to your model.But first, let’s give some credits where it’s due.
In this tutorial, you will find, with a few changes, the method thought up by TrueSilver for making SURs.
I also wish to thank him greatly for his work, his precious help and his patience to always answer to my (too) numerous questions :D.
I also want to thank CZW for his good tips ;).
Preliminary Work
I will start with 3ds Max 9.
Be advised Max 9 includes an advanced booleans management, which can help making functional docks for ships and stations.
I’ll use the broadest case: starting from a CMP.A : import the original CMP (if you are creating it, just import it)
lancer milkshape 3D - File->Import->Freelancer CMP Importer.
Step 1 : Go select the CMP.
Step 2 : Don’t change a thing.
Step 3 : Select the MAT that goes with the CMP.
B : Export the original CMP as a 3ds file
Still in Milkshape, properly orient your 3D object if it isn’t already the case using the rotate tool set as “Center of mass”. Select the whole 3D object and export as 3ds.
C : Import the 3ds into 3ds Max
Under the File menu, select Import.
Browse to your new 3ds file.
You will most likely see your object is not oriented properly.
Select it and right click on the Rotate tool.
In general, there is a difference of plus or minus 90 degrees between MS3D and 3ds Max.
Using 3ds Max
You now have an object imported into 3ds Max.
I will now open a small parenthesis to guide you through some of Max’s functions. Those are sufficient for most of what you will have to do here.
You will find some good tutorials over at 3D Total.
Of course, I’m not saying I will be showing you how to use 3ds Max; I’ve only been using it for a month and that’s not 12 hours a day ^^ (I DO have a real life).
Who said no? xD. In any case, it’s plenty to do what needs to be done ;).Moving and orienting your point of view in 3ds Max
This is the default view in Max:
By clicking on the red square, you can enlarge the active viewport (framed in bright yellow)
Clicking on the yellow square will make you go into arc rotate mode around the object.
Clicking on the green square will get you into pan mode.
Using the mousewheel will let you zoom in/out on the object.
Those commands might be basic, but they also are essential since they allow you to see what you’re doing :).You can also decide to change the size of the 4 viewports. An example:
Tools you will need
In the first tab (in red)
“Standard Primitives”
Box
Sphere
Cylinder
Torus
Cone
Those tools allow you to draw new polygons. You will sometimes have to deform those to fit them to the 3D object.
This may seem a bit complicated, but it’s very doable. At the end, I’ll show you a video with the different tools :).
Careful not to use something else.
Any other tool, such as splines, will make your hitbox work, but the sun flares will show through.The second tab (in yellow) is used to modify the shapes that you will have laid out.
To do this, you select your shape and go in the “Modifier List”.
We will speak about the Boolean function later to create holes in a shape.
Small tips :
Be curious: look at what menus do and what their shortcuts are.
W will select the move object tool.
E will select the rotate object tool.
In general, the top toolbar has two functions:
A left click will select the tool and will let you use it directly.
A right click will let you use a dialog to set the parameters more precisely.
A striking example of an use for the right-click option will show up with the rotate tool :D.Laying a Shape
We have a 3ds Max model that we just imported.
With the Standard Primitive tools, we can draw out shapes.We want to draw around the upper part
In the first tab, there are many shapes under Standard Primitives.
You must choose the one which matches as closely as possible the shape you want to get at the end.
In this example, we will use a cone.You must immediately understand how 3ds Max draws an object. It decomposes a shape in multiple simple elements. A cone is made up of a circle at its base, of a cylinder and of another circle at the top. That’s exactly what 3ds Max will draw down, each element one after the other.
I am telling this to you as that will help you draw in the good view in order for your element to be well proportioned/placed right off.-Select the cone tool and go into top view.
-Place your cursor in the center and start dragging the shape.
In order to draw a shape, left-click and hold and move your mouse. Release to draw the first section. Move the mouse again and left-click to set down the 2nd section. Once more for the 3rd part and so on.
This can look very abstract like this, but try it out and you’ll catch fast.-Lay the shape down as closely as possible and press Escape.
-Go into the second tab with the shape still selected.
You will find the parameters of that shape under this section.
Radius 1 and 2, height, height segments, cap segments, sides…
Each value will make a part of the shape vary. Up to you to test it all out to make it as tight a fit as possible.Again, a small parenthesis. There are to manners to modify the shape we’ve just laid down.
Those are not opposite and you can well use both one after the other.
1st method: convert the shape we just created as a Mesh and modify it vertex-by-vertex.
2nd method: apply to the shape some modifiers.This brings me to the Editable Mesh modifier.
This gives nothing more than a way to modify the object we just created. As in Milkshape, we will have edges, faces and vertice.
Each sub-part can be selected and moved independently.
Exemple :
I’ll immediately show you that you can apply a modifier on top of an Editable Mesh.
Let’s take the Twist modifier.
Select your whole editable mesh without activating any sub-selection mode.
Go in the Modifiers List and select Twist.
Make your angle vary to deform your 3D object.
The interest here might not be great, but for other shapes it can be :).Instead of putting a ton of explanations, here’s a video to teach you the basics.
http://files.filefront.com/3dsmax+shapes1avi/;12354408;/fileinfo.htmlSoft Selection Tool
Sometimes when we try to draw an object with lines, we need to smooth them.
Here’s the way.
http://files.filefront.com/3dsmax+softSelectavi/;12361618;/fileinfo.html-
Your hitbox is done for this part.
-
Do a right-click and select “Convert to Editable Mesh” under “Convert To:”
This is imperative. If you do not do this when you re-export into 3ds format and then import into MS3D, it won’t read it properly. You will see the hitbox, but it won’t work in the game!
I’ll be brief in order not to flood you will long explanations…
How to “dig” a hole into a hitbox.
Even if you can draw holes into 3ds Max and make them work in FL, the hitboxes still have to be closed surfaces.How to go from this:
To this:
Explanations:
http://files.filefront.com/3DsMax+Booleanavi/;12355917;/fileinfo.html
Soft Selection Tool
Sometimes when you draw an object you need to smooth them.
Here is the way.
http://files.filefront.com/3dsmax+softSelectavi/;12361618;/fileinfo.html -
-
Part 2
Exporting the Shape as 3ds
There aren’t two methods for Milkshape to understand the shape you’ve just done.
Each part of your hitbox has to be exported separately into 3ds files.
You must do exactly how the video shows.
To summarize:- Select the part you want to export and select Edit, Select Inverse (or just use Ctrl+I)
- Do Edit, Delete.
- You now only have the shape you want to export.
- Go in File, Export.
- Select 3ds file format.
- I suggest you give an explicit name to your 3ds file, such as TIE_sur01.3DS
- Undo (Edit, Undo or Ctrl+Z) to revert back to before you deleted all the other objects.
- Repeat the procedure for the next hitbox.
http://files.filefront.com/3dsmax+xport3DSavi/;12354637;/fileinfo.html
Importing everything into Milkshape
You initially imported a 3ds file of your base/ship/planet/whatever.
See: Preliminary Work.- Import that 3ds into Milkshape.
- Import each of the 3ds of the hitbox into milkshape.
- Same as before: the object does not have the proper orientation. Just fix it all like before.
http://files.filefront.com/mS3D+import3DSavi/;12355027;/fileinfo.html
Isolating the Hitbox
You’ll need TrueSilver’s toolpack: http://files.filefront.com/hitbox+toolsrar/;12355436;/fileinfo.html
You have your object and its collision boxes in MS3D.
Here, we use TrueSilver’s tutorial.- Deselect everything.
- Go to the Group tab and DELETE everything not part of the hitbox (such as the actual model). Make sure only the hitbox remains.
- Go in the Material tab. delete everything. Make a new material and name it “sur”.
- Go back to the Group tab and select the whole hitbox.
- Go back to the Material tab, select the “sur” material and click on “Assign”.
Organizing your work
You will realise that the hardest part is organizing everything.
Therefore, go back to the Group tab and rename each part of your hitbox into something you can recognize.I’ll pick an example which will serve for the rest of this tutorial so get it in your head already ^^.
-
Blacksun Ship having 14 groups for the ship itself. There will be 6 hitboxes.
-
Save your work (for example bs_sur.3ds)
This is very important as if you didn’t save here you’ll have to redo it all… I’ve told you now.
Creating an .ini
I will now create this INI since the SUR filenames are determined here. We must put the same ones for the exporting.
- Go in your work folder. You should have cmd.exe, sur_splice.exe, utf_edit.exe, splicer.bat in it (from TrueSilver’s toolpack).* Open ini.ini and fill it as follows
[*] bs_light.sur [*] bs_light_cons_fix.dat [*] Radius of the ship (open the CMP with FLModelTool to get that value) [*] X Y Z (put three times the mass with a space in between) [*] bsl_S01.sur Root [*] bsl_S02.sur bsl_S02_lod1 [*] bsl_S03.sur bsl_S03_lod1 [*] bsl_S04.sur bsl_S04_lod1 [*] bsl_S05.sur bsl_S05_lod1 [*] bsl_S06.sur bsl_S06_lod1 [*] ....... etc for as many hitbox parts as you have. [*] Save the 'ini. [hr][/hr][center][color]Creating a SUR Per Part of the Hitbox[/color][/center] [hr][/hr] We now have 6 parts for the hitbox. [*] You therefore have 6 groups without necessarily representative names of what they are. You will therefore rename them with the names you have put in your INI. [*] Afterwards, still under the Group tab, erase every element except the first. [*] Go into the menu File->Export->Freelancer Sur Exporter [*] Choose the emplacement to save the file and the name. The name of the file MUST be the same as the one in the INI, such as bsl_S06.sur [*] As far as options go, select "Back To Front", collision must be "Shrink Wrapped" and scale down set to "1", mass on 100. [*] Once all good, click on OK; you will have a file bsl_S06.sur. [color][size]Repeat the process for as many times as necessary with all the hitbox parts[/size] This is why you had to save your Hitbox's MS3D file first, so you can reload it if you screw up with the Undos.[/color] Everything's exported? Now is the hard part :D [hr][/hr][center][color]Creating a Stat file[/color][/center] [hr][/hr] [*] double-click on splicer.bat [*] It'll show you something similar to this: [img]http://img215.imageshack.us/img215/8179/screen2hi5.jpg[/img] [*] You should now have two new files : bs_light.sur et bs_light_con_fix.dat [hr][/hr][center][color]Exporting a modified CMP[/color][/center] [hr][/hr] - Open another Milkshape window and import the 3ds of the model or the original CMP. - We will now add "ghost" groups. In order to do this, go under the Model tab and select Sphere. Draw a sphere that's as small as possible [u][b]WITHIN[/b][/u] the ship's mesh. You need to have N-1 spheres, where N is the number of parts you had in the SURs - Rename each sphere with the SUR part's name You'll start with this: [img]http://soler.sebastien.free.fr/TUTO/Tuto_sur/15.jpg[/img] And end with this: [img]http://soler.sebastien.free.fr/TUTO/Tuto_sur/16.jpg[/img] Here my method differs slightly from TrueSilver's since I use the version 3 exporter which imports into the CMP the Stat file directly. On top of that, for larger objects I've seen that with the 2.1 exporter the object disappeared when you didn't see the object's center. That is not the case with version 3. - Let's export the CMP: - Select all the groups and go in SCALE. - Select Origin and put 92 for each axis. Just like this: [img]http://soler.sebastien.free.fr/TUTO/Tuto_sur/22.jpg[/img] - Then, go to File->Export->Freelancer CMP Exporter v0.3->Create New CMP Name it correctly. Options : - Detail :arrow: 0 - Orientation : Back to front - Scale Down : 100 - Let's calm down now, we still have a few things to do under "Number of Groups". Remember we had 14 groups for the ship and 6 for the hitbox? Right below "Group Quantities", change... In the first group, put the amount of groups of the ship; in this case 14. In each other group, put 1 for as many hitbox groups as you had (minus one). Like this: [img]http://soler.sebastien.free.fr/TUTO/Tuto_sur/23.jpg[/img] - Select "Continue" [hr][/hr][center][color]Modifying the Exported CMP[/color][/center] [hr][/hr] You've got a headache? Normal ;D Don't worry, we're near the end now; hardest is done! [u]Stats File[/u] - Boot UTF Editor. - Select the CMP we just exported. - Click on the "+" - Go into \Cmpnd\Cons\Fix. Make sure it isn't empty. If this isn't the case (Although normally the 0.3 exporter imports the Stat file), do as follows: - Still under Fix, click on Import and browse to the DAT file - Go back in Fix and now you have values :) [u]ROOT Group Name[/u] You've noticed before, when we did the spheres we put N-1 spheres. This means the group #1 in your CMP doesn't have the proper name :) - You have: "Group1_lod1.3db". You must rename it to be like the first name in your ini. In the example this would be: bsl_S01_lod1.3db. To rename select the line, wait 3 seconds and select the line again. This will highlight it in blue and you'll be able to rename it. - You must do the same in \Cmpnd\Root\File name\ Select File name. Click on the Edit button to the right. Right to its left you have "Float Array". With the small arrows go up to "string". Select that and click on Edit. Rename it to bsl_S01_lod1.3db. - Congratualtions, all you need now is to redo the hardpoints based on the older CMP ;) http://files.filefront.com/ms3D+cmpProdavi/;12355474;/fileinfo.html Here you go! With this you should be able to make all kinds of shapes for hitboxes.
-
Sorry if there is any spellingz errorz, it’s late and translating all that stuff in a single shot made me a bit dizzy ;D
-
Wow, thanks for doing this FF. This is a great translation Maybe replace Mirkha’s French post with your English, so people don’t get confused?
I also posted your translation at our site with all the proper bbcoding that Mirkha originally used: http://www.freeworlds-mod.net/forum/viewtopic.php?f=140&t=3471
-
We use 1:1 at FWs.
-
Thx Mirkha …
i haven’t the time yesterday to translate it … thx to FriendlyFire to have done it …This is a long work we have done with Mirkha of testing step by step all this tutorial
with this method, and this soft, you could create ring, tubular form , boolean form, convace form and convex form with ANY problem of SUR in space …
and now without Sun light throught an objectat this time, if someone have enough knowledge to delevop a import/export function for 3Dmax, it will be great …
why we have use 3Dmax, cuz Milkshape is very buggy to create complex form and impossible to do boolean operation
vertex 3d posittionning and orientation could create bugs into the SUR with milkshape, not if your bow was done with 3Dmax .please , to all who will use this tutorial, just post a thx into your credit for , Mirkha & CzW , that’s just we requiring …
hope now work on Syd information to animate models …
with this tuto, i think we could do great thing with animate model -
looks good thanks for that.
Does anybody know what scale in max you should use that fits with Freelancer model scales? (saves re-sizing)
we have use this setting …
1 unit in milkshape is 1 meter in game …
we have scale it to a PNC in game with a box for comparaison -
If my CMP model is one part (not only one group), how to make it to work ?
Same as above ?
your cmp could be in multiple part, it doesn’t matter
you could have a cmp in only one volume or in separate element …
when you do the SUR, box will be close to your CMP
you could do a solid one bloc SUR , or a multiple SUR for destructible component or animate part …
if you do multiple SUR, better to do multiple CMP, with parent function for destructible of animateCzW
-
looking on this tutorial i must say that its a method that i only want to use on very complex objects coz its much more complicated then creating surs in ms3d and much more time consuming
i guess its good for creating stations surs… but not good for ship surs.
-
I’m getting an issue when I try to run splicer.bat
C:\Users\Antares\Desktop\hitbox_tools\hitbox tools>sur_splice.exe ini.ini
Could not open output file* C:\Users\Antares\Desktop\hitbox_tools\hitbox tools>pause
Press any key to continue . . .This is my ini.ini ``` [*] ds_light.sur [*] ds_light_cons_fix.dat [*] 10517.076172 [*] 4856.150391 4860.586914 4856.150391 [*] dsl_S01.sur Root The only sur I have is called dsl_S01.sur and it's in the same folder. Any ideas? [code] Fix: remove the [*] at the beginning of each line in the ini.[/code] ```