[Tutorial] Creating your own Payload Explosions with Rayfire and 3ds Max

Lord Ned

L420: High Member
Feb 11, 2008
421
174
Creating a TF2 Payload Explosion - From Hammer to In Game

Step 1: Create your map in Hammer.
Your probably not going to want to make this explosion multiple times, so plan your map out, test it out, finalize everything (atleast the final point), etc. You'll find more resources on this at www.tf2maps.net or their chat room Team Fortress 2 Mappers.

Here we have our final CP blocked out in Hammer. (Map by Chrono, used with premission)

SS-2009.05.23-21.07.00.png


You can see the tracks and the hole. Bomb goes off the tracks, into the hole, kablooey!

Now, before it can drop into the 'hole', it needs a cover plate that actually explodes. This should probably only be about 16 units thick, which is a nice number, and sounds good for something like concrete. If you were doing something like boards then you could make it thinner, etc.

SS-2009.05.23-21.07.48.png


That's actually more or less it for the Hammer side of things -- For right now.

Next we will export it to .DXF which 3ds Max reads nicely. However, before we export note that models do not export. Therefor, you will have to build a custom clip-collision around them, so that there is something to collide with in 3ds Max. So here our level is clipped up real fast:

Notice I have clipped the windows and the cart's track.

SS-2009.05.23-21.11.14.png


Depending on the size of the explosion you want, and the size of your map, you will probably only want to export the end part of your map. (Too many blocks in your .DXF makes 3ds Max slow)

Select all the blocks you want to keep, and then hit Hide Unselected Objects.

SS-2009.05.23-21.13.12.png


I've now found a better way of Importing! Go ahead and build the collision hull around models like you would and instead of exporting to .dxf, just save the VMF.

Then, Open it in Crafty and configure the game settings and all that so it shows up nice. Then do File->Export and export to OBJ. Import that into max and you should not only have a textured level, but you don't have to re-flip all the faces. YOU ALSO DON'T HAVE TO RE-UV THE PLATE. IT WILL KEEP THE COORDINATES (AND TEXTURE) FROM HAMMER!

Woo! :)


(I learned this while doing an explosion in 3.5 hours from start to finish for Blackwood)

KEEP THE ABOVE INFORMATION IN MIND FOR THE REST OF THE POST. IGNORE ANYTHING ABOUT .DXF IMPORTING AND ADDING A UV MAP, ETC.

This tutorial really needs to be re-written but I can't find the energy for it... Any takers?

Now, export the map to .DXF via File->Export to .DXF, however check "Save Visible objects only", and save it to somewhere like your desktop.


Step 2: Setting up 3ds Max and Importing your Level

First off, you will need a copy of 3ds max. Anything from 9 to 2009 will work. Grab a trial at Autodesk's site.
Then, you will need Rayfire v1.44. v1.43 does NOT work with this method, as the objects exported don't animate. However, when they changed something in v1.44, they now animate, which is a good thing. You'll also want Wunderboy's SMD exporter, and his VTF Plugin. This allows you to use/view VTF's right in Max. You can find these tools at their respective sites.
Donate to Wunderboy if you can, he's an awesome guy.

Now, Install all those, restart 3ds Max, make sure they are all up and working, etc. If you want quick access to the Rayfire tool (It's a pain to do it by hand), you can follow this:
Customize->Customize user Interface

Then, In the Category Dropdown (Where it currently says All Commands), pick "RayFire Tool". Then in Hotkey (On the Right), click and type "Ctrl Q" or whatever you want. Then click "Launch Rayfire" and hit "Assign". Now, whenever you press Ctrl Q, it will launch Rayfire. :)


If you want to open Rayfire by hand:

SS-2009.05.23-21.30.15.png

Then you'll have to click RayFire tool each time.

WARNING: EACH TIME YOU CLICK "RAYFIRE" (OR PRESS CTRL + Q) IT WILL USE ONE OF YOUR 30 OPENS. IF YOU ARE ON THE TRIAL/DEMO, I HIGHLY SUGGEST LEARNING TO MINIMIZE RAYFIRE EACH TIME YOU USE IT OR NOT CLOSING IT!

I don't suggest opening RayFire, quiet yet however. First we will want to Import our .DXF!

Go to File->Import, Files of Type: AutoCAD Drawing (*.DWG, *.DXF ). Then go to the desktop/wherever you exported it to, and pick your map:

SS-2009.05.23-21.33.22.png


