# Interesting voxel solution

Hi,

recently i seen nice interesting videos about voxel destructible buildings.

do anyone know what “voxel solution” did he solve it?
seen there are several voxel solutions, but what do you think is used here?

i ask because im curious if it would be simple to create similar effect(simpler physics) of wall destruction using some existing JME voxel libs. and which one would be best/fastest

some of voxel engines i know(starting from most recently updated):

which one would be best do you think? and why?

Thanks!

2 Likes

but thanks a lot for sharing the links, what i just saw is just incredible
i have not tested all those jmonkey voxel libs but im afraid none of them supports what you can see in the videos, otherwise they would be linked to in every voxel related topic
but i would also be really interested in how its done and if this is actually possible with jmonkeyengine

are you sure?

assuming single voxel world = voxel object Node.

lets say i got 3 voxel voxel object Nodes. like 3 worlds.

1 would be wall(partially destroyed), second would be “splitted voxel object Node”, third also some fragment of destroyed wall as voxel object Node.

Physics require just some collision mesh. I seen @sgold created multiple collision spheres that wasnt there before. Also its anyway possible to generate collisions from “mesh”.

So once “rocket” go into wall, we would have this 3 voxel object Nodes where this “fragments from wall” would have own physics collision mesh, while main wall would have update collision mesh (since there will be hole now).

also you can know Mass and center of mass of this “pieces”. I belive rotating Node will rotate voxel object Node, while voxel engine would see them aligned in x,y,z properly in local Node space.

Would it work? or am i missing something?

of calculations when “split fragment as new voxel Node” would need to be calculated too.

To me it looks like he’s just creating objects using voxels and then treating them as a regular geometry - and so you get the physics simulation to work as you would expect them to. The fluid smoke is cool, though.

Since each “voxel” has data (i.e. how easily it can be broken) it simulates these effects really well. Nice idea tbh, and seems to work really well.

This is nothing like the typical “minecraft” style world, though.

3 Likes

if youre only about thowing a bomb at a wall and make the physics happen, yeah thats definitely possible, but look at how the ripe bends when the support on the left side is gone or how the smoke behaves, the look of the windows etc

im currently working on something similar which is why i was so impressed, but i guess floodfills are your friends here too or maybe pathfinding since you need to find the loose parts and floodfill your damage through the voxels.
but im sure its done completly differently especially looking at how the pipe bends
here is an article that i have not read yet but just found on his twitter page, maybe its interesting:

edit: ok seems like there is nothing about the physics aspect here

1 Like

yes, it looks complex if you mean “partially split ripe that gow little below”. thats the part i have no idea how he did it.

well, its quite easy imo, make particles be affected by physics and tick them to go “UP” each frame a little. (might lower fps much though)

But im not sure how floodfills can help me here, didnt you used it just to determine where light can go?

about pathfinding well i already can update it by Tile, so should not be a problem.

not only that, also the particles all have to check for voxel collisions, so that would lower fps a lot i guess, its probably done differently from the usual particle approaches and voxel approaches

i know thats why i thought it might answer some questions

yes and i guess determining where light can go and determining where smoke can go is not too much of a difference. also checking which voxels the damage from the explosion can be propagated to is basically the same (or might be he just selects all voxels within a radius and then does some randomness about which ones disappear and which ones get turned into separate voxel objects to behave according to physics) and once those voxels are gone you need to check all voxels that were previously touching a voxel and now do lo longer, if they are still connected to some structure or are now left floating in which case they would have to be turned into an separate voxel object too so they could also react to physics and start fall down

i did not mean for mods to walk around, i meant for finding a connectionpoint when you got a voxel that was formerly connected to another voxel, which was now removed.
it might be the voxel is still connected to the world on one of the other sides, or it might be its floating now

EDIT: looking at the last video starting at around 0:35, it seems like he is working on different scales, the smoke somewhat looks blocky, but the blocks looks way bigger than the blocks the world is made of

