Thought I'd start my own thread on this so as not to highjack the initial Impact Tool thread. This is a script I'm working on inspired by the great work of Daniel Ferreira while he was working at Blur. Basically, it makes the process of setting up explosions and bullet impacts faster and easier. To see the original thread and have a look at Daniel's impact tool, go here.

And now, on to Winchester. I'm posting the first beta version for people to try out.

Instructions:
- Define the "gun" and "target" using the pick buttons at the top. Optionally define the "ground" for particles to come to rest on.
- Define the type of tesselation to use for the target. "Tesselate" is localized around the impact point and results in a lower poly count, but "Turbosmooth" works better for organic objects like the curvy wall in my sample movie.
- Select the type of fragments you want. "Pyramid" is good for testing, or long shots where you don't need detailed meshes. "Custom" lets you choose one or more objects to use as instances in the particle system.
- "Hit Radius" defines the size of the hole left by the gun shot.
- "Randomize +/-" randomizes the size of the hole so they're not all exactly the same.
- "Particles Per Hit" does what it says, defines the number of particle fragments for each hit on the target.
- "Begin/End Shooting" defines the time range to calculate the hits.
- "Random Shot Every" randomizes the frames that the gun fires. Choose a range that you want the shots to occur at.
- "DO IT!" does it.

Notes:
- The gun shoots from the +Z axis. Rotate it accordingly. The best way to visualize this is to create a pyramid object on the ground plane. The point of the pyramid shows where the gun will shoot. You can use the pyramid as the Winchester gun object, and link your real gun to it if you like.
- When you've defined both the gun and target, a green line will project out from the gun to the surface of the target when it's pointing the right way. Use this as a guide when animating the gun shooting across the target.
- When you can see the green aiming line, adjusting the hit radius spinner will bring up a circle of the same size so you can visually see an approximation of how big the hole will be.
- VERY IMPORTANT! When the setup is complete, there are still two steps you need to manually do. One is to define the ground node for the ground deflector object. It will be selected, so just hit the pick object button and select the ground mesh. This is a limitation in MaxScript and there's nothing I can do about it. The second is that you need to manually delete the link in the pFlow system between the parent box to the first event, called, "particle seeds", and then relink them. This is a bug and hopefully I can find a way to get it eventually.

That's it. Let me know what you think. Report any bugs you find. This is still a work in progress, so I'll be adding to it over time.

So far the displacement seems to be working well... is there a way to increase depth of the dent without increasing radius? That would be neat to have control over as well, so you can punch stronger holes without needing a bigger radius..? and to have a randomization on this as well would be cool.

I haven't tried custom shapes yet, but when i first tried the script the fragments seemed to work ok, but then after a few more tries they just wouldn't show up for some reason. I'll keep playing with it and see what happens before I say it's a bug... just played with it again and it's working fine... maybe it was just me?

Smoke should be an easy add with the way you have it set up already... I'm glad you made it with pflow so we can add or remove as we wish to it.

Thanks everyone, I'm glad you all like it. I wish I could take full credit for the idea, but I'm doing what I can to go beyond the original inspiration.

scrimski: Thanks for catching that. It'll be fixed in the next release.

PsychoSilence: Can't wait to see what you do with this, I'm sure it'll be cool.

Ian: Right now, you can always make adjustments manually by unhiding the displace warp objects, but I do have some ideas on how to make it easier to change settings like the displacement depth, or particle speed and size, etc., after everything's been set up. Maybe a second rollout that comes up with various adjustment settings so you never really have to manually get into the pFlow system or unhide all the different objects if you don't want to.

And I can't think of why particles wouldn't show up sometimes except for the pFlow scripting bug I already pointed out. If you figure out what's going on, let me know.

