Glass and Smash

Avatar
Fracture
797 Posts
Posted Nov 07, 2012
I have a huge glass physbox that is set to shatter, but the effect is very cheap and anti-climactic for it's size and purpose. Is it in any way possible to set it up with large broken glass gibs or something?
Advertisement
Registered users don’t see ads! Register now!
Avatar
josepezdj
2,386 Posts
Posted Nov 07, 2012
Replied 29 minutes later
Have you tried the func_breakable brush entity or better the func_breakable_surf? they work great and you can make them the desired size...
Avatar
ChickenMobile
2,460 Posts
Posted Nov 07, 2012
Replied 16 minutes later
pie1.jpg
Images 1
Post image 1
Avatar
josepezdj
2,386 Posts
Posted Nov 07, 2012
Replied 55 minutes later
Mel... :confused: ?? I had to hold my mouse pointer over the drawing to know that's a cake (it looked like an empty nest to me, sry :lol: maybe because of the nest prop in Portal2??? :biggrin:)... What do you mean by that post?
Avatar
FelixGriffin
2,680 Posts
Posted Nov 07, 2012
Replied 1 hour later
If it needs physics, try uing Propper to make an enormous quantity of glass gibs come out of the model when broken. It'll also look more realistic.
Avatar
Habzs
225 Posts
Posted Nov 07, 2012
Replied 1 hour later
Use the model "***models/props_destruction/glass_break_192x128_b.mdl***". It has a semi-realistic breaking animation.

Place a trigger_once over the glass model and have it change the model's animation when triggered.
Since the model has no collision, add a nodraw brush over the glass model and disable it when the trigger_once is triggered.
The model has no sound, use a ambient_generic to play the breaking sound once it has been triggered.

Also, PIE.

Avatar
RectorRocks
522 Posts
Posted Nov 07, 2012
Replied 17 minutes later

ChickenMobile wrote:
pie1.jpg

Are you saying that its as simple as pie?

Habzs wrote:
Also, PIE

[OFF-TOPIC] Pan Island Expressway? O_O

Avatar
Fracture
797 Posts
Posted Nov 07, 2012
Replied 2 hours later
Damnit, now I want pie
Avatar
Fracture
797 Posts
Posted Nov 14, 2012
Replied 6 days later
do the shards of glass function like normal prop_dynamics or is there any physics applied to them?
Avatar
zivi7
649 Posts
Posted Nov 14, 2012
Replied 5 hours later
They pop up and disappear shortly after just like any gibs: http://www.youtube.com/watch?v=nut9edTwVC8#t=01m50s
Avatar
Habzs
225 Posts
Posted Nov 14, 2012
Replied 2 hours later
If you're talking about the "**glass_break_192x128_b**" model, they are animations. The shards of glass has no physics applied to it.
Avatar
zivi7
649 Posts
Posted Nov 14, 2012
Replied 2 hours later
Oh, sorry, I was talking about another model. In fact, it's several models to get the effect. I meant the effect used for the "Schr?dinger's Catch" achievement, where a cube painted in blue breaks the glass surrounding it.

nXRzxleoy9c

We used the same technique for our Halloween map. It looks great in my opinion, the only problems might be that the somewhat greenish tone of the glass doesn't fit your chamber or that seasoned players could recognize it and will be expecting the breaking. Maybe a creative use of light can prevent that though.

Here's how to do it:

||Place a prop_dynamic with the model glass_b1.mdl and name it, for example "glass_normal".

Create a second prop_dynamic with the model glass_break_b1_edge.mdl and name it, for example "glass_edges". In its properties, set the Render mode to "Texture" and set the FX Amount to 0 (this makes the model invisible).

Next, create a prop_dynamic_override with the model glass_break_b1.mdl and name it, for example "glass_break". In its properties, set the Render mode to "Texture" and set the FX Amount to 0. This is a model that has cracks inside the glass and that can break into the gibs I mentioned earlier.

Now, place these three models in the same place. Not one unit apart, ontop of each other or anything, simply the same spot. So instead of three glass models like this: "l l l" you only see this now: "l".

You now have a visible glass surface, an invisible glass surface with cracks and invisible corner pieces of glass for when the glass is broken eventually.