not only that, also the particles all have to check for voxel collisions, so that would lower fps a lot i guess, its probably done differently from the usual particle approaches and voxel approaches

well voxels collisions = physics mesh collisions in my idea. I agree its much complex than sphere or box collisions, but voxel optimize “flat areas” so i think it would be problem only with complex areas.

also checking which voxels the damage from the explosion can be propagated to is basically the same

ah, now i understand what you mean. good idea! but since it would be Mix of voxels and non-voxels im not sure if mess with it, or just make “radius” explosion with randomness like you say.

i did not mean for mods to walk around, i meant for finding a connectionpoint when you got a voxel that was formerly connected to another voxel, which was now removed.
it might be the voxel is still connected to the world on one of the other sides, or it might be its floating now

ah sorry, wrong understand you before. right, it could be done this way.

Edit:

anyway could you look at this engines and say what do you think, which one would be best for this?

well i have not read each class of those projects and i highly recommend writing your own if you are serious about it, but assuming you only want to play around a little the ones by melsov and emamaker look most promising to me

by “writing your own” i mean just some prototype, doesnt need fancy stuff but you get a better feeling especially about the impact on performance of specific aspects
you only need some noise to sample from and a mesher that goes like “if block is solid, check all neighbours, for each one that is not empty, put a face there” and you already got something to play with
maybe its just a personal thing though and using one of the provided ones is sufficient

1 Like

Small typo… should be “for each that is empty”

its like i have seen you post that “algorithm” near 643896 times, still i managed to fail

It seems like some of the “structures” in those vids are made by individual voxel geometries (as @jayfella suggested) with joints placed at the actual points of connection to the neighboring geometry (like the nails in a wooden plank), seemingly holding it up.
eg. every two pipes may be connected by a joint (placed specifically when modeling) so that when a segment of pipe is “destructed”, the separated pipe segments become individual geometries with only one remaining joint each.

It is pretty awesome the way the material properties affect the actions on the voxels, like seeing the concrete remain under the splintering wood trim when shooting holes in the wall.

I personally would be very interested to know how that engine implements it’s voxel bouyancy.

1 Like

something work already, but still a lot of work to do:

7 Likes

This looks pretty good so far. Nice work.

1 Like

Just noticed this project and I must say great job!

Assuming this uses bullet for the physics it’s gotta be quite similar to what I implemented for LSF ship destruction a while back. That usecase didn’t need any texturing work though, since the modules were batched together discrete custom meshes.

If the wireframe display is the physics debug appstate you currently have hundreds of boxes as colliders. Have you considered using a greedy algorithm to convert the cubes into big rectangles? That way a giant wall with no holes would be a single box collider.

That brought me a far bit more performance I think, but it needed to be done in an executor thread to avoid hitching during battles.

@MoffKalast

i think you missed Monthly WIP video i posted. this one is old video where still were too much to do. here is updated one:

still there are fixes to do tho. floating box and collision mesh still to fix/make better.

i use greedy algorithm for faces here (its just not visible in video)

That brought me a far bit more performance I think, but it needed to be done in an executor thread to avoid hitching during battles.

i have synchronized queue of block changes. Voxel Update thread once done, pull this synchronized queue changes into its block array and execute all again (if there were changes) this is how i do it. Then it again give queue for JME to update mesh.

If the wireframe display is the physics debug appstate you currently have hundreds of boxes as colliders. Have you considered using a greedy algorithm to convert the cubes into big rectangles? That way a giant wall with no holes would be a single box collider.

already using greedy mesh collision mesh here, but anyway it was told that BoxCollision is faster, so i plan to use it later (and make some greedyBox kind of for it like for faces)

1 Like

Oh yeah, now that is something else.

Ah I see, so the voxel thread basically does everything internally? Neat.

Honestly after watching that video I’m not entirely sure if there will be a noticeable difference, given how fast it is currently.

1 Like

I think it’s a soft body stimulation.

4 Likes