You'll get a bunch of options about importing, as far as I've seen the default settings are fine. (That is if you haven't touch Max's size settings before). Go ahead, Click OK and let it import. Now, you've got this awesome black level-shaped blob. You'll notice if it renders, it's grey, but if you look at it in the Viewport it's black. This is obviously a problem. To fix this:

Select everything, convert it to Edible Poly. Then go into Element Selection Mode, and hit Ctrl + A, then click Flip.


Obviously, this would take FOREVER to do by hand, so [hopefully] we can use ATTACH and attach everything to one, and flip them all at once! Take note of where your explode-plate is, we'll need it later. For now, go ahead and click Attach List, then select them all and hit Attach. Now hit Element Selection (3d Cube under Selection) and hit Ctrl A, then Flip.

Whoosh, you can suddenly see your level!
SS-2009.05.23-21.42.07.png


Now, while using Element selection mode, click on your explode-plate, and hit "Detach". This needs to be a seperate object as this is what we are going to blow up.

Now, we want to center the Origins of the imported material, because they are off for some reason. Go ahead into the Hierarchy tab, and hit "Affect Pivot Only" and then "Center to Object".

SS-2009.05.23-21.47.35.png


I'm going to go ahead and create a darker material for the 'collision', or the rest of our level geometry. Go ahead and hit M, hit the second sphere, then click on the colored box next to diffuse and drag it darker. Then drag it onto our level geometry and get this:

SS-2009.05.23-21.43.50.png


As you may have noticed, I've also enabled what I call "Shaded Wireframe Mode", or F4. This makes it way easier to see what your doing, as the grey isn't a very good option.

Go ahead and Save this right now, as it's going to get bumpy, and your going to enjoy having a backup... You may need it.

Step 3: Material Setup + Overview

Now, we've gotten things into Max, got everything set up... Now we need to RayFire it!

Here's an overview of what is going to happen:

We will split the explode-plate into large chunks. Then we will take the ones near the center, and split those into smaller chunks. This gives us large plates that can be forced upwards at the outer edge of the model, and then lots of smaller chunks that can go flying. It's an awesome effect, I promise.


Now, we'll need to apply a material to it before we can export it to max. To do this, I'm going to use two textures: One is my 'top' plate, which will match the surrounding ground in Hammer. The other will be the 'concrete debries', which will be the INSIDE, or where Rayfire fractured it.

To do this, Have the VTF Plugin installed, then extract your two textures from the TF2 GCF. Then hit M, and make two new materials:

SS-2009.05.23-22.05.26.png


You can see I've already dragged it out onto the ground. However, this isn't the same scale as in Hammer, so were going to add a Unwrap UVW Modifier. To do this, click on the explode-plate, and in the Modifiers List, pick Unwrap UVW. Go ahead and hit "Edit", and then pick the Polygon Selection Mode in the Edit UVW's window. (Highlighted on the bottom in the picture)

Then, click the top face of your explode plate, and hit Mapping-> Flatten Mapping. The default settings should be ok. Then, click the bottom face and hit Mapping->Flatten Mapping again. This way the two overlay each other, and are easier to scale.

Now, it STILL isn't the same scale. Your going to have to play around with this one, but how I fixed it was:
Scale the UV up by 25 times. I believe this will now correspond with TF2's ground texture scale. If someone has a better way of doing this... do tell.

Do the same for your Red texture.

Now, hit the Up arrow for both of them, and change the "Default #**" box to something reconizable, such as Red or Blu. You'll need to do this for both materials.

SS-2009.05.23-22.24.09.png


Now, go ahead and click on the Unwrap UVW modifier, and hit "Collapse To". Go ahead and hit Yes to the box that might pop up.

Step 4: Time to Explode some Ground!

