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

Zeewier

L9: Fashionable Member
Sep 20, 2008
619
262
Shouldn't you attach bones to all pieces for it to animate properly ingame?
 

YM

LVL100 YM
aa
Dec 5, 2007
7,135
6,056
My preferred method is a well worded email to valve.. however I have an unfair advantage there..

Alternatively.. make a tutorial for blender so I can bug Mouse to make me explosions..
 

Lord Ned

L420: High Member
Feb 11, 2008
421
174
It depends on the "start time" of the explosion. You can probably select all of the fragments and grab their markers in the tool bar, and drag it backwards.


I guess I was kinda incomplete in the first part: What your gonna wanna do is: Hand animate the outer-ring so that it looks like it buckles in. That's why we seperated the center part.

I didn't make an overview when I wrote the tutorial so it's probably kinda disjointed.

But it gets the idea out there so... :)

Shouldn't you attach bones to all pieces for it to animate properly ingame?
Nope. With Wunderboy's exporter and V 1.44 of Rayfire they export as objects and the exporter treats them as bones.

Alternatively.. make a tutorial for blender so I can bug Mouse to make me explosions..
Don't know blender.
 

Rexy

The Kwisatz Haderach
aa
Dec 22, 2008
1,798
2,533
I've already been through as much as this tutorial explains (on interlopers), it's the exporting and compiling I would like to know, so as soon as you can get that down pat, let me know!
 
Last edited:

Lord Ned

L420: High Member
Feb 11, 2008
421
174
I can post what someone else did in a similar tutorial:

Now, delete everything you used for colliding with the debris, like your map you imported or whatever, and also your geosphere. You should be left with just the debris and the little blue marker it created. You're done! Move the animation timeline at the bottom back to 0.

Now, go to File > Export. Export as SMD (If you don't have SMD import/export i suggest you go get them at www.wunderboy.org/) First export as a reference (We'll call that "slab_ref.smd"), then export as a Sequence SMD from frames 9-100 (Or replace 100 with however many frames you set the animation to be). We'll call this "boom.smd"

The exporter seems to bone every piece for you. If you get an error about too many bones, you need to break your model into chunks.

Viola. Here's my qc file for the model:
Code:
Code:
$cd "C:\slab"
$modelname "PhysXDemolition\slab.mdl"
$model "Body" "slab_ref.smd"
$cdmaterials "models\props_physxdem\"

$sequence idle "slab_ref" loop fps 30.00
$sequence boom "boom" fps 30.00
 

Zeewier

L9: Fashionable Member
Sep 20, 2008
619
262
Nope. With Wunderboy's exporter and V 1.44 of Rayfire they export as objects and the exporter treats them as bones.


Time for me to upgrade then :p
 

Jive Turkey

L3: Member
Jan 22, 2008
120
32
Good write-up. Here's some tips from my own experience:

On importing:
When pulling a map into 3ds Max, especially if it is near completion, I've found that the dxf files that hammer creates are often overly complex and can lead to massively over-inflated load times. If you encounter this, just use Crafty instead. It will produce dxfs that load right up. Also, be sure and remove any excess geometry from your level that you're sure the explosion will never come into contact with. Either beforehand within Hammer or usually more easily within 3ds Max itself where you can just poly edit away any extraneous polygons. The more you remove the simpler the collision detection and the faster the simulation will run, as the level itself is necessarily simulated as a concave mesh, the most complex sort of geometry.

Small rant:
Also keep in mind not to make your explosions too large. We had a phantom crash in our map the cause of which we could not locate for weeks. It just appeared out of nowhere. It turned out the explosion had a ridiculously large bounding box that had it drawing the explosion in many leafs where it shouldn't have and as we layered more detail into the level we eventually encountered a crash from a vertex overflow. The early explosion was sloppy and I hadn't given much thought to it, but I had pieces flying too far from the explosion site. Also watch for any pieces of debris that fall through the level floor during simulation as these will continue to fall forever. You can select these pieces and just find a frame where you'd like them to come to rest and then simply delete all successive keyframes to curb movement.

On exporting:
Create a single bone (or a dummy object) at 0, 0, 0 and call it "root." Be sure it has 0 0 0 for rotation. Next from the file menu select Graph Editors/New Schematic View. This is a view of the hierarchy of your scene and each object's relationship with each other. Select everything you want to export, either in the window or within this view if its easier, then select the Connect tool. Drag from one of the selected objects to your "root" bone to establish a relationship. Now you have a single skeleton with each object linking to this single root bone. Don't forget to include this root object when exporting.

This step may be unnecessary depending on how your scene is setup but it's easy enough to do and will give you a proper skeletal system that the mdl compiler will recognize. This may be the reason why Rayfire 1.43 (which is the version I have used for all my explosions) was not producing animated models for you. Also read up on "Named Selection Sets" and layers to make selecting parts of your scene easier and more manageable to work with and export.

