Leadwerks 5 Breakable Objects

Share with us how are you using the powerrrr of the force

Moderator: Alain

Leadwerks 5 Breakable Objects

Postby JoshKlint » Wed Aug 27, 2025 10:16 pm

Nothing very special here from a technical point of view, but the physics and art combined look good.

Details here: https://www.leadwerks.com/community/blo ... e-objects/

I used the Source Engine method of dealing with debris collision:
Image
JoshKlint
 
Posts: 184
Joined: Sun Dec 10, 2017 8:03 pm

Re: Leadwerks 5 Breakable Objects

Postby Julio Jerez » Thu Aug 28, 2025 12:55 pm

I see that the pieces interpenetrate, which is distracting from the immersive realism.
You say that you are trying to mimic how half life did it, where they just disable interaction between debris.
My opinion is that back then, that was a big achievement, but it will not impressed too many people these days.
The challenge is how to make concave and yet stable and looking realistic.
The answer is that, I can may suggest an algorithm that may help.

Algorithm for Building Concave Collision Shapes Without Interpretation
The goal is to construct concave collision structures out of convex pieces in a way that guarantees no overlaps.

Initial Setup
Start with the asset model.
An artist provides a set of convex collision shapes for the model.

Voronoi Decomposition
Iterate over all convex shapes.
For each shape, compute a Voronoi decomposition.
By construction, Voronoi cells do not overlap, so this yields a clean set of non-overlapping convex pieces.

Adjacency Graph Construction
From the convex decomposition, build an adjacency structure:
For each convex piece, determine which other pieces are directly adjacent.
Store these as an array of adjacency pairs.

Interactive Chunking (Editor Tool)
In the editor, when the user selects a convex piece, the tool highlights all adjacent pieces based on the adjacency graph.
after the selection of a chunk.
In code the editor groups the subset of adjacent convex pieces into a chunk.

Lemma: If all atomic convex pieces are non-overlapping, then any subset of adjacent pieces is also non-overlapping (take this as an axiom).

Chunk Consolidation
Once a chunk is chosen:
Remove all adjacency pairs involving any piece in the chunk from that initial array of pairs.

This leaves two disjoint sets:
The selected concave chunk and form a compound debris object from this.
The remaining set of convex pieces need to be converted into array of adjacent atomic pierces.

Decomposing Remaining Pieces
Use a disjoint-set algorithm (Union–Find) to partition the remaining convex pieces into connected subsets of adjacent primitives. check out Wikipedia:
https://en.wikipedia.org/wiki/Disjoint- ... _structure

after this, each resulting subset is either:
A valid concave group (to keep as-is), or
A set that may be further processed interactively.

this let you build a first level of clean debris system that is guaranteed to not overlap when breaking

Hierarchical Subsystems
This process naturally supports hierarchical decomposition:
At a higher level, create large concave chunks.

At lower levels (e.g., for LOD), treat each chunk as a set of convex parts that can be regrouped or further subdivided.

you can add tool options, stuff like automation
After the first layer of user-guided chunking, sub-parts can be auto-generated using heuristics (e.g., size, balance, connectivity).

This makes it trivial to produce multiple levels of concave grouping automatically.

I wanted to make the debris demo that way, but the lack of editor makes it very difficult.
Julio Jerez
Moderator
Moderator
 
Posts: 12425
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Leadwerks 5 Breakable Objects

Postby Julio Jerez » Thu Aug 28, 2025 4:57 pm

Here is more detail of how you can make even more sophisticated.

A said that you have an artist assigning the collision sheps by placing them manually, try to minimize overlapping.

This is a trivial task for any artist

After that, I say you interate over each convex shape.

Now you end up with array of pairs.
It would be nice if you can merge all these arrays, into a single array.

That just a enumeration of the element.

Basically you make one array, and you enumerate all the elements from 0 to n
Where n is the number of atomic convex.

The you add the next array from n to m, and so on.


Now you made the array of pairs, but this time you will get a single array, that made of few disjoint set.

To fuse these set, you iterate over each convex, and check if it is adjacent to some other convex,
If so you add those pairs.
After that is done.

You just run the construction part.

I will try to make a demo to show how is done.
Julio Jerez
Moderator
Moderator
 
Posts: 12425
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles


Return to User Gallery

Who is online

Users browsing this forum: No registered users and 1 guest

cron