Go ahead and add a preliminary bomb. (We'll adjust settings later, this is just used for the inital fracturing. To do this, go to Helpers->Rayfire Tool->RF_Bomb

SS-2009.05.23-22.14.43.png


Place this roughly in the center of your explosion, at the bottom of your pit.

SS-2009.05.23-22.15.50.png


(I've turned the explode-plate into a see-through object for this shot by selecting it and hitting Alt + X)

Go ahead and open Rayfire now, either using Ctrl + Q, or Create->Rayfire Tool->RayFire.

In the Simulation Tab, click on the explode-plate, and hit "Add" underneath Impact Objects. What Impact Objects indicates (As far as I can tell) is what objects are going to be affected by anything Rayfire does -- Fragmentations, etc. I've renamed the Explode-Plate via the top of the Modify tab. Where it used to say OBJECT: **, just change it to "Explode Plate" or something.

Now, go ahead and wander over to the RayXPlosion tab. Were going to add the Bomb system now, so scroll down to Reactor Explosion and hit "Add" while the bomb is selected. This helps with the preliminary fracture, as it now knows what bomb to fracture relative to.

Scroll up to the Fragmentation Objects section, and expand it. Change the following settings:
Fragmentation Type: Relative to Bomb/Impact
Iterations: 12, 5
Chaos: 65
Detailization: 10
Noise Strength: 0.5

Now, go to Fragmentation Material (Click on it) and then to MtlEditor. You'll notice a long line of names. Somewhere in the list should be your Red/Blu materials. (If you named them earlier in the Material Editor)

SS-2009.05.23-22.36.56.png


Pick Instance in the box that comes up, this way any changes made to your Red material will be updated to your explosion.

Now go ahead and hit "Fragment Impact Objects". It might look like this:

SS-2009.05.23-22.38.11.png


As you can see, it's nothing like what I want! (I forgot to change the Fragmentation Type)

You'll notice you CANNOT CTRL-Z it.

To un-fragment it, go back to the Simulation tab, and find "RF_Layer_1" (Should be under Interactive Layer Manager). Go ahead and click delete. Poof! It's back to normal! :D

Now, change your settings to your liking, and re-Fragment.

Now, you'll notice it still may not be what your going for. I was going for this:

SS-2009.05.23-22.41.44.png


However (even with the correctly adjusted settings), I got this:

SS-2009.05.23-22.43.13.png



Kind of a far cry, right? Well, we'll have to do some 'manual' editing per say. Go back to the Simulation tab, and clear all of the Impact Objects. (Just hit the Clear button)

Now, Click on one of the big chunks near the center, go to the RayXPlosion tab, and hit Fracture again. It should get broken up into smaller parts.

SS-2009.05.23-22.46.24.png



Now, repeat this process for the other chunks that need it, and you'll eventually end up with something like this:

SS-2009.05.23-22.47.35.png


Now we've gotten a larger outer ring, and then a bunch of smaller chunks inside. This next part might be a little tricky. Go ahead and pick a bunch of pieces from the inner ring. I've outlined them in photoshop. (The ones I want to have as part of the inner ring)

It now looks like this:

SS-2009.05.23-23.13.13.png


Go ahead and select one of the inner fragments. Then hold control and select another. And another. And another.

It may take you a few tries, to get it.

After a while, you'll be all done, and it won't look any different. (Or shouldn't)

Once you've selected all of the ones we want, go ahead and group it (Group->Group), and name it something like "Inner-Ring".



However, if you pull the explode-plate up, it will probably look a bit like this:

SS-2009.05.23-23.24.13.png


Notice how the sides aren't streight down, and are still sloped, etc?"

Now, we've got the outer ring, and the inner ring. The inner ring will be all the pieces that go flying, while the outer ring will serve as a buckled plate. Now, onto the actual collision/explodey part. Were going to go ahead and 'freeze' the outer ring so it makes life easier on us later. Go ahead and select all of the pieces of the outer ring, and then go Group->Group. Name it "Outer Plate" or something, then right click and hit Properties. Uncheck "Show Frozen In Grey" and check "Frozen". Now, it should look the same, but be unselectable. Do it with the rest of the world too if you want.


Go ahead and un-minimize RayFire, go to the Simulation Tab, and hit "Clear" on the Impact Objects list. Go ahead and add your 'inner' ring to the list now (Have it selected and hit Add). Now, go to the Physics tab. Here we will set up the physics of the scene. Scroll down to Impact Objects, and change the material from Porus Rock to Concrete. Change the "Mass by:" to "By volume: range". 30 to 60 should be fine, for now.


Go to Unyielding Objects. Change the Material to Concrete again, and add the World and the Outer-Ring to the unyileding Objects list. Go ahead and Unfreeze everything (Right Click->Unfreeze All), then click on the outer-ring and the world, hit add, and then re-freeze. Then, select the inner ring, and add it to the list under "Inactive Objects". Again, change the Material and the Mass By. Go ahead and add the existing Bomb to the PhysX influence. Were almost ready to explode things, I promise!

Scroll up to Physical Options. Change the Physical Engine to PhysX (Vs. Reactor). Change the Timeframe to 160+. Increase the Substeps if you want (Amount of 'finess' in the calculations.). However, be warned: THIS CAN GREATLY ADD TO SIMULATION TIME, RAM USAGE, AND INCREASE RISK OF CRASHES.

Now, you'll see 4 buttons. You really only want the first button for now. The first button plays the animation, but can be undone. The second one 'bakes' the animation, and cannot be undone, or changed. The third is only used to pause baked animations. The fourth is only used to stop baked animations as far as I know.

The first button starts/pauses, and can be undone and changed, so we'll use that until we've finalized our explosion.


Go ahead and save now, if you do anything wrong you'll have to reload/come back to this point. Now, click the Play button. It will say at the bottom "Creating World" (Can take a while). If your like me, it can also freeze. If it locks up for a long time, go ahead and end max, and reduce the number of Substeps if you changed it.

EXPORTING AND COMPILING TO COME SOON.
The low down is: Export everything (except the level) as a sequence and as a reference SMD and write a QC...
 
Last edited:

Lord Ned

L420: High Member
Feb 11, 2008
421
174
Now that I look at the posted tutorial it's lacking... Oh well. It's been sitting on my harddrive for over 5 weeks so... Hope this helps someone. :)
 

Nineaxis

Quack Doctor
aa
May 19, 2008
1,767
2,820
Now we need a "[Tutorial] How to get a few thousand dollars to buy 3ds!"
 

Ravidge

Grand Vizier
aa
May 14, 2008
1,544
2,818
Great! I'll try this out soon. Thanks
 

Lord Ned

L420: High Member
Feb 11, 2008
421
174
Oh no, dont tell them this! ;D

Well... I had wanted to keep it to myself so I could do everyone's explosions and have a higher chance of getting paid if someone's map goes 'official' per say... Decided it wasn't worth the requests. :p
 

UKCS-Alias

Mann vs Machine... or... Mapper vs Meta?
aa
Sep 8, 2008
1,264
816
Cool, I've done this before with xsi, but nevertheless, this is very useful
I would like to know the diffirences in XSI if it arent too many.

And yes, the tutoral is very usefull. If i have made an explosion in my map (which is too early for it atm) i might add your name in the credits :)
 
Last edited:

AntonJ3000

I am inactive and make horrible maps
Oct 29, 2008
401
90
Woah nice, Now I don't have to do func_physbox_multiplayer + trigger_push for my explosions :p
 

Lord Ned

L420: High Member
Feb 11, 2008
421
174
I would like to know the diffirences in XSI if it arent too many.

And yes, the tutoral is very usefull. If i have made an explosion in my map (which is too early for it atm) i might add your name in the credits :)