Now all you have to do is trigger the "swap" of the models. In our Halloween map, we used two func_breakables. Number one triggered the cracks to appear, number two triggered the breaking. Let's assume you just want a surface on the ground the player steps on and you want it to break under his/her weight.

In this case, you could place a trigger on the model and add these outputs:

MyOutput - Target Entity - Target Input - Parameter - Delay

OnTrigger - glass_normal - Kill - no parameter - no delay
OnTrigger - glass_break - Alpha - 255 - no delay
OnTrigger - glass_break - Break - no parameter - 2
OnTrigger - glass_edges - Alpha - 255 - 2
OnTrigger - glass_break - Kill - no parameter - 2.01

So what happens when the player walks into the trigger is: the normal looking glass is removed with the Kill input. In the same moment, the glass model with cracks is made visible by setting it's Alpha to 255 (this is the FX Amount which you set to 0 in the beginning to make it invisible). The player has two seconds to watch the cracks before the trigger breaks the model with cracks into glass gibs while at the same time the model with glass edges becomes visible.

From the top of my head I'm not sure if the breaking comes with glass breaking sound effects already. If not, you can add ambient_generics with glass breaking sounds that are triggered at the same time as the model swap happens. Or, you could place two physboxes above the model, each just one unit thick and covered in nodraw. Set their material to glass and set the Performance mode to "No gibs" so that they don't spawn glass shards out of nowhere. Now, make the trigger break the first physbox first and the second two seconds after that. Copypaste the earlier outputs of the trigger to the two physboxes, and use "OnBreak" instead of OnTrigger. Make it so that the first breaing physbox causes the cracks to appear and the second one to break the glass.||

This must sound mighty complicated, if needed maybe I can make a video some time. But I think the effect you achieve is well worth the effort.

Recently I saw on the Steam forum that the Sixense addition to Portal 2 made func_breakable_surf actually work without creating errors. That could be an alternative if you find a way to get that into your non-sixense Portal 2.

Avatar
Fracture
797 Posts
Posted Nov 14, 2012
Replied 58 minutes later
thats pretty informative.... but it is unfortunately not the effect i was trying to do. I have a massive room with one massive observation room and instead of it being square-ish, It is entirely cylindrical. The drop to the floor from the observation room is actually much further than the animation of the glass for normal windows. I tried changing it, but it involving changing a lot of other elements that are necessary.

I may have to use physbox glass peices and spawn them with a template at the point of shattering

Avatar
zivi7
649 Posts
Posted Nov 14, 2012
Replied 17 minutes later
The best thing would be a func_breakable_surf then. Maybe you can get someone with the Sixense materials to send you the necessary glass files and then pack it into the map for everyone later.

Or, as a not so beautiful work-around, cut up each physbox glass window up in a random way to have several small physboxes. That way, some of them can break while other stay intact longer. It's nowhere near the func_breakable_surf effect, but far less ugly than one physbox breaking into its unrealistic gibs.

Avatar
Fracture
797 Posts
Posted Nov 14, 2012
Replied 54 minutes later
i dont see a significant differance between the surf and non-surf
Avatar
zivi7
649 Posts
Posted Nov 14, 2012
Replied 13 minutes later
Nonsurf will just break, unrealistic gibs, no edges left over. Surf will only break at the point where it has been broken, leaving the rest of the window semi-intact, but shattered. These remains will fall down when touched.

Here's a video that shows you the difference:

Ztt-b8m6YIE

The problem is that surf doesn't seem to work at all in Portal 2. I've seen guides saying that it does when used with a certain texture, "glasswindowbreak07a", but it didn't for me. It just created flying Error messages where gibs should have been and it didn't look shattered at all.

The Sixense addon does seem to add this function though. So if what you see in the video is what you want in your map, you could probably ask a Sixense owner to help you get it.

Advertisement
Registered users don’t see ads! Register now!
Avatar
Fracture
797 Posts
Posted Nov 14, 2012
Replied 37 minutes later
i have infact seen small shards that appear when the breakable and physbox breaks, but they scatter randomly and are very small and hard to see, they also disappaer immediately.

I did not see the surf do what it did in the video, though. I hope this works out, because I just got spammed by friction errors and and 300 pounds of lag

EDIT: so debris made those error and lag go away, and it definitely looks a ton better than before.

Thanks for the info