And just to let everyone know, you can change the displacement map by unhiding one of the displace objects and dragging the map to the material editor as an instance. And then updating that will update all the bullet holes. The default map isn't that great, but there's another maxScript limitation that won't let me add flags to a gradient ramp, I'm stuck with the default three. So I can't build really nice maps on the fly through scripting. I'll probably end up providing a material library to draw from in the future. If anyone comes up with some good displacement maps, post them here and I'll include them as options in future releases.

Originally Posted by bardur:The fragments dont show... or they just aret created.. its weird...
just like "SoLiTuDe" sayd... but mine never show.. their missing
and also the scene becomes "black" but thats nothing thou...

any solution for the "dissapearing"?

But an awsome tool non the less !!

Regards

Did you delete and then reconnect the first wire in PFlow that connects the main box to the first event? There's a bug when scripting PFlow systems that I mentioned that forces you to manually do that before the particles will show up in the scene. There should be a message box that pops up at the end that says this also. If that's not the problem then I don't know what's going on. If you get send me the scene I can take a look.

And the scene becomes black because you started with no lights before you ran the script, and then the script added some lights that are all set to zero for most of the animation. They're the lights that flash on at impact. In a real scene with lighting already set up this isn't an issue, but for tests it can be strange to have your scene go black. You can turn default lighting on in the viewport if you don't want to add lights and you don't want it to be black. I have a script on my site that lets you make a "default viewport lighting" toggle hotkey or button to make this easier.

Edit:
Oh, and by the way, I should have another update in a day or two. I've almost got multiple target objects working. Just a little more to do before its ready.

I have tried everything...
and in NO scene does it work... i have tried to restart max several times... but without luck..
and yeah.. i know about the lights

i have unlinked the wire between the 1 event... (and also tried to re wire all the events once) and relinked... nope.. done this every time with no results..

the deflector stuff there is no problem with... its just that it makes no fractures...
i use Max 9 BTW... i can send you a scene if needed...

AND btw.. i started to get wierd results when using the script yesterday... even when i chose all the right "objects" eg. gun - target - ground..
it made all the "particles"/"effects" on 0, 0, 0 in world space... and it did it every time the last 10 times i tried it... i did everything known to me... except restaring the computer..

thanks for the great script, however I'm experiencing the same problem as bardur.
I'm using 3ds max 9. I pick all the objects-ground, target and gun, create a few omnis and hit "DO IT!!". It does some calculating after which it displayes the message about the 2 manual to-do's. first thing I delete and recreate the link between myTarget_fragementParticles, the next step confuses me- how to "define the ground node for the ground deflector object" do I have to create a deflector in addition to the ground object by hand? Or do I have to define it in PFlow? Here is a screenshot:

About defining the "ground". If you select a ground object in the setup panel, when the script is done, after the warning message, a deflector space warp object will be already selected. All you have to do is look over at the modify panel, click on the button that says, "Pick Object", and then pick the ground mesh. Here's a picture:

It's really just a UDeflector space warp that lets you use a mesh object as a deflector. In a perfect world, I could set the mesh node on the UDeflector through scripting, but according to the MaxScript help file, "There is no way to set the Deflector object using MAXScript." To me, this is just dumb, but it's the way it is.

About the particles not working, it would really help if someone who is having this problem could send me the scene so I can look at it. I'm using Max 9 to create this, so I don't think that's the problem. One thing to keep in mind is that the target mesh needs to be pre-tesselated to a certain extent. If you just make a big box, or whatever, with no segments, the seed particles will be placed too far away from each other to get hit by the deflectors that trigger them. Here's a picture of a test scene to show how the target is still low-poly, but there is still some extra geometry to work with and the squares are about as big as the Hit Radius circle:

And just be perfectly clear about which wire to relink in the PFlow system, here's a picture of that:

When this is more final, I'll do a video tutorial on the whole process. But hopefully, for now, this clears it up.

Follow Us On:

The CGSociety

The CGSociety is the most respected and accessible global organization for creative digital artists. The CGS supports artists at every level by offering a range of services to connect, inform, educate and promote digital artists worldwide. More about us on TheArtSociety.com