There's a tutorial on Interlopers. And there's no rayfire equivalent as far as I know.

Question: If you're using a RayFire trial, and your map went official, it would be problematic right? The whole free-trial not for commercial use thing.

Freaking thanks button is in the wrong spot with quote.

Anyways: I doubt Valve would even care/investigate what you made it with.
 
Last edited:

Nineaxis

Quack Doctor
aa
May 19, 2008
1,767
2,820
Anyways: I doubt Valve would even care/investigate what you made it with.

Hoodoo only took forever to get packed into an update because of a single model made in free XSI. Which was removed in the end. Because VALVe does care (and XSI are greedy).
 

Lord Ned

L420: High Member
Feb 11, 2008
421
174
Hoodoo only took forever to get packed into an update because of a single model made in free XSI. Which was removed in the end. Because VALVe does care (and XSI are greedy).

Interesting. Who was it that told them it was made with XSI Free? >:p
 

Ida

deer
aa
Jan 6, 2008
2,289
1,372
That's a freaking awesome guide. I wish I had the patience. :)
 

Tyker

L5: Dapper Member
Jun 1, 2009
232
142
I still have a problem with the qc. My model shows up in hammer, it says it has an animation, but it doesn't show the animation. It just stays in the idle position without animation. It doesn't show animation in the viewport or when triggered in-game.

All I changed apart form a regular model is that I added this to the qc:

$sequence "boom" "explosion_boom" fps 30

What did I do wrong?
 

Lord Ned

L420: High Member
Feb 11, 2008
421
174
Do you have two sequences? $sequence "idle" "idle" fps 30 and $sequence "boom" "explosion"

When you exported it: Did you check "Sequence"?
 

UKCS-Alias

Mann vs Machine... or... Mapper vs Meta?
aa
Sep 8, 2008
1,264
816
I also tried it and had the same problem that it didnt animate at all. However, as soon as i removed the inner part from the inactive list and added it back to the impact objects (they can only be in 1 of those lists) it moved again. But it didnt break up at first. I fixed that by ungrouping them (there is also a flag to break groups for the bomb). and then it exploded. Still, my explosion wasnt as it should. first it breaks apart knocking everything up normaly. Then after 20 frames there was a massive boom where i dont know where it came from.