On Simulating:
I tend not to use PhysX because it is buggy and crashes for me. I just use Reactor. What I do is repopulate the impact objects list with everything that I want to have move in the scene, then on the RayXplosion tab press "Explode Impact Objects." This will setup all the objects with proper masses and then insert them into a Rigid Bodies Collection. It will also jostle their orientations to make simulating less prone to destabilizing, but I usually pull the slider back to frame 0 and delete those keyframes so I get a good transition from unbroken to broken object. After this point I am now done with Rayfire.

Go to the Utilities tab, then reactor. This is where you'll run and re-run simulations until you get something that looks good. Sometimes you can get away with 10 substeps, but I usually go with 20 and I've gone as high as 50. It depends on the complexity of your scene. If you get objects interpenetrating too much or just plain falling through the map geometry you may need to set the substep value higher to stabilize everything.

Also be sure to put the end frame at around 700 or so. You can always choose a smaller range of frames for final export, but you don't want to go through a lengthy simulation only to have it stop before all objects have come to rest. And generally it will simulate much faster as objects fall out and away from each other so the extra frames won't take forever to simulate anyway. It's really just the initial configuration where all objects are next to each othere where the real number crunching takes place. And do be patient with those first frames as Max can just sit there looking deceptively hung, when in fact it is hard at work toiling away at the simulation. Go eat a sandwich or something.

What I usually do is put the start frame at around 10 and then after each simulation result that I don't like, I select all moving objects and just delete from frame 10 onward. It's like a slightly messy undo function.

First of all though, we'll need to add some forces into the system to get things moving. I use simple invisible geometry like spheres that I animate to have some kind of violent force on the debris objects. For a typical explosion I just place a sphere at the explosion site and then animate its scale to increase rapidly around frame 10 then quickly pull back in. Like a violent balloon. To get this sphere to interact with the other objects in the Rigid Body Collection however, you need to create a Deforming Mesh Collection then add the sphere to it. This tells Reactor that you want objects to react to the sphere's change of shape. You can also use a Deforming Mesh Collection to include statically animated objects in your simulation. Say you have something you've animated by hand, you can place it in a Deforming Mesh Collection and then have debris bounce off and react to this animated object (but not vice versa, the pre-animated object will only maintain its own animation). And of course, remember not to export these dummy objects. They're just supposed to be invisible forces in the simulation.

You can also simply animate the position/rotation of objects up to the first frame of the simulation (frame 10 in the discussion so far). Objects are given the apparent velocity at the time of the simulation start. So for instance you could just animate a sphere moving from some removed distance at frame 0 to a small distance from your debris at frame 10 and reactor will give the sphere the resulting velocity at the time of the simulation's start, giving you a sort of wrecking-ball or cannon ball effect.

The point is that while Reactor is perhaps a little slower and doesn't have such a readily available preview of the resulting animation, it's also less crash prone (in my experience anyway) and you have many other options with the animation when working this way (although much of this is probably also available when using PhysX, I couldn't tell you). I sometimes use multiple tiny explosion spheres in a scene to get objects moving around and falling in the way I would like. For instance in pl_cashworks I used some smaller explosions to move the vault dials about more interestingly.
 

AntonJ3000

I am inactive and make horrible maps
Oct 29, 2008
401
90
Can you make a video tutorial or something? I've tried getting this but I simply can't :(
Select everything, convert it to Edible Poly. Then go into Element Selection Mode, and hit Ctrl + A, then click Flip.

After about 10 minutes I found out where to find how to make it a Edible Poly, still haven't find the element selection mode, This is really getting on my nerves, and I wanna make custom explosion :(

I have really hard to find what to do.
 

Altaco

L420: High Member
Jul 3, 2008
484
120
Can you make a video tutorial or something? I've tried getting this but I simply can't :(


After about 10 minutes I found out where to find how to make it a Edible Poly, still haven't find the element selection mode, This is really getting on my nerves, and I wanna make custom explosion :(

I have really hard to find what to do.

The selection modes are on the right sidepanel at the top while you're in editable poly mode.
 

AntonJ3000

I am inactive and make horrible maps
Oct 29, 2008
401
90
The selection modes are on the right sidepanel at the top while you're in editable poly mode.

I'll try this again when I have time, Gonna need to google-search nearly each step though :p



EDIT: Could you point out where on this pic it is, Still can't find it :/
3dsmaxproblem.PNG
 
Last edited:

Lord Ned

L420: High Member
Feb 11, 2008
421
174
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)
 

Tapp

L10: Glamorous Member
Jan 26, 2009
776
215
Thanks for this, combined with my relative competence in the particle editor I am now adding custom explosions to ALL of my maps. yes, even CTF (hey, you did it with arena).
 

Psy

The Imp Queen
aa
Apr 9, 2008
1,706
1,491
Matt, I would like to give you a big hug for the tip about Crafty and .OBJ. This will make converting brushes to models such a breeze! <3